ARM Pseudo-ize tBR_JTr.
[oota-llvm.git] / lib / Target / PTX / PTXInstrInfo.td
1 //===- PTXInstrInfo.td - PTX Instruction defs -----------------*- tblgen-*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file describes the PTX instructions in TableGen format.
11 //
12 //===----------------------------------------------------------------------===//
13
14 //===----------------------------------------------------------------------===//
15 // Instruction format superclass
16 //===----------------------------------------------------------------------===//
17
18 include "PTXInstrFormats.td"
19
20 //===----------------------------------------------------------------------===//
21 // PTX Specific Node Definitions
22 //===----------------------------------------------------------------------===//
23
24 def PTXexit
25   : SDNode<"PTXISD::EXIT", SDTNone, [SDNPHasChain]>;
26 def PTXret
27   : SDNode<"PTXISD::RET",  SDTNone, [SDNPHasChain]>;
28
29 //===----------------------------------------------------------------------===//
30 // Instruction Class Templates
31 //===----------------------------------------------------------------------===//
32
33 multiclass INT3<string opcstr, SDNode opnode> {
34   def rr : InstPTX<(outs RRegs32:$d),
35                    (ins RRegs32:$a, RRegs32:$b),
36                    !strconcat(opcstr, ".%type\t$d, $a, $b"),
37                    [(set RRegs32:$d, (opnode RRegs32:$a, RRegs32:$b))]>;
38   def ri : InstPTX<(outs RRegs32:$d),
39                    (ins RRegs32:$a, i32imm:$b),
40                    !strconcat(opcstr, ".%type\t$d, $a, $b"),
41                    [(set RRegs32:$d, (opnode RRegs32:$a, imm:$b))]>;
42 }
43
44 //===----------------------------------------------------------------------===//
45 // Instructions
46 //===----------------------------------------------------------------------===//
47
48 ///===- Integer Arithmetic Instructions -----------------------------------===//
49
50 defm ADD : INT3<"add", add>;
51 defm SUB : INT3<"sub", sub>;
52
53 ///===- Data Movement and Conversion Instructions -------------------------===//
54
55 let neverHasSideEffects = 1 in {
56   // rely on isMoveInstr to separate MOVpp, MOVrr, etc.
57   def MOVpp
58     : InstPTX<(outs Preds:$d), (ins Preds:$a), "mov.pred\t$d, $a", []>;
59   def MOVrr
60     : InstPTX<(outs RRegs32:$d), (ins RRegs32:$a), "mov.%type\t$d, $a", []>;
61 }
62
63 let isReMaterializable = 1, isAsCheapAsAMove = 1 in {
64   def MOVpi
65     : InstPTX<(outs Preds:$d), (ins i1imm:$a), "mov.pred\t$d, $a",
66               [(set Preds:$d, imm:$a)]>;
67   def MOVri
68     : InstPTX<(outs RRegs32:$d), (ins i32imm:$a), "mov.s32\t$d, $a",
69               [(set RRegs32:$d, imm:$a)]>;
70 }
71
72 ///===- Control Flow Instructions -----------------------------------------===//
73
74 let isReturn = 1, isTerminator = 1, isBarrier = 1 in {
75   def EXIT : InstPTX<(outs), (ins), "exit", [(PTXexit)]>;
76   def RET  : InstPTX<(outs), (ins), "ret",  [(PTXret)]>;
77 }