1 //===-- SIInstrFormats.td - SI Instruction Formats ------------------------===//
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 // SI Instruction format definitions.
12 // Instructions with _32 take 32-bit operands.
13 // Instructions with _64 take 64-bit operands.
15 // VOP_* instructions can use either a 32-bit or 64-bit encoding. The 32-bit
16 // encoding is the standard encoding, but instruction that make use of
17 // any of the instruction modifiers must use the 64-bit encoding.
19 // Instructions with _e32 use the 32-bit encoding.
20 // Instructions with _e64 use the 64-bit encoding.
22 //===----------------------------------------------------------------------===//
24 class VOP3_32 <bits<9> op, string opName, list<dag> pattern>
25 : VOP3 <op, (outs VReg_32:$dst), (ins AllReg_32:$src0, VReg_32:$src1, VReg_32:$src2, i32imm:$src3, i32imm:$src4, i32imm:$src5, i32imm:$src6), opName, pattern>;
27 class VOP3_64 <bits<9> op, string opName, list<dag> pattern>
28 : VOP3 <op, (outs VReg_64:$dst), (ins AllReg_64:$src0, VReg_64:$src1, VReg_64:$src2, i32imm:$src3, i32imm:$src4, i32imm:$src5, i32imm:$src6), opName, pattern>;
30 class SOP1_32 <bits<8> op, string opName, list<dag> pattern>
31 : SOP1 <op, (outs SReg_32:$dst), (ins SReg_32:$src0), opName, pattern>;
33 class SOP1_64 <bits<8> op, string opName, list<dag> pattern>
34 : SOP1 <op, (outs SReg_64:$dst), (ins SReg_64:$src0), opName, pattern>;
36 class SOP2_32 <bits<7> op, string opName, list<dag> pattern>
37 : SOP2 <op, (outs SReg_32:$dst), (ins SReg_32:$src0, SReg_32:$src1), opName, pattern>;
39 class SOP2_64 <bits<7> op, string opName, list<dag> pattern>
40 : SOP2 <op, (outs SReg_64:$dst), (ins SReg_64:$src0, SReg_64:$src1), opName, pattern>;
42 class SOP2_VCC <bits<7> op, string opName, list<dag> pattern>
43 : SOP2 <op, (outs SReg_1:$vcc), (ins SReg_64:$src0, SReg_64:$src1), opName, pattern>;
45 class VOP1_Helper <bits<8> op, RegisterClass vrc, RegisterClass arc,
46 string opName, list<dag> pattern> :
48 op, (outs vrc:$dst), (ins arc:$src0), opName, pattern
51 multiclass VOP1_32 <bits<8> op, string opName, list<dag> pattern> {
52 def _e32: VOP1_Helper <op, VReg_32, AllReg_32, opName, pattern>;
53 def _e64 : VOP3_32 <{1, 1, op{6}, op{5}, op{4}, op{3}, op{2}, op{1}, op{0}},
58 multiclass VOP1_64 <bits<8> op, string opName, list<dag> pattern> {
60 def _e32 : VOP1_Helper <op, VReg_64, AllReg_64, opName, pattern>;
63 {1, 1, op{6}, op{5}, op{4}, op{3}, op{2}, op{1}, op{0}},
68 class VOP2_Helper <bits<6> op, RegisterClass vrc, RegisterClass arc,
69 string opName, list<dag> pattern> :
71 op, (outs vrc:$dst), (ins arc:$src0, vrc:$src1), opName, pattern
74 multiclass VOP2_32 <bits<6> op, string opName, list<dag> pattern> {
76 def _e32 : VOP2_Helper <op, VReg_32, AllReg_32, opName, pattern>;
78 def _e64 : VOP3_32 <{1, 0, 0, op{5}, op{4}, op{3}, op{2}, op{1}, op{0}},
83 multiclass VOP2_64 <bits<6> op, string opName, list<dag> pattern> {
84 def _e32: VOP2_Helper <op, VReg_64, AllReg_64, opName, pattern>;
87 {1, 0, 0, op{5}, op{4}, op{3}, op{2}, op{1}, op{0}},
92 class SOPK_32 <bits<5> op, string opName, list<dag> pattern>
93 : SOPK <op, (outs SReg_32:$dst), (ins i16imm:$src0), opName, pattern>;
95 class SOPK_64 <bits<5> op, string opName, list<dag> pattern>
96 : SOPK <op, (outs SReg_64:$dst), (ins i16imm:$src0), opName, pattern>;
98 multiclass VOPC_Helper <bits<8> op, RegisterClass vrc, RegisterClass arc,
99 string opName, list<dag> pattern> {
101 def _e32 : VOPC <op, (ins arc:$src0, vrc:$src1), opName, pattern>;
103 {0, op{7}, op{6}, op{5}, op{4}, op{3}, op{2}, op{1}, op{0}},
105 (ins arc:$src0, vrc:$src1,
106 InstFlag:$abs, InstFlag:$clamp,
107 InstFlag:$omod, InstFlag:$neg),
114 multiclass VOPC_32 <bits<8> op, string opName, list<dag> pattern>
115 : VOPC_Helper <op, VReg_32, AllReg_32, opName, pattern>;
117 multiclass VOPC_64 <bits<8> op, string opName, list<dag> pattern>
118 : VOPC_Helper <op, VReg_64, AllReg_64, opName, pattern>;
120 class SOPC_32 <bits<7> op, string opName, list<dag> pattern>
121 : SOPC <op, (outs SCCReg:$dst), (ins SReg_32:$src0, SReg_32:$src1), opName, pattern>;
123 class SOPC_64 <bits<7> op, string opName, list<dag> pattern>
124 : SOPC <op, (outs SCCReg:$dst), (ins SReg_64:$src0, SReg_64:$src1), opName, pattern>;
126 class MIMG_Load_Helper <bits<7> op, string asm> : MIMG <
128 (outs VReg_128:$vdata),
129 (ins i32imm:$dmask, i1imm:$unorm, i1imm:$glc, i1imm:$da, i1imm:$r128,
130 i1imm:$tfe, i1imm:$lwe, i1imm:$slc, VReg_32:$vaddr,
131 GPR4Align<SReg_256>:$srsrc, GPR4Align<SReg_128>:$ssamp),
138 class MTBUF_Store_Helper <bits<3> op, string asm, RegisterClass regClass> : MTBUF <
141 (ins regClass:$vdata, i16imm:$offset, i1imm:$offen, i1imm:$idxen, i1imm:$glc,
142 i1imm:$addr64, i8imm:$dfmt, i8imm:$nfmt, VReg_32:$vaddr,
143 GPR4Align<SReg_128>:$srsrc, i1imm:$slc, i1imm:$tfe, SReg_32:$soffset),
150 class MUBUF_Load_Helper <bits<7> op, string asm, RegisterClass regClass> : MUBUF <
152 (outs regClass:$dst),
153 (ins i16imm:$offset, i1imm:$offen, i1imm:$idxen, i1imm:$glc, i1imm:$addr64,
154 i1imm:$lds, VReg_32:$vaddr, GPR4Align<SReg_128>:$srsrc, i1imm:$slc,
155 i1imm:$tfe, SReg_32:$soffset),
162 class MTBUF_Load_Helper <bits<3> op, string asm, RegisterClass regClass> : MTBUF <
164 (outs regClass:$dst),
165 (ins i16imm:$offset, i1imm:$offen, i1imm:$idxen, i1imm:$glc, i1imm:$addr64,
166 i8imm:$dfmt, i8imm:$nfmt, VReg_32:$vaddr, GPR4Align<SReg_128>:$srsrc,
167 i1imm:$slc, i1imm:$tfe, SReg_32:$soffset),
174 multiclass SMRD_Helper <bits<5> op, string asm, RegisterClass dstClass> {
177 (outs dstClass:$dst),
178 (ins GPR2Align<SReg_64>:$sbase, i32imm:$offset),
185 (outs dstClass:$dst),
186 (ins GPR2Align<SReg_64>:$sbase, SReg_32:$soff),