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 VSrc_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 VSrc_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 SSrc_32:$src0), opName, pattern>;
33 class SOP1_64 <bits<8> op, string opName, list<dag> pattern>
34 : SOP1 <op, (outs SReg_64:$dst), (ins SSrc_64:$src0), opName, pattern>;
36 class SOP2_32 <bits<7> op, string opName, list<dag> pattern>
37 : SOP2 <op, (outs SReg_32:$dst), (ins SSrc_32:$src0, SSrc_32:$src1), opName, pattern>;
39 class SOP2_64 <bits<7> op, string opName, list<dag> pattern>
40 : SOP2 <op, (outs SReg_64:$dst), (ins SSrc_64:$src0, SSrc_64:$src1), opName, pattern>;
42 class VOP1_Helper <bits<8> op, RegisterClass vrc, RegisterClass arc,
43 string opName, list<dag> pattern> :
45 op, (outs vrc:$dst), (ins arc:$src0), opName, pattern
48 multiclass VOP1_32 <bits<8> op, string opName, list<dag> pattern> {
49 def _e32: VOP1_Helper <op, VReg_32, VSrc_32, opName, pattern>;
50 def _e64 : VOP3_32 <{1, 1, op{6}, op{5}, op{4}, op{3}, op{2}, op{1}, op{0}},
55 multiclass VOP1_64 <bits<8> op, string opName, list<dag> pattern> {
57 def _e32 : VOP1_Helper <op, VReg_64, VSrc_64, opName, pattern>;
60 {1, 1, op{6}, op{5}, op{4}, op{3}, op{2}, op{1}, op{0}},
65 class VOP2_Helper <bits<6> op, RegisterClass vrc, RegisterClass arc,
66 string opName, list<dag> pattern> :
68 op, (outs vrc:$dst), (ins arc:$src0, vrc:$src1), opName, pattern
71 multiclass VOP2_32 <bits<6> op, string opName, list<dag> pattern> {
73 def _e32 : VOP2_Helper <op, VReg_32, VSrc_32, opName, pattern>;
75 def _e64 : VOP3_32 <{1, 0, 0, op{5}, op{4}, op{3}, op{2}, op{1}, op{0}},
80 multiclass VOP2_64 <bits<6> op, string opName, list<dag> pattern> {
81 def _e32: VOP2_Helper <op, VReg_64, VSrc_64, opName, pattern>;
84 {1, 0, 0, op{5}, op{4}, op{3}, op{2}, op{1}, op{0}},
89 class SOPK_32 <bits<5> op, string opName, list<dag> pattern>
90 : SOPK <op, (outs SReg_32:$dst), (ins i16imm:$src0), opName, pattern>;
92 class SOPK_64 <bits<5> op, string opName, list<dag> pattern>
93 : SOPK <op, (outs SReg_64:$dst), (ins i16imm:$src0), opName, pattern>;
95 multiclass VOPC_Helper <bits<8> op, RegisterClass vrc, RegisterClass arc,
96 string opName, list<dag> pattern> {
98 def _e32 : VOPC <op, (ins arc:$src0, vrc:$src1), opName, pattern>;
100 {0, op{7}, op{6}, op{5}, op{4}, op{3}, op{2}, op{1}, op{0}},
102 (ins arc:$src0, vrc:$src1,
103 InstFlag:$abs, InstFlag:$clamp,
104 InstFlag:$omod, InstFlag:$neg),
111 multiclass VOPC_32 <bits<8> op, string opName, list<dag> pattern>
112 : VOPC_Helper <op, VReg_32, VSrc_32, opName, pattern>;
114 multiclass VOPC_64 <bits<8> op, string opName, list<dag> pattern>
115 : VOPC_Helper <op, VReg_64, VSrc_64, opName, pattern>;
117 class SOPC_32 <bits<7> op, string opName, list<dag> pattern>
118 : SOPC <op, (outs SCCReg:$dst), (ins SSrc_32:$src0, SSrc_32:$src1), opName, pattern>;
120 class SOPC_64 <bits<7> op, string opName, list<dag> pattern>
121 : SOPC <op, (outs SCCReg:$dst), (ins SSrc_64:$src0, SSrc_64:$src1), opName, pattern>;
123 class MIMG_Load_Helper <bits<7> op, string asm> : MIMG <
125 (outs VReg_128:$vdata),
126 (ins i32imm:$dmask, i1imm:$unorm, i1imm:$glc, i1imm:$da, i1imm:$r128,
127 i1imm:$tfe, i1imm:$lwe, i1imm:$slc, VReg_32:$vaddr,
128 GPR4Align<SReg_256>:$srsrc, GPR4Align<SReg_128>:$ssamp),
135 class MTBUF_Store_Helper <bits<3> op, string asm, RegisterClass regClass> : MTBUF <
138 (ins regClass:$vdata, i16imm:$offset, i1imm:$offen, i1imm:$idxen, i1imm:$glc,
139 i1imm:$addr64, i8imm:$dfmt, i8imm:$nfmt, VReg_32:$vaddr,
140 GPR4Align<SReg_128>:$srsrc, i1imm:$slc, i1imm:$tfe, SSrc_32:$soffset),
147 class MUBUF_Load_Helper <bits<7> op, string asm, RegisterClass regClass> : MUBUF <
149 (outs regClass:$dst),
150 (ins i16imm:$offset, i1imm:$offen, i1imm:$idxen, i1imm:$glc, i1imm:$addr64,
151 i1imm:$lds, VReg_32:$vaddr, GPR4Align<SReg_128>:$srsrc, i1imm:$slc,
152 i1imm:$tfe, SSrc_32:$soffset),
159 class MTBUF_Load_Helper <bits<3> op, string asm, RegisterClass regClass> : MTBUF <
161 (outs regClass:$dst),
162 (ins i16imm:$offset, i1imm:$offen, i1imm:$idxen, i1imm:$glc, i1imm:$addr64,
163 i8imm:$dfmt, i8imm:$nfmt, VReg_32:$vaddr, GPR4Align<SReg_128>:$srsrc,
164 i1imm:$slc, i1imm:$tfe, SSrc_32:$soffset),
171 multiclass SMRD_Helper <bits<5> op, string asm, RegisterClass dstClass> {
174 (outs dstClass:$dst),
175 (ins GPR2Align<SReg_64>:$sbase, i32imm:$offset),
182 (outs dstClass:$dst),
183 (ins GPR2Align<SReg_64>:$sbase, SReg_32:$soff),