1 //===- PTXInstrInfo.td - PTX Instruction defs -----------------*- tblgen-*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file describes the PTX instructions in TableGen format.
12 //===----------------------------------------------------------------------===//
14 //===----------------------------------------------------------------------===//
15 // Instruction format superclass
16 //===----------------------------------------------------------------------===//
18 include "PTXInstrFormats.td"
20 //===----------------------------------------------------------------------===//
21 // PTX Specific Node Definitions
22 //===----------------------------------------------------------------------===//
25 : SDNode<"PTXISD::EXIT", SDTNone, [SDNPHasChain]>;
27 : SDNode<"PTXISD::RET", SDTNone, [SDNPHasChain]>;
29 //===----------------------------------------------------------------------===//
30 // Instruction Class Templates
31 //===----------------------------------------------------------------------===//
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))]>;
44 //===----------------------------------------------------------------------===//
46 //===----------------------------------------------------------------------===//
48 ///===- Integer Arithmetic Instructions -----------------------------------===//
50 defm ADD : INT3<"add", add>;
51 defm SUB : INT3<"sub", sub>;
53 ///===- Data Movement and Conversion Instructions -------------------------===//
55 let neverHasSideEffects = 1 in {
56 // rely on isMoveInstr to separate MOVpp, MOVrr, etc.
58 : InstPTX<(outs Preds:$d), (ins Preds:$a), "mov.pred\t$d, $a", []>;
60 : InstPTX<(outs RRegs32:$d), (ins RRegs32:$a), "mov.%type\t$d, $a", []>;
63 let isReMaterializable = 1, isAsCheapAsAMove = 1 in {
65 : InstPTX<(outs Preds:$d), (ins i1imm:$a), "mov.pred\t$d, $a",
66 [(set Preds:$d, imm:$a)]>;
68 : InstPTX<(outs RRegs32:$d), (ins i32imm:$a), "mov.s32\t$d, $a",
69 [(set RRegs32:$d, imm:$a)]>;
72 ///===- Control Flow Instructions -----------------------------------------===//
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)]>;