1 //===-- SIInstructions.td - SI Instruction Defintions ---------------------===//
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 //===----------------------------------------------------------------------===//
9 // This file was originally auto-generated from a GPU register header file and
10 // all the instruction definitions were originally commented out. Instructions
11 // that are not yet supported remain commented out.
12 //===----------------------------------------------------------------------===//
19 def INTERP : InterpSlots;
21 def InterpSlot : Operand<i32> {
22 let PrintMethod = "printInterpSlot";
25 def isSI : Predicate<"Subtarget.getGeneration() "
26 ">= AMDGPUSubtarget::SOUTHERN_ISLANDS">;
28 def WAIT_FLAG : InstFlag<"printWaitFlag">;
30 let Predicates = [isSI] in {
32 let neverHasSideEffects = 1 in {
34 let isMoveImm = 1 in {
35 def S_MOV_B32 : SOP1_32 <0x00000003, "S_MOV_B32", []>;
36 def S_MOV_B64 : SOP1_64 <0x00000004, "S_MOV_B64", []>;
37 def S_CMOV_B32 : SOP1_32 <0x00000005, "S_CMOV_B32", []>;
38 def S_CMOV_B64 : SOP1_64 <0x00000006, "S_CMOV_B64", []>;
39 } // End isMoveImm = 1
41 def S_NOT_B32 : SOP1_32 <0x00000007, "S_NOT_B32", []>;
42 def S_NOT_B64 : SOP1_64 <0x00000008, "S_NOT_B64", []>;
43 def S_WQM_B32 : SOP1_32 <0x00000009, "S_WQM_B32", []>;
44 def S_WQM_B64 : SOP1_64 <0x0000000a, "S_WQM_B64", []>;
45 def S_BREV_B32 : SOP1_32 <0x0000000b, "S_BREV_B32", []>;
46 def S_BREV_B64 : SOP1_64 <0x0000000c, "S_BREV_B64", []>;
47 } // End neverHasSideEffects = 1
49 ////def S_BCNT0_I32_B32 : SOP1_BCNT0 <0x0000000d, "S_BCNT0_I32_B32", []>;
50 ////def S_BCNT0_I32_B64 : SOP1_BCNT0 <0x0000000e, "S_BCNT0_I32_B64", []>;
51 ////def S_BCNT1_I32_B32 : SOP1_BCNT1 <0x0000000f, "S_BCNT1_I32_B32", []>;
52 ////def S_BCNT1_I32_B64 : SOP1_BCNT1 <0x00000010, "S_BCNT1_I32_B64", []>;
53 ////def S_FF0_I32_B32 : SOP1_FF0 <0x00000011, "S_FF0_I32_B32", []>;
54 ////def S_FF0_I32_B64 : SOP1_FF0 <0x00000012, "S_FF0_I32_B64", []>;
55 ////def S_FF1_I32_B32 : SOP1_FF1 <0x00000013, "S_FF1_I32_B32", []>;
56 ////def S_FF1_I32_B64 : SOP1_FF1 <0x00000014, "S_FF1_I32_B64", []>;
57 //def S_FLBIT_I32_B32 : SOP1_32 <0x00000015, "S_FLBIT_I32_B32", []>;
58 //def S_FLBIT_I32_B64 : SOP1_32 <0x00000016, "S_FLBIT_I32_B64", []>;
59 def S_FLBIT_I32 : SOP1_32 <0x00000017, "S_FLBIT_I32", []>;
60 //def S_FLBIT_I32_I64 : SOP1_32 <0x00000018, "S_FLBIT_I32_I64", []>;
61 //def S_SEXT_I32_I8 : SOP1_32 <0x00000019, "S_SEXT_I32_I8", []>;
62 //def S_SEXT_I32_I16 : SOP1_32 <0x0000001a, "S_SEXT_I32_I16", []>;
63 ////def S_BITSET0_B32 : SOP1_BITSET0 <0x0000001b, "S_BITSET0_B32", []>;
64 ////def S_BITSET0_B64 : SOP1_BITSET0 <0x0000001c, "S_BITSET0_B64", []>;
65 ////def S_BITSET1_B32 : SOP1_BITSET1 <0x0000001d, "S_BITSET1_B32", []>;
66 ////def S_BITSET1_B64 : SOP1_BITSET1 <0x0000001e, "S_BITSET1_B64", []>;
67 def S_GETPC_B64 : SOP1_64 <0x0000001f, "S_GETPC_B64", []>;
68 def S_SETPC_B64 : SOP1_64 <0x00000020, "S_SETPC_B64", []>;
69 def S_SWAPPC_B64 : SOP1_64 <0x00000021, "S_SWAPPC_B64", []>;
70 def S_RFE_B64 : SOP1_64 <0x00000022, "S_RFE_B64", []>;
72 let hasSideEffects = 1, Uses = [EXEC], Defs = [EXEC] in {
74 def S_AND_SAVEEXEC_B64 : SOP1_64 <0x00000024, "S_AND_SAVEEXEC_B64", []>;
75 def S_OR_SAVEEXEC_B64 : SOP1_64 <0x00000025, "S_OR_SAVEEXEC_B64", []>;
76 def S_XOR_SAVEEXEC_B64 : SOP1_64 <0x00000026, "S_XOR_SAVEEXEC_B64", []>;
77 def S_ANDN2_SAVEEXEC_B64 : SOP1_64 <0x00000027, "S_ANDN2_SAVEEXEC_B64", []>;
78 def S_ORN2_SAVEEXEC_B64 : SOP1_64 <0x00000028, "S_ORN2_SAVEEXEC_B64", []>;
79 def S_NAND_SAVEEXEC_B64 : SOP1_64 <0x00000029, "S_NAND_SAVEEXEC_B64", []>;
80 def S_NOR_SAVEEXEC_B64 : SOP1_64 <0x0000002a, "S_NOR_SAVEEXEC_B64", []>;
81 def S_XNOR_SAVEEXEC_B64 : SOP1_64 <0x0000002b, "S_XNOR_SAVEEXEC_B64", []>;
83 } // End hasSideEffects = 1
85 def S_QUADMASK_B32 : SOP1_32 <0x0000002c, "S_QUADMASK_B32", []>;
86 def S_QUADMASK_B64 : SOP1_64 <0x0000002d, "S_QUADMASK_B64", []>;
87 def S_MOVRELS_B32 : SOP1_32 <0x0000002e, "S_MOVRELS_B32", []>;
88 def S_MOVRELS_B64 : SOP1_64 <0x0000002f, "S_MOVRELS_B64", []>;
89 def S_MOVRELD_B32 : SOP1_32 <0x00000030, "S_MOVRELD_B32", []>;
90 def S_MOVRELD_B64 : SOP1_64 <0x00000031, "S_MOVRELD_B64", []>;
91 //def S_CBRANCH_JOIN : SOP1_ <0x00000032, "S_CBRANCH_JOIN", []>;
92 def S_MOV_REGRD_B32 : SOP1_32 <0x00000033, "S_MOV_REGRD_B32", []>;
93 def S_ABS_I32 : SOP1_32 <0x00000034, "S_ABS_I32", []>;
94 def S_MOV_FED_B32 : SOP1_32 <0x00000035, "S_MOV_FED_B32", []>;
95 def S_MOVK_I32 : SOPK_32 <0x00000000, "S_MOVK_I32", []>;
96 def S_CMOVK_I32 : SOPK_32 <0x00000002, "S_CMOVK_I32", []>;
99 This instruction is disabled for now until we can figure out how to teach
100 the instruction selector to correctly use the S_CMP* vs V_CMP*
103 When this instruction is enabled the code generator sometimes produces this
106 SCC = S_CMPK_EQ_I32 SGPR0, imm
108 VGPR0 = V_CNDMASK VCC, VGPR0, VGPR1
110 def S_CMPK_EQ_I32 : SOPK <
111 0x00000003, (outs SCCReg:$dst), (ins SReg_32:$src0, i32imm:$src1),
113 [(set i1:$dst, (setcc i32:$src0, imm:$src1, SETEQ))]
117 let isCompare = 1 in {
118 def S_CMPK_LG_I32 : SOPK_32 <0x00000004, "S_CMPK_LG_I32", []>;
119 def S_CMPK_GT_I32 : SOPK_32 <0x00000005, "S_CMPK_GT_I32", []>;
120 def S_CMPK_GE_I32 : SOPK_32 <0x00000006, "S_CMPK_GE_I32", []>;
121 def S_CMPK_LT_I32 : SOPK_32 <0x00000007, "S_CMPK_LT_I32", []>;
122 def S_CMPK_LE_I32 : SOPK_32 <0x00000008, "S_CMPK_LE_I32", []>;
123 def S_CMPK_EQ_U32 : SOPK_32 <0x00000009, "S_CMPK_EQ_U32", []>;
124 def S_CMPK_LG_U32 : SOPK_32 <0x0000000a, "S_CMPK_LG_U32", []>;
125 def S_CMPK_GT_U32 : SOPK_32 <0x0000000b, "S_CMPK_GT_U32", []>;
126 def S_CMPK_GE_U32 : SOPK_32 <0x0000000c, "S_CMPK_GE_U32", []>;
127 def S_CMPK_LT_U32 : SOPK_32 <0x0000000d, "S_CMPK_LT_U32", []>;
128 def S_CMPK_LE_U32 : SOPK_32 <0x0000000e, "S_CMPK_LE_U32", []>;
129 } // End isCompare = 1
131 let Defs = [SCC], isCommutable = 1 in {
132 def S_ADDK_I32 : SOPK_32 <0x0000000f, "S_ADDK_I32", []>;
133 def S_MULK_I32 : SOPK_32 <0x00000010, "S_MULK_I32", []>;
136 //def S_CBRANCH_I_FORK : SOPK_ <0x00000011, "S_CBRANCH_I_FORK", []>;
137 def S_GETREG_B32 : SOPK_32 <0x00000012, "S_GETREG_B32", []>;
138 def S_SETREG_B32 : SOPK_32 <0x00000013, "S_SETREG_B32", []>;
139 def S_GETREG_REGRD_B32 : SOPK_32 <0x00000014, "S_GETREG_REGRD_B32", []>;
140 //def S_SETREG_IMM32_B32 : SOPK_32 <0x00000015, "S_SETREG_IMM32_B32", []>;
141 //def EXP : EXP_ <0x00000000, "EXP", []>;
143 let isCompare = 1 in {
145 defm V_CMP_F_F32 : VOPC_32 <0x00000000, "V_CMP_F_F32">;
146 defm V_CMP_LT_F32 : VOPC_32 <0x00000001, "V_CMP_LT_F32", f32, COND_LT>;
147 defm V_CMP_EQ_F32 : VOPC_32 <0x00000002, "V_CMP_EQ_F32", f32, COND_EQ>;
148 defm V_CMP_LE_F32 : VOPC_32 <0x00000003, "V_CMP_LE_F32", f32, COND_LE>;
149 defm V_CMP_GT_F32 : VOPC_32 <0x00000004, "V_CMP_GT_F32", f32, COND_GT>;
150 defm V_CMP_LG_F32 : VOPC_32 <0x00000005, "V_CMP_LG_F32", f32, COND_NE>;
151 defm V_CMP_GE_F32 : VOPC_32 <0x00000006, "V_CMP_GE_F32", f32, COND_GE>;
152 defm V_CMP_O_F32 : VOPC_32 <0x00000007, "V_CMP_O_F32">;
153 defm V_CMP_U_F32 : VOPC_32 <0x00000008, "V_CMP_U_F32">;
154 defm V_CMP_NGE_F32 : VOPC_32 <0x00000009, "V_CMP_NGE_F32">;
155 defm V_CMP_NLG_F32 : VOPC_32 <0x0000000a, "V_CMP_NLG_F32">;
156 defm V_CMP_NGT_F32 : VOPC_32 <0x0000000b, "V_CMP_NGT_F32">;
157 defm V_CMP_NLE_F32 : VOPC_32 <0x0000000c, "V_CMP_NLE_F32">;
158 defm V_CMP_NEQ_F32 : VOPC_32 <0x0000000d, "V_CMP_NEQ_F32", f32, COND_NE>;
159 defm V_CMP_NLT_F32 : VOPC_32 <0x0000000e, "V_CMP_NLT_F32">;
160 defm V_CMP_TRU_F32 : VOPC_32 <0x0000000f, "V_CMP_TRU_F32">;
162 let hasSideEffects = 1, Defs = [EXEC] in {
164 defm V_CMPX_F_F32 : VOPC_32 <0x00000010, "V_CMPX_F_F32">;
165 defm V_CMPX_LT_F32 : VOPC_32 <0x00000011, "V_CMPX_LT_F32">;
166 defm V_CMPX_EQ_F32 : VOPC_32 <0x00000012, "V_CMPX_EQ_F32">;
167 defm V_CMPX_LE_F32 : VOPC_32 <0x00000013, "V_CMPX_LE_F32">;
168 defm V_CMPX_GT_F32 : VOPC_32 <0x00000014, "V_CMPX_GT_F32">;
169 defm V_CMPX_LG_F32 : VOPC_32 <0x00000015, "V_CMPX_LG_F32">;
170 defm V_CMPX_GE_F32 : VOPC_32 <0x00000016, "V_CMPX_GE_F32">;
171 defm V_CMPX_O_F32 : VOPC_32 <0x00000017, "V_CMPX_O_F32">;
172 defm V_CMPX_U_F32 : VOPC_32 <0x00000018, "V_CMPX_U_F32">;
173 defm V_CMPX_NGE_F32 : VOPC_32 <0x00000019, "V_CMPX_NGE_F32">;
174 defm V_CMPX_NLG_F32 : VOPC_32 <0x0000001a, "V_CMPX_NLG_F32">;
175 defm V_CMPX_NGT_F32 : VOPC_32 <0x0000001b, "V_CMPX_NGT_F32">;
176 defm V_CMPX_NLE_F32 : VOPC_32 <0x0000001c, "V_CMPX_NLE_F32">;
177 defm V_CMPX_NEQ_F32 : VOPC_32 <0x0000001d, "V_CMPX_NEQ_F32">;
178 defm V_CMPX_NLT_F32 : VOPC_32 <0x0000001e, "V_CMPX_NLT_F32">;
179 defm V_CMPX_TRU_F32 : VOPC_32 <0x0000001f, "V_CMPX_TRU_F32">;
181 } // End hasSideEffects = 1, Defs = [EXEC]
183 defm V_CMP_F_F64 : VOPC_64 <0x00000020, "V_CMP_F_F64">;
184 defm V_CMP_LT_F64 : VOPC_64 <0x00000021, "V_CMP_LT_F64", f64, COND_LT>;
185 defm V_CMP_EQ_F64 : VOPC_64 <0x00000022, "V_CMP_EQ_F64", f64, COND_EQ>;
186 defm V_CMP_LE_F64 : VOPC_64 <0x00000023, "V_CMP_LE_F64", f64, COND_LE>;
187 defm V_CMP_GT_F64 : VOPC_64 <0x00000024, "V_CMP_GT_F64", f64, COND_GT>;
188 defm V_CMP_LG_F64 : VOPC_64 <0x00000025, "V_CMP_LG_F64">;
189 defm V_CMP_GE_F64 : VOPC_64 <0x00000026, "V_CMP_GE_F64", f64, COND_GE>;
190 defm V_CMP_O_F64 : VOPC_64 <0x00000027, "V_CMP_O_F64">;
191 defm V_CMP_U_F64 : VOPC_64 <0x00000028, "V_CMP_U_F64">;
192 defm V_CMP_NGE_F64 : VOPC_64 <0x00000029, "V_CMP_NGE_F64">;
193 defm V_CMP_NLG_F64 : VOPC_64 <0x0000002a, "V_CMP_NLG_F64">;
194 defm V_CMP_NGT_F64 : VOPC_64 <0x0000002b, "V_CMP_NGT_F64">;
195 defm V_CMP_NLE_F64 : VOPC_64 <0x0000002c, "V_CMP_NLE_F64">;
196 defm V_CMP_NEQ_F64 : VOPC_64 <0x0000002d, "V_CMP_NEQ_F64", f64, COND_NE>;
197 defm V_CMP_NLT_F64 : VOPC_64 <0x0000002e, "V_CMP_NLT_F64">;
198 defm V_CMP_TRU_F64 : VOPC_64 <0x0000002f, "V_CMP_TRU_F64">;
200 let hasSideEffects = 1, Defs = [EXEC] in {
202 defm V_CMPX_F_F64 : VOPC_64 <0x00000030, "V_CMPX_F_F64">;
203 defm V_CMPX_LT_F64 : VOPC_64 <0x00000031, "V_CMPX_LT_F64">;
204 defm V_CMPX_EQ_F64 : VOPC_64 <0x00000032, "V_CMPX_EQ_F64">;
205 defm V_CMPX_LE_F64 : VOPC_64 <0x00000033, "V_CMPX_LE_F64">;
206 defm V_CMPX_GT_F64 : VOPC_64 <0x00000034, "V_CMPX_GT_F64">;
207 defm V_CMPX_LG_F64 : VOPC_64 <0x00000035, "V_CMPX_LG_F64">;
208 defm V_CMPX_GE_F64 : VOPC_64 <0x00000036, "V_CMPX_GE_F64">;
209 defm V_CMPX_O_F64 : VOPC_64 <0x00000037, "V_CMPX_O_F64">;
210 defm V_CMPX_U_F64 : VOPC_64 <0x00000038, "V_CMPX_U_F64">;
211 defm V_CMPX_NGE_F64 : VOPC_64 <0x00000039, "V_CMPX_NGE_F64">;
212 defm V_CMPX_NLG_F64 : VOPC_64 <0x0000003a, "V_CMPX_NLG_F64">;
213 defm V_CMPX_NGT_F64 : VOPC_64 <0x0000003b, "V_CMPX_NGT_F64">;
214 defm V_CMPX_NLE_F64 : VOPC_64 <0x0000003c, "V_CMPX_NLE_F64">;
215 defm V_CMPX_NEQ_F64 : VOPC_64 <0x0000003d, "V_CMPX_NEQ_F64">;
216 defm V_CMPX_NLT_F64 : VOPC_64 <0x0000003e, "V_CMPX_NLT_F64">;
217 defm V_CMPX_TRU_F64 : VOPC_64 <0x0000003f, "V_CMPX_TRU_F64">;
219 } // End hasSideEffects = 1, Defs = [EXEC]
221 defm V_CMPS_F_F32 : VOPC_32 <0x00000040, "V_CMPS_F_F32">;
222 defm V_CMPS_LT_F32 : VOPC_32 <0x00000041, "V_CMPS_LT_F32">;
223 defm V_CMPS_EQ_F32 : VOPC_32 <0x00000042, "V_CMPS_EQ_F32">;
224 defm V_CMPS_LE_F32 : VOPC_32 <0x00000043, "V_CMPS_LE_F32">;
225 defm V_CMPS_GT_F32 : VOPC_32 <0x00000044, "V_CMPS_GT_F32">;
226 defm V_CMPS_LG_F32 : VOPC_32 <0x00000045, "V_CMPS_LG_F32">;
227 defm V_CMPS_GE_F32 : VOPC_32 <0x00000046, "V_CMPS_GE_F32">;
228 defm V_CMPS_O_F32 : VOPC_32 <0x00000047, "V_CMPS_O_F32">;
229 defm V_CMPS_U_F32 : VOPC_32 <0x00000048, "V_CMPS_U_F32">;
230 defm V_CMPS_NGE_F32 : VOPC_32 <0x00000049, "V_CMPS_NGE_F32">;
231 defm V_CMPS_NLG_F32 : VOPC_32 <0x0000004a, "V_CMPS_NLG_F32">;
232 defm V_CMPS_NGT_F32 : VOPC_32 <0x0000004b, "V_CMPS_NGT_F32">;
233 defm V_CMPS_NLE_F32 : VOPC_32 <0x0000004c, "V_CMPS_NLE_F32">;
234 defm V_CMPS_NEQ_F32 : VOPC_32 <0x0000004d, "V_CMPS_NEQ_F32">;
235 defm V_CMPS_NLT_F32 : VOPC_32 <0x0000004e, "V_CMPS_NLT_F32">;
236 defm V_CMPS_TRU_F32 : VOPC_32 <0x0000004f, "V_CMPS_TRU_F32">;
238 let hasSideEffects = 1, Defs = [EXEC] in {
240 defm V_CMPSX_F_F32 : VOPC_32 <0x00000050, "V_CMPSX_F_F32">;
241 defm V_CMPSX_LT_F32 : VOPC_32 <0x00000051, "V_CMPSX_LT_F32">;
242 defm V_CMPSX_EQ_F32 : VOPC_32 <0x00000052, "V_CMPSX_EQ_F32">;
243 defm V_CMPSX_LE_F32 : VOPC_32 <0x00000053, "V_CMPSX_LE_F32">;
244 defm V_CMPSX_GT_F32 : VOPC_32 <0x00000054, "V_CMPSX_GT_F32">;
245 defm V_CMPSX_LG_F32 : VOPC_32 <0x00000055, "V_CMPSX_LG_F32">;
246 defm V_CMPSX_GE_F32 : VOPC_32 <0x00000056, "V_CMPSX_GE_F32">;
247 defm V_CMPSX_O_F32 : VOPC_32 <0x00000057, "V_CMPSX_O_F32">;
248 defm V_CMPSX_U_F32 : VOPC_32 <0x00000058, "V_CMPSX_U_F32">;
249 defm V_CMPSX_NGE_F32 : VOPC_32 <0x00000059, "V_CMPSX_NGE_F32">;
250 defm V_CMPSX_NLG_F32 : VOPC_32 <0x0000005a, "V_CMPSX_NLG_F32">;
251 defm V_CMPSX_NGT_F32 : VOPC_32 <0x0000005b, "V_CMPSX_NGT_F32">;
252 defm V_CMPSX_NLE_F32 : VOPC_32 <0x0000005c, "V_CMPSX_NLE_F32">;
253 defm V_CMPSX_NEQ_F32 : VOPC_32 <0x0000005d, "V_CMPSX_NEQ_F32">;
254 defm V_CMPSX_NLT_F32 : VOPC_32 <0x0000005e, "V_CMPSX_NLT_F32">;
255 defm V_CMPSX_TRU_F32 : VOPC_32 <0x0000005f, "V_CMPSX_TRU_F32">;
257 } // End hasSideEffects = 1, Defs = [EXEC]
259 defm V_CMPS_F_F64 : VOPC_64 <0x00000060, "V_CMPS_F_F64">;
260 defm V_CMPS_LT_F64 : VOPC_64 <0x00000061, "V_CMPS_LT_F64">;
261 defm V_CMPS_EQ_F64 : VOPC_64 <0x00000062, "V_CMPS_EQ_F64">;
262 defm V_CMPS_LE_F64 : VOPC_64 <0x00000063, "V_CMPS_LE_F64">;
263 defm V_CMPS_GT_F64 : VOPC_64 <0x00000064, "V_CMPS_GT_F64">;
264 defm V_CMPS_LG_F64 : VOPC_64 <0x00000065, "V_CMPS_LG_F64">;
265 defm V_CMPS_GE_F64 : VOPC_64 <0x00000066, "V_CMPS_GE_F64">;
266 defm V_CMPS_O_F64 : VOPC_64 <0x00000067, "V_CMPS_O_F64">;
267 defm V_CMPS_U_F64 : VOPC_64 <0x00000068, "V_CMPS_U_F64">;
268 defm V_CMPS_NGE_F64 : VOPC_64 <0x00000069, "V_CMPS_NGE_F64">;
269 defm V_CMPS_NLG_F64 : VOPC_64 <0x0000006a, "V_CMPS_NLG_F64">;
270 defm V_CMPS_NGT_F64 : VOPC_64 <0x0000006b, "V_CMPS_NGT_F64">;
271 defm V_CMPS_NLE_F64 : VOPC_64 <0x0000006c, "V_CMPS_NLE_F64">;
272 defm V_CMPS_NEQ_F64 : VOPC_64 <0x0000006d, "V_CMPS_NEQ_F64">;
273 defm V_CMPS_NLT_F64 : VOPC_64 <0x0000006e, "V_CMPS_NLT_F64">;
274 defm V_CMPS_TRU_F64 : VOPC_64 <0x0000006f, "V_CMPS_TRU_F64">;
276 let hasSideEffects = 1, Defs = [EXEC] in {
278 defm V_CMPSX_F_F64 : VOPC_64 <0x00000070, "V_CMPSX_F_F64">;
279 defm V_CMPSX_LT_F64 : VOPC_64 <0x00000071, "V_CMPSX_LT_F64">;
280 defm V_CMPSX_EQ_F64 : VOPC_64 <0x00000072, "V_CMPSX_EQ_F64">;
281 defm V_CMPSX_LE_F64 : VOPC_64 <0x00000073, "V_CMPSX_LE_F64">;
282 defm V_CMPSX_GT_F64 : VOPC_64 <0x00000074, "V_CMPSX_GT_F64">;
283 defm V_CMPSX_LG_F64 : VOPC_64 <0x00000075, "V_CMPSX_LG_F64">;
284 defm V_CMPSX_GE_F64 : VOPC_64 <0x00000076, "V_CMPSX_GE_F64">;
285 defm V_CMPSX_O_F64 : VOPC_64 <0x00000077, "V_CMPSX_O_F64">;
286 defm V_CMPSX_U_F64 : VOPC_64 <0x00000078, "V_CMPSX_U_F64">;
287 defm V_CMPSX_NGE_F64 : VOPC_64 <0x00000079, "V_CMPSX_NGE_F64">;
288 defm V_CMPSX_NLG_F64 : VOPC_64 <0x0000007a, "V_CMPSX_NLG_F64">;
289 defm V_CMPSX_NGT_F64 : VOPC_64 <0x0000007b, "V_CMPSX_NGT_F64">;
290 defm V_CMPSX_NLE_F64 : VOPC_64 <0x0000007c, "V_CMPSX_NLE_F64">;
291 defm V_CMPSX_NEQ_F64 : VOPC_64 <0x0000007d, "V_CMPSX_NEQ_F64">;
292 defm V_CMPSX_NLT_F64 : VOPC_64 <0x0000007e, "V_CMPSX_NLT_F64">;
293 defm V_CMPSX_TRU_F64 : VOPC_64 <0x0000007f, "V_CMPSX_TRU_F64">;
295 } // End hasSideEffects = 1, Defs = [EXEC]
297 defm V_CMP_F_I32 : VOPC_32 <0x00000080, "V_CMP_F_I32">;
298 defm V_CMP_LT_I32 : VOPC_32 <0x00000081, "V_CMP_LT_I32", i32, COND_LT>;
299 defm V_CMP_EQ_I32 : VOPC_32 <0x00000082, "V_CMP_EQ_I32", i32, COND_EQ>;
300 defm V_CMP_LE_I32 : VOPC_32 <0x00000083, "V_CMP_LE_I32", i32, COND_LE>;
301 defm V_CMP_GT_I32 : VOPC_32 <0x00000084, "V_CMP_GT_I32", i32, COND_GT>;
302 defm V_CMP_NE_I32 : VOPC_32 <0x00000085, "V_CMP_NE_I32", i32, COND_NE>;
303 defm V_CMP_GE_I32 : VOPC_32 <0x00000086, "V_CMP_GE_I32", i32, COND_GE>;
304 defm V_CMP_T_I32 : VOPC_32 <0x00000087, "V_CMP_T_I32">;
306 let hasSideEffects = 1, Defs = [EXEC] in {
308 defm V_CMPX_F_I32 : VOPC_32 <0x00000090, "V_CMPX_F_I32">;
309 defm V_CMPX_LT_I32 : VOPC_32 <0x00000091, "V_CMPX_LT_I32">;
310 defm V_CMPX_EQ_I32 : VOPC_32 <0x00000092, "V_CMPX_EQ_I32">;
311 defm V_CMPX_LE_I32 : VOPC_32 <0x00000093, "V_CMPX_LE_I32">;
312 defm V_CMPX_GT_I32 : VOPC_32 <0x00000094, "V_CMPX_GT_I32">;
313 defm V_CMPX_NE_I32 : VOPC_32 <0x00000095, "V_CMPX_NE_I32">;
314 defm V_CMPX_GE_I32 : VOPC_32 <0x00000096, "V_CMPX_GE_I32">;
315 defm V_CMPX_T_I32 : VOPC_32 <0x00000097, "V_CMPX_T_I32">;
317 } // End hasSideEffects = 1, Defs = [EXEC]
319 defm V_CMP_F_I64 : VOPC_64 <0x000000a0, "V_CMP_F_I64">;
320 defm V_CMP_LT_I64 : VOPC_64 <0x000000a1, "V_CMP_LT_I64">;
321 defm V_CMP_EQ_I64 : VOPC_64 <0x000000a2, "V_CMP_EQ_I64">;
322 defm V_CMP_LE_I64 : VOPC_64 <0x000000a3, "V_CMP_LE_I64">;
323 defm V_CMP_GT_I64 : VOPC_64 <0x000000a4, "V_CMP_GT_I64">;
324 defm V_CMP_NE_I64 : VOPC_64 <0x000000a5, "V_CMP_NE_I64">;
325 defm V_CMP_GE_I64 : VOPC_64 <0x000000a6, "V_CMP_GE_I64">;
326 defm V_CMP_T_I64 : VOPC_64 <0x000000a7, "V_CMP_T_I64">;
328 let hasSideEffects = 1, Defs = [EXEC] in {
330 defm V_CMPX_F_I64 : VOPC_64 <0x000000b0, "V_CMPX_F_I64">;
331 defm V_CMPX_LT_I64 : VOPC_64 <0x000000b1, "V_CMPX_LT_I64">;
332 defm V_CMPX_EQ_I64 : VOPC_64 <0x000000b2, "V_CMPX_EQ_I64">;
333 defm V_CMPX_LE_I64 : VOPC_64 <0x000000b3, "V_CMPX_LE_I64">;
334 defm V_CMPX_GT_I64 : VOPC_64 <0x000000b4, "V_CMPX_GT_I64">;
335 defm V_CMPX_NE_I64 : VOPC_64 <0x000000b5, "V_CMPX_NE_I64">;
336 defm V_CMPX_GE_I64 : VOPC_64 <0x000000b6, "V_CMPX_GE_I64">;
337 defm V_CMPX_T_I64 : VOPC_64 <0x000000b7, "V_CMPX_T_I64">;
339 } // End hasSideEffects = 1, Defs = [EXEC]
341 defm V_CMP_F_U32 : VOPC_32 <0x000000c0, "V_CMP_F_U32">;
342 defm V_CMP_LT_U32 : VOPC_32 <0x000000c1, "V_CMP_LT_U32">;
343 defm V_CMP_EQ_U32 : VOPC_32 <0x000000c2, "V_CMP_EQ_U32">;
344 defm V_CMP_LE_U32 : VOPC_32 <0x000000c3, "V_CMP_LE_U32">;
345 defm V_CMP_GT_U32 : VOPC_32 <0x000000c4, "V_CMP_GT_U32">;
346 defm V_CMP_NE_U32 : VOPC_32 <0x000000c5, "V_CMP_NE_U32">;
347 defm V_CMP_GE_U32 : VOPC_32 <0x000000c6, "V_CMP_GE_U32">;
348 defm V_CMP_T_U32 : VOPC_32 <0x000000c7, "V_CMP_T_U32">;
350 let hasSideEffects = 1, Defs = [EXEC] in {
352 defm V_CMPX_F_U32 : VOPC_32 <0x000000d0, "V_CMPX_F_U32">;
353 defm V_CMPX_LT_U32 : VOPC_32 <0x000000d1, "V_CMPX_LT_U32">;
354 defm V_CMPX_EQ_U32 : VOPC_32 <0x000000d2, "V_CMPX_EQ_U32">;
355 defm V_CMPX_LE_U32 : VOPC_32 <0x000000d3, "V_CMPX_LE_U32">;
356 defm V_CMPX_GT_U32 : VOPC_32 <0x000000d4, "V_CMPX_GT_U32">;
357 defm V_CMPX_NE_U32 : VOPC_32 <0x000000d5, "V_CMPX_NE_U32">;
358 defm V_CMPX_GE_U32 : VOPC_32 <0x000000d6, "V_CMPX_GE_U32">;
359 defm V_CMPX_T_U32 : VOPC_32 <0x000000d7, "V_CMPX_T_U32">;
361 } // End hasSideEffects = 1, Defs = [EXEC]
363 defm V_CMP_F_U64 : VOPC_64 <0x000000e0, "V_CMP_F_U64">;
364 defm V_CMP_LT_U64 : VOPC_64 <0x000000e1, "V_CMP_LT_U64">;
365 defm V_CMP_EQ_U64 : VOPC_64 <0x000000e2, "V_CMP_EQ_U64">;
366 defm V_CMP_LE_U64 : VOPC_64 <0x000000e3, "V_CMP_LE_U64">;
367 defm V_CMP_GT_U64 : VOPC_64 <0x000000e4, "V_CMP_GT_U64">;
368 defm V_CMP_NE_U64 : VOPC_64 <0x000000e5, "V_CMP_NE_U64">;
369 defm V_CMP_GE_U64 : VOPC_64 <0x000000e6, "V_CMP_GE_U64">;
370 defm V_CMP_T_U64 : VOPC_64 <0x000000e7, "V_CMP_T_U64">;
372 let hasSideEffects = 1, Defs = [EXEC] in {
374 defm V_CMPX_F_U64 : VOPC_64 <0x000000f0, "V_CMPX_F_U64">;
375 defm V_CMPX_LT_U64 : VOPC_64 <0x000000f1, "V_CMPX_LT_U64">;
376 defm V_CMPX_EQ_U64 : VOPC_64 <0x000000f2, "V_CMPX_EQ_U64">;
377 defm V_CMPX_LE_U64 : VOPC_64 <0x000000f3, "V_CMPX_LE_U64">;
378 defm V_CMPX_GT_U64 : VOPC_64 <0x000000f4, "V_CMPX_GT_U64">;
379 defm V_CMPX_NE_U64 : VOPC_64 <0x000000f5, "V_CMPX_NE_U64">;
380 defm V_CMPX_GE_U64 : VOPC_64 <0x000000f6, "V_CMPX_GE_U64">;
381 defm V_CMPX_T_U64 : VOPC_64 <0x000000f7, "V_CMPX_T_U64">;
383 } // End hasSideEffects = 1, Defs = [EXEC]
385 defm V_CMP_CLASS_F32 : VOPC_32 <0x00000088, "V_CMP_CLASS_F32">;
387 let hasSideEffects = 1, Defs = [EXEC] in {
388 defm V_CMPX_CLASS_F32 : VOPC_32 <0x00000098, "V_CMPX_CLASS_F32">;
389 } // End hasSideEffects = 1, Defs = [EXEC]
391 defm V_CMP_CLASS_F64 : VOPC_64 <0x000000a8, "V_CMP_CLASS_F64">;
393 let hasSideEffects = 1, Defs = [EXEC] in {
394 defm V_CMPX_CLASS_F64 : VOPC_64 <0x000000b8, "V_CMPX_CLASS_F64">;
395 } // End hasSideEffects = 1, Defs = [EXEC]
397 } // End isCompare = 1
399 def DS_ADD_U32_RTN : DS_1A1D_RET <0x20, "DS_ADD_U32_RTN", VReg_32>;
400 def DS_SUB_U32_RTN : DS_1A1D_RET <0x21, "DS_SUB_U32_RTN", VReg_32>;
401 def DS_WRITE_B32 : DS_Store_Helper <0x0000000d, "DS_WRITE_B32", VReg_32>;
402 def DS_WRITE_B8 : DS_Store_Helper <0x00000001e, "DS_WRITE_B8", VReg_32>;
403 def DS_WRITE_B16 : DS_Store_Helper <0x00000001f, "DS_WRITE_B16", VReg_32>;
404 def DS_READ_B32 : DS_Load_Helper <0x00000036, "DS_READ_B32", VReg_32>;
405 def DS_READ_I8 : DS_Load_Helper <0x00000039, "DS_READ_I8", VReg_32>;
406 def DS_READ_U8 : DS_Load_Helper <0x0000003a, "DS_READ_U8", VReg_32>;
407 def DS_READ_I16 : DS_Load_Helper <0x0000003b, "DS_READ_I16", VReg_32>;
408 def DS_READ_U16 : DS_Load_Helper <0x0000003c, "DS_READ_U16", VReg_32>;
410 //def BUFFER_LOAD_FORMAT_X : MUBUF_ <0x00000000, "BUFFER_LOAD_FORMAT_X", []>;
411 //def BUFFER_LOAD_FORMAT_XY : MUBUF_ <0x00000001, "BUFFER_LOAD_FORMAT_XY", []>;
412 //def BUFFER_LOAD_FORMAT_XYZ : MUBUF_ <0x00000002, "BUFFER_LOAD_FORMAT_XYZ", []>;
413 defm BUFFER_LOAD_FORMAT_XYZW : MUBUF_Load_Helper <0x00000003, "BUFFER_LOAD_FORMAT_XYZW", VReg_128>;
414 //def BUFFER_STORE_FORMAT_X : MUBUF_ <0x00000004, "BUFFER_STORE_FORMAT_X", []>;
415 //def BUFFER_STORE_FORMAT_XY : MUBUF_ <0x00000005, "BUFFER_STORE_FORMAT_XY", []>;
416 //def BUFFER_STORE_FORMAT_XYZ : MUBUF_ <0x00000006, "BUFFER_STORE_FORMAT_XYZ", []>;
417 //def BUFFER_STORE_FORMAT_XYZW : MUBUF_ <0x00000007, "BUFFER_STORE_FORMAT_XYZW", []>;
418 defm BUFFER_LOAD_UBYTE : MUBUF_Load_Helper <0x00000008, "BUFFER_LOAD_UBYTE", VReg_32>;
419 defm BUFFER_LOAD_SBYTE : MUBUF_Load_Helper <0x00000009, "BUFFER_LOAD_SBYTE", VReg_32>;
420 defm BUFFER_LOAD_USHORT : MUBUF_Load_Helper <0x0000000a, "BUFFER_LOAD_USHORT", VReg_32>;
421 defm BUFFER_LOAD_SSHORT : MUBUF_Load_Helper <0x0000000b, "BUFFER_LOAD_SSHORT", VReg_32>;
422 defm BUFFER_LOAD_DWORD : MUBUF_Load_Helper <0x0000000c, "BUFFER_LOAD_DWORD", VReg_32>;
423 defm BUFFER_LOAD_DWORDX2 : MUBUF_Load_Helper <0x0000000d, "BUFFER_LOAD_DWORDX2", VReg_64>;
424 defm BUFFER_LOAD_DWORDX4 : MUBUF_Load_Helper <0x0000000e, "BUFFER_LOAD_DWORDX4", VReg_128>;
426 def BUFFER_STORE_BYTE : MUBUF_Store_Helper <
427 0x00000018, "BUFFER_STORE_BYTE", VReg_32
430 def BUFFER_STORE_SHORT : MUBUF_Store_Helper <
431 0x0000001a, "BUFFER_STORE_SHORT", VReg_32
434 def BUFFER_STORE_DWORD : MUBUF_Store_Helper <
435 0x0000001c, "BUFFER_STORE_DWORD", VReg_32
438 def BUFFER_STORE_DWORDX2 : MUBUF_Store_Helper <
439 0x0000001d, "BUFFER_STORE_DWORDX2", VReg_64
442 def BUFFER_STORE_DWORDX4 : MUBUF_Store_Helper <
443 0x0000001e, "BUFFER_STORE_DWORDX4", VReg_128
445 //def BUFFER_ATOMIC_SWAP : MUBUF_ <0x00000030, "BUFFER_ATOMIC_SWAP", []>;
446 //def BUFFER_ATOMIC_CMPSWAP : MUBUF_ <0x00000031, "BUFFER_ATOMIC_CMPSWAP", []>;
447 //def BUFFER_ATOMIC_ADD : MUBUF_ <0x00000032, "BUFFER_ATOMIC_ADD", []>;
448 //def BUFFER_ATOMIC_SUB : MUBUF_ <0x00000033, "BUFFER_ATOMIC_SUB", []>;
449 //def BUFFER_ATOMIC_RSUB : MUBUF_ <0x00000034, "BUFFER_ATOMIC_RSUB", []>;
450 //def BUFFER_ATOMIC_SMIN : MUBUF_ <0x00000035, "BUFFER_ATOMIC_SMIN", []>;
451 //def BUFFER_ATOMIC_UMIN : MUBUF_ <0x00000036, "BUFFER_ATOMIC_UMIN", []>;
452 //def BUFFER_ATOMIC_SMAX : MUBUF_ <0x00000037, "BUFFER_ATOMIC_SMAX", []>;
453 //def BUFFER_ATOMIC_UMAX : MUBUF_ <0x00000038, "BUFFER_ATOMIC_UMAX", []>;
454 //def BUFFER_ATOMIC_AND : MUBUF_ <0x00000039, "BUFFER_ATOMIC_AND", []>;
455 //def BUFFER_ATOMIC_OR : MUBUF_ <0x0000003a, "BUFFER_ATOMIC_OR", []>;
456 //def BUFFER_ATOMIC_XOR : MUBUF_ <0x0000003b, "BUFFER_ATOMIC_XOR", []>;
457 //def BUFFER_ATOMIC_INC : MUBUF_ <0x0000003c, "BUFFER_ATOMIC_INC", []>;
458 //def BUFFER_ATOMIC_DEC : MUBUF_ <0x0000003d, "BUFFER_ATOMIC_DEC", []>;
459 //def BUFFER_ATOMIC_FCMPSWAP : MUBUF_ <0x0000003e, "BUFFER_ATOMIC_FCMPSWAP", []>;
460 //def BUFFER_ATOMIC_FMIN : MUBUF_ <0x0000003f, "BUFFER_ATOMIC_FMIN", []>;
461 //def BUFFER_ATOMIC_FMAX : MUBUF_ <0x00000040, "BUFFER_ATOMIC_FMAX", []>;
462 //def BUFFER_ATOMIC_SWAP_X2 : MUBUF_X2 <0x00000050, "BUFFER_ATOMIC_SWAP_X2", []>;
463 //def BUFFER_ATOMIC_CMPSWAP_X2 : MUBUF_X2 <0x00000051, "BUFFER_ATOMIC_CMPSWAP_X2", []>;
464 //def BUFFER_ATOMIC_ADD_X2 : MUBUF_X2 <0x00000052, "BUFFER_ATOMIC_ADD_X2", []>;
465 //def BUFFER_ATOMIC_SUB_X2 : MUBUF_X2 <0x00000053, "BUFFER_ATOMIC_SUB_X2", []>;
466 //def BUFFER_ATOMIC_RSUB_X2 : MUBUF_X2 <0x00000054, "BUFFER_ATOMIC_RSUB_X2", []>;
467 //def BUFFER_ATOMIC_SMIN_X2 : MUBUF_X2 <0x00000055, "BUFFER_ATOMIC_SMIN_X2", []>;
468 //def BUFFER_ATOMIC_UMIN_X2 : MUBUF_X2 <0x00000056, "BUFFER_ATOMIC_UMIN_X2", []>;
469 //def BUFFER_ATOMIC_SMAX_X2 : MUBUF_X2 <0x00000057, "BUFFER_ATOMIC_SMAX_X2", []>;
470 //def BUFFER_ATOMIC_UMAX_X2 : MUBUF_X2 <0x00000058, "BUFFER_ATOMIC_UMAX_X2", []>;
471 //def BUFFER_ATOMIC_AND_X2 : MUBUF_X2 <0x00000059, "BUFFER_ATOMIC_AND_X2", []>;
472 //def BUFFER_ATOMIC_OR_X2 : MUBUF_X2 <0x0000005a, "BUFFER_ATOMIC_OR_X2", []>;
473 //def BUFFER_ATOMIC_XOR_X2 : MUBUF_X2 <0x0000005b, "BUFFER_ATOMIC_XOR_X2", []>;
474 //def BUFFER_ATOMIC_INC_X2 : MUBUF_X2 <0x0000005c, "BUFFER_ATOMIC_INC_X2", []>;
475 //def BUFFER_ATOMIC_DEC_X2 : MUBUF_X2 <0x0000005d, "BUFFER_ATOMIC_DEC_X2", []>;
476 //def BUFFER_ATOMIC_FCMPSWAP_X2 : MUBUF_X2 <0x0000005e, "BUFFER_ATOMIC_FCMPSWAP_X2", []>;
477 //def BUFFER_ATOMIC_FMIN_X2 : MUBUF_X2 <0x0000005f, "BUFFER_ATOMIC_FMIN_X2", []>;
478 //def BUFFER_ATOMIC_FMAX_X2 : MUBUF_X2 <0x00000060, "BUFFER_ATOMIC_FMAX_X2", []>;
479 //def BUFFER_WBINVL1_SC : MUBUF_WBINVL1 <0x00000070, "BUFFER_WBINVL1_SC", []>;
480 //def BUFFER_WBINVL1 : MUBUF_WBINVL1 <0x00000071, "BUFFER_WBINVL1", []>;
481 //def TBUFFER_LOAD_FORMAT_X : MTBUF_ <0x00000000, "TBUFFER_LOAD_FORMAT_X", []>;
482 //def TBUFFER_LOAD_FORMAT_XY : MTBUF_ <0x00000001, "TBUFFER_LOAD_FORMAT_XY", []>;
483 //def TBUFFER_LOAD_FORMAT_XYZ : MTBUF_ <0x00000002, "TBUFFER_LOAD_FORMAT_XYZ", []>;
484 def TBUFFER_LOAD_FORMAT_XYZW : MTBUF_Load_Helper <0x00000003, "TBUFFER_LOAD_FORMAT_XYZW", VReg_128>;
485 def TBUFFER_STORE_FORMAT_X : MTBUF_Store_Helper <0x00000004, "TBUFFER_STORE_FORMAT_X", VReg_32>;
486 def TBUFFER_STORE_FORMAT_XY : MTBUF_Store_Helper <0x00000005, "TBUFFER_STORE_FORMAT_XY", VReg_64>;
487 def TBUFFER_STORE_FORMAT_XYZ : MTBUF_Store_Helper <0x00000006, "TBUFFER_STORE_FORMAT_XYZ", VReg_128>;
488 def TBUFFER_STORE_FORMAT_XYZW : MTBUF_Store_Helper <0x00000007, "TBUFFER_STORE_FORMAT_XYZW", VReg_128>;
492 defm S_LOAD_DWORD : SMRD_Helper <0x00, "S_LOAD_DWORD", SReg_64, SReg_32>;
493 defm S_LOAD_DWORDX2 : SMRD_Helper <0x01, "S_LOAD_DWORDX2", SReg_64, SReg_64>;
494 defm S_LOAD_DWORDX4 : SMRD_Helper <0x02, "S_LOAD_DWORDX4", SReg_64, SReg_128>;
495 defm S_LOAD_DWORDX8 : SMRD_Helper <0x03, "S_LOAD_DWORDX8", SReg_64, SReg_256>;
496 defm S_LOAD_DWORDX16 : SMRD_Helper <0x04, "S_LOAD_DWORDX16", SReg_64, SReg_512>;
498 defm S_BUFFER_LOAD_DWORD : SMRD_Helper <
499 0x08, "S_BUFFER_LOAD_DWORD", SReg_128, SReg_32
502 defm S_BUFFER_LOAD_DWORDX2 : SMRD_Helper <
503 0x09, "S_BUFFER_LOAD_DWORDX2", SReg_128, SReg_64
506 defm S_BUFFER_LOAD_DWORDX4 : SMRD_Helper <
507 0x0a, "S_BUFFER_LOAD_DWORDX4", SReg_128, SReg_128
510 defm S_BUFFER_LOAD_DWORDX8 : SMRD_Helper <
511 0x0b, "S_BUFFER_LOAD_DWORDX8", SReg_128, SReg_256
514 defm S_BUFFER_LOAD_DWORDX16 : SMRD_Helper <
515 0x0c, "S_BUFFER_LOAD_DWORDX16", SReg_128, SReg_512
520 //def S_MEMTIME : SMRD_ <0x0000001e, "S_MEMTIME", []>;
521 //def S_DCACHE_INV : SMRD_ <0x0000001f, "S_DCACHE_INV", []>;
522 defm IMAGE_LOAD : MIMG_NoSampler <0x00000000, "IMAGE_LOAD">;
523 defm IMAGE_LOAD_MIP : MIMG_NoSampler <0x00000001, "IMAGE_LOAD_MIP">;
524 //def IMAGE_LOAD_PCK : MIMG_NoPattern_ <"IMAGE_LOAD_PCK", 0x00000002>;
525 //def IMAGE_LOAD_PCK_SGN : MIMG_NoPattern_ <"IMAGE_LOAD_PCK_SGN", 0x00000003>;
526 //def IMAGE_LOAD_MIP_PCK : MIMG_NoPattern_ <"IMAGE_LOAD_MIP_PCK", 0x00000004>;
527 //def IMAGE_LOAD_MIP_PCK_SGN : MIMG_NoPattern_ <"IMAGE_LOAD_MIP_PCK_SGN", 0x00000005>;
528 //def IMAGE_STORE : MIMG_NoPattern_ <"IMAGE_STORE", 0x00000008>;
529 //def IMAGE_STORE_MIP : MIMG_NoPattern_ <"IMAGE_STORE_MIP", 0x00000009>;
530 //def IMAGE_STORE_PCK : MIMG_NoPattern_ <"IMAGE_STORE_PCK", 0x0000000a>;
531 //def IMAGE_STORE_MIP_PCK : MIMG_NoPattern_ <"IMAGE_STORE_MIP_PCK", 0x0000000b>;
532 defm IMAGE_GET_RESINFO : MIMG_NoSampler <0x0000000e, "IMAGE_GET_RESINFO">;
533 //def IMAGE_ATOMIC_SWAP : MIMG_NoPattern_ <"IMAGE_ATOMIC_SWAP", 0x0000000f>;
534 //def IMAGE_ATOMIC_CMPSWAP : MIMG_NoPattern_ <"IMAGE_ATOMIC_CMPSWAP", 0x00000010>;
535 //def IMAGE_ATOMIC_ADD : MIMG_NoPattern_ <"IMAGE_ATOMIC_ADD", 0x00000011>;
536 //def IMAGE_ATOMIC_SUB : MIMG_NoPattern_ <"IMAGE_ATOMIC_SUB", 0x00000012>;
537 //def IMAGE_ATOMIC_RSUB : MIMG_NoPattern_ <"IMAGE_ATOMIC_RSUB", 0x00000013>;
538 //def IMAGE_ATOMIC_SMIN : MIMG_NoPattern_ <"IMAGE_ATOMIC_SMIN", 0x00000014>;
539 //def IMAGE_ATOMIC_UMIN : MIMG_NoPattern_ <"IMAGE_ATOMIC_UMIN", 0x00000015>;
540 //def IMAGE_ATOMIC_SMAX : MIMG_NoPattern_ <"IMAGE_ATOMIC_SMAX", 0x00000016>;
541 //def IMAGE_ATOMIC_UMAX : MIMG_NoPattern_ <"IMAGE_ATOMIC_UMAX", 0x00000017>;
542 //def IMAGE_ATOMIC_AND : MIMG_NoPattern_ <"IMAGE_ATOMIC_AND", 0x00000018>;
543 //def IMAGE_ATOMIC_OR : MIMG_NoPattern_ <"IMAGE_ATOMIC_OR", 0x00000019>;
544 //def IMAGE_ATOMIC_XOR : MIMG_NoPattern_ <"IMAGE_ATOMIC_XOR", 0x0000001a>;
545 //def IMAGE_ATOMIC_INC : MIMG_NoPattern_ <"IMAGE_ATOMIC_INC", 0x0000001b>;
546 //def IMAGE_ATOMIC_DEC : MIMG_NoPattern_ <"IMAGE_ATOMIC_DEC", 0x0000001c>;
547 //def IMAGE_ATOMIC_FCMPSWAP : MIMG_NoPattern_ <"IMAGE_ATOMIC_FCMPSWAP", 0x0000001d>;
548 //def IMAGE_ATOMIC_FMIN : MIMG_NoPattern_ <"IMAGE_ATOMIC_FMIN", 0x0000001e>;
549 //def IMAGE_ATOMIC_FMAX : MIMG_NoPattern_ <"IMAGE_ATOMIC_FMAX", 0x0000001f>;
550 defm IMAGE_SAMPLE : MIMG_Sampler <0x00000020, "IMAGE_SAMPLE">;
551 //def IMAGE_SAMPLE_CL : MIMG_NoPattern_ <"IMAGE_SAMPLE_CL", 0x00000021>;
552 defm IMAGE_SAMPLE_D : MIMG_Sampler <0x00000022, "IMAGE_SAMPLE_D">;
553 //def IMAGE_SAMPLE_D_CL : MIMG_NoPattern_ <"IMAGE_SAMPLE_D_CL", 0x00000023>;
554 defm IMAGE_SAMPLE_L : MIMG_Sampler <0x00000024, "IMAGE_SAMPLE_L">;
555 defm IMAGE_SAMPLE_B : MIMG_Sampler <0x00000025, "IMAGE_SAMPLE_B">;
556 //def IMAGE_SAMPLE_B_CL : MIMG_NoPattern_ <"IMAGE_SAMPLE_B_CL", 0x00000026>;
557 //def IMAGE_SAMPLE_LZ : MIMG_NoPattern_ <"IMAGE_SAMPLE_LZ", 0x00000027>;
558 defm IMAGE_SAMPLE_C : MIMG_Sampler <0x00000028, "IMAGE_SAMPLE_C">;
559 //def IMAGE_SAMPLE_C_CL : MIMG_NoPattern_ <"IMAGE_SAMPLE_C_CL", 0x00000029>;
560 defm IMAGE_SAMPLE_C_D : MIMG_Sampler <0x0000002a, "IMAGE_SAMPLE_C_D">;
561 //def IMAGE_SAMPLE_C_D_CL : MIMG_NoPattern_ <"IMAGE_SAMPLE_C_D_CL", 0x0000002b>;
562 defm IMAGE_SAMPLE_C_L : MIMG_Sampler <0x0000002c, "IMAGE_SAMPLE_C_L">;
563 defm IMAGE_SAMPLE_C_B : MIMG_Sampler <0x0000002d, "IMAGE_SAMPLE_C_B">;
564 //def IMAGE_SAMPLE_C_B_CL : MIMG_NoPattern_ <"IMAGE_SAMPLE_C_B_CL", 0x0000002e>;
565 //def IMAGE_SAMPLE_C_LZ : MIMG_NoPattern_ <"IMAGE_SAMPLE_C_LZ", 0x0000002f>;
566 //def IMAGE_SAMPLE_O : MIMG_NoPattern_ <"IMAGE_SAMPLE_O", 0x00000030>;
567 //def IMAGE_SAMPLE_CL_O : MIMG_NoPattern_ <"IMAGE_SAMPLE_CL_O", 0x00000031>;
568 //def IMAGE_SAMPLE_D_O : MIMG_NoPattern_ <"IMAGE_SAMPLE_D_O", 0x00000032>;
569 //def IMAGE_SAMPLE_D_CL_O : MIMG_NoPattern_ <"IMAGE_SAMPLE_D_CL_O", 0x00000033>;
570 //def IMAGE_SAMPLE_L_O : MIMG_NoPattern_ <"IMAGE_SAMPLE_L_O", 0x00000034>;
571 //def IMAGE_SAMPLE_B_O : MIMG_NoPattern_ <"IMAGE_SAMPLE_B_O", 0x00000035>;
572 //def IMAGE_SAMPLE_B_CL_O : MIMG_NoPattern_ <"IMAGE_SAMPLE_B_CL_O", 0x00000036>;
573 //def IMAGE_SAMPLE_LZ_O : MIMG_NoPattern_ <"IMAGE_SAMPLE_LZ_O", 0x00000037>;
574 //def IMAGE_SAMPLE_C_O : MIMG_NoPattern_ <"IMAGE_SAMPLE_C_O", 0x00000038>;
575 //def IMAGE_SAMPLE_C_CL_O : MIMG_NoPattern_ <"IMAGE_SAMPLE_C_CL_O", 0x00000039>;
576 //def IMAGE_SAMPLE_C_D_O : MIMG_NoPattern_ <"IMAGE_SAMPLE_C_D_O", 0x0000003a>;
577 //def IMAGE_SAMPLE_C_D_CL_O : MIMG_NoPattern_ <"IMAGE_SAMPLE_C_D_CL_O", 0x0000003b>;
578 //def IMAGE_SAMPLE_C_L_O : MIMG_NoPattern_ <"IMAGE_SAMPLE_C_L_O", 0x0000003c>;
579 //def IMAGE_SAMPLE_C_B_O : MIMG_NoPattern_ <"IMAGE_SAMPLE_C_B_O", 0x0000003d>;
580 //def IMAGE_SAMPLE_C_B_CL_O : MIMG_NoPattern_ <"IMAGE_SAMPLE_C_B_CL_O", 0x0000003e>;
581 //def IMAGE_SAMPLE_C_LZ_O : MIMG_NoPattern_ <"IMAGE_SAMPLE_C_LZ_O", 0x0000003f>;
582 //def IMAGE_GATHER4 : MIMG_NoPattern_GATHER4 <"IMAGE_GATHER4", 0x00000040>;
583 //def IMAGE_GATHER4_CL : MIMG_NoPattern_GATHER4 <"IMAGE_GATHER4_CL", 0x00000041>;
584 //def IMAGE_GATHER4_L : MIMG_NoPattern_GATHER4 <"IMAGE_GATHER4_L", 0x00000044>;
585 //def IMAGE_GATHER4_B : MIMG_NoPattern_GATHER4 <"IMAGE_GATHER4_B", 0x00000045>;
586 //def IMAGE_GATHER4_B_CL : MIMG_NoPattern_GATHER4 <"IMAGE_GATHER4_B_CL", 0x00000046>;
587 //def IMAGE_GATHER4_LZ : MIMG_NoPattern_GATHER4 <"IMAGE_GATHER4_LZ", 0x00000047>;
588 //def IMAGE_GATHER4_C : MIMG_NoPattern_GATHER4 <"IMAGE_GATHER4_C", 0x00000048>;
589 //def IMAGE_GATHER4_C_CL : MIMG_NoPattern_GATHER4 <"IMAGE_GATHER4_C_CL", 0x00000049>;
590 //def IMAGE_GATHER4_C_L : MIMG_NoPattern_GATHER4 <"IMAGE_GATHER4_C_L", 0x0000004c>;
591 //def IMAGE_GATHER4_C_B : MIMG_NoPattern_GATHER4 <"IMAGE_GATHER4_C_B", 0x0000004d>;
592 //def IMAGE_GATHER4_C_B_CL : MIMG_NoPattern_GATHER4 <"IMAGE_GATHER4_C_B_CL", 0x0000004e>;
593 //def IMAGE_GATHER4_C_LZ : MIMG_NoPattern_GATHER4 <"IMAGE_GATHER4_C_LZ", 0x0000004f>;
594 //def IMAGE_GATHER4_O : MIMG_NoPattern_GATHER4 <"IMAGE_GATHER4_O", 0x00000050>;
595 //def IMAGE_GATHER4_CL_O : MIMG_NoPattern_GATHER4 <"IMAGE_GATHER4_CL_O", 0x00000051>;
596 //def IMAGE_GATHER4_L_O : MIMG_NoPattern_GATHER4 <"IMAGE_GATHER4_L_O", 0x00000054>;
597 //def IMAGE_GATHER4_B_O : MIMG_NoPattern_GATHER4 <"IMAGE_GATHER4_B_O", 0x00000055>;
598 //def IMAGE_GATHER4_B_CL_O : MIMG_NoPattern_GATHER4 <"IMAGE_GATHER4_B_CL_O", 0x00000056>;
599 //def IMAGE_GATHER4_LZ_O : MIMG_NoPattern_GATHER4 <"IMAGE_GATHER4_LZ_O", 0x00000057>;
600 //def IMAGE_GATHER4_C_O : MIMG_NoPattern_GATHER4 <"IMAGE_GATHER4_C_O", 0x00000058>;
601 //def IMAGE_GATHER4_C_CL_O : MIMG_NoPattern_GATHER4 <"IMAGE_GATHER4_C_CL_O", 0x00000059>;
602 //def IMAGE_GATHER4_C_L_O : MIMG_NoPattern_GATHER4 <"IMAGE_GATHER4_C_L_O", 0x0000005c>;
603 //def IMAGE_GATHER4_C_B_O : MIMG_NoPattern_GATHER4 <"IMAGE_GATHER4_C_B_O", 0x0000005d>;
604 //def IMAGE_GATHER4_C_B_CL_O : MIMG_NoPattern_GATHER4 <"IMAGE_GATHER4_C_B_CL_O", 0x0000005e>;
605 //def IMAGE_GATHER4_C_LZ_O : MIMG_NoPattern_GATHER4 <"IMAGE_GATHER4_C_LZ_O", 0x0000005f>;
606 //def IMAGE_GET_LOD : MIMG_NoPattern_ <"IMAGE_GET_LOD", 0x00000060>;
607 //def IMAGE_SAMPLE_CD : MIMG_NoPattern_ <"IMAGE_SAMPLE_CD", 0x00000068>;
608 //def IMAGE_SAMPLE_CD_CL : MIMG_NoPattern_ <"IMAGE_SAMPLE_CD_CL", 0x00000069>;
609 //def IMAGE_SAMPLE_C_CD : MIMG_NoPattern_ <"IMAGE_SAMPLE_C_CD", 0x0000006a>;
610 //def IMAGE_SAMPLE_C_CD_CL : MIMG_NoPattern_ <"IMAGE_SAMPLE_C_CD_CL", 0x0000006b>;
611 //def IMAGE_SAMPLE_CD_O : MIMG_NoPattern_ <"IMAGE_SAMPLE_CD_O", 0x0000006c>;
612 //def IMAGE_SAMPLE_CD_CL_O : MIMG_NoPattern_ <"IMAGE_SAMPLE_CD_CL_O", 0x0000006d>;
613 //def IMAGE_SAMPLE_C_CD_O : MIMG_NoPattern_ <"IMAGE_SAMPLE_C_CD_O", 0x0000006e>;
614 //def IMAGE_SAMPLE_C_CD_CL_O : MIMG_NoPattern_ <"IMAGE_SAMPLE_C_CD_CL_O", 0x0000006f>;
615 //def IMAGE_RSRC256 : MIMG_NoPattern_RSRC256 <"IMAGE_RSRC256", 0x0000007e>;
616 //def IMAGE_SAMPLER : MIMG_NoPattern_ <"IMAGE_SAMPLER", 0x0000007f>;
617 //def V_NOP : VOP1_ <0x00000000, "V_NOP", []>;
620 let neverHasSideEffects = 1, isMoveImm = 1 in {
621 defm V_MOV_B32 : VOP1_32 <0x00000001, "V_MOV_B32", []>;
622 } // End neverHasSideEffects = 1, isMoveImm = 1
624 defm V_READFIRSTLANE_B32 : VOP1_32 <0x00000002, "V_READFIRSTLANE_B32", []>;
625 defm V_CVT_I32_F64 : VOP1_32_64 <0x00000003, "V_CVT_I32_F64",
626 [(set i32:$dst, (fp_to_sint f64:$src0))]
628 defm V_CVT_F64_I32 : VOP1_64_32 <0x00000004, "V_CVT_F64_I32",
629 [(set f64:$dst, (sint_to_fp i32:$src0))]
631 defm V_CVT_F32_I32 : VOP1_32 <0x00000005, "V_CVT_F32_I32",
632 [(set f32:$dst, (sint_to_fp i32:$src0))]
634 defm V_CVT_F32_U32 : VOP1_32 <0x00000006, "V_CVT_F32_U32",
635 [(set f32:$dst, (uint_to_fp i32:$src0))]
637 defm V_CVT_U32_F32 : VOP1_32 <0x00000007, "V_CVT_U32_F32",
638 [(set i32:$dst, (fp_to_uint f32:$src0))]
640 defm V_CVT_I32_F32 : VOP1_32 <0x00000008, "V_CVT_I32_F32",
641 [(set i32:$dst, (fp_to_sint f32:$src0))]
643 defm V_MOV_FED_B32 : VOP1_32 <0x00000009, "V_MOV_FED_B32", []>;
644 ////def V_CVT_F16_F32 : VOP1_F16 <0x0000000a, "V_CVT_F16_F32", []>;
645 //defm V_CVT_F32_F16 : VOP1_32 <0x0000000b, "V_CVT_F32_F16", []>;
646 //defm V_CVT_RPI_I32_F32 : VOP1_32 <0x0000000c, "V_CVT_RPI_I32_F32", []>;
647 //defm V_CVT_FLR_I32_F32 : VOP1_32 <0x0000000d, "V_CVT_FLR_I32_F32", []>;
648 //defm V_CVT_OFF_F32_I4 : VOP1_32 <0x0000000e, "V_CVT_OFF_F32_I4", []>;
649 defm V_CVT_F32_F64 : VOP1_32_64 <0x0000000f, "V_CVT_F32_F64",
650 [(set f32:$dst, (fround f64:$src0))]
652 defm V_CVT_F64_F32 : VOP1_64_32 <0x00000010, "V_CVT_F64_F32",
653 [(set f64:$dst, (fextend f32:$src0))]
655 //defm V_CVT_F32_UBYTE0 : VOP1_32 <0x00000011, "V_CVT_F32_UBYTE0", []>;
656 //defm V_CVT_F32_UBYTE1 : VOP1_32 <0x00000012, "V_CVT_F32_UBYTE1", []>;
657 //defm V_CVT_F32_UBYTE2 : VOP1_32 <0x00000013, "V_CVT_F32_UBYTE2", []>;
658 //defm V_CVT_F32_UBYTE3 : VOP1_32 <0x00000014, "V_CVT_F32_UBYTE3", []>;
659 //defm V_CVT_U32_F64 : VOP1_32 <0x00000015, "V_CVT_U32_F64", []>;
660 //defm V_CVT_F64_U32 : VOP1_64 <0x00000016, "V_CVT_F64_U32", []>;
661 defm V_FRACT_F32 : VOP1_32 <0x00000020, "V_FRACT_F32",
662 [(set f32:$dst, (AMDGPUfract f32:$src0))]
664 defm V_TRUNC_F32 : VOP1_32 <0x00000021, "V_TRUNC_F32",
665 [(set f32:$dst, (int_AMDGPU_trunc f32:$src0))]
667 defm V_CEIL_F32 : VOP1_32 <0x00000022, "V_CEIL_F32",
668 [(set f32:$dst, (fceil f32:$src0))]
670 defm V_RNDNE_F32 : VOP1_32 <0x00000023, "V_RNDNE_F32",
671 [(set f32:$dst, (frint f32:$src0))]
673 defm V_FLOOR_F32 : VOP1_32 <0x00000024, "V_FLOOR_F32",
674 [(set f32:$dst, (ffloor f32:$src0))]
676 defm V_EXP_F32 : VOP1_32 <0x00000025, "V_EXP_F32",
677 [(set f32:$dst, (fexp2 f32:$src0))]
679 defm V_LOG_CLAMP_F32 : VOP1_32 <0x00000026, "V_LOG_CLAMP_F32", []>;
680 defm V_LOG_F32 : VOP1_32 <0x00000027, "V_LOG_F32",
681 [(set f32:$dst, (flog2 f32:$src0))]
683 defm V_RCP_CLAMP_F32 : VOP1_32 <0x00000028, "V_RCP_CLAMP_F32", []>;
684 defm V_RCP_LEGACY_F32 : VOP1_32 <0x00000029, "V_RCP_LEGACY_F32", []>;
685 defm V_RCP_F32 : VOP1_32 <0x0000002a, "V_RCP_F32",
686 [(set f32:$dst, (fdiv FP_ONE, f32:$src0))]
688 defm V_RCP_IFLAG_F32 : VOP1_32 <0x0000002b, "V_RCP_IFLAG_F32", []>;
689 defm V_RSQ_CLAMP_F32 : VOP1_32 <0x0000002c, "V_RSQ_CLAMP_F32", []>;
690 defm V_RSQ_LEGACY_F32 : VOP1_32 <
691 0x0000002d, "V_RSQ_LEGACY_F32",
692 [(set f32:$dst, (int_AMDGPU_rsq f32:$src0))]
694 defm V_RSQ_F32 : VOP1_32 <0x0000002e, "V_RSQ_F32", []>;
695 defm V_RCP_F64 : VOP1_64 <0x0000002f, "V_RCP_F64",
696 [(set f64:$dst, (fdiv FP_ONE, f64:$src0))]
698 defm V_RCP_CLAMP_F64 : VOP1_64 <0x00000030, "V_RCP_CLAMP_F64", []>;
699 defm V_RSQ_F64 : VOP1_64 <0x00000031, "V_RSQ_F64", []>;
700 defm V_RSQ_CLAMP_F64 : VOP1_64 <0x00000032, "V_RSQ_CLAMP_F64", []>;
701 defm V_SQRT_F32 : VOP1_32 <0x00000033, "V_SQRT_F32",
702 [(set f32:$dst, (fsqrt f32:$src0))]
704 defm V_SQRT_F64 : VOP1_64 <0x00000034, "V_SQRT_F64",
705 [(set f64:$dst, (fsqrt f64:$src0))]
707 defm V_SIN_F32 : VOP1_32 <0x00000035, "V_SIN_F32", []>;
708 defm V_COS_F32 : VOP1_32 <0x00000036, "V_COS_F32", []>;
709 defm V_NOT_B32 : VOP1_32 <0x00000037, "V_NOT_B32", []>;
710 defm V_BFREV_B32 : VOP1_32 <0x00000038, "V_BFREV_B32", []>;
711 defm V_FFBH_U32 : VOP1_32 <0x00000039, "V_FFBH_U32", []>;
712 defm V_FFBL_B32 : VOP1_32 <0x0000003a, "V_FFBL_B32", []>;
713 defm V_FFBH_I32 : VOP1_32 <0x0000003b, "V_FFBH_I32", []>;
714 //defm V_FREXP_EXP_I32_F64 : VOP1_32 <0x0000003c, "V_FREXP_EXP_I32_F64", []>;
715 defm V_FREXP_MANT_F64 : VOP1_64 <0x0000003d, "V_FREXP_MANT_F64", []>;
716 defm V_FRACT_F64 : VOP1_64 <0x0000003e, "V_FRACT_F64", []>;
717 //defm V_FREXP_EXP_I32_F32 : VOP1_32 <0x0000003f, "V_FREXP_EXP_I32_F32", []>;
718 defm V_FREXP_MANT_F32 : VOP1_32 <0x00000040, "V_FREXP_MANT_F32", []>;
719 //def V_CLREXCP : VOP1_ <0x00000041, "V_CLREXCP", []>;
720 defm V_MOVRELD_B32 : VOP1_32 <0x00000042, "V_MOVRELD_B32", []>;
721 defm V_MOVRELS_B32 : VOP1_32 <0x00000043, "V_MOVRELS_B32", []>;
722 defm V_MOVRELSD_B32 : VOP1_32 <0x00000044, "V_MOVRELSD_B32", []>;
724 def V_INTERP_P1_F32 : VINTRP <
727 (ins VReg_32:$i, i32imm:$attr_chan, i32imm:$attr, M0Reg:$m0),
728 "V_INTERP_P1_F32 $dst, $i, $attr_chan, $attr, [$m0]",
730 let DisableEncoding = "$m0";
733 def V_INTERP_P2_F32 : VINTRP <
736 (ins VReg_32:$src0, VReg_32:$j, i32imm:$attr_chan, i32imm:$attr, M0Reg:$m0),
737 "V_INTERP_P2_F32 $dst, [$src0], $j, $attr_chan, $attr, [$m0]",
740 let Constraints = "$src0 = $dst";
741 let DisableEncoding = "$src0,$m0";
745 def V_INTERP_MOV_F32 : VINTRP <
748 (ins InterpSlot:$src0, i32imm:$attr_chan, i32imm:$attr, M0Reg:$m0),
749 "V_INTERP_MOV_F32 $dst, $src0, $attr_chan, $attr, [$m0]",
751 let DisableEncoding = "$m0";
754 //def S_NOP : SOPP_ <0x00000000, "S_NOP", []>;
756 let isTerminator = 1 in {
758 def S_ENDPGM : SOPP <0x00000001, (ins), "S_ENDPGM",
765 let isBranch = 1 in {
766 def S_BRANCH : SOPP <
767 0x00000002, (ins brtarget:$target), "S_BRANCH $target",
772 let DisableEncoding = "$scc" in {
773 def S_CBRANCH_SCC0 : SOPP <
774 0x00000004, (ins brtarget:$target, SCCReg:$scc),
775 "S_CBRANCH_SCC0 $target", []
777 def S_CBRANCH_SCC1 : SOPP <
778 0x00000005, (ins brtarget:$target, SCCReg:$scc),
779 "S_CBRANCH_SCC1 $target",
782 } // End DisableEncoding = "$scc"
784 def S_CBRANCH_VCCZ : SOPP <
785 0x00000006, (ins brtarget:$target, VCCReg:$vcc),
786 "S_CBRANCH_VCCZ $target",
789 def S_CBRANCH_VCCNZ : SOPP <
790 0x00000007, (ins brtarget:$target, VCCReg:$vcc),
791 "S_CBRANCH_VCCNZ $target",
795 let DisableEncoding = "$exec" in {
796 def S_CBRANCH_EXECZ : SOPP <
797 0x00000008, (ins brtarget:$target, EXECReg:$exec),
798 "S_CBRANCH_EXECZ $target",
801 def S_CBRANCH_EXECNZ : SOPP <
802 0x00000009, (ins brtarget:$target, EXECReg:$exec),
803 "S_CBRANCH_EXECNZ $target",
806 } // End DisableEncoding = "$exec"
809 } // End isBranch = 1
810 } // End isTerminator = 1
812 let hasSideEffects = 1 in {
813 def S_BARRIER : SOPP <0x0000000a, (ins), "S_BARRIER",
814 [(int_AMDGPU_barrier_local)]
823 def S_WAITCNT : SOPP <0x0000000c, (ins WAIT_FLAG:$simm16), "S_WAITCNT $simm16",
826 } // End hasSideEffects
827 //def S_SETHALT : SOPP_ <0x0000000d, "S_SETHALT", []>;
828 //def S_SLEEP : SOPP_ <0x0000000e, "S_SLEEP", []>;
829 //def S_SETPRIO : SOPP_ <0x0000000f, "S_SETPRIO", []>;
830 //def S_SENDMSG : SOPP_ <0x00000010, "S_SENDMSG", []>;
831 //def S_SENDMSGHALT : SOPP_ <0x00000011, "S_SENDMSGHALT", []>;
832 //def S_TRAP : SOPP_ <0x00000012, "S_TRAP", []>;
833 //def S_ICACHE_INV : SOPP_ <0x00000013, "S_ICACHE_INV", []>;
834 //def S_INCPERFLEVEL : SOPP_ <0x00000014, "S_INCPERFLEVEL", []>;
835 //def S_DECPERFLEVEL : SOPP_ <0x00000015, "S_DECPERFLEVEL", []>;
836 //def S_TTRACEDATA : SOPP_ <0x00000016, "S_TTRACEDATA", []>;
838 def V_CNDMASK_B32_e32 : VOP2 <0x00000000, (outs VReg_32:$dst),
839 (ins VSrc_32:$src0, VReg_32:$src1, VCCReg:$vcc),
840 "V_CNDMASK_B32_e32 $dst, $src0, $src1, [$vcc]",
843 let DisableEncoding = "$vcc";
846 def V_CNDMASK_B32_e64 : VOP3 <0x00000100, (outs VReg_32:$dst),
847 (ins VSrc_32:$src0, VSrc_32:$src1, SSrc_64:$src2,
848 InstFlag:$abs, InstFlag:$clamp, InstFlag:$omod, InstFlag:$neg),
849 "V_CNDMASK_B32_e64 $dst, $src0, $src1, $src2, $abs, $clamp, $omod, $neg",
850 [(set i32:$dst, (select i1:$src2, i32:$src1, i32:$src0))]
853 //f32 pattern for V_CNDMASK_B32_e64
855 (f32 (select i1:$src2, f32:$src1, f32:$src0)),
856 (V_CNDMASK_B32_e64 $src0, $src1, $src2)
860 (i32 (trunc i64:$val)),
861 (EXTRACT_SUBREG $val, sub0)
864 //use two V_CNDMASK_B32_e64 instructions for f64
866 (f64 (select i1:$src2, f64:$src1, f64:$src0)),
867 (INSERT_SUBREG (INSERT_SUBREG (f64 (IMPLICIT_DEF)),
868 (V_CNDMASK_B32_e64 (EXTRACT_SUBREG $src0, sub0),
869 (EXTRACT_SUBREG $src1, sub0),
871 (V_CNDMASK_B32_e64 (EXTRACT_SUBREG $src0, sub1),
872 (EXTRACT_SUBREG $src1, sub1),
876 defm V_READLANE_B32 : VOP2_32 <0x00000001, "V_READLANE_B32", []>;
877 defm V_WRITELANE_B32 : VOP2_32 <0x00000002, "V_WRITELANE_B32", []>;
879 let isCommutable = 1 in {
880 defm V_ADD_F32 : VOP2_32 <0x00000003, "V_ADD_F32",
881 [(set f32:$dst, (fadd f32:$src0, f32:$src1))]
884 defm V_SUB_F32 : VOP2_32 <0x00000004, "V_SUB_F32",
885 [(set f32:$dst, (fsub f32:$src0, f32:$src1))]
887 defm V_SUBREV_F32 : VOP2_32 <0x00000005, "V_SUBREV_F32", [], "V_SUB_F32">;
888 } // End isCommutable = 1
890 defm V_MAC_LEGACY_F32 : VOP2_32 <0x00000006, "V_MAC_LEGACY_F32", []>;
892 let isCommutable = 1 in {
894 defm V_MUL_LEGACY_F32 : VOP2_32 <
895 0x00000007, "V_MUL_LEGACY_F32",
896 [(set f32:$dst, (int_AMDGPU_mul f32:$src0, f32:$src1))]
899 defm V_MUL_F32 : VOP2_32 <0x00000008, "V_MUL_F32",
900 [(set f32:$dst, (fmul f32:$src0, f32:$src1))]
904 defm V_MUL_I32_I24 : VOP2_32 <0x00000009, "V_MUL_I32_I24",
905 [(set i32:$dst, (mul I24:$src0, I24:$src1))]
907 //defm V_MUL_HI_I32_I24 : VOP2_32 <0x0000000a, "V_MUL_HI_I32_I24", []>;
908 defm V_MUL_U32_U24 : VOP2_32 <0x0000000b, "V_MUL_U32_U24",
909 [(set i32:$dst, (mul U24:$src0, U24:$src1))]
911 //defm V_MUL_HI_U32_U24 : VOP2_32 <0x0000000c, "V_MUL_HI_U32_U24", []>;
914 defm V_MIN_LEGACY_F32 : VOP2_32 <0x0000000d, "V_MIN_LEGACY_F32",
915 [(set f32:$dst, (AMDGPUfmin f32:$src0, f32:$src1))]
918 defm V_MAX_LEGACY_F32 : VOP2_32 <0x0000000e, "V_MAX_LEGACY_F32",
919 [(set f32:$dst, (AMDGPUfmax f32:$src0, f32:$src1))]
922 defm V_MIN_F32 : VOP2_32 <0x0000000f, "V_MIN_F32", []>;
923 defm V_MAX_F32 : VOP2_32 <0x00000010, "V_MAX_F32", []>;
924 defm V_MIN_I32 : VOP2_32 <0x00000011, "V_MIN_I32",
925 [(set i32:$dst, (AMDGPUsmin i32:$src0, i32:$src1))]
927 defm V_MAX_I32 : VOP2_32 <0x00000012, "V_MAX_I32",
928 [(set i32:$dst, (AMDGPUsmax i32:$src0, i32:$src1))]
930 defm V_MIN_U32 : VOP2_32 <0x00000013, "V_MIN_U32",
931 [(set i32:$dst, (AMDGPUumin i32:$src0, i32:$src1))]
933 defm V_MAX_U32 : VOP2_32 <0x00000014, "V_MAX_U32",
934 [(set i32:$dst, (AMDGPUumax i32:$src0, i32:$src1))]
937 defm V_LSHR_B32 : VOP2_32 <0x00000015, "V_LSHR_B32",
938 [(set i32:$dst, (srl i32:$src0, i32:$src1))]
940 defm V_LSHRREV_B32 : VOP2_32 <0x00000016, "V_LSHRREV_B32", [], "V_LSHR_B32">;
942 defm V_ASHR_I32 : VOP2_32 <0x00000017, "V_ASHR_I32",
943 [(set i32:$dst, (sra i32:$src0, i32:$src1))]
945 defm V_ASHRREV_I32 : VOP2_32 <0x00000018, "V_ASHRREV_I32", [], "V_ASHR_I32">;
947 let hasPostISelHook = 1 in {
949 defm V_LSHL_B32 : VOP2_32 <0x00000019, "V_LSHL_B32",
950 [(set i32:$dst, (shl i32:$src0, i32:$src1))]
954 defm V_LSHLREV_B32 : VOP2_32 <0x0000001a, "V_LSHLREV_B32", [], "V_LSHL_B32">;
956 defm V_AND_B32 : VOP2_32 <0x0000001b, "V_AND_B32",
957 [(set i32:$dst, (and i32:$src0, i32:$src1))]
959 defm V_OR_B32 : VOP2_32 <0x0000001c, "V_OR_B32",
960 [(set i32:$dst, (or i32:$src0, i32:$src1))]
962 defm V_XOR_B32 : VOP2_32 <0x0000001d, "V_XOR_B32",
963 [(set i32:$dst, (xor i32:$src0, i32:$src1))]
966 } // End isCommutable = 1
968 defm V_BFM_B32 : VOP2_32 <0x0000001e, "V_BFM_B32", []>;
969 defm V_MAC_F32 : VOP2_32 <0x0000001f, "V_MAC_F32", []>;
970 defm V_MADMK_F32 : VOP2_32 <0x00000020, "V_MADMK_F32", []>;
971 defm V_MADAK_F32 : VOP2_32 <0x00000021, "V_MADAK_F32", []>;
972 //defm V_BCNT_U32_B32 : VOP2_32 <0x00000022, "V_BCNT_U32_B32", []>;
973 defm V_MBCNT_LO_U32_B32 : VOP2_32 <0x00000023, "V_MBCNT_LO_U32_B32", []>;
974 defm V_MBCNT_HI_U32_B32 : VOP2_32 <0x00000024, "V_MBCNT_HI_U32_B32", []>;
976 let isCommutable = 1, Defs = [VCC] in { // Carry-out goes to VCC
977 // No patterns so that the scalar instructions are always selected.
978 // The scalar versions will be replaced with vector when needed later.
979 defm V_ADD_I32 : VOP2b_32 <0x00000025, "V_ADD_I32", []>;
980 defm V_SUB_I32 : VOP2b_32 <0x00000026, "V_SUB_I32", []>;
981 defm V_SUBREV_I32 : VOP2b_32 <0x00000027, "V_SUBREV_I32", [], "V_SUB_I32">;
983 let Uses = [VCC] in { // Carry-in comes from VCC
984 defm V_ADDC_U32 : VOP2b_32 <0x00000028, "V_ADDC_U32", []>;
985 defm V_SUBB_U32 : VOP2b_32 <0x00000029, "V_SUBB_U32", []>;
986 defm V_SUBBREV_U32 : VOP2b_32 <0x0000002a, "V_SUBBREV_U32", [], "V_SUBB_U32">;
987 } // End Uses = [VCC]
988 } // End isCommutable = 1, Defs = [VCC]
990 defm V_LDEXP_F32 : VOP2_32 <0x0000002b, "V_LDEXP_F32", []>;
991 ////def V_CVT_PKACCUM_U8_F32 : VOP2_U8 <0x0000002c, "V_CVT_PKACCUM_U8_F32", []>;
992 ////def V_CVT_PKNORM_I16_F32 : VOP2_I16 <0x0000002d, "V_CVT_PKNORM_I16_F32", []>;
993 ////def V_CVT_PKNORM_U16_F32 : VOP2_U16 <0x0000002e, "V_CVT_PKNORM_U16_F32", []>;
994 defm V_CVT_PKRTZ_F16_F32 : VOP2_32 <0x0000002f, "V_CVT_PKRTZ_F16_F32",
995 [(set i32:$dst, (int_SI_packf16 f32:$src0, f32:$src1))]
997 ////def V_CVT_PK_U16_U32 : VOP2_U16 <0x00000030, "V_CVT_PK_U16_U32", []>;
998 ////def V_CVT_PK_I16_I32 : VOP2_I16 <0x00000031, "V_CVT_PK_I16_I32", []>;
999 def S_CMP_EQ_I32 : SOPC_32 <0x00000000, "S_CMP_EQ_I32", []>;
1000 def S_CMP_LG_I32 : SOPC_32 <0x00000001, "S_CMP_LG_I32", []>;
1001 def S_CMP_GT_I32 : SOPC_32 <0x00000002, "S_CMP_GT_I32", []>;
1002 def S_CMP_GE_I32 : SOPC_32 <0x00000003, "S_CMP_GE_I32", []>;
1003 def S_CMP_LT_I32 : SOPC_32 <0x00000004, "S_CMP_LT_I32", []>;
1004 def S_CMP_LE_I32 : SOPC_32 <0x00000005, "S_CMP_LE_I32", []>;
1005 def S_CMP_EQ_U32 : SOPC_32 <0x00000006, "S_CMP_EQ_U32", []>;
1006 def S_CMP_LG_U32 : SOPC_32 <0x00000007, "S_CMP_LG_U32", []>;
1007 def S_CMP_GT_U32 : SOPC_32 <0x00000008, "S_CMP_GT_U32", []>;
1008 def S_CMP_GE_U32 : SOPC_32 <0x00000009, "S_CMP_GE_U32", []>;
1009 def S_CMP_LT_U32 : SOPC_32 <0x0000000a, "S_CMP_LT_U32", []>;
1010 def S_CMP_LE_U32 : SOPC_32 <0x0000000b, "S_CMP_LE_U32", []>;
1011 ////def S_BITCMP0_B32 : SOPC_BITCMP0 <0x0000000c, "S_BITCMP0_B32", []>;
1012 ////def S_BITCMP1_B32 : SOPC_BITCMP1 <0x0000000d, "S_BITCMP1_B32", []>;
1013 ////def S_BITCMP0_B64 : SOPC_BITCMP0 <0x0000000e, "S_BITCMP0_B64", []>;
1014 ////def S_BITCMP1_B64 : SOPC_BITCMP1 <0x0000000f, "S_BITCMP1_B64", []>;
1015 //def S_SETVSKIP : SOPC_ <0x00000010, "S_SETVSKIP", []>;
1017 let neverHasSideEffects = 1 in {
1019 def V_MAD_LEGACY_F32 : VOP3_32 <0x00000140, "V_MAD_LEGACY_F32", []>;
1020 def V_MAD_F32 : VOP3_32 <0x00000141, "V_MAD_F32", []>;
1021 def V_MAD_I32_I24 : VOP3_32 <0x00000142, "V_MAD_I32_I24",
1022 [(set i32:$dst, (add (mul I24:$src0, I24:$src1), i32:$src2))]
1024 def V_MAD_U32_U24 : VOP3_32 <0x00000143, "V_MAD_U32_U24",
1025 [(set i32:$dst, (add (mul U24:$src0, U24:$src1), i32:$src2))]
1028 } // End neverHasSideEffects
1029 def V_CUBEID_F32 : VOP3_32 <0x00000144, "V_CUBEID_F32", []>;
1030 def V_CUBESC_F32 : VOP3_32 <0x00000145, "V_CUBESC_F32", []>;
1031 def V_CUBETC_F32 : VOP3_32 <0x00000146, "V_CUBETC_F32", []>;
1032 def V_CUBEMA_F32 : VOP3_32 <0x00000147, "V_CUBEMA_F32", []>;
1033 def V_BFE_U32 : VOP3_32 <0x00000148, "V_BFE_U32", []>;
1034 def V_BFE_I32 : VOP3_32 <0x00000149, "V_BFE_I32", []>;
1035 def V_BFI_B32 : VOP3_32 <0x0000014a, "V_BFI_B32", []>;
1036 defm : BFIPatterns <V_BFI_B32>;
1037 def V_FMA_F32 : VOP3_32 <0x0000014b, "V_FMA_F32",
1038 [(set f32:$dst, (fma f32:$src0, f32:$src1, f32:$src2))]
1040 def V_FMA_F64 : VOP3_64 <0x0000014c, "V_FMA_F64",
1041 [(set f64:$dst, (fma f64:$src0, f64:$src1, f64:$src2))]
1043 //def V_LERP_U8 : VOP3_U8 <0x0000014d, "V_LERP_U8", []>;
1044 def V_ALIGNBIT_B32 : VOP3_32 <0x0000014e, "V_ALIGNBIT_B32", []>;
1045 def : ROTRPattern <V_ALIGNBIT_B32>;
1047 def V_ALIGNBYTE_B32 : VOP3_32 <0x0000014f, "V_ALIGNBYTE_B32", []>;
1048 def V_MULLIT_F32 : VOP3_32 <0x00000150, "V_MULLIT_F32", []>;
1049 ////def V_MIN3_F32 : VOP3_MIN3 <0x00000151, "V_MIN3_F32", []>;
1050 ////def V_MIN3_I32 : VOP3_MIN3 <0x00000152, "V_MIN3_I32", []>;
1051 ////def V_MIN3_U32 : VOP3_MIN3 <0x00000153, "V_MIN3_U32", []>;
1052 ////def V_MAX3_F32 : VOP3_MAX3 <0x00000154, "V_MAX3_F32", []>;
1053 ////def V_MAX3_I32 : VOP3_MAX3 <0x00000155, "V_MAX3_I32", []>;
1054 ////def V_MAX3_U32 : VOP3_MAX3 <0x00000156, "V_MAX3_U32", []>;
1055 ////def V_MED3_F32 : VOP3_MED3 <0x00000157, "V_MED3_F32", []>;
1056 ////def V_MED3_I32 : VOP3_MED3 <0x00000158, "V_MED3_I32", []>;
1057 ////def V_MED3_U32 : VOP3_MED3 <0x00000159, "V_MED3_U32", []>;
1058 //def V_SAD_U8 : VOP3_U8 <0x0000015a, "V_SAD_U8", []>;
1059 //def V_SAD_HI_U8 : VOP3_U8 <0x0000015b, "V_SAD_HI_U8", []>;
1060 //def V_SAD_U16 : VOP3_U16 <0x0000015c, "V_SAD_U16", []>;
1061 def V_SAD_U32 : VOP3_32 <0x0000015d, "V_SAD_U32", []>;
1062 ////def V_CVT_PK_U8_F32 : VOP3_U8 <0x0000015e, "V_CVT_PK_U8_F32", []>;
1063 def V_DIV_FIXUP_F32 : VOP3_32 <0x0000015f, "V_DIV_FIXUP_F32", []>;
1064 def V_DIV_FIXUP_F64 : VOP3_64 <0x00000160, "V_DIV_FIXUP_F64", []>;
1066 def V_LSHL_B64 : VOP3_64_Shift <0x00000161, "V_LSHL_B64",
1067 [(set i64:$dst, (shl i64:$src0, i32:$src1))]
1069 def V_LSHR_B64 : VOP3_64_Shift <0x00000162, "V_LSHR_B64",
1070 [(set i64:$dst, (srl i64:$src0, i32:$src1))]
1072 def V_ASHR_I64 : VOP3_64_Shift <0x00000163, "V_ASHR_I64",
1073 [(set i64:$dst, (sra i64:$src0, i32:$src1))]
1076 let isCommutable = 1 in {
1078 def V_ADD_F64 : VOP3_64 <0x00000164, "V_ADD_F64", []>;
1079 def V_MUL_F64 : VOP3_64 <0x00000165, "V_MUL_F64", []>;
1080 def V_MIN_F64 : VOP3_64 <0x00000166, "V_MIN_F64", []>;
1081 def V_MAX_F64 : VOP3_64 <0x00000167, "V_MAX_F64", []>;
1083 } // isCommutable = 1
1086 (fadd f64:$src0, f64:$src1),
1087 (V_ADD_F64 $src0, $src1, (i64 0))
1091 (fmul f64:$src0, f64:$src1),
1092 (V_MUL_F64 $src0, $src1, (i64 0))
1095 def V_LDEXP_F64 : VOP3_64 <0x00000168, "V_LDEXP_F64", []>;
1097 let isCommutable = 1 in {
1099 def V_MUL_LO_U32 : VOP3_32 <0x00000169, "V_MUL_LO_U32", []>;
1100 def V_MUL_HI_U32 : VOP3_32 <0x0000016a, "V_MUL_HI_U32", []>;
1101 def V_MUL_LO_I32 : VOP3_32 <0x0000016b, "V_MUL_LO_I32", []>;
1102 def V_MUL_HI_I32 : VOP3_32 <0x0000016c, "V_MUL_HI_I32", []>;
1104 } // isCommutable = 1
1107 (mul i32:$src0, i32:$src1),
1108 (V_MUL_LO_I32 $src0, $src1, (i32 0))
1112 (mulhu i32:$src0, i32:$src1),
1113 (V_MUL_HI_U32 $src0, $src1, (i32 0))
1117 (mulhs i32:$src0, i32:$src1),
1118 (V_MUL_HI_I32 $src0, $src1, (i32 0))
1121 def V_DIV_SCALE_F32 : VOP3_32 <0x0000016d, "V_DIV_SCALE_F32", []>;
1122 def V_DIV_SCALE_F64 : VOP3_64 <0x0000016e, "V_DIV_SCALE_F64", []>;
1123 def V_DIV_FMAS_F32 : VOP3_32 <0x0000016f, "V_DIV_FMAS_F32", []>;
1124 def V_DIV_FMAS_F64 : VOP3_64 <0x00000170, "V_DIV_FMAS_F64", []>;
1125 //def V_MSAD_U8 : VOP3_U8 <0x00000171, "V_MSAD_U8", []>;
1126 //def V_QSAD_U8 : VOP3_U8 <0x00000172, "V_QSAD_U8", []>;
1127 //def V_MQSAD_U8 : VOP3_U8 <0x00000173, "V_MQSAD_U8", []>;
1128 def V_TRIG_PREOP_F64 : VOP3_64 <0x00000174, "V_TRIG_PREOP_F64", []>;
1130 let Defs = [SCC] in { // Carry out goes to SCC
1131 let isCommutable = 1 in {
1132 def S_ADD_U32 : SOP2_32 <0x00000000, "S_ADD_U32", []>;
1133 def S_ADD_I32 : SOP2_32 <0x00000002, "S_ADD_I32",
1134 [(set i32:$dst, (add SSrc_32:$src0, SSrc_32:$src1))]
1136 } // End isCommutable = 1
1138 def S_SUB_U32 : SOP2_32 <0x00000001, "S_SUB_U32", []>;
1139 def S_SUB_I32 : SOP2_32 <0x00000003, "S_SUB_I32",
1140 [(set i32:$dst, (sub SSrc_32:$src0, SSrc_32:$src1))]
1143 let Uses = [SCC] in { // Carry in comes from SCC
1144 let isCommutable = 1 in {
1145 def S_ADDC_U32 : SOP2_32 <0x00000004, "S_ADDC_U32",
1146 [(set i32:$dst, (adde (i32 SSrc_32:$src0), (i32 SSrc_32:$src1)))]>;
1147 } // End isCommutable = 1
1149 def S_SUBB_U32 : SOP2_32 <0x00000005, "S_SUBB_U32",
1150 [(set i32:$dst, (sube (i32 SSrc_32:$src0), (i32 SSrc_32:$src1)))]>;
1151 } // End Uses = [SCC]
1152 } // End Defs = [SCC]
1154 def S_MIN_I32 : SOP2_32 <0x00000006, "S_MIN_I32", []>;
1155 def S_MIN_U32 : SOP2_32 <0x00000007, "S_MIN_U32", []>;
1156 def S_MAX_I32 : SOP2_32 <0x00000008, "S_MAX_I32", []>;
1157 def S_MAX_U32 : SOP2_32 <0x00000009, "S_MAX_U32", []>;
1159 def S_CSELECT_B32 : SOP2 <
1160 0x0000000a, (outs SReg_32:$dst),
1161 (ins SReg_32:$src0, SReg_32:$src1, SCCReg:$scc), "S_CSELECT_B32",
1165 def S_CSELECT_B64 : SOP2_64 <0x0000000b, "S_CSELECT_B64", []>;
1167 def S_AND_B32 : SOP2_32 <0x0000000e, "S_AND_B32", []>;
1169 def S_AND_B64 : SOP2_64 <0x0000000f, "S_AND_B64",
1170 [(set i64:$dst, (and i64:$src0, i64:$src1))]
1174 (i1 (and i1:$src0, i1:$src1)),
1175 (S_AND_B64 $src0, $src1)
1178 def S_OR_B32 : SOP2_32 <0x00000010, "S_OR_B32", []>;
1179 def S_OR_B64 : SOP2_64 <0x00000011, "S_OR_B64", []>;
1181 (i1 (or i1:$src0, i1:$src1)),
1182 (S_OR_B64 $src0, $src1)
1184 def S_XOR_B32 : SOP2_32 <0x00000012, "S_XOR_B32", []>;
1185 def S_XOR_B64 : SOP2_64 <0x00000013, "S_XOR_B64",
1186 [(set i1:$dst, (xor i1:$src0, i1:$src1))]
1188 def S_ANDN2_B32 : SOP2_32 <0x00000014, "S_ANDN2_B32", []>;
1189 def S_ANDN2_B64 : SOP2_64 <0x00000015, "S_ANDN2_B64", []>;
1190 def S_ORN2_B32 : SOP2_32 <0x00000016, "S_ORN2_B32", []>;
1191 def S_ORN2_B64 : SOP2_64 <0x00000017, "S_ORN2_B64", []>;
1192 def S_NAND_B32 : SOP2_32 <0x00000018, "S_NAND_B32", []>;
1193 def S_NAND_B64 : SOP2_64 <0x00000019, "S_NAND_B64", []>;
1194 def S_NOR_B32 : SOP2_32 <0x0000001a, "S_NOR_B32", []>;
1195 def S_NOR_B64 : SOP2_64 <0x0000001b, "S_NOR_B64", []>;
1196 def S_XNOR_B32 : SOP2_32 <0x0000001c, "S_XNOR_B32", []>;
1197 def S_XNOR_B64 : SOP2_64 <0x0000001d, "S_XNOR_B64", []>;
1199 // Use added complexity so these patterns are preferred to the VALU patterns.
1200 let AddedComplexity = 1 in {
1202 def S_LSHL_B32 : SOP2_32 <0x0000001e, "S_LSHL_B32",
1203 [(set i32:$dst, (shl i32:$src0, i32:$src1))]
1205 def S_LSHL_B64 : SOP2_SHIFT_64 <0x0000001f, "S_LSHL_B64",
1206 [(set i64:$dst, (shl i64:$src0, i32:$src1))]
1208 def S_LSHR_B32 : SOP2_32 <0x00000020, "S_LSHR_B32",
1209 [(set i32:$dst, (srl i32:$src0, i32:$src1))]
1211 def S_LSHR_B64 : SOP2_SHIFT_64 <0x00000021, "S_LSHR_B64",
1212 [(set i64:$dst, (srl i64:$src0, i32:$src1))]
1214 def S_ASHR_I32 : SOP2_32 <0x00000022, "S_ASHR_I32",
1215 [(set i32:$dst, (sra i32:$src0, i32:$src1))]
1217 def S_ASHR_I64 : SOP2_SHIFT_64 <0x00000023, "S_ASHR_I64",
1218 [(set i64:$dst, (sra i64:$src0, i32:$src1))]
1221 } // End AddedComplexity = 1
1223 def S_BFM_B32 : SOP2_32 <0x00000024, "S_BFM_B32", []>;
1224 def S_BFM_B64 : SOP2_64 <0x00000025, "S_BFM_B64", []>;
1225 def S_MUL_I32 : SOP2_32 <0x00000026, "S_MUL_I32", []>;
1226 def S_BFE_U32 : SOP2_32 <0x00000027, "S_BFE_U32", []>;
1227 def S_BFE_I32 : SOP2_32 <0x00000028, "S_BFE_I32", []>;
1228 def S_BFE_U64 : SOP2_64 <0x00000029, "S_BFE_U64", []>;
1229 def S_BFE_I64 : SOP2_64 <0x0000002a, "S_BFE_I64", []>;
1230 //def S_CBRANCH_G_FORK : SOP2_ <0x0000002b, "S_CBRANCH_G_FORK", []>;
1231 def S_ABSDIFF_I32 : SOP2_32 <0x0000002c, "S_ABSDIFF_I32", []>;
1233 let isCodeGenOnly = 1, isPseudo = 1 in {
1235 def LOAD_CONST : AMDGPUShaderInst <
1238 "LOAD_CONST $dst, $src",
1239 [(set GPRF32:$dst, (int_AMDGPU_load_const imm:$src))]
1242 // SI pseudo instructions. These are used by the CFG structurizer pass
1243 // and should be lowered to ISA instructions prior to codegen.
1245 let mayLoad = 1, mayStore = 1, hasSideEffects = 1,
1246 Uses = [EXEC], Defs = [EXEC] in {
1248 let isBranch = 1, isTerminator = 1 in {
1250 def SI_IF : InstSI <
1251 (outs SReg_64:$dst),
1252 (ins SReg_64:$vcc, brtarget:$target),
1253 "SI_IF $dst, $vcc, $target",
1254 [(set i64:$dst, (int_SI_if i1:$vcc, bb:$target))]
1257 def SI_ELSE : InstSI <
1258 (outs SReg_64:$dst),
1259 (ins SReg_64:$src, brtarget:$target),
1260 "SI_ELSE $dst, $src, $target",
1261 [(set i64:$dst, (int_SI_else i64:$src, bb:$target))]> {
1263 let Constraints = "$src = $dst";
1266 def SI_LOOP : InstSI <
1268 (ins SReg_64:$saved, brtarget:$target),
1269 "SI_LOOP $saved, $target",
1270 [(int_SI_loop i64:$saved, bb:$target)]
1273 } // end isBranch = 1, isTerminator = 1
1275 def SI_BREAK : InstSI <
1276 (outs SReg_64:$dst),
1278 "SI_ELSE $dst, $src",
1279 [(set i64:$dst, (int_SI_break i64:$src))]
1282 def SI_IF_BREAK : InstSI <
1283 (outs SReg_64:$dst),
1284 (ins SReg_64:$vcc, SReg_64:$src),
1285 "SI_IF_BREAK $dst, $vcc, $src",
1286 [(set i64:$dst, (int_SI_if_break i1:$vcc, i64:$src))]
1289 def SI_ELSE_BREAK : InstSI <
1290 (outs SReg_64:$dst),
1291 (ins SReg_64:$src0, SReg_64:$src1),
1292 "SI_ELSE_BREAK $dst, $src0, $src1",
1293 [(set i64:$dst, (int_SI_else_break i64:$src0, i64:$src1))]
1296 def SI_END_CF : InstSI <
1298 (ins SReg_64:$saved),
1300 [(int_SI_end_cf i64:$saved)]
1303 def SI_KILL : InstSI <
1307 [(int_AMDGPU_kill f32:$src)]
1310 } // end mayLoad = 1, mayStore = 1, hasSideEffects = 1
1311 // Uses = [EXEC], Defs = [EXEC]
1313 let Uses = [EXEC], Defs = [EXEC,VCC,M0] in {
1315 //defm SI_ : RegisterLoadStore <VReg_32, FRAMEri64, ADDRIndirect>;
1317 let UseNamedOperandTable = 1 in {
1319 def SI_RegisterLoad : AMDGPUShaderInst <
1320 (outs VReg_32:$dst, SReg_64:$temp),
1321 (ins FRAMEri64:$addr, i32imm:$chan),
1324 let isRegisterLoad = 1;
1328 class SIRegStore<dag outs> : AMDGPUShaderInst <
1330 (ins VReg_32:$val, FRAMEri64:$addr, i32imm:$chan),
1333 let isRegisterStore = 1;
1337 let usesCustomInserter = 1 in {
1338 def SI_RegisterStorePseudo : SIRegStore<(outs)>;
1339 } // End usesCustomInserter = 1
1340 def SI_RegisterStore : SIRegStore<(outs SReg_64:$temp)>;
1343 } // End UseNamedOperandTable = 1
1345 def SI_INDIRECT_SRC : InstSI <
1346 (outs VReg_32:$dst, SReg_64:$temp),
1347 (ins unknown:$src, VSrc_32:$idx, i32imm:$off),
1348 "SI_INDIRECT_SRC $dst, $temp, $src, $idx, $off",
1352 class SI_INDIRECT_DST<RegisterClass rc> : InstSI <
1353 (outs rc:$dst, SReg_64:$temp),
1354 (ins unknown:$src, VSrc_32:$idx, i32imm:$off, VReg_32:$val),
1355 "SI_INDIRECT_DST $dst, $temp, $src, $idx, $off, $val",
1358 let Constraints = "$src = $dst";
1361 def SI_INDIRECT_DST_V1 : SI_INDIRECT_DST<VReg_32>;
1362 def SI_INDIRECT_DST_V2 : SI_INDIRECT_DST<VReg_64>;
1363 def SI_INDIRECT_DST_V4 : SI_INDIRECT_DST<VReg_128>;
1364 def SI_INDIRECT_DST_V8 : SI_INDIRECT_DST<VReg_256>;
1365 def SI_INDIRECT_DST_V16 : SI_INDIRECT_DST<VReg_512>;
1367 } // Uses = [EXEC,VCC,M0], Defs = [EXEC,VCC,M0]
1369 let usesCustomInserter = 1 in {
1371 // This pseudo instruction takes a pointer as input and outputs a resource
1372 // constant that can be used with the ADDR64 MUBUF instructions.
1373 def SI_ADDR64_RSRC : InstSI <
1374 (outs SReg_128:$srsrc),
1379 def V_SUB_F64 : InstSI <
1380 (outs VReg_64:$dst),
1381 (ins VReg_64:$src0, VReg_64:$src1),
1382 "V_SUB_F64 $dst, $src0, $src1",
1386 } // end usesCustomInserter
1388 } // end IsCodeGenOnly, isPseudo
1391 (int_AMDGPU_cndlt f32:$src0, f32:$src1, f32:$src2),
1392 (V_CNDMASK_B32_e64 $src2, $src1, (V_CMP_GT_F32_e64 0, $src0))
1397 (SI_KILL (V_MOV_B32_e32 0xbf800000))
1400 /* int_SI_vs_load_input */
1402 (SIload_input i128:$tlst, IMM12bit:$attr_offset, i32:$buf_idx_vgpr),
1403 (BUFFER_LOAD_FORMAT_XYZW_IDXEN $tlst, $buf_idx_vgpr, imm:$attr_offset)
1408 (int_SI_export imm:$en, imm:$vm, imm:$done, imm:$tgt, imm:$compr,
1409 f32:$src0, f32:$src1, f32:$src2, f32:$src3),
1410 (EXP imm:$en, imm:$tgt, imm:$compr, imm:$done, imm:$vm,
1411 $src0, $src1, $src2, $src3)
1415 (f64 (fsub f64:$src0, f64:$src1)),
1416 (V_SUB_F64 $src0, $src1)
1419 /********** ======================= **********/
1420 /********** Image sampling patterns **********/
1421 /********** ======================= **********/
1423 /* SIsample for simple 1D texture lookup */
1425 (SIsample i32:$addr, v32i8:$rsrc, i128:$sampler, imm),
1426 (IMAGE_SAMPLE_V4_V1 0xf, 0, 0, 0, 0, 0, 0, 0, $addr, $rsrc, $sampler)
1429 class SamplePattern<SDNode name, MIMG opcode, ValueType vt> : Pat <
1430 (name vt:$addr, v32i8:$rsrc, i128:$sampler, imm),
1431 (opcode 0xf, 0, 0, 0, 0, 0, 0, 0, $addr, $rsrc, $sampler)
1434 class SampleRectPattern<SDNode name, MIMG opcode, ValueType vt> : Pat <
1435 (name vt:$addr, v32i8:$rsrc, i128:$sampler, TEX_RECT),
1436 (opcode 0xf, 1, 0, 0, 0, 0, 0, 0, $addr, $rsrc, $sampler)
1439 class SampleArrayPattern<SDNode name, MIMG opcode, ValueType vt> : Pat <
1440 (name vt:$addr, v32i8:$rsrc, i128:$sampler, TEX_ARRAY),
1441 (opcode 0xf, 0, 0, 1, 0, 0, 0, 0, $addr, $rsrc, $sampler)
1444 class SampleShadowPattern<SDNode name, MIMG opcode,
1445 ValueType vt> : Pat <
1446 (name vt:$addr, v32i8:$rsrc, i128:$sampler, TEX_SHADOW),
1447 (opcode 0xf, 0, 0, 0, 0, 0, 0, 0, $addr, $rsrc, $sampler)
1450 class SampleShadowArrayPattern<SDNode name, MIMG opcode,
1451 ValueType vt> : Pat <
1452 (name vt:$addr, v32i8:$rsrc, i128:$sampler, TEX_SHADOW_ARRAY),
1453 (opcode 0xf, 0, 0, 1, 0, 0, 0, 0, $addr, $rsrc, $sampler)
1456 /* SIsample* for texture lookups consuming more address parameters */
1457 multiclass SamplePatterns<MIMG sample, MIMG sample_c, MIMG sample_l,
1458 MIMG sample_c_l, MIMG sample_b, MIMG sample_c_b,
1459 MIMG sample_d, MIMG sample_c_d, ValueType addr_type> {
1460 def : SamplePattern <SIsample, sample, addr_type>;
1461 def : SampleRectPattern <SIsample, sample, addr_type>;
1462 def : SampleArrayPattern <SIsample, sample, addr_type>;
1463 def : SampleShadowPattern <SIsample, sample_c, addr_type>;
1464 def : SampleShadowArrayPattern <SIsample, sample_c, addr_type>;
1466 def : SamplePattern <SIsamplel, sample_l, addr_type>;
1467 def : SampleArrayPattern <SIsamplel, sample_l, addr_type>;
1468 def : SampleShadowPattern <SIsamplel, sample_c_l, addr_type>;
1469 def : SampleShadowArrayPattern <SIsamplel, sample_c_l, addr_type>;
1471 def : SamplePattern <SIsampleb, sample_b, addr_type>;
1472 def : SampleArrayPattern <SIsampleb, sample_b, addr_type>;
1473 def : SampleShadowPattern <SIsampleb, sample_c_b, addr_type>;
1474 def : SampleShadowArrayPattern <SIsampleb, sample_c_b, addr_type>;
1476 def : SamplePattern <SIsampled, sample_d, addr_type>;
1477 def : SampleArrayPattern <SIsampled, sample_d, addr_type>;
1478 def : SampleShadowPattern <SIsampled, sample_c_d, addr_type>;
1479 def : SampleShadowArrayPattern <SIsampled, sample_c_d, addr_type>;
1482 defm : SamplePatterns<IMAGE_SAMPLE_V4_V2, IMAGE_SAMPLE_C_V4_V2,
1483 IMAGE_SAMPLE_L_V4_V2, IMAGE_SAMPLE_C_L_V4_V2,
1484 IMAGE_SAMPLE_B_V4_V2, IMAGE_SAMPLE_C_B_V4_V2,
1485 IMAGE_SAMPLE_D_V4_V2, IMAGE_SAMPLE_C_D_V4_V2,
1487 defm : SamplePatterns<IMAGE_SAMPLE_V4_V4, IMAGE_SAMPLE_C_V4_V4,
1488 IMAGE_SAMPLE_L_V4_V4, IMAGE_SAMPLE_C_L_V4_V4,
1489 IMAGE_SAMPLE_B_V4_V4, IMAGE_SAMPLE_C_B_V4_V4,
1490 IMAGE_SAMPLE_D_V4_V4, IMAGE_SAMPLE_C_D_V4_V4,
1492 defm : SamplePatterns<IMAGE_SAMPLE_V4_V8, IMAGE_SAMPLE_C_V4_V8,
1493 IMAGE_SAMPLE_L_V4_V8, IMAGE_SAMPLE_C_L_V4_V8,
1494 IMAGE_SAMPLE_B_V4_V8, IMAGE_SAMPLE_C_B_V4_V8,
1495 IMAGE_SAMPLE_D_V4_V8, IMAGE_SAMPLE_C_D_V4_V8,
1497 defm : SamplePatterns<IMAGE_SAMPLE_V4_V16, IMAGE_SAMPLE_C_V4_V16,
1498 IMAGE_SAMPLE_L_V4_V16, IMAGE_SAMPLE_C_L_V4_V16,
1499 IMAGE_SAMPLE_B_V4_V16, IMAGE_SAMPLE_C_B_V4_V16,
1500 IMAGE_SAMPLE_D_V4_V16, IMAGE_SAMPLE_C_D_V4_V16,
1503 /* int_SI_imageload for texture fetches consuming varying address parameters */
1504 class ImageLoadPattern<Intrinsic name, MIMG opcode, ValueType addr_type> : Pat <
1505 (name addr_type:$addr, v32i8:$rsrc, imm),
1506 (opcode 0xf, 0, 0, 0, 0, 0, 0, 0, $addr, $rsrc)
1509 class ImageLoadArrayPattern<Intrinsic name, MIMG opcode, ValueType addr_type> : Pat <
1510 (name addr_type:$addr, v32i8:$rsrc, TEX_ARRAY),
1511 (opcode 0xf, 0, 0, 1, 0, 0, 0, 0, $addr, $rsrc)
1514 class ImageLoadMSAAPattern<Intrinsic name, MIMG opcode, ValueType addr_type> : Pat <
1515 (name addr_type:$addr, v32i8:$rsrc, TEX_MSAA),
1516 (opcode 0xf, 0, 0, 0, 0, 0, 0, 0, $addr, $rsrc)
1519 class ImageLoadArrayMSAAPattern<Intrinsic name, MIMG opcode, ValueType addr_type> : Pat <
1520 (name addr_type:$addr, v32i8:$rsrc, TEX_ARRAY_MSAA),
1521 (opcode 0xf, 0, 0, 1, 0, 0, 0, 0, $addr, $rsrc)
1524 multiclass ImageLoadPatterns<MIMG opcode, ValueType addr_type> {
1525 def : ImageLoadPattern <int_SI_imageload, opcode, addr_type>;
1526 def : ImageLoadArrayPattern <int_SI_imageload, opcode, addr_type>;
1529 multiclass ImageLoadMSAAPatterns<MIMG opcode, ValueType addr_type> {
1530 def : ImageLoadMSAAPattern <int_SI_imageload, opcode, addr_type>;
1531 def : ImageLoadArrayMSAAPattern <int_SI_imageload, opcode, addr_type>;
1534 defm : ImageLoadPatterns<IMAGE_LOAD_MIP_V4_V2, v2i32>;
1535 defm : ImageLoadPatterns<IMAGE_LOAD_MIP_V4_V4, v4i32>;
1537 defm : ImageLoadMSAAPatterns<IMAGE_LOAD_V4_V2, v2i32>;
1538 defm : ImageLoadMSAAPatterns<IMAGE_LOAD_V4_V4, v4i32>;
1540 /* Image resource information */
1542 (int_SI_resinfo i32:$mipid, v32i8:$rsrc, imm),
1543 (IMAGE_GET_RESINFO_V4_V1 0xf, 0, 0, 0, 0, 0, 0, 0, (V_MOV_B32_e32 $mipid), $rsrc)
1547 (int_SI_resinfo i32:$mipid, v32i8:$rsrc, TEX_ARRAY),
1548 (IMAGE_GET_RESINFO_V4_V1 0xf, 0, 0, 1, 0, 0, 0, 0, (V_MOV_B32_e32 $mipid), $rsrc)
1552 (int_SI_resinfo i32:$mipid, v32i8:$rsrc, TEX_ARRAY_MSAA),
1553 (IMAGE_GET_RESINFO_V4_V1 0xf, 0, 0, 1, 0, 0, 0, 0, (V_MOV_B32_e32 $mipid), $rsrc)
1556 /********** ============================================ **********/
1557 /********** Extraction, Insertion, Building and Casting **********/
1558 /********** ============================================ **********/
1560 foreach Index = 0-2 in {
1561 def Extract_Element_v2i32_#Index : Extract_Element <
1562 i32, v2i32, Index, !cast<SubRegIndex>(sub#Index)
1564 def Insert_Element_v2i32_#Index : Insert_Element <
1565 i32, v2i32, Index, !cast<SubRegIndex>(sub#Index)
1568 def Extract_Element_v2f32_#Index : Extract_Element <
1569 f32, v2f32, Index, !cast<SubRegIndex>(sub#Index)
1571 def Insert_Element_v2f32_#Index : Insert_Element <
1572 f32, v2f32, Index, !cast<SubRegIndex>(sub#Index)
1576 foreach Index = 0-3 in {
1577 def Extract_Element_v4i32_#Index : Extract_Element <
1578 i32, v4i32, Index, !cast<SubRegIndex>(sub#Index)
1580 def Insert_Element_v4i32_#Index : Insert_Element <
1581 i32, v4i32, Index, !cast<SubRegIndex>(sub#Index)
1584 def Extract_Element_v4f32_#Index : Extract_Element <
1585 f32, v4f32, Index, !cast<SubRegIndex>(sub#Index)
1587 def Insert_Element_v4f32_#Index : Insert_Element <
1588 f32, v4f32, Index, !cast<SubRegIndex>(sub#Index)
1592 foreach Index = 0-7 in {
1593 def Extract_Element_v8i32_#Index : Extract_Element <
1594 i32, v8i32, Index, !cast<SubRegIndex>(sub#Index)
1596 def Insert_Element_v8i32_#Index : Insert_Element <
1597 i32, v8i32, Index, !cast<SubRegIndex>(sub#Index)
1600 def Extract_Element_v8f32_#Index : Extract_Element <
1601 f32, v8f32, Index, !cast<SubRegIndex>(sub#Index)
1603 def Insert_Element_v8f32_#Index : Insert_Element <
1604 f32, v8f32, Index, !cast<SubRegIndex>(sub#Index)
1608 foreach Index = 0-15 in {
1609 def Extract_Element_v16i32_#Index : Extract_Element <
1610 i32, v16i32, Index, !cast<SubRegIndex>(sub#Index)
1612 def Insert_Element_v16i32_#Index : Insert_Element <
1613 i32, v16i32, Index, !cast<SubRegIndex>(sub#Index)
1616 def Extract_Element_v16f32_#Index : Extract_Element <
1617 f32, v16f32, Index, !cast<SubRegIndex>(sub#Index)
1619 def Insert_Element_v16f32_#Index : Insert_Element <
1620 f32, v16f32, Index, !cast<SubRegIndex>(sub#Index)
1624 def : BitConvert <i32, f32, SReg_32>;
1625 def : BitConvert <i32, f32, VReg_32>;
1627 def : BitConvert <f32, i32, SReg_32>;
1628 def : BitConvert <f32, i32, VReg_32>;
1630 def : BitConvert <i64, f64, VReg_64>;
1632 def : BitConvert <f64, i64, VReg_64>;
1634 def : BitConvert <v2f32, v2i32, VReg_64>;
1635 def : BitConvert <v2i32, v2f32, VReg_64>;
1636 def : BitConvert <v2i32, i64, VReg_64>;
1638 def : BitConvert <v4f32, v4i32, VReg_128>;
1639 def : BitConvert <v4i32, v4f32, VReg_128>;
1640 def : BitConvert <v4i32, i128, VReg_128>;
1641 def : BitConvert <i128, v4i32, VReg_128>;
1643 def : BitConvert <v8i32, v32i8, SReg_256>;
1644 def : BitConvert <v32i8, v8i32, SReg_256>;
1645 def : BitConvert <v8i32, v32i8, VReg_256>;
1646 def : BitConvert <v32i8, v8i32, VReg_256>;
1648 /********** =================== **********/
1649 /********** Src & Dst modifiers **********/
1650 /********** =================== **********/
1653 (int_AMDIL_clamp f32:$src, (f32 FP_ZERO), (f32 FP_ONE)),
1654 (V_ADD_F32_e64 $src, (i32 0 /* SRC1 */),
1655 0 /* ABS */, 1 /* CLAMP */, 0 /* OMOD */, 0 /* NEG */)
1660 (V_ADD_F32_e64 $src, (i32 0 /* SRC1 */),
1661 1 /* ABS */, 0 /* CLAMP */, 0 /* OMOD */, 0 /* NEG */)
1666 (V_ADD_F32_e64 $src, (i32 0 /* SRC1 */),
1667 0 /* ABS */, 0 /* CLAMP */, 0 /* OMOD */, 1 /* NEG */)
1670 /********** ================== **********/
1671 /********** Immediate Patterns **********/
1672 /********** ================== **********/
1675 (SGPRImm<(i32 imm)>:$imm),
1676 (S_MOV_B32 imm:$imm)
1680 (SGPRImm<(f32 fpimm)>:$imm),
1681 (S_MOV_B32 fpimm:$imm)
1686 (V_MOV_B32_e32 imm:$imm)
1691 (V_MOV_B32_e32 fpimm:$imm)
1696 (S_MOV_B64 imm:$imm)
1700 (i64 InlineImm<i64>:$imm),
1701 (S_MOV_B64 InlineImm<i64>:$imm)
1704 // i64 immediates aren't supported in hardware, split it into two 32bit values
1707 (INSERT_SUBREG (INSERT_SUBREG (i64 (IMPLICIT_DEF)),
1708 (S_MOV_B32 (i32 (LO32 imm:$imm))), sub0),
1709 (S_MOV_B32 (i32 (HI32 imm:$imm))), sub1)
1714 (INSERT_SUBREG (INSERT_SUBREG (f64 (IMPLICIT_DEF)),
1715 (V_MOV_B32_e32 (f32 (LO32f fpimm:$imm))), sub0),
1716 (V_MOV_B32_e32 (f32 (HI32f fpimm:$imm))), sub1)
1719 /********** ===================== **********/
1720 /********** Interpolation Paterns **********/
1721 /********** ===================== **********/
1724 (int_SI_fs_constant imm:$attr_chan, imm:$attr, i32:$params),
1725 (V_INTERP_MOV_F32 INTERP.P0, imm:$attr_chan, imm:$attr, $params)
1729 (int_SI_fs_interp imm:$attr_chan, imm:$attr, M0Reg:$params, v2i32:$ij),
1730 (V_INTERP_P2_F32 (V_INTERP_P1_F32 (EXTRACT_SUBREG v2i32:$ij, sub0),
1731 imm:$attr_chan, imm:$attr, i32:$params),
1732 (EXTRACT_SUBREG $ij, sub1),
1733 imm:$attr_chan, imm:$attr, $params)
1736 /********** ================== **********/
1737 /********** Intrinsic Patterns **********/
1738 /********** ================== **********/
1740 /* llvm.AMDGPU.pow */
1741 def : POW_Common <V_LOG_F32_e32, V_EXP_F32_e32, V_MUL_LEGACY_F32_e32>;
1744 (int_AMDGPU_div f32:$src0, f32:$src1),
1745 (V_MUL_LEGACY_F32_e32 $src0, (V_RCP_LEGACY_F32_e32 $src1))
1749 (fdiv f32:$src0, f32:$src1),
1750 (V_MUL_F32_e32 $src0, (V_RCP_F32_e32 $src1))
1754 (fdiv f64:$src0, f64:$src1),
1755 (V_MUL_F64 $src0, (V_RCP_F64_e32 $src1), (i64 0))
1760 (V_COS_F32_e32 (V_MUL_F32_e32 $src0, (V_MOV_B32_e32 CONST.TWO_PI_INV)))
1765 (V_SIN_F32_e32 (V_MUL_F32_e32 $src0, (V_MOV_B32_e32 CONST.TWO_PI_INV)))
1769 (int_AMDGPU_cube v4f32:$src),
1770 (INSERT_SUBREG (INSERT_SUBREG (INSERT_SUBREG (INSERT_SUBREG (v4f32 (IMPLICIT_DEF)),
1771 (V_CUBETC_F32 (EXTRACT_SUBREG $src, sub0),
1772 (EXTRACT_SUBREG $src, sub1),
1773 (EXTRACT_SUBREG $src, sub2)),
1775 (V_CUBESC_F32 (EXTRACT_SUBREG $src, sub0),
1776 (EXTRACT_SUBREG $src, sub1),
1777 (EXTRACT_SUBREG $src, sub2)),
1779 (V_CUBEMA_F32 (EXTRACT_SUBREG $src, sub0),
1780 (EXTRACT_SUBREG $src, sub1),
1781 (EXTRACT_SUBREG $src, sub2)),
1783 (V_CUBEID_F32 (EXTRACT_SUBREG $src, sub0),
1784 (EXTRACT_SUBREG $src, sub1),
1785 (EXTRACT_SUBREG $src, sub2)),
1790 (i32 (sext i1:$src0)),
1791 (V_CNDMASK_B32_e64 (i32 0), (i32 -1), $src0)
1794 // 1. Offset as 8bit DWORD immediate
1796 (SIload_constant i128:$sbase, IMM8bitDWORD:$offset),
1797 (S_BUFFER_LOAD_DWORD_IMM $sbase, IMM8bitDWORD:$offset)
1800 // 2. Offset loaded in an 32bit SGPR
1802 (SIload_constant i128:$sbase, imm:$offset),
1803 (S_BUFFER_LOAD_DWORD_SGPR $sbase, (S_MOV_B32 imm:$offset))
1806 // 3. Offset in an 32Bit VGPR
1808 (SIload_constant i128:$sbase, i32:$voff),
1809 (BUFFER_LOAD_DWORD_OFFEN $sbase, $voff)
1812 // The multiplication scales from [0,1] to the unsigned integer range
1814 (AMDGPUurecip i32:$src0),
1816 (V_MUL_F32_e32 CONST.FP_UINT_MAX_PLUS_1,
1817 (V_RCP_IFLAG_F32_e32 (V_CVT_F32_U32_e32 $src0))))
1822 (V_MBCNT_HI_U32_B32_e32 0xffffffff,
1823 (V_MBCNT_LO_U32_B32_e64 0xffffffff, 0, 0, 0, 0, 0))
1826 /********** ================== **********/
1827 /********** VOP3 Patterns **********/
1828 /********** ================== **********/
1831 (f32 (fadd (fmul f32:$src0, f32:$src1), f32:$src2)),
1832 (V_MAD_F32 $src0, $src1, $src2)
1835 /********** ======================= **********/
1836 /********** Load/Store Patterns **********/
1837 /********** ======================= **********/
1839 class DSReadPat <DS inst, ValueType vt, PatFrag frag> : Pat <
1841 (vt (inst 0, $src0, $src0, $src0, 0, 0))
1844 def : DSReadPat <DS_READ_I8, i32, sextloadi8_local>;
1845 def : DSReadPat <DS_READ_U8, i32, az_extloadi8_local>;
1846 def : DSReadPat <DS_READ_I16, i32, sextloadi16_local>;
1847 def : DSReadPat <DS_READ_U16, i32, az_extloadi16_local>;
1848 def : DSReadPat <DS_READ_B32, i32, local_load>;
1850 (local_load i32:$src0),
1851 (i32 (DS_READ_B32 0, $src0, $src0, $src0, 0, 0))
1854 class DSWritePat <DS inst, ValueType vt, PatFrag frag> : Pat <
1855 (frag i32:$src1, i32:$src0),
1856 (inst 0, $src0, $src1, $src1, 0, 0)
1859 def : DSWritePat <DS_WRITE_B8, i32, truncstorei8_local>;
1860 def : DSWritePat <DS_WRITE_B16, i32, truncstorei16_local>;
1861 def : DSWritePat <DS_WRITE_B32, i32, local_store>;
1863 def : Pat <(atomic_load_add_local i32:$ptr, i32:$val),
1864 (DS_ADD_U32_RTN 0, $ptr, $val, 0, 0)>;
1866 def : Pat <(atomic_load_sub_local i32:$ptr, i32:$val),
1867 (DS_SUB_U32_RTN 0, $ptr, $val, 0, 0)>;
1869 /********** ================== **********/
1870 /********** SMRD Patterns **********/
1871 /********** ================== **********/
1873 multiclass SMRD_Pattern <SMRD Instr_IMM, SMRD Instr_SGPR, ValueType vt> {
1875 // 1. Offset as 8bit DWORD immediate
1877 (constant_load (SIadd64bit32bit i64:$sbase, IMM8bitDWORD:$offset)),
1878 (vt (Instr_IMM $sbase, IMM8bitDWORD:$offset))
1881 // 2. Offset loaded in an 32bit SGPR
1883 (constant_load (SIadd64bit32bit i64:$sbase, imm:$offset)),
1884 (vt (Instr_SGPR $sbase, (S_MOV_B32 imm:$offset)))
1887 // 3. No offset at all
1889 (constant_load i64:$sbase),
1890 (vt (Instr_IMM $sbase, 0))
1894 defm : SMRD_Pattern <S_LOAD_DWORD_IMM, S_LOAD_DWORD_SGPR, f32>;
1895 defm : SMRD_Pattern <S_LOAD_DWORD_IMM, S_LOAD_DWORD_SGPR, i32>;
1896 defm : SMRD_Pattern <S_LOAD_DWORDX2_IMM, S_LOAD_DWORDX2_SGPR, i64>;
1897 defm : SMRD_Pattern <S_LOAD_DWORDX2_IMM, S_LOAD_DWORDX2_SGPR, v2i32>;
1898 defm : SMRD_Pattern <S_LOAD_DWORDX4_IMM, S_LOAD_DWORDX4_SGPR, i128>;
1899 defm : SMRD_Pattern <S_LOAD_DWORDX4_IMM, S_LOAD_DWORDX4_SGPR, v4i32>;
1900 defm : SMRD_Pattern <S_LOAD_DWORDX8_IMM, S_LOAD_DWORDX8_SGPR, v32i8>;
1901 defm : SMRD_Pattern <S_LOAD_DWORDX8_IMM, S_LOAD_DWORDX8_SGPR, v8i32>;
1902 defm : SMRD_Pattern <S_LOAD_DWORDX16_IMM, S_LOAD_DWORDX16_SGPR, v16i32>;
1904 //===----------------------------------------------------------------------===//
1906 //===----------------------------------------------------------------------===//
1908 multiclass MUBUFLoad_Pattern <MUBUF Instr_ADDR64, ValueType vt,
1909 PatFrag global_ld, PatFrag constant_ld> {
1911 (vt (global_ld (add i64:$ptr, (i64 IMM12bit:$offset)))),
1912 (Instr_ADDR64 (SI_ADDR64_RSRC (i64 0)), $ptr, (as_i16imm $offset))
1916 (vt (global_ld i64:$ptr)),
1917 (Instr_ADDR64 (SI_ADDR64_RSRC (i64 0)), $ptr, 0)
1921 (vt (global_ld (add i64:$ptr, i64:$offset))),
1922 (Instr_ADDR64 (SI_ADDR64_RSRC $ptr), $offset, 0)
1926 (vt (constant_ld (add i64:$ptr, i64:$offset))),
1927 (Instr_ADDR64 (SI_ADDR64_RSRC $ptr), $offset, 0)
1931 defm : MUBUFLoad_Pattern <BUFFER_LOAD_SBYTE_ADDR64, i32,
1932 sextloadi8_global, sextloadi8_constant>;
1933 defm : MUBUFLoad_Pattern <BUFFER_LOAD_UBYTE_ADDR64, i32,
1934 az_extloadi8_global, az_extloadi8_constant>;
1935 defm : MUBUFLoad_Pattern <BUFFER_LOAD_SSHORT_ADDR64, i32,
1936 sextloadi16_global, sextloadi16_constant>;
1937 defm : MUBUFLoad_Pattern <BUFFER_LOAD_USHORT_ADDR64, i32,
1938 az_extloadi16_global, az_extloadi16_constant>;
1939 defm : MUBUFLoad_Pattern <BUFFER_LOAD_DWORD_ADDR64, i32,
1940 global_load, constant_load>;
1941 defm : MUBUFLoad_Pattern <BUFFER_LOAD_DWORDX2_ADDR64, i64,
1942 global_load, constant_load>;
1943 defm : MUBUFLoad_Pattern <BUFFER_LOAD_DWORDX2_ADDR64, i64,
1944 az_extloadi32_global, az_extloadi32_constant>;
1945 defm : MUBUFLoad_Pattern <BUFFER_LOAD_DWORDX2_ADDR64, v2i32,
1946 global_load, constant_load>;
1947 defm : MUBUFLoad_Pattern <BUFFER_LOAD_DWORDX4_ADDR64, v4i32,
1948 global_load, constant_load>;
1950 multiclass MUBUFStore_Pattern <MUBUF Instr, ValueType vt, PatFrag st> {
1953 (st vt:$value, i64:$ptr),
1954 (Instr $value, (SI_ADDR64_RSRC (i64 0)), $ptr, 0)
1958 (st vt:$value, (add i64:$ptr, i64:$offset)),
1959 (Instr $value, (SI_ADDR64_RSRC $ptr), $offset, 0)
1963 defm : MUBUFStore_Pattern <BUFFER_STORE_BYTE, i32, truncstorei8_global>;
1964 defm : MUBUFStore_Pattern <BUFFER_STORE_SHORT, i32, truncstorei16_global>;
1965 defm : MUBUFStore_Pattern <BUFFER_STORE_DWORD, i32, global_store>;
1966 defm : MUBUFStore_Pattern <BUFFER_STORE_DWORDX2, i64, global_store>;
1967 defm : MUBUFStore_Pattern <BUFFER_STORE_DWORDX2, v2i32, global_store>;
1968 defm : MUBUFStore_Pattern <BUFFER_STORE_DWORDX4, v4i32, global_store>;
1970 //===----------------------------------------------------------------------===//
1972 //===----------------------------------------------------------------------===//
1974 // TBUFFER_STORE_FORMAT_*, addr64=0
1975 class MTBUF_StoreResource <ValueType vt, int num_channels, MTBUF opcode> : Pat<
1976 (SItbuffer_store i128:$rsrc, vt:$vdata, num_channels, i32:$vaddr,
1977 i32:$soffset, imm:$inst_offset, imm:$dfmt,
1978 imm:$nfmt, imm:$offen, imm:$idxen,
1979 imm:$glc, imm:$slc, imm:$tfe),
1981 $vdata, (as_i16imm $inst_offset), (as_i1imm $offen), (as_i1imm $idxen),
1982 (as_i1imm $glc), 0, (as_i8imm $dfmt), (as_i8imm $nfmt), $vaddr, $rsrc,
1983 (as_i1imm $slc), (as_i1imm $tfe), $soffset)
1986 def : MTBUF_StoreResource <i32, 1, TBUFFER_STORE_FORMAT_X>;
1987 def : MTBUF_StoreResource <v2i32, 2, TBUFFER_STORE_FORMAT_XY>;
1988 def : MTBUF_StoreResource <v4i32, 3, TBUFFER_STORE_FORMAT_XYZ>;
1989 def : MTBUF_StoreResource <v4i32, 4, TBUFFER_STORE_FORMAT_XYZW>;
1991 /********** ====================== **********/
1992 /********** Indirect adressing **********/
1993 /********** ====================== **********/
1995 multiclass SI_INDIRECT_Pattern <ValueType vt, SI_INDIRECT_DST IndDst> {
1997 // 1. Extract with offset
1999 (vector_extract vt:$vec, (add i32:$idx, imm:$off)),
2000 (f32 (SI_INDIRECT_SRC (IMPLICIT_DEF), $vec, $idx, imm:$off))
2003 // 2. Extract without offset
2005 (vector_extract vt:$vec, i32:$idx),
2006 (f32 (SI_INDIRECT_SRC (IMPLICIT_DEF), $vec, $idx, 0))
2009 // 3. Insert with offset
2011 (vector_insert vt:$vec, f32:$val, (add i32:$idx, imm:$off)),
2012 (IndDst (IMPLICIT_DEF), $vec, $idx, imm:$off, $val)
2015 // 4. Insert without offset
2017 (vector_insert vt:$vec, f32:$val, i32:$idx),
2018 (IndDst (IMPLICIT_DEF), $vec, $idx, 0, $val)
2022 defm : SI_INDIRECT_Pattern <v2f32, SI_INDIRECT_DST_V2>;
2023 defm : SI_INDIRECT_Pattern <v4f32, SI_INDIRECT_DST_V4>;
2024 defm : SI_INDIRECT_Pattern <v8f32, SI_INDIRECT_DST_V8>;
2025 defm : SI_INDIRECT_Pattern <v16f32, SI_INDIRECT_DST_V16>;
2027 /********** =============== **********/
2028 /********** Conditions **********/
2029 /********** =============== **********/
2032 (i1 (setcc f32:$src0, f32:$src1, SETO)),
2033 (V_CMP_O_F32_e64 $src0, $src1)
2037 (i1 (setcc f32:$src0, f32:$src1, SETUO)),
2038 (V_CMP_U_F32_e64 $src0, $src1)
2041 //===----------------------------------------------------------------------===//
2042 // Miscellaneous Patterns
2043 //===----------------------------------------------------------------------===//
2046 (i64 (trunc i128:$x)),
2047 (INSERT_SUBREG (INSERT_SUBREG (i64 (IMPLICIT_DEF)),
2048 (i32 (EXTRACT_SUBREG $x, sub0)), sub0),
2049 (i32 (EXTRACT_SUBREG $x, sub1)), sub1)
2053 (i32 (trunc i64:$a)),
2054 (EXTRACT_SUBREG $a, sub0)
2057 // V_ADD_I32_e32/S_ADD_I32 produces carry in VCC/SCC. For the vector
2058 // case, the sgpr-copies pass will fix this to use the vector version.
2060 (i32 (addc i32:$src0, i32:$src1)),
2061 (S_ADD_I32 $src0, $src1)
2065 (or i64:$a, i64:$b),
2067 (INSERT_SUBREG (IMPLICIT_DEF),
2068 (V_OR_B32_e32 (EXTRACT_SUBREG $a, sub0), (EXTRACT_SUBREG $b, sub0)), sub0),
2069 (V_OR_B32_e32 (EXTRACT_SUBREG $a, sub1), (EXTRACT_SUBREG $b, sub1)), sub1)
2072 //============================================================================//
2073 // Miscellaneous Optimization Patterns
2074 //============================================================================//
2076 def : SHA256MaPattern <V_BFI_B32, V_XOR_B32_e32>;
2078 } // End isSI predicate