1 //===-- SOPInstructions.td - SOP Instruction Defintions -------------------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 def GPRIdxModeMatchClass : AsmOperandClass {
10 let Name = "GPRIdxMode";
11 let PredicateMethod = "isGPRIdxMode";
12 let ParserMethod = "parseGPRIdxMode";
13 let RenderMethod = "addImmOperands";
16 def GPRIdxMode : Operand<i32> {
17 let PrintMethod = "printVGPRIndexMode";
18 let ParserMatchClass = GPRIdxModeMatchClass;
19 let OperandType = "OPERAND_IMMEDIATE";
22 class SOP_Pseudo<string opName, dag outs, dag ins, string asmOps,
23 list<dag> pattern=[]> :
24 InstSI<outs, ins, "", pattern>,
25 SIMCInstr<opName, SIEncodingFamily.NONE> {
28 let isCodeGenOnly = 1;
30 string Mnemonic = opName;
31 string AsmOperands = asmOps;
36 //===----------------------------------------------------------------------===//
38 //===----------------------------------------------------------------------===//
40 class SOP1_Pseudo <string opName, dag outs, dag ins,
41 string asmOps, list<dag> pattern=[]> :
42 SOP_Pseudo<opName, outs, ins, asmOps, pattern> {
46 let hasSideEffects = 0;
49 let SchedRW = [WriteSALU];
51 let UseNamedOperandTable = 1;
57 class SOP1_Real<bits<8> op, SOP1_Pseudo ps> :
58 InstSI <ps.OutOperandList, ps.InOperandList,
59 ps.Mnemonic # " " # ps.AsmOperands, []>,
63 let isCodeGenOnly = 0;
66 // copy relevant pseudo op flags
67 let SubtargetPredicate = ps.SubtargetPredicate;
68 let AsmMatchConverter = ps.AsmMatchConverter;
74 let Inst{7-0} = !if(ps.has_src0, src0, ?);
76 let Inst{22-16} = !if(ps.has_sdst, sdst, ?);
77 let Inst{31-23} = 0x17d; //encoding;
80 class SOP1_32 <string opName, list<dag> pattern=[], bit tied_in = 0> : SOP1_Pseudo <
81 opName, (outs SReg_32:$sdst),
82 !if(tied_in, (ins SSrc_b32:$src0, SReg_32:$sdst_in),
83 (ins SSrc_b32:$src0)),
84 "$sdst, $src0", pattern> {
85 let Constraints = !if(tied_in, "$sdst = $sdst_in", "");
88 // 32-bit input, no output.
89 class SOP1_0_32 <string opName, list<dag> pattern = []> : SOP1_Pseudo <
90 opName, (outs), (ins SSrc_b32:$src0),
95 class SOP1_0_32R <string opName, list<dag> pattern = []> : SOP1_Pseudo <
96 opName, (outs), (ins SReg_32:$src0),
101 class SOP1_64 <string opName, list<dag> pattern=[]> : SOP1_Pseudo <
102 opName, (outs SReg_64:$sdst), (ins SSrc_b64:$src0),
103 "$sdst, $src0", pattern
106 // 64-bit input, 32-bit output.
107 class SOP1_32_64 <string opName, list<dag> pattern=[]> : SOP1_Pseudo <
108 opName, (outs SReg_32:$sdst), (ins SSrc_b64:$src0),
109 "$sdst, $src0", pattern
112 // 32-bit input, 64-bit output.
113 class SOP1_64_32 <string opName, list<dag> pattern=[], bit tied_in = 0> : SOP1_Pseudo <
114 opName, (outs SReg_64:$sdst),
115 !if(tied_in, (ins SSrc_b32:$src0, SReg_64:$sdst_in),
116 (ins SSrc_b32:$src0)),
117 "$sdst, $src0", pattern> {
118 let Constraints = !if(tied_in, "$sdst = $sdst_in", "");
121 // no input, 64-bit output.
122 class SOP1_64_0 <string opName, list<dag> pattern=[]> : SOP1_Pseudo <
123 opName, (outs SReg_64:$sdst), (ins), "$sdst", pattern> {
127 // 64-bit input, no output
128 class SOP1_1 <string opName, RegisterClass rc = SReg_64, list<dag> pattern=[]> : SOP1_Pseudo <
129 opName, (outs), (ins rc:$src0), "$src0", pattern> {
134 let isMoveImm = 1 in {
135 let isReMaterializable = 1, isAsCheapAsAMove = 1 in {
136 def S_MOV_B32 : SOP1_32 <"s_mov_b32">;
137 def S_MOV_B64 : SOP1_64 <"s_mov_b64">;
138 } // End isRematerializeable = 1
140 let Uses = [SCC] in {
141 def S_CMOV_B32 : SOP1_32 <"s_cmov_b32">;
142 def S_CMOV_B64 : SOP1_64 <"s_cmov_b64">;
143 } // End Uses = [SCC]
144 } // End isMoveImm = 1
146 let Defs = [SCC] in {
147 def S_NOT_B32 : SOP1_32 <"s_not_b32",
148 [(set i32:$sdst, (not i32:$src0))]
151 def S_NOT_B64 : SOP1_64 <"s_not_b64",
152 [(set i64:$sdst, (not i64:$src0))]
154 def S_WQM_B32 : SOP1_32 <"s_wqm_b32">;
155 def S_WQM_B64 : SOP1_64 <"s_wqm_b64">;
156 } // End Defs = [SCC]
159 let WaveSizePredicate = isWave32 in {
161 (int_amdgcn_wqm_vote i1:$src0),
166 let WaveSizePredicate = isWave64 in {
168 (int_amdgcn_wqm_vote i1:$src0),
173 def S_BREV_B32 : SOP1_32 <"s_brev_b32",
174 [(set i32:$sdst, (bitreverse i32:$src0))]
176 def S_BREV_B64 : SOP1_64 <"s_brev_b64">;
178 let Defs = [SCC] in {
179 def S_BCNT0_I32_B32 : SOP1_32 <"s_bcnt0_i32_b32">;
180 def S_BCNT0_I32_B64 : SOP1_32_64 <"s_bcnt0_i32_b64">;
181 def S_BCNT1_I32_B32 : SOP1_32 <"s_bcnt1_i32_b32",
182 [(set i32:$sdst, (ctpop i32:$src0))]
184 def S_BCNT1_I32_B64 : SOP1_32_64 <"s_bcnt1_i32_b64",
185 [(set i32:$sdst, (ctpop i64:$src0))]
187 } // End Defs = [SCC]
189 def S_FF0_I32_B32 : SOP1_32 <"s_ff0_i32_b32">;
190 def S_FF0_I32_B64 : SOP1_32_64 <"s_ff0_i32_b64">;
191 def S_FF1_I32_B64 : SOP1_32_64 <"s_ff1_i32_b64">;
193 def S_FF1_I32_B32 : SOP1_32 <"s_ff1_i32_b32",
194 [(set i32:$sdst, (AMDGPUffbl_b32 i32:$src0))]
197 def S_FLBIT_I32_B32 : SOP1_32 <"s_flbit_i32_b32",
198 [(set i32:$sdst, (AMDGPUffbh_u32 i32:$src0))]
201 def S_FLBIT_I32_B64 : SOP1_32_64 <"s_flbit_i32_b64">;
202 def S_FLBIT_I32 : SOP1_32 <"s_flbit_i32",
203 [(set i32:$sdst, (AMDGPUffbh_i32 i32:$src0))]
205 def S_FLBIT_I32_I64 : SOP1_32_64 <"s_flbit_i32_i64">;
206 def S_SEXT_I32_I8 : SOP1_32 <"s_sext_i32_i8",
207 [(set i32:$sdst, (sext_inreg i32:$src0, i8))]
209 def S_SEXT_I32_I16 : SOP1_32 <"s_sext_i32_i16",
210 [(set i32:$sdst, (sext_inreg i32:$src0, i16))]
213 def S_BITSET0_B32 : SOP1_32 <"s_bitset0_b32", [], 1>;
214 def S_BITSET0_B64 : SOP1_64_32 <"s_bitset0_b64", [], 1>;
215 def S_BITSET1_B32 : SOP1_32 <"s_bitset1_b32", [], 1>;
216 def S_BITSET1_B64 : SOP1_64_32 <"s_bitset1_b64", [], 1>;
217 def S_GETPC_B64 : SOP1_64_0 <"s_getpc_b64",
218 [(set i64:$sdst, (int_amdgcn_s_getpc))]
221 let isTerminator = 1, isBarrier = 1, SchedRW = [WriteBranch] in {
223 let isBranch = 1, isIndirectBranch = 1 in {
224 def S_SETPC_B64 : SOP1_1 <"s_setpc_b64">;
225 } // End isBranch = 1, isIndirectBranch = 1
227 let isReturn = 1 in {
228 // Define variant marked as return rather than branch.
229 def S_SETPC_B64_return : SOP1_1<"", CCR_SGPR_64, [(AMDGPUret_flag i64:$src0)]>;
231 } // End isTerminator = 1, isBarrier = 1
234 def S_SWAPPC_B64 : SOP1_64 <"s_swappc_b64"
238 def S_RFE_B64 : SOP1_1 <"s_rfe_b64">;
240 let hasSideEffects = 1, Uses = [EXEC], Defs = [EXEC, SCC] in {
242 def S_AND_SAVEEXEC_B64 : SOP1_64 <"s_and_saveexec_b64">;
243 def S_OR_SAVEEXEC_B64 : SOP1_64 <"s_or_saveexec_b64">;
244 def S_XOR_SAVEEXEC_B64 : SOP1_64 <"s_xor_saveexec_b64">;
245 def S_ANDN2_SAVEEXEC_B64 : SOP1_64 <"s_andn2_saveexec_b64">;
246 def S_ORN2_SAVEEXEC_B64 : SOP1_64 <"s_orn2_saveexec_b64">;
247 def S_NAND_SAVEEXEC_B64 : SOP1_64 <"s_nand_saveexec_b64">;
248 def S_NOR_SAVEEXEC_B64 : SOP1_64 <"s_nor_saveexec_b64">;
249 def S_XNOR_SAVEEXEC_B64 : SOP1_64 <"s_xnor_saveexec_b64">;
251 } // End hasSideEffects = 1, Uses = [EXEC], Defs = [EXEC, SCC]
253 def S_QUADMASK_B32 : SOP1_32 <"s_quadmask_b32">;
254 def S_QUADMASK_B64 : SOP1_64 <"s_quadmask_b64">;
257 def S_MOVRELS_B32 : SOP1_32 <"s_movrels_b32">;
258 def S_MOVRELS_B64 : SOP1_64 <"s_movrels_b64">;
259 def S_MOVRELD_B32 : SOP1_32 <"s_movreld_b32">;
260 def S_MOVRELD_B64 : SOP1_64 <"s_movreld_b64">;
263 let SubtargetPredicate = isGFX6GFX7GFX8GFX9 in {
264 def S_CBRANCH_JOIN : SOP1_0_32R <"s_cbranch_join">;
265 def S_MOV_REGRD_B32 : SOP1_32 <"s_mov_regrd_b32">;
266 } // End SubtargetPredicate = isGFX6GFX7GFX8GFX9
268 let Defs = [SCC] in {
269 def S_ABS_I32 : SOP1_32 <"s_abs_i32">;
270 } // End Defs = [SCC]
271 def S_MOV_FED_B32 : SOP1_32 <"s_mov_fed_b32">;
273 let SubtargetPredicate = HasVGPRIndexMode in {
274 def S_SET_GPR_IDX_IDX : SOP1_0_32<"s_set_gpr_idx_idx"> {
280 let SubtargetPredicate = isGFX9Plus in {
281 let hasSideEffects = 1, Defs = [EXEC, SCC], Uses = [EXEC] in {
282 def S_ANDN1_SAVEEXEC_B64 : SOP1_64<"s_andn1_saveexec_b64">;
283 def S_ORN1_SAVEEXEC_B64 : SOP1_64<"s_orn1_saveexec_b64">;
284 def S_ANDN1_WREXEC_B64 : SOP1_64<"s_andn1_wrexec_b64">;
285 def S_ANDN2_WREXEC_B64 : SOP1_64<"s_andn2_wrexec_b64">;
286 } // End hasSideEffects = 1, Defs = [EXEC, SCC], Uses = [EXEC]
288 def S_BITREPLICATE_B64_B32 : SOP1_64_32<"s_bitreplicate_b64_b32">;
289 } // End SubtargetPredicate = isGFX9Plus
291 let SubtargetPredicate = isGFX10Plus in {
292 let hasSideEffects = 1, Defs = [EXEC, SCC], Uses = [EXEC] in {
293 def S_AND_SAVEEXEC_B32 : SOP1_32<"s_and_saveexec_b32">;
294 def S_OR_SAVEEXEC_B32 : SOP1_32<"s_or_saveexec_b32">;
295 def S_XOR_SAVEEXEC_B32 : SOP1_32<"s_xor_saveexec_b32">;
296 def S_ANDN2_SAVEEXEC_B32 : SOP1_32<"s_andn2_saveexec_b32">;
297 def S_ORN2_SAVEEXEC_B32 : SOP1_32<"s_orn2_saveexec_b32">;
298 def S_NAND_SAVEEXEC_B32 : SOP1_32<"s_nand_saveexec_b32">;
299 def S_NOR_SAVEEXEC_B32 : SOP1_32<"s_nor_saveexec_b32">;
300 def S_XNOR_SAVEEXEC_B32 : SOP1_32<"s_xnor_saveexec_b32">;
301 def S_ANDN1_SAVEEXEC_B32 : SOP1_32<"s_andn1_saveexec_b32">;
302 def S_ORN1_SAVEEXEC_B32 : SOP1_32<"s_orn1_saveexec_b32">;
303 def S_ANDN1_WREXEC_B32 : SOP1_32<"s_andn1_wrexec_b32">;
304 def S_ANDN2_WREXEC_B32 : SOP1_32<"s_andn2_wrexec_b32">;
305 } // End hasSideEffects = 1, Defs = [EXEC, SCC], Uses = [EXEC]
308 def S_MOVRELSD_2_B32 : SOP1_32<"s_movrelsd_2_b32">;
310 } // End SubtargetPredicate = isGFX10Plus
312 //===----------------------------------------------------------------------===//
314 //===----------------------------------------------------------------------===//
316 class SOP2_Pseudo<string opName, dag outs, dag ins,
317 string asmOps, list<dag> pattern=[]> :
318 SOP_Pseudo<opName, outs, ins, asmOps, pattern> {
322 let hasSideEffects = 0;
325 let SchedRW = [WriteSALU];
326 let UseNamedOperandTable = 1;
330 // Pseudo instructions have no encodings, but adding this field here allows
332 // let sdst = xxx in {
333 // for multiclasses that include both real and pseudo instructions.
334 // field bits<7> sdst = 0;
335 // let Size = 4; // Do we need size here?
338 class SOP2_Real<bits<7> op, SOP_Pseudo ps> :
339 InstSI <ps.OutOperandList, ps.InOperandList,
340 ps.Mnemonic # " " # ps.AsmOperands, []>,
343 let isCodeGenOnly = 0;
345 // copy relevant pseudo op flags
346 let SubtargetPredicate = ps.SubtargetPredicate;
347 let AsmMatchConverter = ps.AsmMatchConverter;
348 let UseNamedOperandTable = ps.UseNamedOperandTable;
349 let TSFlags = ps.TSFlags;
356 let Inst{7-0} = src0;
357 let Inst{15-8} = src1;
358 let Inst{22-16} = !if(ps.has_sdst, sdst, ?);
359 let Inst{29-23} = op;
360 let Inst{31-30} = 0x2; // encoding
364 class SOP2_32 <string opName, list<dag> pattern=[]> : SOP2_Pseudo <
365 opName, (outs SReg_32:$sdst), (ins SSrc_b32:$src0, SSrc_b32:$src1),
366 "$sdst, $src0, $src1", pattern
369 class SOP2_64 <string opName, list<dag> pattern=[]> : SOP2_Pseudo <
370 opName, (outs SReg_64:$sdst), (ins SSrc_b64:$src0, SSrc_b64:$src1),
371 "$sdst, $src0, $src1", pattern
374 class SOP2_64_32 <string opName, list<dag> pattern=[]> : SOP2_Pseudo <
375 opName, (outs SReg_64:$sdst), (ins SSrc_b64:$src0, SSrc_b32:$src1),
376 "$sdst, $src0, $src1", pattern
379 class SOP2_64_32_32 <string opName, list<dag> pattern=[]> : SOP2_Pseudo <
380 opName, (outs SReg_64:$sdst), (ins SSrc_b32:$src0, SSrc_b32:$src1),
381 "$sdst, $src0, $src1", pattern
384 class UniformUnaryFrag<SDPatternOperator Op> : PatFrag <
387 [{ return !N->isDivergent(); }]
390 class UniformBinFrag<SDPatternOperator Op> : PatFrag <
391 (ops node:$src0, node:$src1),
393 [{ return !N->isDivergent(); }]
396 let Defs = [SCC] in { // Carry out goes to SCC
397 let isCommutable = 1 in {
398 def S_ADD_U32 : SOP2_32 <"s_add_u32">;
399 def S_ADD_I32 : SOP2_32 <"s_add_i32",
400 [(set i32:$sdst, (UniformBinFrag<add> SSrc_b32:$src0, SSrc_b32:$src1))]
402 } // End isCommutable = 1
404 def S_SUB_U32 : SOP2_32 <"s_sub_u32">;
405 def S_SUB_I32 : SOP2_32 <"s_sub_i32",
406 [(set i32:$sdst, (UniformBinFrag<sub> SSrc_b32:$src0, SSrc_b32:$src1))]
409 let Uses = [SCC] in { // Carry in comes from SCC
410 let isCommutable = 1 in {
411 def S_ADDC_U32 : SOP2_32 <"s_addc_u32",
412 [(set i32:$sdst, (UniformBinFrag<adde> (i32 SSrc_b32:$src0), (i32 SSrc_b32:$src1)))]>;
413 } // End isCommutable = 1
415 def S_SUBB_U32 : SOP2_32 <"s_subb_u32",
416 [(set i32:$sdst, (UniformBinFrag<sube> (i32 SSrc_b32:$src0), (i32 SSrc_b32:$src1)))]>;
417 } // End Uses = [SCC]
420 let isCommutable = 1 in {
421 def S_MIN_I32 : SOP2_32 <"s_min_i32",
422 [(set i32:$sdst, (smin i32:$src0, i32:$src1))]
424 def S_MIN_U32 : SOP2_32 <"s_min_u32",
425 [(set i32:$sdst, (umin i32:$src0, i32:$src1))]
427 def S_MAX_I32 : SOP2_32 <"s_max_i32",
428 [(set i32:$sdst, (smax i32:$src0, i32:$src1))]
430 def S_MAX_U32 : SOP2_32 <"s_max_u32",
431 [(set i32:$sdst, (umax i32:$src0, i32:$src1))]
433 } // End isCommutable = 1
434 } // End Defs = [SCC]
437 let Uses = [SCC] in {
438 def S_CSELECT_B32 : SOP2_32 <"s_cselect_b32">;
439 def S_CSELECT_B64 : SOP2_64 <"s_cselect_b64">;
440 } // End Uses = [SCC]
442 let Defs = [SCC] in {
443 let isCommutable = 1 in {
444 def S_AND_B32 : SOP2_32 <"s_and_b32",
445 [(set i32:$sdst, (UniformBinFrag<and> i32:$src0, i32:$src1))]
448 def S_AND_B64 : SOP2_64 <"s_and_b64",
449 [(set i64:$sdst, (UniformBinFrag<and> i64:$src0, i64:$src1))]
452 def S_OR_B32 : SOP2_32 <"s_or_b32",
453 [(set i32:$sdst, (UniformBinFrag<or> i32:$src0, i32:$src1))]
456 def S_OR_B64 : SOP2_64 <"s_or_b64",
457 [(set i64:$sdst, (UniformBinFrag<or> i64:$src0, i64:$src1))]
460 def S_XOR_B32 : SOP2_32 <"s_xor_b32",
461 [(set i32:$sdst, (UniformBinFrag<xor> i32:$src0, i32:$src1))]
464 def S_XOR_B64 : SOP2_64 <"s_xor_b64",
465 [(set i64:$sdst, (UniformBinFrag<xor> i64:$src0, i64:$src1))]
468 def S_XNOR_B32 : SOP2_32 <"s_xnor_b32",
469 [(set i32:$sdst, (not (xor_oneuse i32:$src0, i32:$src1)))]
472 def S_XNOR_B64 : SOP2_64 <"s_xnor_b64",
473 [(set i64:$sdst, (not (xor_oneuse i64:$src0, i64:$src1)))]
476 def S_NAND_B32 : SOP2_32 <"s_nand_b32",
477 [(set i32:$sdst, (not (and_oneuse i32:$src0, i32:$src1)))]
480 def S_NAND_B64 : SOP2_64 <"s_nand_b64",
481 [(set i64:$sdst, (not (and_oneuse i64:$src0, i64:$src1)))]
484 def S_NOR_B32 : SOP2_32 <"s_nor_b32",
485 [(set i32:$sdst, (not (or_oneuse i32:$src0, i32:$src1)))]
488 def S_NOR_B64 : SOP2_64 <"s_nor_b64",
489 [(set i64:$sdst, (not (or_oneuse i64:$src0, i64:$src1)))]
491 } // End isCommutable = 1
493 def S_ANDN2_B32 : SOP2_32 <"s_andn2_b32",
494 [(set i32:$sdst, (UniformBinFrag<and> i32:$src0, (UniformUnaryFrag<not> i32:$src1)))]
497 def S_ANDN2_B64 : SOP2_64 <"s_andn2_b64",
498 [(set i64:$sdst, (UniformBinFrag<and> i64:$src0, (UniformUnaryFrag<not> i64:$src1)))]
501 def S_ORN2_B32 : SOP2_32 <"s_orn2_b32",
502 [(set i32:$sdst, (UniformBinFrag<or> i32:$src0, (UniformUnaryFrag<not> i32:$src1)))]
505 def S_ORN2_B64 : SOP2_64 <"s_orn2_b64",
506 [(set i64:$sdst, (UniformBinFrag<or> i64:$src0, (UniformUnaryFrag<not> i64:$src1)))]
508 } // End Defs = [SCC]
510 // Use added complexity so these patterns are preferred to the VALU patterns.
511 let AddedComplexity = 1 in {
513 let Defs = [SCC] in {
514 // TODO: b64 versions require VOP3 change since v_lshlrev_b64 is VOP3
515 def S_LSHL_B32 : SOP2_32 <"s_lshl_b32",
516 [(set SReg_32:$sdst, (shl (i32 SSrc_b32:$src0), (i32 SSrc_b32:$src1)))]
518 def S_LSHL_B64 : SOP2_64_32 <"s_lshl_b64",
519 [(set SReg_64:$sdst, (shl (i64 SSrc_b64:$src0), (i32 SSrc_b32:$src1)))]
521 def S_LSHR_B32 : SOP2_32 <"s_lshr_b32",
522 [(set SReg_32:$sdst, (srl (i32 SSrc_b32:$src0), (i32 SSrc_b32:$src1)))]
524 def S_LSHR_B64 : SOP2_64_32 <"s_lshr_b64",
525 [(set SReg_64:$sdst, (srl (i64 SSrc_b64:$src0), (i32 SSrc_b32:$src1)))]
527 def S_ASHR_I32 : SOP2_32 <"s_ashr_i32",
528 [(set SReg_32:$sdst, (sra (i32 SSrc_b32:$src0), (i32 SSrc_b32:$src1)))]
530 def S_ASHR_I64 : SOP2_64_32 <"s_ashr_i64",
531 [(set SReg_64:$sdst, (sra (i64 SSrc_b64:$src0), (i32 SSrc_b32:$src1)))]
533 } // End Defs = [SCC]
535 def S_BFM_B32 : SOP2_32 <"s_bfm_b32",
536 [(set i32:$sdst, (UniformBinFrag<AMDGPUbfm> i32:$src0, i32:$src1))]>;
537 def S_BFM_B64 : SOP2_64_32_32 <"s_bfm_b64">;
539 // TODO: S_MUL_I32 require V_MUL_LO_I32 from VOP3 change
540 def S_MUL_I32 : SOP2_32 <"s_mul_i32",
541 [(set i32:$sdst, (mul i32:$src0, i32:$src1))]> {
542 let isCommutable = 1;
545 } // End AddedComplexity = 1
547 let Defs = [SCC] in {
548 def S_BFE_U32 : SOP2_32 <"s_bfe_u32">;
549 def S_BFE_I32 : SOP2_32 <"s_bfe_i32">;
550 def S_BFE_U64 : SOP2_64_32 <"s_bfe_u64">;
551 def S_BFE_I64 : SOP2_64_32 <"s_bfe_i64">;
552 } // End Defs = [SCC]
554 def S_CBRANCH_G_FORK : SOP2_Pseudo <
555 "s_cbranch_g_fork", (outs),
556 (ins SCSrc_b64:$src0, SCSrc_b64:$src1),
560 let SubtargetPredicate = isGFX6GFX7GFX8GFX9;
563 let Defs = [SCC] in {
564 def S_ABSDIFF_I32 : SOP2_32 <"s_absdiff_i32">;
565 } // End Defs = [SCC]
567 let SubtargetPredicate = isGFX8GFX9 in {
568 def S_RFE_RESTORE_B64 : SOP2_Pseudo <
569 "s_rfe_restore_b64", (outs),
570 (ins SSrc_b64:$src0, SSrc_b32:$src1),
573 let hasSideEffects = 1;
578 let SubtargetPredicate = isGFX9Plus in {
579 def S_PACK_LL_B32_B16 : SOP2_32<"s_pack_ll_b32_b16">;
580 def S_PACK_LH_B32_B16 : SOP2_32<"s_pack_lh_b32_b16">;
581 def S_PACK_HH_B32_B16 : SOP2_32<"s_pack_hh_b32_b16">;
583 let Defs = [SCC] in {
584 def S_LSHL1_ADD_U32 : SOP2_32<"s_lshl1_add_u32">;
585 def S_LSHL2_ADD_U32 : SOP2_32<"s_lshl2_add_u32">;
586 def S_LSHL3_ADD_U32 : SOP2_32<"s_lshl3_add_u32">;
587 def S_LSHL4_ADD_U32 : SOP2_32<"s_lshl4_add_u32">;
588 } // End Defs = [SCC]
590 def S_MUL_HI_U32 : SOP2_32<"s_mul_hi_u32">;
591 def S_MUL_HI_I32 : SOP2_32<"s_mul_hi_i32">;
592 } // End SubtargetPredicate = isGFX9Plus
594 //===----------------------------------------------------------------------===//
596 //===----------------------------------------------------------------------===//
598 class SOPK_Pseudo <string opName, dag outs, dag ins,
599 string asmOps, list<dag> pattern=[]> :
600 InstSI <outs, ins, "", pattern>,
601 SIMCInstr<opName, SIEncodingFamily.NONE> {
603 let isCodeGenOnly = 1;
606 let hasSideEffects = 0;
609 let SchedRW = [WriteSALU];
610 let UseNamedOperandTable = 1;
611 string Mnemonic = opName;
612 string AsmOperands = asmOps;
614 bits<1> has_sdst = 1;
617 class SOPK_Real<bits<5> op, SOPK_Pseudo ps> :
618 InstSI <ps.OutOperandList, ps.InOperandList,
619 ps.Mnemonic # " " # ps.AsmOperands, []> {
621 let isCodeGenOnly = 0;
623 // copy relevant pseudo op flags
624 let SubtargetPredicate = ps.SubtargetPredicate;
625 let AsmMatchConverter = ps.AsmMatchConverter;
626 let DisableEncoding = ps.DisableEncoding;
627 let Constraints = ps.Constraints;
635 class SOPK_Real32<bits<5> op, SOPK_Pseudo ps> :
638 let Inst{15-0} = simm16;
639 let Inst{22-16} = !if(ps.has_sdst, sdst, ?);
640 let Inst{27-23} = op;
641 let Inst{31-28} = 0xb; //encoding
644 class SOPK_Real64<bits<5> op, SOPK_Pseudo ps> :
647 let Inst{15-0} = simm16;
648 let Inst{22-16} = !if(ps.has_sdst, sdst, ?);
649 let Inst{27-23} = op;
650 let Inst{31-28} = 0xb; //encoding
651 let Inst{63-32} = imm;
654 class SOPKInstTable <bit is_sopk, string cmpOp = ""> {
655 bit IsSOPK = is_sopk;
656 string BaseCmpOp = cmpOp;
659 class SOPK_32 <string opName, list<dag> pattern=[]> : SOPK_Pseudo <
661 (outs SReg_32:$sdst),
662 (ins s16imm:$simm16),
666 class SOPK_32_BR <string opName, list<dag> pattern=[]> : SOPK_Pseudo <
669 (ins sopp_brtarget:$simm16, SReg_32:$sdst),
675 let isTerminator = 1;
676 let SchedRW = [WriteBranch];
679 class SOPK_SCC <string opName, string base_op, bit isSignExt> : SOPK_Pseudo <
683 (ins SReg_32:$sdst, s16imm:$simm16),
684 (ins SReg_32:$sdst, u16imm:$simm16)),
685 "$sdst, $simm16", []>,
686 SOPKInstTable<1, base_op>{
690 class SOPK_32TIE <string opName, list<dag> pattern=[]> : SOPK_Pseudo <
692 (outs SReg_32:$sdst),
693 (ins SReg_32:$src0, s16imm:$simm16),
698 let isReMaterializable = 1, isMoveImm = 1 in {
699 def S_MOVK_I32 : SOPK_32 <"s_movk_i32">;
700 } // End isReMaterializable = 1
701 let Uses = [SCC] in {
702 def S_CMOVK_I32 : SOPK_32 <"s_cmovk_i32">;
705 let isCompare = 1 in {
707 // This instruction is disabled for now until we can figure out how to teach
708 // the instruction selector to correctly use the S_CMP* vs V_CMP*
711 // When this instruction is enabled the code generator sometimes produces this
714 // SCC = S_CMPK_EQ_I32 SGPR0, imm
716 // VGPR0 = V_CNDMASK VCC, VGPR0, VGPR1
718 // def S_CMPK_EQ_I32 : SOPK_SCC <"s_cmpk_eq_i32",
719 // [(set i1:$dst, (setcc i32:$src0, imm:$src1, SETEQ))]
722 def S_CMPK_EQ_I32 : SOPK_SCC <"s_cmpk_eq_i32", "s_cmp_eq_i32", 1>;
723 def S_CMPK_LG_I32 : SOPK_SCC <"s_cmpk_lg_i32", "s_cmp_lg_i32", 1>;
724 def S_CMPK_GT_I32 : SOPK_SCC <"s_cmpk_gt_i32", "s_cmp_gt_i32", 1>;
725 def S_CMPK_GE_I32 : SOPK_SCC <"s_cmpk_ge_i32", "s_cmp_ge_i32", 1>;
726 def S_CMPK_LT_I32 : SOPK_SCC <"s_cmpk_lt_i32", "s_cmp_lt_i32", 1>;
727 def S_CMPK_LE_I32 : SOPK_SCC <"s_cmpk_le_i32", "s_cmp_le_i32", 1>;
729 let SOPKZext = 1 in {
730 def S_CMPK_EQ_U32 : SOPK_SCC <"s_cmpk_eq_u32", "s_cmp_eq_u32", 0>;
731 def S_CMPK_LG_U32 : SOPK_SCC <"s_cmpk_lg_u32", "s_cmp_lg_u32", 0>;
732 def S_CMPK_GT_U32 : SOPK_SCC <"s_cmpk_gt_u32", "s_cmp_gt_u32", 0>;
733 def S_CMPK_GE_U32 : SOPK_SCC <"s_cmpk_ge_u32", "s_cmp_ge_u32", 0>;
734 def S_CMPK_LT_U32 : SOPK_SCC <"s_cmpk_lt_u32", "s_cmp_lt_u32", 0>;
735 def S_CMPK_LE_U32 : SOPK_SCC <"s_cmpk_le_u32", "s_cmp_le_u32", 0>;
736 } // End SOPKZext = 1
737 } // End isCompare = 1
739 let Defs = [SCC], isCommutable = 1, DisableEncoding = "$src0",
740 Constraints = "$sdst = $src0" in {
741 def S_ADDK_I32 : SOPK_32TIE <"s_addk_i32">;
742 def S_MULK_I32 : SOPK_32TIE <"s_mulk_i32">;
745 let SubtargetPredicate = isGFX6GFX7GFX8GFX9 in
746 def S_CBRANCH_I_FORK : SOPK_Pseudo <
748 (outs), (ins SReg_64:$sdst, sopp_brtarget:$simm16),
753 def S_GETREG_B32 : SOPK_Pseudo <
755 (outs SReg_32:$sdst), (ins hwreg:$simm16),
760 let hasSideEffects = 1 in {
762 def S_SETREG_B32 : SOPK_Pseudo <
764 (outs), (ins SReg_32:$sdst, hwreg:$simm16),
766 [(AMDGPUsetreg i32:$sdst, (i16 timm:$simm16))]
770 //def S_GETREG_REGRD_B32 : SOPK_32 <sopk<0x14, 0x13>, "s_getreg_regrd_b32">;
772 def S_SETREG_IMM32_B32 : SOPK_Pseudo <
773 "s_setreg_imm32_b32",
774 (outs), (ins i32imm:$imm, hwreg:$simm16),
776 let Size = 8; // Unlike every other SOPK instruction.
780 } // End hasSideEffects = 1
782 class SOPK_WAITCNT<string opName, list<dag> pat=[]> :
786 (ins SReg_32:$sdst, s16imm:$simm16),
789 let hasSideEffects = 1;
792 let has_sdst = 1; // First source takes place of sdst in encoding
795 let SubtargetPredicate = isGFX9Plus in {
796 def S_CALL_B64 : SOPK_Pseudo<
798 (outs SReg_64:$sdst),
799 (ins sopp_brtarget:$simm16),
803 } // End SubtargetPredicate = isGFX9Plus
805 let SubtargetPredicate = isGFX10Plus in {
806 def S_VERSION : SOPK_Pseudo<
809 (ins s16imm:$simm16),
814 def S_SUBVECTOR_LOOP_BEGIN : SOPK_32_BR<"s_subvector_loop_begin">;
815 def S_SUBVECTOR_LOOP_END : SOPK_32_BR<"s_subvector_loop_end">;
817 def S_WAITCNT_VSCNT : SOPK_WAITCNT<"s_waitcnt_vscnt">;
818 def S_WAITCNT_VMCNT : SOPK_WAITCNT<"s_waitcnt_vmcnt">;
819 def S_WAITCNT_EXPCNT : SOPK_WAITCNT<"s_waitcnt_expcnt">;
820 def S_WAITCNT_LGKMCNT : SOPK_WAITCNT<"s_waitcnt_lgkmcnt">;
821 } // End SubtargetPredicate = isGFX10Plus
823 //===----------------------------------------------------------------------===//
825 //===----------------------------------------------------------------------===//
827 class SOPCe <bits<7> op> : Enc32 {
831 let Inst{7-0} = src0;
832 let Inst{15-8} = src1;
833 let Inst{22-16} = op;
834 let Inst{31-23} = 0x17e;
837 class SOPC <bits<7> op, dag outs, dag ins, string asm,
838 list<dag> pattern = []> :
839 InstSI<outs, ins, asm, pattern>, SOPCe <op> {
842 let hasSideEffects = 0;
845 let isCodeGenOnly = 0;
847 let SchedRW = [WriteSALU];
848 let UseNamedOperandTable = 1;
851 class SOPC_Base <bits<7> op, RegisterOperand rc0, RegisterOperand rc1,
852 string opName, list<dag> pattern = []> : SOPC <
853 op, (outs), (ins rc0:$src0, rc1:$src1),
854 opName#" $src0, $src1", pattern > {
857 class SOPC_Helper <bits<7> op, RegisterOperand rc, ValueType vt,
858 string opName, SDPatternOperator cond> : SOPC_Base <
860 [(set SCC, (si_setcc_uniform vt:$src0, vt:$src1, cond))] > {
863 class SOPC_CMP_32<bits<7> op, string opName,
864 SDPatternOperator cond = COND_NULL, string revOp = opName>
865 : SOPC_Helper<op, SSrc_b32, i32, opName, cond>,
866 Commutable_REV<revOp, !eq(revOp, opName)>,
867 SOPKInstTable<0, opName> {
869 let isCommutable = 1;
872 class SOPC_CMP_64<bits<7> op, string opName,
873 SDPatternOperator cond = COND_NULL, string revOp = opName>
874 : SOPC_Helper<op, SSrc_b64, i64, opName, cond>,
875 Commutable_REV<revOp, !eq(revOp, opName)> {
877 let isCommutable = 1;
880 class SOPC_32<bits<7> op, string opName, list<dag> pattern = []>
881 : SOPC_Base<op, SSrc_b32, SSrc_b32, opName, pattern>;
883 class SOPC_64_32<bits<7> op, string opName, list<dag> pattern = []>
884 : SOPC_Base<op, SSrc_b64, SSrc_b32, opName, pattern>;
886 def S_CMP_EQ_I32 : SOPC_CMP_32 <0x00, "s_cmp_eq_i32">;
887 def S_CMP_LG_I32 : SOPC_CMP_32 <0x01, "s_cmp_lg_i32">;
888 def S_CMP_GT_I32 : SOPC_CMP_32 <0x02, "s_cmp_gt_i32", COND_SGT>;
889 def S_CMP_GE_I32 : SOPC_CMP_32 <0x03, "s_cmp_ge_i32", COND_SGE>;
890 def S_CMP_LT_I32 : SOPC_CMP_32 <0x04, "s_cmp_lt_i32", COND_SLT, "s_cmp_gt_i32">;
891 def S_CMP_LE_I32 : SOPC_CMP_32 <0x05, "s_cmp_le_i32", COND_SLE, "s_cmp_ge_i32">;
892 def S_CMP_EQ_U32 : SOPC_CMP_32 <0x06, "s_cmp_eq_u32", COND_EQ>;
893 def S_CMP_LG_U32 : SOPC_CMP_32 <0x07, "s_cmp_lg_u32", COND_NE>;
894 def S_CMP_GT_U32 : SOPC_CMP_32 <0x08, "s_cmp_gt_u32", COND_UGT>;
895 def S_CMP_GE_U32 : SOPC_CMP_32 <0x09, "s_cmp_ge_u32", COND_UGE>;
896 def S_CMP_LT_U32 : SOPC_CMP_32 <0x0a, "s_cmp_lt_u32", COND_ULT, "s_cmp_gt_u32">;
897 def S_CMP_LE_U32 : SOPC_CMP_32 <0x0b, "s_cmp_le_u32", COND_ULE, "s_cmp_ge_u32">;
899 def S_BITCMP0_B32 : SOPC_32 <0x0c, "s_bitcmp0_b32">;
900 def S_BITCMP1_B32 : SOPC_32 <0x0d, "s_bitcmp1_b32">;
901 def S_BITCMP0_B64 : SOPC_64_32 <0x0e, "s_bitcmp0_b64">;
902 def S_BITCMP1_B64 : SOPC_64_32 <0x0f, "s_bitcmp1_b64">;
903 let SubtargetPredicate = isGFX6GFX7GFX8GFX9 in
904 def S_SETVSKIP : SOPC_32 <0x10, "s_setvskip">;
906 let SubtargetPredicate = isGFX8Plus in {
907 def S_CMP_EQ_U64 : SOPC_CMP_64 <0x12, "s_cmp_eq_u64", COND_EQ>;
908 def S_CMP_LG_U64 : SOPC_CMP_64 <0x13, "s_cmp_lg_u64", COND_NE>;
909 } // End SubtargetPredicate = isGFX8Plus
911 let SubtargetPredicate = HasVGPRIndexMode in {
912 def S_SET_GPR_IDX_ON : SOPC <0x11,
914 (ins SSrc_b32:$src0, GPRIdxMode:$src1),
915 "s_set_gpr_idx_on $src0,$src1"> {
916 let Defs = [M0]; // No scc def
917 let Uses = [M0]; // Other bits of m0 unmodified.
918 let hasSideEffects = 1; // Sets mode.gpr_idx_en
923 //===----------------------------------------------------------------------===//
925 //===----------------------------------------------------------------------===//
927 class Base_SOPP <string asm> {
928 string AsmString = asm;
931 class SOPPe <bits<7> op> : Enc32 {
934 let Inst{15-0} = simm16;
935 let Inst{22-16} = op;
936 let Inst{31-23} = 0x17f; // encoding
939 class SOPP <bits<7> op, dag ins, string asm, list<dag> pattern = []> :
940 InstSI <(outs), ins, asm, pattern >, SOPPe <op>, Base_SOPP <asm> {
944 let hasSideEffects = 0;
948 let SchedRW = [WriteSALU];
950 let UseNamedOperandTable = 1;
953 def S_NOP : SOPP <0x00000000, (ins i16imm:$simm16), "s_nop $simm16">;
955 class SOPP_w_nop_e <bits<7> op> : Enc64 {
958 let Inst{15-0} = simm16;
959 let Inst{22-16} = op;
960 let Inst{31-23} = 0x17f; // encoding
961 let Inst{47-32} = 0x0;
962 let Inst{54-48} = S_NOP.Inst{22-16}; // opcode
963 let Inst{63-55} = S_NOP.Inst{31-23}; // encoding
966 class SOPP_w_nop <bits<7> op, dag ins, string asm, list<dag> pattern = []> :
967 InstSI <(outs), ins, asm, pattern >, SOPP_w_nop_e <op>, Base_SOPP <asm> {
971 let hasSideEffects = 0;
975 let SchedRW = [WriteSALU];
977 let UseNamedOperandTable = 1;
980 multiclass SOPP_With_Relaxation <bits<7> op, dag ins, string asm, list<dag> pattern = []> {
981 def "" : SOPP <op, ins, asm, pattern>;
982 def _pad_s_nop : SOPP_w_nop <op, ins, asm, pattern>;
985 let isTerminator = 1 in {
987 def S_ENDPGM : SOPP <0x00000001, (ins EndpgmImm:$simm16), "s_endpgm$simm16"> {
992 def S_ENDPGM_SAVED : SOPP <0x0000001B, (ins), "s_endpgm_saved"> {
993 let SubtargetPredicate = isGFX8Plus;
999 let SubtargetPredicate = isGFX9Plus in {
1000 let isBarrier = 1, isReturn = 1, simm16 = 0 in {
1001 def S_ENDPGM_ORDERED_PS_DONE :
1002 SOPP<0x01e, (ins), "s_endpgm_ordered_ps_done">;
1003 } // End isBarrier = 1, isReturn = 1, simm16 = 0
1004 } // End SubtargetPredicate = isGFX9Plus
1006 let SubtargetPredicate = isGFX10Plus in {
1007 let isBarrier = 1, isReturn = 1, simm16 = 0 in {
1009 SOPP<0x01f, (ins), "s_code_end">;
1010 } // End isBarrier = 1, isReturn = 1, simm16 = 0
1011 } // End SubtargetPredicate = isGFX10Plus
1013 let isBranch = 1, SchedRW = [WriteBranch] in {
1014 let isBarrier = 1 in {
1015 defm S_BRANCH : SOPP_With_Relaxation <
1016 0x00000002, (ins sopp_brtarget:$simm16), "s_branch $simm16",
1020 let Uses = [SCC] in {
1021 defm S_CBRANCH_SCC0 : SOPP_With_Relaxation <
1022 0x00000004, (ins sopp_brtarget:$simm16),
1023 "s_cbranch_scc0 $simm16"
1025 defm S_CBRANCH_SCC1 : SOPP_With_Relaxation <
1026 0x00000005, (ins sopp_brtarget:$simm16),
1027 "s_cbranch_scc1 $simm16"
1029 } // End Uses = [SCC]
1031 let Uses = [VCC] in {
1032 defm S_CBRANCH_VCCZ : SOPP_With_Relaxation <
1033 0x00000006, (ins sopp_brtarget:$simm16),
1034 "s_cbranch_vccz $simm16"
1036 defm S_CBRANCH_VCCNZ : SOPP_With_Relaxation <
1037 0x00000007, (ins sopp_brtarget:$simm16),
1038 "s_cbranch_vccnz $simm16"
1040 } // End Uses = [VCC]
1042 let Uses = [EXEC] in {
1043 defm S_CBRANCH_EXECZ : SOPP_With_Relaxation <
1044 0x00000008, (ins sopp_brtarget:$simm16),
1045 "s_cbranch_execz $simm16"
1047 defm S_CBRANCH_EXECNZ : SOPP_With_Relaxation <
1048 0x00000009, (ins sopp_brtarget:$simm16),
1049 "s_cbranch_execnz $simm16"
1051 } // End Uses = [EXEC]
1053 defm S_CBRANCH_CDBGSYS : SOPP_With_Relaxation <
1054 0x00000017, (ins sopp_brtarget:$simm16),
1055 "s_cbranch_cdbgsys $simm16"
1058 defm S_CBRANCH_CDBGSYS_AND_USER : SOPP_With_Relaxation <
1059 0x0000001A, (ins sopp_brtarget:$simm16),
1060 "s_cbranch_cdbgsys_and_user $simm16"
1063 defm S_CBRANCH_CDBGSYS_OR_USER : SOPP_With_Relaxation <
1064 0x00000019, (ins sopp_brtarget:$simm16),
1065 "s_cbranch_cdbgsys_or_user $simm16"
1068 defm S_CBRANCH_CDBGUSER : SOPP_With_Relaxation <
1069 0x00000018, (ins sopp_brtarget:$simm16),
1070 "s_cbranch_cdbguser $simm16"
1073 } // End isBranch = 1
1074 } // End isTerminator = 1
1076 let hasSideEffects = 1 in {
1077 def S_BARRIER : SOPP <0x0000000a, (ins), "s_barrier",
1078 [(int_amdgcn_s_barrier)]> {
1079 let SchedRW = [WriteBarrier];
1081 let isConvergent = 1;
1084 def S_WAKEUP : SOPP <0x00000003, (ins), "s_wakeup"> {
1085 let SubtargetPredicate = isGFX8Plus;
1091 let mayLoad = 1, mayStore = 1, hasSideEffects = 1 in
1092 def S_WAITCNT : SOPP <0x0000000c, (ins WAIT_FLAG:$simm16), "s_waitcnt $simm16",
1093 [(int_amdgcn_s_waitcnt timm:$simm16)]>;
1094 def S_SETHALT : SOPP <0x0000000d, (ins i16imm:$simm16), "s_sethalt $simm16">;
1095 def S_SETKILL : SOPP <0x0000000b, (ins i16imm:$simm16), "s_setkill $simm16">;
1097 // On SI the documentation says sleep for approximately 64 * low 2
1098 // bits, consistent with the reported maximum of 448. On VI the
1099 // maximum reported is 960 cycles, so 960 / 64 = 15 max, so is the
1100 // maximum really 15 on VI?
1101 def S_SLEEP : SOPP <0x0000000e, (ins i32imm:$simm16),
1102 "s_sleep $simm16", [(int_amdgcn_s_sleep timm:$simm16)]> {
1103 let hasSideEffects = 1;
1108 def S_SETPRIO : SOPP <0x0000000f, (ins i16imm:$simm16), "s_setprio $simm16">;
1110 let Uses = [EXEC, M0] in {
1111 // FIXME: Should this be mayLoad+mayStore?
1112 def S_SENDMSG : SOPP <0x00000010, (ins SendMsgImm:$simm16), "s_sendmsg $simm16",
1113 [(int_amdgcn_s_sendmsg (i32 timm:$simm16), M0)]>;
1115 def S_SENDMSGHALT : SOPP <0x00000011, (ins SendMsgImm:$simm16), "s_sendmsghalt $simm16",
1116 [(int_amdgcn_s_sendmsghalt (i32 timm:$simm16), M0)]>;
1118 } // End Uses = [EXEC, M0]
1120 def S_TRAP : SOPP <0x00000012, (ins i16imm:$simm16), "s_trap $simm16"> {
1124 def S_ICACHE_INV : SOPP <0x00000013, (ins), "s_icache_inv"> {
1127 def S_INCPERFLEVEL : SOPP <0x00000014, (ins i32imm:$simm16), "s_incperflevel $simm16",
1128 [(int_amdgcn_s_incperflevel timm:$simm16)]> {
1129 let hasSideEffects = 1;
1133 def S_DECPERFLEVEL : SOPP <0x00000015, (ins i32imm:$simm16), "s_decperflevel $simm16",
1134 [(int_amdgcn_s_decperflevel timm:$simm16)]> {
1135 let hasSideEffects = 1;
1139 def S_TTRACEDATA : SOPP <0x00000016, (ins), "s_ttracedata"> {
1143 let SubtargetPredicate = HasVGPRIndexMode in {
1144 def S_SET_GPR_IDX_OFF : SOPP<0x1c, (ins), "s_set_gpr_idx_off"> {
1148 } // End hasSideEffects
1150 let SubtargetPredicate = HasVGPRIndexMode in {
1151 def S_SET_GPR_IDX_MODE : SOPP<0x1d, (ins GPRIdxMode:$simm16),
1152 "s_set_gpr_idx_mode$simm16"> {
1157 let SubtargetPredicate = isGFX10Plus in {
1158 def S_INST_PREFETCH :
1159 SOPP<0x020, (ins s16imm:$simm16), "s_inst_prefetch $simm16">;
1161 SOPP<0x021, (ins s16imm:$simm16), "s_clause $simm16">;
1162 def S_WAITCNT_IDLE :
1163 SOPP <0x022, (ins), "s_wait_idle"> {
1166 def S_WAITCNT_DEPCTR :
1167 SOPP <0x023, (ins s16imm:$simm16), "s_waitcnt_depctr $simm16">;
1169 SOPP<0x024, (ins s16imm:$simm16), "s_round_mode $simm16">;
1171 SOPP<0x025, (ins i32imm:$simm16), "s_denorm_mode $simm16",
1172 [(SIdenorm_mode (i32 timm:$simm16))]> {
1173 let hasSideEffects = 1;
1175 def S_TTRACEDATA_IMM :
1176 SOPP<0x028, (ins s16imm:$simm16), "s_ttracedata_imm $simm16">;
1177 } // End SubtargetPredicate = isGFX10Plus
1179 //===----------------------------------------------------------------------===//
1180 // S_GETREG_B32 Intrinsic Pattern.
1181 //===----------------------------------------------------------------------===//
1183 (int_amdgcn_s_getreg timm:$simm16),
1184 (S_GETREG_B32 (as_i16imm $simm16))
1187 //===----------------------------------------------------------------------===//
1189 //===----------------------------------------------------------------------===//
1197 (i64 (ctpop i64:$src)),
1198 (i64 (REG_SEQUENCE SReg_64,
1199 (i32 (COPY_TO_REGCLASS (S_BCNT1_I32_B64 $src), SReg_32)), sub0,
1200 (S_MOV_B32 (i32 0)), sub1))
1204 (i32 (smax i32:$x, (i32 (ineg i32:$x)))),
1210 (S_MOV_B32 imm:$imm)
1213 // Same as a 32-bit inreg
1215 (i32 (sext i16:$src)),
1216 (S_SEXT_I32_I16 $src)
1220 //===----------------------------------------------------------------------===//
1222 //===----------------------------------------------------------------------===//
1224 // V_ADD_I32_e32/S_ADD_U32 produces carry in VCC/SCC. For the vector
1225 // case, the sgpr-copies pass will fix this to use the vector version.
1227 (i32 (addc i32:$src0, i32:$src1)),
1228 (S_ADD_U32 $src0, $src1)
1231 // FIXME: We need to use COPY_TO_REGCLASS to work-around the fact that
1232 // REG_SEQUENCE patterns don't support instructions with multiple
1235 (i64 (zext i16:$src)),
1236 (REG_SEQUENCE SReg_64,
1237 (i32 (COPY_TO_REGCLASS (S_AND_B32 $src, (S_MOV_B32 (i32 0xffff))), SGPR_32)), sub0,
1238 (S_MOV_B32 (i32 0)), sub1)
1242 (i64 (sext i16:$src)),
1243 (REG_SEQUENCE SReg_64, (i32 (S_SEXT_I32_I16 $src)), sub0,
1244 (i32 (COPY_TO_REGCLASS (S_ASHR_I32 (i32 (S_SEXT_I32_I16 $src)), (S_MOV_B32 (i32 31))), SGPR_32)), sub1)
1248 (i32 (zext i16:$src)),
1249 (S_AND_B32 (S_MOV_B32 (i32 0xffff)), $src)
1253 //===----------------------------------------------------------------------===//
1254 // Target-specific instruction encodings.
1255 //===----------------------------------------------------------------------===//
1257 //===----------------------------------------------------------------------===//
1259 //===----------------------------------------------------------------------===//
1261 class Select_gfx10<string opName> : SIMCInstr<opName, SIEncodingFamily.GFX10> {
1262 Predicate AssemblerPredicate = isGFX10Plus;
1263 string DecoderNamespace = "GFX10";
1266 multiclass SOP1_Real_gfx10<bits<8> op> {
1267 def _gfx10 : SOP1_Real<op, !cast<SOP1_Pseudo>(NAME)>,
1268 Select_gfx10<!cast<SOP1_Pseudo>(NAME).Mnemonic>;
1271 defm S_ANDN1_SAVEEXEC_B64 : SOP1_Real_gfx10<0x037>;
1272 defm S_ORN1_SAVEEXEC_B64 : SOP1_Real_gfx10<0x038>;
1273 defm S_ANDN1_WREXEC_B64 : SOP1_Real_gfx10<0x039>;
1274 defm S_ANDN2_WREXEC_B64 : SOP1_Real_gfx10<0x03a>;
1275 defm S_BITREPLICATE_B64_B32 : SOP1_Real_gfx10<0x03b>;
1276 defm S_AND_SAVEEXEC_B32 : SOP1_Real_gfx10<0x03c>;
1277 defm S_OR_SAVEEXEC_B32 : SOP1_Real_gfx10<0x03d>;
1278 defm S_XOR_SAVEEXEC_B32 : SOP1_Real_gfx10<0x03e>;
1279 defm S_ANDN2_SAVEEXEC_B32 : SOP1_Real_gfx10<0x03f>;
1280 defm S_ORN2_SAVEEXEC_B32 : SOP1_Real_gfx10<0x040>;
1281 defm S_NAND_SAVEEXEC_B32 : SOP1_Real_gfx10<0x041>;
1282 defm S_NOR_SAVEEXEC_B32 : SOP1_Real_gfx10<0x042>;
1283 defm S_XNOR_SAVEEXEC_B32 : SOP1_Real_gfx10<0x043>;
1284 defm S_ANDN1_SAVEEXEC_B32 : SOP1_Real_gfx10<0x044>;
1285 defm S_ORN1_SAVEEXEC_B32 : SOP1_Real_gfx10<0x045>;
1286 defm S_ANDN1_WREXEC_B32 : SOP1_Real_gfx10<0x046>;
1287 defm S_ANDN2_WREXEC_B32 : SOP1_Real_gfx10<0x047>;
1288 defm S_MOVRELSD_2_B32 : SOP1_Real_gfx10<0x049>;
1290 //===----------------------------------------------------------------------===//
1291 // SOP1 - GFX6, GFX7.
1292 //===----------------------------------------------------------------------===//
1294 class Select_gfx6_gfx7<string opName> : SIMCInstr<opName, SIEncodingFamily.SI> {
1295 Predicate AssemblerPredicate = isGFX6GFX7;
1296 string DecoderNamespace = "GFX6GFX7";
1299 multiclass SOP1_Real_gfx6_gfx7<bits<8> op> {
1300 def _gfx6_gfx7 : SOP1_Real<op, !cast<SOP1_Pseudo>(NAME)>,
1301 Select_gfx6_gfx7<!cast<SOP1_Pseudo>(NAME).Mnemonic>;
1304 multiclass SOP1_Real_gfx6_gfx7_gfx10<bits<8> op> :
1305 SOP1_Real_gfx6_gfx7<op>, SOP1_Real_gfx10<op>;
1307 defm S_CBRANCH_JOIN : SOP1_Real_gfx6_gfx7<0x032>;
1308 defm S_MOV_REGRD_B32 : SOP1_Real_gfx6_gfx7<0x033>;
1310 defm S_MOV_B32 : SOP1_Real_gfx6_gfx7_gfx10<0x003>;
1311 defm S_MOV_B64 : SOP1_Real_gfx6_gfx7_gfx10<0x004>;
1312 defm S_CMOV_B32 : SOP1_Real_gfx6_gfx7_gfx10<0x005>;
1313 defm S_CMOV_B64 : SOP1_Real_gfx6_gfx7_gfx10<0x006>;
1314 defm S_NOT_B32 : SOP1_Real_gfx6_gfx7_gfx10<0x007>;
1315 defm S_NOT_B64 : SOP1_Real_gfx6_gfx7_gfx10<0x008>;
1316 defm S_WQM_B32 : SOP1_Real_gfx6_gfx7_gfx10<0x009>;
1317 defm S_WQM_B64 : SOP1_Real_gfx6_gfx7_gfx10<0x00a>;
1318 defm S_BREV_B32 : SOP1_Real_gfx6_gfx7_gfx10<0x00b>;
1319 defm S_BREV_B64 : SOP1_Real_gfx6_gfx7_gfx10<0x00c>;
1320 defm S_BCNT0_I32_B32 : SOP1_Real_gfx6_gfx7_gfx10<0x00d>;
1321 defm S_BCNT0_I32_B64 : SOP1_Real_gfx6_gfx7_gfx10<0x00e>;
1322 defm S_BCNT1_I32_B32 : SOP1_Real_gfx6_gfx7_gfx10<0x00f>;
1323 defm S_BCNT1_I32_B64 : SOP1_Real_gfx6_gfx7_gfx10<0x010>;
1324 defm S_FF0_I32_B32 : SOP1_Real_gfx6_gfx7_gfx10<0x011>;
1325 defm S_FF0_I32_B64 : SOP1_Real_gfx6_gfx7_gfx10<0x012>;
1326 defm S_FF1_I32_B32 : SOP1_Real_gfx6_gfx7_gfx10<0x013>;
1327 defm S_FF1_I32_B64 : SOP1_Real_gfx6_gfx7_gfx10<0x014>;
1328 defm S_FLBIT_I32_B32 : SOP1_Real_gfx6_gfx7_gfx10<0x015>;
1329 defm S_FLBIT_I32_B64 : SOP1_Real_gfx6_gfx7_gfx10<0x016>;
1330 defm S_FLBIT_I32 : SOP1_Real_gfx6_gfx7_gfx10<0x017>;
1331 defm S_FLBIT_I32_I64 : SOP1_Real_gfx6_gfx7_gfx10<0x018>;
1332 defm S_SEXT_I32_I8 : SOP1_Real_gfx6_gfx7_gfx10<0x019>;
1333 defm S_SEXT_I32_I16 : SOP1_Real_gfx6_gfx7_gfx10<0x01a>;
1334 defm S_BITSET0_B32 : SOP1_Real_gfx6_gfx7_gfx10<0x01b>;
1335 defm S_BITSET0_B64 : SOP1_Real_gfx6_gfx7_gfx10<0x01c>;
1336 defm S_BITSET1_B32 : SOP1_Real_gfx6_gfx7_gfx10<0x01d>;
1337 defm S_BITSET1_B64 : SOP1_Real_gfx6_gfx7_gfx10<0x01e>;
1338 defm S_GETPC_B64 : SOP1_Real_gfx6_gfx7_gfx10<0x01f>;
1339 defm S_SETPC_B64 : SOP1_Real_gfx6_gfx7_gfx10<0x020>;
1340 defm S_SWAPPC_B64 : SOP1_Real_gfx6_gfx7_gfx10<0x021>;
1341 defm S_RFE_B64 : SOP1_Real_gfx6_gfx7_gfx10<0x022>;
1342 defm S_AND_SAVEEXEC_B64 : SOP1_Real_gfx6_gfx7_gfx10<0x024>;
1343 defm S_OR_SAVEEXEC_B64 : SOP1_Real_gfx6_gfx7_gfx10<0x025>;
1344 defm S_XOR_SAVEEXEC_B64 : SOP1_Real_gfx6_gfx7_gfx10<0x026>;
1345 defm S_ANDN2_SAVEEXEC_B64 : SOP1_Real_gfx6_gfx7_gfx10<0x027>;
1346 defm S_ORN2_SAVEEXEC_B64 : SOP1_Real_gfx6_gfx7_gfx10<0x028>;
1347 defm S_NAND_SAVEEXEC_B64 : SOP1_Real_gfx6_gfx7_gfx10<0x029>;
1348 defm S_NOR_SAVEEXEC_B64 : SOP1_Real_gfx6_gfx7_gfx10<0x02a>;
1349 defm S_XNOR_SAVEEXEC_B64 : SOP1_Real_gfx6_gfx7_gfx10<0x02b>;
1350 defm S_QUADMASK_B32 : SOP1_Real_gfx6_gfx7_gfx10<0x02c>;
1351 defm S_QUADMASK_B64 : SOP1_Real_gfx6_gfx7_gfx10<0x02d>;
1352 defm S_MOVRELS_B32 : SOP1_Real_gfx6_gfx7_gfx10<0x02e>;
1353 defm S_MOVRELS_B64 : SOP1_Real_gfx6_gfx7_gfx10<0x02f>;
1354 defm S_MOVRELD_B32 : SOP1_Real_gfx6_gfx7_gfx10<0x030>;
1355 defm S_MOVRELD_B64 : SOP1_Real_gfx6_gfx7_gfx10<0x031>;
1356 defm S_ABS_I32 : SOP1_Real_gfx6_gfx7_gfx10<0x034>;
1357 defm S_MOV_FED_B32 : SOP1_Real_gfx6_gfx7_gfx10<0x035>;
1359 //===----------------------------------------------------------------------===//
1361 //===----------------------------------------------------------------------===//
1363 multiclass SOP2_Real_gfx10<bits<7> op> {
1364 def _gfx10 : SOP2_Real<op, !cast<SOP2_Pseudo>(NAME)>,
1365 Select_gfx10<!cast<SOP2_Pseudo>(NAME).Mnemonic>;
1368 defm S_LSHL1_ADD_U32 : SOP2_Real_gfx10<0x02e>;
1369 defm S_LSHL2_ADD_U32 : SOP2_Real_gfx10<0x02f>;
1370 defm S_LSHL3_ADD_U32 : SOP2_Real_gfx10<0x030>;
1371 defm S_LSHL4_ADD_U32 : SOP2_Real_gfx10<0x031>;
1372 defm S_PACK_LL_B32_B16 : SOP2_Real_gfx10<0x032>;
1373 defm S_PACK_LH_B32_B16 : SOP2_Real_gfx10<0x033>;
1374 defm S_PACK_HH_B32_B16 : SOP2_Real_gfx10<0x034>;
1375 defm S_MUL_HI_U32 : SOP2_Real_gfx10<0x035>;
1376 defm S_MUL_HI_I32 : SOP2_Real_gfx10<0x036>;
1378 //===----------------------------------------------------------------------===//
1379 // SOP2 - GFX6, GFX7.
1380 //===----------------------------------------------------------------------===//
1382 multiclass SOP2_Real_gfx6_gfx7<bits<7> op> {
1383 def _gfx6_gfx7 : SOP2_Real<op, !cast<SOP_Pseudo>(NAME)>,
1384 Select_gfx6_gfx7<!cast<SOP_Pseudo>(NAME).Mnemonic>;
1387 multiclass SOP2_Real_gfx6_gfx7_gfx10<bits<7> op> :
1388 SOP2_Real_gfx6_gfx7<op>, SOP2_Real_gfx10<op>;
1390 defm S_CBRANCH_G_FORK : SOP2_Real_gfx6_gfx7<0x02b>;
1392 defm S_ADD_U32 : SOP2_Real_gfx6_gfx7_gfx10<0x000>;
1393 defm S_SUB_U32 : SOP2_Real_gfx6_gfx7_gfx10<0x001>;
1394 defm S_ADD_I32 : SOP2_Real_gfx6_gfx7_gfx10<0x002>;
1395 defm S_SUB_I32 : SOP2_Real_gfx6_gfx7_gfx10<0x003>;
1396 defm S_ADDC_U32 : SOP2_Real_gfx6_gfx7_gfx10<0x004>;
1397 defm S_SUBB_U32 : SOP2_Real_gfx6_gfx7_gfx10<0x005>;
1398 defm S_MIN_I32 : SOP2_Real_gfx6_gfx7_gfx10<0x006>;
1399 defm S_MIN_U32 : SOP2_Real_gfx6_gfx7_gfx10<0x007>;
1400 defm S_MAX_I32 : SOP2_Real_gfx6_gfx7_gfx10<0x008>;
1401 defm S_MAX_U32 : SOP2_Real_gfx6_gfx7_gfx10<0x009>;
1402 defm S_CSELECT_B32 : SOP2_Real_gfx6_gfx7_gfx10<0x00a>;
1403 defm S_CSELECT_B64 : SOP2_Real_gfx6_gfx7_gfx10<0x00b>;
1404 defm S_AND_B32 : SOP2_Real_gfx6_gfx7_gfx10<0x00e>;
1405 defm S_AND_B64 : SOP2_Real_gfx6_gfx7_gfx10<0x00f>;
1406 defm S_OR_B32 : SOP2_Real_gfx6_gfx7_gfx10<0x010>;
1407 defm S_OR_B64 : SOP2_Real_gfx6_gfx7_gfx10<0x011>;
1408 defm S_XOR_B32 : SOP2_Real_gfx6_gfx7_gfx10<0x012>;
1409 defm S_XOR_B64 : SOP2_Real_gfx6_gfx7_gfx10<0x013>;
1410 defm S_ANDN2_B32 : SOP2_Real_gfx6_gfx7_gfx10<0x014>;
1411 defm S_ANDN2_B64 : SOP2_Real_gfx6_gfx7_gfx10<0x015>;
1412 defm S_ORN2_B32 : SOP2_Real_gfx6_gfx7_gfx10<0x016>;
1413 defm S_ORN2_B64 : SOP2_Real_gfx6_gfx7_gfx10<0x017>;
1414 defm S_NAND_B32 : SOP2_Real_gfx6_gfx7_gfx10<0x018>;
1415 defm S_NAND_B64 : SOP2_Real_gfx6_gfx7_gfx10<0x019>;
1416 defm S_NOR_B32 : SOP2_Real_gfx6_gfx7_gfx10<0x01a>;
1417 defm S_NOR_B64 : SOP2_Real_gfx6_gfx7_gfx10<0x01b>;
1418 defm S_XNOR_B32 : SOP2_Real_gfx6_gfx7_gfx10<0x01c>;
1419 defm S_XNOR_B64 : SOP2_Real_gfx6_gfx7_gfx10<0x01d>;
1420 defm S_LSHL_B32 : SOP2_Real_gfx6_gfx7_gfx10<0x01e>;
1421 defm S_LSHL_B64 : SOP2_Real_gfx6_gfx7_gfx10<0x01f>;
1422 defm S_LSHR_B32 : SOP2_Real_gfx6_gfx7_gfx10<0x020>;
1423 defm S_LSHR_B64 : SOP2_Real_gfx6_gfx7_gfx10<0x021>;
1424 defm S_ASHR_I32 : SOP2_Real_gfx6_gfx7_gfx10<0x022>;
1425 defm S_ASHR_I64 : SOP2_Real_gfx6_gfx7_gfx10<0x023>;
1426 defm S_BFM_B32 : SOP2_Real_gfx6_gfx7_gfx10<0x024>;
1427 defm S_BFM_B64 : SOP2_Real_gfx6_gfx7_gfx10<0x025>;
1428 defm S_MUL_I32 : SOP2_Real_gfx6_gfx7_gfx10<0x026>;
1429 defm S_BFE_U32 : SOP2_Real_gfx6_gfx7_gfx10<0x027>;
1430 defm S_BFE_I32 : SOP2_Real_gfx6_gfx7_gfx10<0x028>;
1431 defm S_BFE_U64 : SOP2_Real_gfx6_gfx7_gfx10<0x029>;
1432 defm S_BFE_I64 : SOP2_Real_gfx6_gfx7_gfx10<0x02a>;
1433 defm S_ABSDIFF_I32 : SOP2_Real_gfx6_gfx7_gfx10<0x02c>;
1435 //===----------------------------------------------------------------------===//
1437 //===----------------------------------------------------------------------===//
1439 multiclass SOPK_Real32_gfx10<bits<5> op> {
1440 def _gfx10 : SOPK_Real32<op, !cast<SOPK_Pseudo>(NAME)>,
1441 Select_gfx10<!cast<SOPK_Pseudo>(NAME).Mnemonic>;
1444 multiclass SOPK_Real64_gfx10<bits<5> op> {
1445 def _gfx10 : SOPK_Real64<op, !cast<SOPK_Pseudo>(NAME)>,
1446 Select_gfx10<!cast<SOPK_Pseudo>(NAME).Mnemonic>;
1449 defm S_VERSION : SOPK_Real32_gfx10<0x001>;
1450 defm S_CALL_B64 : SOPK_Real32_gfx10<0x016>;
1451 defm S_WAITCNT_VSCNT : SOPK_Real32_gfx10<0x017>;
1452 defm S_WAITCNT_VMCNT : SOPK_Real32_gfx10<0x018>;
1453 defm S_WAITCNT_EXPCNT : SOPK_Real32_gfx10<0x019>;
1454 defm S_WAITCNT_LGKMCNT : SOPK_Real32_gfx10<0x01a>;
1455 defm S_SUBVECTOR_LOOP_BEGIN : SOPK_Real32_gfx10<0x01b>;
1456 defm S_SUBVECTOR_LOOP_END : SOPK_Real32_gfx10<0x01c>;
1458 //===----------------------------------------------------------------------===//
1459 // SOPK - GFX6, GFX7.
1460 //===----------------------------------------------------------------------===//
1462 multiclass SOPK_Real32_gfx6_gfx7<bits<5> op> {
1463 def _gfx6_gfx7 : SOPK_Real32<op, !cast<SOPK_Pseudo>(NAME)>,
1464 Select_gfx6_gfx7<!cast<SOPK_Pseudo>(NAME).Mnemonic>;
1467 multiclass SOPK_Real64_gfx6_gfx7<bits<5> op> {
1468 def _gfx6_gfx7 : SOPK_Real64<op, !cast<SOPK_Pseudo>(NAME)>,
1469 Select_gfx6_gfx7<!cast<SOPK_Pseudo>(NAME).Mnemonic>;
1472 multiclass SOPK_Real32_gfx6_gfx7_gfx10<bits<5> op> :
1473 SOPK_Real32_gfx6_gfx7<op>, SOPK_Real32_gfx10<op>;
1475 multiclass SOPK_Real64_gfx6_gfx7_gfx10<bits<5> op> :
1476 SOPK_Real64_gfx6_gfx7<op>, SOPK_Real64_gfx10<op>;
1478 defm S_CBRANCH_I_FORK : SOPK_Real32_gfx6_gfx7<0x011>;
1480 defm S_MOVK_I32 : SOPK_Real32_gfx6_gfx7_gfx10<0x000>;
1481 defm S_CMOVK_I32 : SOPK_Real32_gfx6_gfx7_gfx10<0x002>;
1482 defm S_CMPK_EQ_I32 : SOPK_Real32_gfx6_gfx7_gfx10<0x003>;
1483 defm S_CMPK_LG_I32 : SOPK_Real32_gfx6_gfx7_gfx10<0x004>;
1484 defm S_CMPK_GT_I32 : SOPK_Real32_gfx6_gfx7_gfx10<0x005>;
1485 defm S_CMPK_GE_I32 : SOPK_Real32_gfx6_gfx7_gfx10<0x006>;
1486 defm S_CMPK_LT_I32 : SOPK_Real32_gfx6_gfx7_gfx10<0x007>;
1487 defm S_CMPK_LE_I32 : SOPK_Real32_gfx6_gfx7_gfx10<0x008>;
1488 defm S_CMPK_EQ_U32 : SOPK_Real32_gfx6_gfx7_gfx10<0x009>;
1489 defm S_CMPK_LG_U32 : SOPK_Real32_gfx6_gfx7_gfx10<0x00a>;
1490 defm S_CMPK_GT_U32 : SOPK_Real32_gfx6_gfx7_gfx10<0x00b>;
1491 defm S_CMPK_GE_U32 : SOPK_Real32_gfx6_gfx7_gfx10<0x00c>;
1492 defm S_CMPK_LT_U32 : SOPK_Real32_gfx6_gfx7_gfx10<0x00d>;
1493 defm S_CMPK_LE_U32 : SOPK_Real32_gfx6_gfx7_gfx10<0x00e>;
1494 defm S_ADDK_I32 : SOPK_Real32_gfx6_gfx7_gfx10<0x00f>;
1495 defm S_MULK_I32 : SOPK_Real32_gfx6_gfx7_gfx10<0x010>;
1496 defm S_GETREG_B32 : SOPK_Real32_gfx6_gfx7_gfx10<0x012>;
1497 defm S_SETREG_B32 : SOPK_Real32_gfx6_gfx7_gfx10<0x013>;
1498 defm S_SETREG_IMM32_B32 : SOPK_Real64_gfx6_gfx7_gfx10<0x015>;
1500 //===----------------------------------------------------------------------===//
1502 //===----------------------------------------------------------------------===//
1504 class Select_vi<string opName> :
1505 SIMCInstr<opName, SIEncodingFamily.VI> {
1506 list<Predicate> AssemblerPredicates = [isGFX8GFX9];
1507 string DecoderNamespace = "GFX8";
1510 class SOP1_Real_vi<bits<8> op, SOP1_Pseudo ps> :
1512 Select_vi<ps.Mnemonic>;
1515 class SOP2_Real_vi<bits<7> op, SOP2_Pseudo ps> :
1517 Select_vi<ps.Mnemonic>;
1519 class SOPK_Real_vi<bits<5> op, SOPK_Pseudo ps> :
1520 SOPK_Real32<op, ps>,
1521 Select_vi<ps.Mnemonic>;
1523 def S_MOV_B32_vi : SOP1_Real_vi <0x00, S_MOV_B32>;
1524 def S_MOV_B64_vi : SOP1_Real_vi <0x01, S_MOV_B64>;
1525 def S_CMOV_B32_vi : SOP1_Real_vi <0x02, S_CMOV_B32>;
1526 def S_CMOV_B64_vi : SOP1_Real_vi <0x03, S_CMOV_B64>;
1527 def S_NOT_B32_vi : SOP1_Real_vi <0x04, S_NOT_B32>;
1528 def S_NOT_B64_vi : SOP1_Real_vi <0x05, S_NOT_B64>;
1529 def S_WQM_B32_vi : SOP1_Real_vi <0x06, S_WQM_B32>;
1530 def S_WQM_B64_vi : SOP1_Real_vi <0x07, S_WQM_B64>;
1531 def S_BREV_B32_vi : SOP1_Real_vi <0x08, S_BREV_B32>;
1532 def S_BREV_B64_vi : SOP1_Real_vi <0x09, S_BREV_B64>;
1533 def S_BCNT0_I32_B32_vi : SOP1_Real_vi <0x0a, S_BCNT0_I32_B32>;
1534 def S_BCNT0_I32_B64_vi : SOP1_Real_vi <0x0b, S_BCNT0_I32_B64>;
1535 def S_BCNT1_I32_B32_vi : SOP1_Real_vi <0x0c, S_BCNT1_I32_B32>;
1536 def S_BCNT1_I32_B64_vi : SOP1_Real_vi <0x0d, S_BCNT1_I32_B64>;
1537 def S_FF0_I32_B32_vi : SOP1_Real_vi <0x0e, S_FF0_I32_B32>;
1538 def S_FF0_I32_B64_vi : SOP1_Real_vi <0x0f, S_FF0_I32_B64>;
1539 def S_FF1_I32_B32_vi : SOP1_Real_vi <0x10, S_FF1_I32_B32>;
1540 def S_FF1_I32_B64_vi : SOP1_Real_vi <0x11, S_FF1_I32_B64>;
1541 def S_FLBIT_I32_B32_vi : SOP1_Real_vi <0x12, S_FLBIT_I32_B32>;
1542 def S_FLBIT_I32_B64_vi : SOP1_Real_vi <0x13, S_FLBIT_I32_B64>;
1543 def S_FLBIT_I32_vi : SOP1_Real_vi <0x14, S_FLBIT_I32>;
1544 def S_FLBIT_I32_I64_vi : SOP1_Real_vi <0x15, S_FLBIT_I32_I64>;
1545 def S_SEXT_I32_I8_vi : SOP1_Real_vi <0x16, S_SEXT_I32_I8>;
1546 def S_SEXT_I32_I16_vi : SOP1_Real_vi <0x17, S_SEXT_I32_I16>;
1547 def S_BITSET0_B32_vi : SOP1_Real_vi <0x18, S_BITSET0_B32>;
1548 def S_BITSET0_B64_vi : SOP1_Real_vi <0x19, S_BITSET0_B64>;
1549 def S_BITSET1_B32_vi : SOP1_Real_vi <0x1a, S_BITSET1_B32>;
1550 def S_BITSET1_B64_vi : SOP1_Real_vi <0x1b, S_BITSET1_B64>;
1551 def S_GETPC_B64_vi : SOP1_Real_vi <0x1c, S_GETPC_B64>;
1552 def S_SETPC_B64_vi : SOP1_Real_vi <0x1d, S_SETPC_B64>;
1553 def S_SWAPPC_B64_vi : SOP1_Real_vi <0x1e, S_SWAPPC_B64>;
1554 def S_RFE_B64_vi : SOP1_Real_vi <0x1f, S_RFE_B64>;
1555 def S_AND_SAVEEXEC_B64_vi : SOP1_Real_vi <0x20, S_AND_SAVEEXEC_B64>;
1556 def S_OR_SAVEEXEC_B64_vi : SOP1_Real_vi <0x21, S_OR_SAVEEXEC_B64>;
1557 def S_XOR_SAVEEXEC_B64_vi : SOP1_Real_vi <0x22, S_XOR_SAVEEXEC_B64>;
1558 def S_ANDN2_SAVEEXEC_B64_vi: SOP1_Real_vi <0x23, S_ANDN2_SAVEEXEC_B64>;
1559 def S_ORN2_SAVEEXEC_B64_vi : SOP1_Real_vi <0x24, S_ORN2_SAVEEXEC_B64>;
1560 def S_NAND_SAVEEXEC_B64_vi : SOP1_Real_vi <0x25, S_NAND_SAVEEXEC_B64>;
1561 def S_NOR_SAVEEXEC_B64_vi : SOP1_Real_vi <0x26, S_NOR_SAVEEXEC_B64>;
1562 def S_XNOR_SAVEEXEC_B64_vi : SOP1_Real_vi <0x27, S_XNOR_SAVEEXEC_B64>;
1563 def S_QUADMASK_B32_vi : SOP1_Real_vi <0x28, S_QUADMASK_B32>;
1564 def S_QUADMASK_B64_vi : SOP1_Real_vi <0x29, S_QUADMASK_B64>;
1565 def S_MOVRELS_B32_vi : SOP1_Real_vi <0x2a, S_MOVRELS_B32>;
1566 def S_MOVRELS_B64_vi : SOP1_Real_vi <0x2b, S_MOVRELS_B64>;
1567 def S_MOVRELD_B32_vi : SOP1_Real_vi <0x2c, S_MOVRELD_B32>;
1568 def S_MOVRELD_B64_vi : SOP1_Real_vi <0x2d, S_MOVRELD_B64>;
1569 def S_CBRANCH_JOIN_vi : SOP1_Real_vi <0x2e, S_CBRANCH_JOIN>;
1570 def S_MOV_REGRD_B32_vi : SOP1_Real_vi <0x2f, S_MOV_REGRD_B32>;
1571 def S_ABS_I32_vi : SOP1_Real_vi <0x30, S_ABS_I32>;
1572 def S_MOV_FED_B32_vi : SOP1_Real_vi <0x31, S_MOV_FED_B32>;
1573 def S_SET_GPR_IDX_IDX_vi : SOP1_Real_vi <0x32, S_SET_GPR_IDX_IDX>;
1575 def S_ADD_U32_vi : SOP2_Real_vi <0x00, S_ADD_U32>;
1576 def S_ADD_I32_vi : SOP2_Real_vi <0x02, S_ADD_I32>;
1577 def S_SUB_U32_vi : SOP2_Real_vi <0x01, S_SUB_U32>;
1578 def S_SUB_I32_vi : SOP2_Real_vi <0x03, S_SUB_I32>;
1579 def S_ADDC_U32_vi : SOP2_Real_vi <0x04, S_ADDC_U32>;
1580 def S_SUBB_U32_vi : SOP2_Real_vi <0x05, S_SUBB_U32>;
1581 def S_MIN_I32_vi : SOP2_Real_vi <0x06, S_MIN_I32>;
1582 def S_MIN_U32_vi : SOP2_Real_vi <0x07, S_MIN_U32>;
1583 def S_MAX_I32_vi : SOP2_Real_vi <0x08, S_MAX_I32>;
1584 def S_MAX_U32_vi : SOP2_Real_vi <0x09, S_MAX_U32>;
1585 def S_CSELECT_B32_vi : SOP2_Real_vi <0x0a, S_CSELECT_B32>;
1586 def S_CSELECT_B64_vi : SOP2_Real_vi <0x0b, S_CSELECT_B64>;
1587 def S_AND_B32_vi : SOP2_Real_vi <0x0c, S_AND_B32>;
1588 def S_AND_B64_vi : SOP2_Real_vi <0x0d, S_AND_B64>;
1589 def S_OR_B32_vi : SOP2_Real_vi <0x0e, S_OR_B32>;
1590 def S_OR_B64_vi : SOP2_Real_vi <0x0f, S_OR_B64>;
1591 def S_XOR_B32_vi : SOP2_Real_vi <0x10, S_XOR_B32>;
1592 def S_XOR_B64_vi : SOP2_Real_vi <0x11, S_XOR_B64>;
1593 def S_ANDN2_B32_vi : SOP2_Real_vi <0x12, S_ANDN2_B32>;
1594 def S_ANDN2_B64_vi : SOP2_Real_vi <0x13, S_ANDN2_B64>;
1595 def S_ORN2_B32_vi : SOP2_Real_vi <0x14, S_ORN2_B32>;
1596 def S_ORN2_B64_vi : SOP2_Real_vi <0x15, S_ORN2_B64>;
1597 def S_NAND_B32_vi : SOP2_Real_vi <0x16, S_NAND_B32>;
1598 def S_NAND_B64_vi : SOP2_Real_vi <0x17, S_NAND_B64>;
1599 def S_NOR_B32_vi : SOP2_Real_vi <0x18, S_NOR_B32>;
1600 def S_NOR_B64_vi : SOP2_Real_vi <0x19, S_NOR_B64>;
1601 def S_XNOR_B32_vi : SOP2_Real_vi <0x1a, S_XNOR_B32>;
1602 def S_XNOR_B64_vi : SOP2_Real_vi <0x1b, S_XNOR_B64>;
1603 def S_LSHL_B32_vi : SOP2_Real_vi <0x1c, S_LSHL_B32>;
1604 def S_LSHL_B64_vi : SOP2_Real_vi <0x1d, S_LSHL_B64>;
1605 def S_LSHR_B32_vi : SOP2_Real_vi <0x1e, S_LSHR_B32>;
1606 def S_LSHR_B64_vi : SOP2_Real_vi <0x1f, S_LSHR_B64>;
1607 def S_ASHR_I32_vi : SOP2_Real_vi <0x20, S_ASHR_I32>;
1608 def S_ASHR_I64_vi : SOP2_Real_vi <0x21, S_ASHR_I64>;
1609 def S_BFM_B32_vi : SOP2_Real_vi <0x22, S_BFM_B32>;
1610 def S_BFM_B64_vi : SOP2_Real_vi <0x23, S_BFM_B64>;
1611 def S_MUL_I32_vi : SOP2_Real_vi <0x24, S_MUL_I32>;
1612 def S_BFE_U32_vi : SOP2_Real_vi <0x25, S_BFE_U32>;
1613 def S_BFE_I32_vi : SOP2_Real_vi <0x26, S_BFE_I32>;
1614 def S_BFE_U64_vi : SOP2_Real_vi <0x27, S_BFE_U64>;
1615 def S_BFE_I64_vi : SOP2_Real_vi <0x28, S_BFE_I64>;
1616 def S_CBRANCH_G_FORK_vi : SOP2_Real_vi <0x29, S_CBRANCH_G_FORK>;
1617 def S_ABSDIFF_I32_vi : SOP2_Real_vi <0x2a, S_ABSDIFF_I32>;
1618 def S_PACK_LL_B32_B16_vi : SOP2_Real_vi <0x32, S_PACK_LL_B32_B16>;
1619 def S_PACK_LH_B32_B16_vi : SOP2_Real_vi <0x33, S_PACK_LH_B32_B16>;
1620 def S_PACK_HH_B32_B16_vi : SOP2_Real_vi <0x34, S_PACK_HH_B32_B16>;
1621 def S_RFE_RESTORE_B64_vi : SOP2_Real_vi <0x2b, S_RFE_RESTORE_B64>;
1623 def S_MOVK_I32_vi : SOPK_Real_vi <0x00, S_MOVK_I32>;
1624 def S_CMOVK_I32_vi : SOPK_Real_vi <0x01, S_CMOVK_I32>;
1625 def S_CMPK_EQ_I32_vi : SOPK_Real_vi <0x02, S_CMPK_EQ_I32>;
1626 def S_CMPK_LG_I32_vi : SOPK_Real_vi <0x03, S_CMPK_LG_I32>;
1627 def S_CMPK_GT_I32_vi : SOPK_Real_vi <0x04, S_CMPK_GT_I32>;
1628 def S_CMPK_GE_I32_vi : SOPK_Real_vi <0x05, S_CMPK_GE_I32>;
1629 def S_CMPK_LT_I32_vi : SOPK_Real_vi <0x06, S_CMPK_LT_I32>;
1630 def S_CMPK_LE_I32_vi : SOPK_Real_vi <0x07, S_CMPK_LE_I32>;
1631 def S_CMPK_EQ_U32_vi : SOPK_Real_vi <0x08, S_CMPK_EQ_U32>;
1632 def S_CMPK_LG_U32_vi : SOPK_Real_vi <0x09, S_CMPK_LG_U32>;
1633 def S_CMPK_GT_U32_vi : SOPK_Real_vi <0x0A, S_CMPK_GT_U32>;
1634 def S_CMPK_GE_U32_vi : SOPK_Real_vi <0x0B, S_CMPK_GE_U32>;
1635 def S_CMPK_LT_U32_vi : SOPK_Real_vi <0x0C, S_CMPK_LT_U32>;
1636 def S_CMPK_LE_U32_vi : SOPK_Real_vi <0x0D, S_CMPK_LE_U32>;
1637 def S_ADDK_I32_vi : SOPK_Real_vi <0x0E, S_ADDK_I32>;
1638 def S_MULK_I32_vi : SOPK_Real_vi <0x0F, S_MULK_I32>;
1639 def S_CBRANCH_I_FORK_vi : SOPK_Real_vi <0x10, S_CBRANCH_I_FORK>;
1640 def S_GETREG_B32_vi : SOPK_Real_vi <0x11, S_GETREG_B32>;
1641 def S_SETREG_B32_vi : SOPK_Real_vi <0x12, S_SETREG_B32>;
1642 //def S_GETREG_REGRD_B32_vi : SOPK_Real_vi <0x13, S_GETREG_REGRD_B32>; // see pseudo for comments
1643 def S_SETREG_IMM32_B32_vi : SOPK_Real64<0x14, S_SETREG_IMM32_B32>,
1644 Select_vi<S_SETREG_IMM32_B32.Mnemonic>;
1646 def S_CALL_B64_vi : SOPK_Real_vi <0x15, S_CALL_B64>;
1648 //===----------------------------------------------------------------------===//
1650 //===----------------------------------------------------------------------===//
1652 def S_ANDN1_SAVEEXEC_B64_vi : SOP1_Real_vi<0x33, S_ANDN1_SAVEEXEC_B64>;
1653 def S_ORN1_SAVEEXEC_B64_vi : SOP1_Real_vi<0x34, S_ORN1_SAVEEXEC_B64>;
1654 def S_ANDN1_WREXEC_B64_vi : SOP1_Real_vi<0x35, S_ANDN1_WREXEC_B64>;
1655 def S_ANDN2_WREXEC_B64_vi : SOP1_Real_vi<0x36, S_ANDN2_WREXEC_B64>;
1656 def S_BITREPLICATE_B64_B32_vi : SOP1_Real_vi<0x37, S_BITREPLICATE_B64_B32>;
1658 //===----------------------------------------------------------------------===//
1660 //===----------------------------------------------------------------------===//
1662 def S_LSHL1_ADD_U32_vi : SOP2_Real_vi<0x2e, S_LSHL1_ADD_U32>;
1663 def S_LSHL2_ADD_U32_vi : SOP2_Real_vi<0x2f, S_LSHL2_ADD_U32>;
1664 def S_LSHL3_ADD_U32_vi : SOP2_Real_vi<0x30, S_LSHL3_ADD_U32>;
1665 def S_LSHL4_ADD_U32_vi : SOP2_Real_vi<0x31, S_LSHL4_ADD_U32>;
1666 def S_MUL_HI_U32_vi : SOP2_Real_vi<0x2c, S_MUL_HI_U32>;
1667 def S_MUL_HI_I32_vi : SOP2_Real_vi<0x2d, S_MUL_HI_I32>;