xref: /freebsd/contrib/llvm-project/llvm/lib/Target/AMDGPU/SOPInstructions.td (revision 1db9f3b21e39176dd5b67cf8ac378633b172463e)
1//===-- SOPInstructions.td - SOP Instruction Definitions ------------------===//
2//
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
6//
7//===----------------------------------------------------------------------===//
8
9def GPRIdxMode : CustomOperand<i32>;
10
11class SOP_Pseudo<string opName, dag outs, dag ins, string asmOps,
12                  list<dag> pattern=[]> :
13    InstSI<outs, ins, "", pattern>,
14    SIMCInstr<opName, SIEncodingFamily.NONE> {
15
16  let isPseudo = 1;
17  let isCodeGenOnly = 1;
18  let Size = 4;
19
20  string Mnemonic = opName;
21  string AsmOperands = asmOps;
22
23  bits<1> has_sdst = 0;
24}
25
26//===----------------------------------------------------------------------===//
27// SOP1 Instructions
28//===----------------------------------------------------------------------===//
29
30class SOP1_Pseudo <string opName, dag outs, dag ins,
31                   string asmOps, list<dag> pattern=[]> :
32  SOP_Pseudo<opName, outs, ins, " " # asmOps, pattern> {
33
34  let mayLoad = 0;
35  let mayStore = 0;
36  let hasSideEffects = 0;
37  let SALU = 1;
38  let SOP1 = 1;
39  let SchedRW = [WriteSALU];
40  let UseNamedOperandTable = 1;
41
42  bits<1> has_src0 = 1;
43  let has_sdst = 1;
44}
45
46class SOP1_Real<bits<8> op, SOP1_Pseudo ps, string real_name = ps.Mnemonic> :
47  InstSI <ps.OutOperandList, ps.InOperandList,
48          real_name # ps.AsmOperands>,
49  Enc32 {
50
51  let SALU = 1;
52  let SOP1 = 1;
53  let isPseudo = 0;
54  let isCodeGenOnly = 0;
55  let Size = 4;
56
57  // copy relevant pseudo op flags
58  let SubtargetPredicate = ps.SubtargetPredicate;
59  let AsmMatchConverter  = ps.AsmMatchConverter;
60  let SchedRW            = ps.SchedRW;
61  let mayLoad            = ps.mayLoad;
62  let mayStore           = ps.mayStore;
63
64  // encoding
65  bits<7> sdst;
66  bits<8> src0;
67
68  let Inst{7-0} = !if(ps.has_src0, src0, ?);
69  let Inst{15-8} = op;
70  let Inst{22-16} = !if(ps.has_sdst, sdst, ?);
71  let Inst{31-23} = 0x17d; //encoding;
72}
73
74class SOP1_32 <string opName, list<dag> pattern=[], bit tied_in = 0> : SOP1_Pseudo <
75  opName, (outs SReg_32:$sdst),
76  !if(tied_in, (ins SSrc_b32:$src0, SReg_32:$sdst_in),
77               (ins SSrc_b32:$src0)),
78  "$sdst, $src0", pattern> {
79  let Constraints = !if(tied_in, "$sdst = $sdst_in", "");
80}
81
82// Only register input allowed.
83class SOP1_32R <string opName, list<dag> pattern=[]> : SOP1_Pseudo <
84  opName, (outs SReg_32:$sdst), (ins SReg_32:$src0),
85  "$sdst, $src0", pattern>;
86
87// 32-bit input, no output.
88class SOP1_0_32 <string opName, list<dag> pattern = []> : SOP1_Pseudo <
89  opName, (outs), (ins SSrc_b32:$src0),
90  "$src0", pattern> {
91  let has_sdst = 0;
92}
93
94// Special case for movreld where sdst is treated as a use operand.
95class SOP1_32_movreld <string opName, list<dag> pattern=[]> : SOP1_Pseudo <
96  opName, (outs), (ins SReg_32:$sdst, SSrc_b32:$src0),
97  "$sdst, $src0", pattern>;
98
99// Special case for movreld where sdst is treated as a use operand.
100class SOP1_64_movreld <string opName, list<dag> pattern=[]> : SOP1_Pseudo <
101  opName, (outs), (ins SReg_64:$sdst, SSrc_b64:$src0),
102  "$sdst, $src0", pattern
103>;
104
105class SOP1_0_32R <string opName, list<dag> pattern = []> : SOP1_Pseudo <
106  opName, (outs), (ins SReg_32:$src0),
107  "$src0", pattern> {
108  let has_sdst = 0;
109}
110
111class SOP1_64 <string opName, list<dag> pattern=[]> : SOP1_Pseudo <
112  opName, (outs SReg_64:$sdst), (ins SSrc_b64:$src0),
113  "$sdst, $src0", pattern
114>;
115
116// Only register input allowed.
117class SOP1_64R <string opName, list<dag> pattern=[]> : SOP1_Pseudo <
118  opName, (outs SReg_64:$sdst), (ins SReg_64:$src0),
119  "$sdst, $src0", pattern
120>;
121
122// 64-bit input, 32-bit output.
123class SOP1_32_64 <string opName, list<dag> pattern=[]> : SOP1_Pseudo <
124  opName, (outs SReg_32:$sdst), (ins SSrc_b64:$src0),
125  "$sdst, $src0", pattern
126>;
127
128// 32-bit input, 64-bit output.
129class SOP1_64_32 <string opName, list<dag> pattern=[], bit tied_in = 0> : SOP1_Pseudo <
130  opName, (outs SReg_64:$sdst),
131  !if(tied_in, (ins SSrc_b32:$src0, SReg_64:$sdst_in),
132               (ins SSrc_b32:$src0)),
133  "$sdst, $src0", pattern> {
134  let Constraints = !if(tied_in, "$sdst = $sdst_in", "");
135}
136
137// no input, 64-bit output.
138class SOP1_64_0 <string opName, list<dag> pattern=[]> : SOP1_Pseudo <
139  opName, (outs SReg_64:$sdst), (ins), "$sdst", pattern> {
140  let has_src0 = 0;
141}
142
143// 64-bit input, no output
144class SOP1_1 <string opName, list<dag> pattern=[]> : SOP1_Pseudo <
145  opName, (outs), (ins SReg_64:$src0), "$src0", pattern> {
146  let has_sdst = 0;
147}
148
149
150class UniformUnaryFrag<SDPatternOperator Op> : PatFrag <
151  (ops node:$src0),
152  (Op $src0),
153  [{ return !N->isDivergent(); }]> {
154  // This check is unnecessary as it's captured by the result register
155  // bank constraint.
156  //
157  // FIXME: Should add a way for the emitter to recognize this is a
158  // trivially true predicate to eliminate the check.
159  let GISelPredicateCode = [{return true;}];
160}
161
162class UniformBinFrag<SDPatternOperator Op> : PatFrag <
163  (ops node:$src0, node:$src1),
164  (Op $src0, $src1),
165  [{ return !N->isDivergent(); }]> {
166  // This check is unnecessary as it's captured by the result register
167  // bank constraint.
168  //
169  // FIXME: Should add a way for the emitter to recognize this is a
170  // trivially true predicate to eliminate the check.
171  let GISelPredicateCode = [{return true;}];
172}
173
174class UniformTernaryFrag<SDPatternOperator Op> : PatFrag <
175  (ops node:$src0, node:$src1, node:$src2),
176  (Op $src0, $src1, $src2),
177  [{ return !N->isDivergent(); }]> {
178  // This check is unnecessary as it's captured by the result register
179  // bank constraint.
180  //
181  // FIXME: Should add a way for the emitter to recognize this is a
182  // trivially true predicate to eliminate the check.
183  let GISelPredicateCode = [{return true;}];
184}
185
186class DivergentBinFrag<SDPatternOperator Op> : PatFrag <
187  (ops node:$src0, node:$src1),
188  (Op $src0, $src1),
189  [{ return N->isDivergent(); }]> {
190  // This check is unnecessary as it's captured by the result register
191  // bank constraint.
192  //
193  // FIXME: Should add a way for the emitter to recognize this is a
194  // trivially true predicate to eliminate the check.
195  let GISelPredicateCode = [{return true;}];
196}
197
198
199let isMoveImm = 1 in {
200  let isReMaterializable = 1, isAsCheapAsAMove = 1 in {
201    def S_MOV_B32 : SOP1_32 <"s_mov_b32">;
202    def S_MOV_B64 : SOP1_64 <"s_mov_b64">;
203  } // End isReMaterializable = 1
204
205  let Uses = [SCC] in {
206    def S_CMOV_B32 : SOP1_32 <"s_cmov_b32">;
207    def S_CMOV_B64 : SOP1_64 <"s_cmov_b64">;
208  } // End Uses = [SCC]
209} // End isMoveImm = 1
210
211let Defs = [SCC] in {
212  def S_NOT_B32 : SOP1_32 <"s_not_b32",
213    [(set i32:$sdst, (UniformUnaryFrag<not> i32:$src0))]
214  >;
215
216  def S_NOT_B64 : SOP1_64 <"s_not_b64",
217    [(set i64:$sdst, (UniformUnaryFrag<not> i64:$src0))]
218  >;
219  def S_WQM_B32 : SOP1_32 <"s_wqm_b32",
220    [(set i32:$sdst, (int_amdgcn_s_wqm i32:$src0))]>;
221  def S_WQM_B64 : SOP1_64 <"s_wqm_b64",
222    [(set i64:$sdst, (int_amdgcn_s_wqm i64:$src0))]>;
223} // End Defs = [SCC]
224
225
226let WaveSizePredicate = isWave32 in {
227def : GCNPat <
228  (int_amdgcn_wqm_vote i1:$src0),
229  (S_WQM_B32 SSrc_b32:$src0)
230>;
231}
232
233let WaveSizePredicate = isWave64 in {
234def : GCNPat <
235  (int_amdgcn_wqm_vote i1:$src0),
236  (S_WQM_B64 SSrc_b64:$src0)
237>;
238}
239
240let isReMaterializable = 1, isAsCheapAsAMove = 1 in {
241def S_BREV_B32 : SOP1_32 <"s_brev_b32",
242  [(set i32:$sdst, (UniformUnaryFrag<bitreverse> i32:$src0))]
243>;
244def S_BREV_B64 : SOP1_64 <"s_brev_b64",
245  [(set i64:$sdst, (UniformUnaryFrag<bitreverse> i64:$src0))]
246>;
247} // End isReMaterializable = 1, isAsCheapAsAMove = 1
248
249let Defs = [SCC] in {
250def S_BCNT0_I32_B32 : SOP1_32 <"s_bcnt0_i32_b32">;
251def S_BCNT0_I32_B64 : SOP1_32_64 <"s_bcnt0_i32_b64">;
252def S_BCNT1_I32_B32 : SOP1_32 <"s_bcnt1_i32_b32",
253  [(set i32:$sdst, (UniformUnaryFrag<ctpop> i32:$src0))]
254>;
255def S_BCNT1_I32_B64 : SOP1_32_64 <"s_bcnt1_i32_b64",
256  [(set i32:$sdst, (UniformUnaryFrag<ctpop> i64:$src0))]
257>;
258} // End Defs = [SCC]
259
260let isReMaterializable = 1 in {
261def S_FF0_I32_B32 : SOP1_32 <"s_ff0_i32_b32">;
262def S_FF0_I32_B64 : SOP1_32_64 <"s_ff0_i32_b64">;
263def S_FF1_I32_B64 : SOP1_32_64 <"s_ff1_i32_b64",
264  [(set i32:$sdst, (UniformUnaryFrag<AMDGPUffbl_b32> i64:$src0))]
265>;
266
267def S_FF1_I32_B32 : SOP1_32 <"s_ff1_i32_b32",
268  [(set i32:$sdst, (UniformUnaryFrag<AMDGPUffbl_b32> i32:$src0))]
269>;
270
271def S_FLBIT_I32_B32 : SOP1_32 <"s_flbit_i32_b32",
272  [(set i32:$sdst, (UniformUnaryFrag<AMDGPUffbh_u32> i32:$src0))]
273>;
274
275def S_FLBIT_I32_B64 : SOP1_32_64 <"s_flbit_i32_b64",
276  [(set i32:$sdst, (UniformUnaryFrag<AMDGPUffbh_u32> i64:$src0))]
277>;
278def S_FLBIT_I32 : SOP1_32 <"s_flbit_i32",
279  [(set i32:$sdst, (UniformUnaryFrag<AMDGPUffbh_i32> i32:$src0))]
280>;
281def S_FLBIT_I32_I64 : SOP1_32_64 <"s_flbit_i32_i64">;
282def S_SEXT_I32_I8 : SOP1_32 <"s_sext_i32_i8",
283  [(set i32:$sdst, (UniformSextInreg<i8> i32:$src0))]
284>;
285def S_SEXT_I32_I16 : SOP1_32 <"s_sext_i32_i16",
286  [(set i32:$sdst, (UniformSextInreg<i16> i32:$src0))]
287>;
288} // End isReMaterializable = 1
289
290def S_BITSET0_B32 : SOP1_32    <"s_bitset0_b32", [], 1>;
291def S_BITSET0_B64 : SOP1_64_32 <"s_bitset0_b64", [], 1>;
292def S_BITSET1_B32 : SOP1_32    <"s_bitset1_b32", [], 1>;
293def S_BITSET1_B64 : SOP1_64_32 <"s_bitset1_b64", [], 1>;
294
295let isReMaterializable = 1 in
296def S_GETPC_B64 : SOP1_64_0  <"s_getpc_b64",
297  [(set i64:$sdst, (int_amdgcn_s_getpc))]
298>;
299
300let isTerminator = 1, isBarrier = 1, SchedRW = [WriteBranch] in {
301
302let isBranch = 1, isIndirectBranch = 1 in {
303def S_SETPC_B64 : SOP1_1  <"s_setpc_b64">;
304} // End isBranch = 1, isIndirectBranch = 1
305
306let isReturn = 1 in {
307// Define variant marked as return rather than branch.
308def S_SETPC_B64_return : SOP1_1<"">;
309}
310} // End isTerminator = 1, isBarrier = 1
311
312let isCall = 1 in {
313def S_SWAPPC_B64 : SOP1_64 <"s_swappc_b64"
314>;
315}
316
317def S_RFE_B64 : SOP1_1  <"s_rfe_b64">;
318
319let hasSideEffects = 1, Uses = [EXEC], Defs = [EXEC, SCC] in {
320
321def S_AND_SAVEEXEC_B64 : SOP1_64 <"s_and_saveexec_b64">;
322def S_OR_SAVEEXEC_B64 : SOP1_64 <"s_or_saveexec_b64">;
323def S_XOR_SAVEEXEC_B64 : SOP1_64 <"s_xor_saveexec_b64">;
324def S_ANDN2_SAVEEXEC_B64 : SOP1_64 <"s_andn2_saveexec_b64">;
325def S_ORN2_SAVEEXEC_B64 : SOP1_64 <"s_orn2_saveexec_b64">;
326def S_NAND_SAVEEXEC_B64 : SOP1_64 <"s_nand_saveexec_b64">;
327def S_NOR_SAVEEXEC_B64 : SOP1_64 <"s_nor_saveexec_b64">;
328def S_XNOR_SAVEEXEC_B64 : SOP1_64 <"s_xnor_saveexec_b64">;
329
330} // End hasSideEffects = 1, Uses = [EXEC], Defs = [EXEC, SCC]
331
332def S_QUADMASK_B32 : SOP1_32 <"s_quadmask_b32",
333  [(set i32:$sdst, (int_amdgcn_s_quadmask i32:$src0))]>;
334def S_QUADMASK_B64 : SOP1_64 <"s_quadmask_b64",
335  [(set i64:$sdst, (int_amdgcn_s_quadmask i64:$src0))]>;
336
337let Uses = [M0] in {
338def S_MOVRELS_B32 : SOP1_32R <"s_movrels_b32">;
339def S_MOVRELS_B64 : SOP1_64R <"s_movrels_b64">;
340def S_MOVRELD_B32 : SOP1_32_movreld <"s_movreld_b32">;
341def S_MOVRELD_B64 : SOP1_64_movreld <"s_movreld_b64">;
342} // End Uses = [M0]
343
344let SubtargetPredicate = isGFX6GFX7GFX8GFX9 in {
345def S_CBRANCH_JOIN : SOP1_0_32R <"s_cbranch_join">;
346} // End SubtargetPredicate = isGFX6GFX7GFX8GFX9
347
348let Defs = [SCC] in {
349def S_ABS_I32 : SOP1_32 <"s_abs_i32",
350    [(set i32:$sdst, (UniformUnaryFrag<abs> i32:$src0))]
351  >;
352} // End Defs = [SCC]
353
354let SubtargetPredicate = HasVGPRIndexMode in {
355def S_SET_GPR_IDX_IDX : SOP1_0_32<"s_set_gpr_idx_idx"> {
356  let Uses = [M0, MODE];
357  let Defs = [M0, MODE];
358}
359}
360
361let SubtargetPredicate = isGFX9Plus in {
362  let hasSideEffects = 1, Defs = [EXEC, SCC], Uses = [EXEC] in {
363    def S_ANDN1_SAVEEXEC_B64 : SOP1_64<"s_andn1_saveexec_b64">;
364    def S_ORN1_SAVEEXEC_B64  : SOP1_64<"s_orn1_saveexec_b64">;
365    def S_ANDN1_WREXEC_B64   : SOP1_64<"s_andn1_wrexec_b64">;
366    def S_ANDN2_WREXEC_B64   : SOP1_64<"s_andn2_wrexec_b64">;
367  } // End hasSideEffects = 1, Defs = [EXEC, SCC], Uses = [EXEC]
368
369  let isReMaterializable = 1 in
370  def S_BITREPLICATE_B64_B32 : SOP1_64_32<"s_bitreplicate_b64_b32",
371  [(set i64:$sdst, (int_amdgcn_s_bitreplicate i32:$src0))]>;
372} // End SubtargetPredicate = isGFX9Plus
373
374let SubtargetPredicate = isGFX10Plus in {
375  let hasSideEffects = 1, Defs = [EXEC, SCC], Uses = [EXEC] in {
376    def S_AND_SAVEEXEC_B32   : SOP1_32<"s_and_saveexec_b32">;
377    def S_OR_SAVEEXEC_B32    : SOP1_32<"s_or_saveexec_b32">;
378    def S_XOR_SAVEEXEC_B32   : SOP1_32<"s_xor_saveexec_b32">;
379    def S_ANDN2_SAVEEXEC_B32 : SOP1_32<"s_andn2_saveexec_b32">;
380    def S_ORN2_SAVEEXEC_B32  : SOP1_32<"s_orn2_saveexec_b32">;
381    def S_NAND_SAVEEXEC_B32  : SOP1_32<"s_nand_saveexec_b32">;
382    def S_NOR_SAVEEXEC_B32   : SOP1_32<"s_nor_saveexec_b32">;
383    def S_XNOR_SAVEEXEC_B32  : SOP1_32<"s_xnor_saveexec_b32">;
384    def S_ANDN1_SAVEEXEC_B32 : SOP1_32<"s_andn1_saveexec_b32">;
385    def S_ORN1_SAVEEXEC_B32  : SOP1_32<"s_orn1_saveexec_b32">;
386    def S_ANDN1_WREXEC_B32   : SOP1_32<"s_andn1_wrexec_b32">;
387    def S_ANDN2_WREXEC_B32   : SOP1_32<"s_andn2_wrexec_b32">;
388  } // End hasSideEffects = 1, Defs = [EXEC, SCC], Uses = [EXEC]
389
390  let Uses = [M0] in {
391    def S_MOVRELSD_2_B32 : SOP1_32<"s_movrelsd_2_b32">;
392  } // End Uses = [M0]
393} // End SubtargetPredicate = isGFX10Plus
394
395let SubtargetPredicate = isGFX11Plus in {
396  let hasSideEffects = 1 in {
397    // For s_sendmsg_rtn_* the src0 field encodes the message type directly; it
398    // is not an SGPR number.
399    def S_SENDMSG_RTN_B32 : SOP1_Pseudo<
400      "s_sendmsg_rtn_b32", (outs SReg_32:$sdst), (ins SendMsg:$src0),
401      "$sdst, $src0", [(set i32:$sdst, (int_amdgcn_s_sendmsg_rtn timm:$src0))]
402    >;
403    def S_SENDMSG_RTN_B64 : SOP1_Pseudo<
404      "s_sendmsg_rtn_b64", (outs SReg_64:$sdst), (ins SendMsg:$src0),
405      "$sdst, $src0", [(set i64:$sdst, (int_amdgcn_s_sendmsg_rtn timm:$src0))]
406    >;
407  }
408} // End SubtargetPredicate = isGFX11Plus
409
410class SOP1_F32_Inst<string opName, SDPatternOperator Op, ValueType vt0=f32,
411                    ValueType vt1=vt0> :
412  SOP1_32<opName, [(set vt0:$sdst, (UniformUnaryFrag<Op> vt1:$src0))]>;
413
414let SubtargetPredicate = HasSALUFloatInsts, Uses = [MODE],
415    SchedRW = [WriteSFPU], isReMaterializable = 1 in {
416  def S_CVT_F32_I32 : SOP1_F32_Inst<"s_cvt_f32_i32", sint_to_fp, f32, i32>;
417  def S_CVT_F32_U32 : SOP1_F32_Inst<"s_cvt_f32_u32", uint_to_fp, f32, i32>;
418
419  let mayRaiseFPException = 1 in {
420    def S_CVT_I32_F32    : SOP1_F32_Inst<"s_cvt_i32_f32", fp_to_sint, i32, f32>;
421    def S_CVT_U32_F32    : SOP1_F32_Inst<"s_cvt_u32_f32", fp_to_uint, i32, f32>;
422    def S_CVT_F32_F16    : SOP1_F32_Inst<"s_cvt_f32_f16", fpextend, f32, f16>;
423    def S_CVT_HI_F32_F16 : SOP1_32<"s_cvt_hi_f32_f16">;
424
425    def S_CEIL_F32  : SOP1_F32_Inst<"s_ceil_f32", fceil>;
426    def S_FLOOR_F32 : SOP1_F32_Inst<"s_floor_f32", ffloor>;
427    def S_TRUNC_F32 : SOP1_F32_Inst<"s_trunc_f32", ftrunc>;
428    def S_RNDNE_F32 : SOP1_F32_Inst<"s_rndne_f32", froundeven>;
429
430    let FPDPRounding = 1 in
431      def S_CVT_F16_F32 : SOP1_F32_Inst<"s_cvt_f16_f32", fpround, f16, f32>;
432
433    def S_CEIL_F16  : SOP1_F32_Inst<"s_ceil_f16", fceil, f16>;
434    def S_FLOOR_F16 : SOP1_F32_Inst<"s_floor_f16", ffloor, f16>;
435    def S_TRUNC_F16 : SOP1_F32_Inst<"s_trunc_f16", ftrunc, f16>;
436    def S_RNDNE_F16 : SOP1_F32_Inst<"s_rndne_f16", froundeven, f16>;
437  } // End mayRaiseFPException = 1
438} // End SubtargetPredicate = HasSALUFloatInsts, Uses = [MODE]
439  // SchedRW = [WriteSFPU], isReMaterializable = 1
440
441let hasSideEffects = 1 in {
442let has_sdst = 0 in {
443let Uses = [M0] in {
444def S_BARRIER_SIGNAL_M0 : SOP1_Pseudo <"s_barrier_signal m0", (outs), (ins),
445  "", [(int_amdgcn_s_barrier_signal_var M0)]>{
446  let SchedRW = [WriteBarrier];
447  let isConvergent = 1;
448}
449
450def S_BARRIER_SIGNAL_ISFIRST_M0 : SOP1_Pseudo <"s_barrier_signal_isfirst m0", (outs), (ins),
451  "", [(set SCC, (int_amdgcn_s_barrier_signal_isfirst_var M0))]>{
452  let Defs = [SCC];
453  let SchedRW = [WriteBarrier];
454  let isConvergent = 1;
455}
456
457def S_BARRIER_INIT_M0 : SOP1_Pseudo <"s_barrier_init m0", (outs), (ins),
458  "", []>{
459  let SchedRW = [WriteBarrier];
460  let isConvergent = 1;
461}
462
463def S_BARRIER_INIT_IMM : SOP1_Pseudo <"s_barrier_init", (outs),
464  (ins SplitBarrier:$src0), "$src0", []>{
465  let SchedRW = [WriteBarrier];
466  let isConvergent = 1;
467}
468
469def S_BARRIER_JOIN_M0 : SOP1_Pseudo <"s_barrier_join m0", (outs), (ins),
470  "", []>{
471  let SchedRW = [WriteBarrier];
472  let isConvergent = 1;
473}
474
475def S_WAKEUP_BARRIER_M0 : SOP1_Pseudo <"s_wakeup_barrier m0", (outs), (ins),
476  "", []>{
477  let SchedRW = [WriteBarrier];
478  let isConvergent = 1;
479}
480} // End Uses = [M0]
481
482def S_BARRIER_SIGNAL_IMM : SOP1_Pseudo <"s_barrier_signal", (outs),
483  (ins SplitBarrier:$src0), "$src0", [(int_amdgcn_s_barrier_signal timm:$src0)]>{
484  let SchedRW = [WriteBarrier];
485  let isConvergent = 1;
486}
487
488def S_BARRIER_SIGNAL_ISFIRST_IMM : SOP1_Pseudo <"s_barrier_signal_isfirst", (outs),
489  (ins SplitBarrier:$src0), "$src0", [(set SCC, (int_amdgcn_s_barrier_signal_isfirst timm:$src0))]>{
490  let Defs = [SCC];
491  let SchedRW = [WriteBarrier];
492  let isConvergent = 1;
493}
494
495def S_BARRIER_JOIN_IMM : SOP1_Pseudo <"s_barrier_join", (outs),
496  (ins SplitBarrier:$src0), "$src0", []>{
497  let SchedRW = [WriteBarrier];
498  let isConvergent = 1;
499}
500
501def S_WAKEUP_BARRIER_IMM : SOP1_Pseudo <"s_wakeup_barrier", (outs),
502  (ins SplitBarrier:$src0), "$src0", []>{
503  let SchedRW = [WriteBarrier];
504  let isConvergent = 1;
505
506
507}
508} // End has_sdst = 0
509
510def S_GET_BARRIER_STATE_IMM : SOP1_Pseudo <"s_get_barrier_state", (outs SSrc_b32:$sdst),
511  (ins SplitBarrier:$src0), "$sdst, $src0", []>{
512  let SchedRW = [WriteBarrier];
513  let isConvergent = 1;
514}
515
516def S_GET_BARRIER_STATE_M0 : SOP1_Pseudo <"s_get_barrier_state $sdst, m0", (outs SSrc_b32:$sdst),
517  (ins), "", []>{
518  let Uses = [M0];
519  let SchedRW = [WriteBarrier];
520  let isConvergent = 1;
521}
522} // End hasSideEffects = 1
523
524//===----------------------------------------------------------------------===//
525// SOP2 Instructions
526//===----------------------------------------------------------------------===//
527
528class SOP2_Pseudo<string opName, dag outs, dag ins,
529                  string asmOps, list<dag> pattern=[]> :
530  SOP_Pseudo<opName, outs, ins, " " # asmOps, pattern> {
531
532  let mayLoad = 0;
533  let mayStore = 0;
534  let hasSideEffects = 0;
535  let SALU = 1;
536  let SOP2 = 1;
537  let SchedRW = [WriteSALU];
538  let UseNamedOperandTable = 1;
539
540  let has_sdst = 1;
541
542  // Pseudo instructions have no encodings, but adding this field here allows
543  // us to do:
544  // let sdst = xxx in {
545  // for multiclasses that include both real and pseudo instructions.
546  // field bits<7> sdst = 0;
547}
548
549class SOP2_Real<SOP_Pseudo ps, string real_name = ps.Mnemonic> :
550  InstSI <ps.OutOperandList, ps.InOperandList,
551          real_name # ps.AsmOperands> {
552  let SALU = 1;
553  let SOP2 = 1;
554  let isPseudo = 0;
555  let isCodeGenOnly = 0;
556
557  // copy relevant pseudo op flags
558  let SubtargetPredicate   = ps.SubtargetPredicate;
559  let AsmMatchConverter    = ps.AsmMatchConverter;
560  let UseNamedOperandTable = ps.UseNamedOperandTable;
561  let TSFlags              = ps.TSFlags;
562  let SchedRW              = ps.SchedRW;
563  let mayLoad              = ps.mayLoad;
564  let mayStore             = ps.mayStore;
565  let Constraints          = ps.Constraints;
566  let DisableEncoding      = ps.DisableEncoding;
567
568  // encoding
569  bits<7> sdst;
570  bits<8> src0;
571  bits<8> src1;
572  bits<32> imm;
573}
574
575class SOP2_Real32<bits<7> op, SOP_Pseudo ps, string real_name = ps.Mnemonic> :
576  SOP2_Real<ps, real_name>, Enc32 {
577  let Inst{7-0}   = src0;
578  let Inst{15-8}  = src1;
579  let Inst{22-16} = !if(ps.has_sdst, sdst, ?);
580  let Inst{29-23} = op;
581  let Inst{31-30} = 0x2; // encoding
582}
583
584class SOP2_Real64<bits<7> op, SOP_Pseudo ps, string real_name = ps.Mnemonic> :
585  SOP2_Real<ps, real_name>, Enc64 {
586  let Inst{7-0}   = src0;
587  let Inst{15-8}  = src1;
588  let Inst{22-16} = !if(ps.has_sdst, sdst, ?);
589  let Inst{29-23} = op;
590  let Inst{31-30} = 0x2; // encoding
591  let Inst{63-32} = imm;
592}
593
594class SOP2_F16 <string opName, list<dag> pattern=[]> : SOP2_Pseudo <
595  opName, (outs SReg_32:$sdst), (ins SSrc_f16:$src0, SSrc_f16:$src1),
596  "$sdst, $src0, $src1", pattern
597>;
598
599class SOP2_32 <string opName, list<dag> pattern=[]> : SOP2_Pseudo <
600  opName, (outs SReg_32:$sdst), (ins SSrc_b32:$src0, SSrc_b32:$src1),
601  "$sdst, $src0, $src1", pattern
602>;
603
604class SOP2_F32 <string opName, list<dag> pattern=[]> : SOP2_Pseudo <
605  opName, (outs SReg_32:$sdst), (ins SSrc_f32:$src0, SSrc_f32:$src1),
606  "$sdst, $src0, $src1", pattern
607>;
608
609class SOP2_64 <string opName, list<dag> pattern=[]> : SOP2_Pseudo <
610  opName, (outs SReg_64:$sdst), (ins SSrc_b64:$src0, SSrc_b64:$src1),
611  "$sdst, $src0, $src1", pattern
612>;
613
614class SOP2_64_32 <string opName, list<dag> pattern=[]> : SOP2_Pseudo <
615  opName, (outs SReg_64:$sdst), (ins SSrc_b64:$src0, SSrc_b32:$src1),
616  "$sdst, $src0, $src1", pattern
617>;
618
619class SOP2_64_32_32 <string opName, list<dag> pattern=[]> : SOP2_Pseudo <
620  opName, (outs SReg_64:$sdst), (ins SSrc_b32:$src0, SSrc_b32:$src1),
621  "$sdst, $src0, $src1", pattern
622>;
623
624
625let Defs = [SCC] in { // Carry out goes to SCC
626let isCommutable = 1 in {
627def S_ADD_U32 : SOP2_32 <"s_add_u32">;
628def S_ADD_I32 : SOP2_32 <"s_add_i32",
629  [(set i32:$sdst, (UniformBinFrag<add> SSrc_b32:$src0, SSrc_b32:$src1))]
630>;
631} // End isCommutable = 1
632
633def S_SUB_U32 : SOP2_32 <"s_sub_u32">;
634def S_SUB_I32 : SOP2_32 <"s_sub_i32",
635  [(set i32:$sdst, (UniformBinFrag<sub> SSrc_b32:$src0, SSrc_b32:$src1))]
636>;
637
638let Uses = [SCC] in { // Carry in comes from SCC
639let isCommutable = 1 in {
640def S_ADDC_U32 : SOP2_32 <"s_addc_u32",
641  [(set i32:$sdst, (UniformBinFrag<adde> (i32 SSrc_b32:$src0), (i32 SSrc_b32:$src1)))]>;
642} // End isCommutable = 1
643
644def S_SUBB_U32 : SOP2_32 <"s_subb_u32",
645  [(set i32:$sdst, (UniformBinFrag<sube> (i32 SSrc_b32:$src0), (i32 SSrc_b32:$src1)))]>;
646} // End Uses = [SCC]
647
648let isCommutable = 1 in {
649def S_MIN_I32 : SOP2_32 <"s_min_i32",
650  [(set i32:$sdst, (UniformBinFrag<smin> i32:$src0, i32:$src1))]
651>;
652def S_MIN_U32 : SOP2_32 <"s_min_u32",
653  [(set i32:$sdst, (UniformBinFrag<umin> i32:$src0, i32:$src1))]
654>;
655def S_MAX_I32 : SOP2_32 <"s_max_i32",
656  [(set i32:$sdst, (UniformBinFrag<smax> i32:$src0, i32:$src1))]
657>;
658def S_MAX_U32 : SOP2_32 <"s_max_u32",
659  [(set i32:$sdst, (UniformBinFrag<umax> i32:$src0, i32:$src1))]
660>;
661} // End isCommutable = 1
662} // End Defs = [SCC]
663
664let SubtargetPredicate = isGFX12Plus in {
665  def S_ADD_U64 : SOP2_64<"s_add_u64">{
666    let isCommutable = 1;
667  }
668
669  def S_SUB_U64 : SOP2_64<"s_sub_u64">;
670
671  def S_MUL_U64 : SOP2_64 <"s_mul_u64",
672    [(set i64:$sdst, (UniformBinFrag<mul> i64:$src0, i64:$src1))]> {
673    let isCommutable = 1;
674  }
675
676  // The higher 32-bits of the inputs contain the sign extension bits.
677  def S_MUL_I64_I32_PSEUDO : SPseudoInstSI <
678    (outs SReg_64:$sdst), (ins SSrc_b64:$src0, SSrc_b64:$src1)
679  >;
680
681  // The higher 32-bits of the inputs are zero.
682  def S_MUL_U64_U32_PSEUDO : SPseudoInstSI <
683    (outs SReg_64:$sdst), (ins SSrc_b64:$src0, SSrc_b64:$src1)
684  >;
685
686} // End SubtargetPredicate = isGFX12Plus
687
688let Uses = [SCC] in {
689  def S_CSELECT_B32 : SOP2_32 <"s_cselect_b32">;
690  def S_CSELECT_B64 : SOP2_64 <"s_cselect_b64">;
691} // End Uses = [SCC]
692
693let Defs = [SCC] in {
694let isCommutable = 1 in {
695def S_AND_B32 : SOP2_32 <"s_and_b32",
696  [(set i32:$sdst, (UniformBinFrag<and> i32:$src0, i32:$src1))]
697>;
698
699def S_AND_B64 : SOP2_64 <"s_and_b64",
700  [(set i64:$sdst, (UniformBinFrag<and> i64:$src0, i64:$src1))]
701>;
702
703def S_OR_B32 : SOP2_32 <"s_or_b32",
704  [(set i32:$sdst, (UniformBinFrag<or> i32:$src0, i32:$src1))]
705>;
706
707def S_OR_B64 : SOP2_64 <"s_or_b64",
708  [(set i64:$sdst, (UniformBinFrag<or> i64:$src0, i64:$src1))]
709>;
710
711def S_XOR_B32 : SOP2_32 <"s_xor_b32",
712  [(set i32:$sdst, (UniformBinFrag<xor> i32:$src0, i32:$src1))]
713>;
714
715def S_XOR_B64 : SOP2_64 <"s_xor_b64",
716  [(set i64:$sdst, (UniformBinFrag<xor> i64:$src0, i64:$src1))]
717>;
718
719def S_XNOR_B32 : SOP2_32 <"s_xnor_b32",
720  [(set i32:$sdst, (UniformUnaryFrag<not> (xor_oneuse i32:$src0, i32:$src1)))]
721>;
722
723def S_XNOR_B64 : SOP2_64 <"s_xnor_b64",
724  [(set i64:$sdst, (UniformUnaryFrag<not> (xor_oneuse i64:$src0, i64:$src1)))]
725>;
726
727def S_NAND_B32 : SOP2_32 <"s_nand_b32",
728  [(set i32:$sdst, (UniformUnaryFrag<not> (and_oneuse i32:$src0, i32:$src1)))]
729>;
730
731def S_NAND_B64 : SOP2_64 <"s_nand_b64",
732  [(set i64:$sdst, (UniformUnaryFrag<not> (and_oneuse i64:$src0, i64:$src1)))]
733>;
734
735def S_NOR_B32 : SOP2_32 <"s_nor_b32",
736  [(set i32:$sdst, (UniformUnaryFrag<not> (or_oneuse i32:$src0, i32:$src1)))]
737>;
738
739def S_NOR_B64 : SOP2_64 <"s_nor_b64",
740  [(set i64:$sdst, (UniformUnaryFrag<not> (or_oneuse i64:$src0, i64:$src1)))]
741>;
742} // End isCommutable = 1
743
744// There are also separate patterns for types other than i32
745def S_ANDN2_B32 : SOP2_32 <"s_andn2_b32",
746  [(set i32:$sdst, (UniformBinFrag<and> i32:$src0, (UniformUnaryFrag<not> i32:$src1)))]
747>;
748
749def S_ANDN2_B64 : SOP2_64 <"s_andn2_b64",
750  [(set i64:$sdst, (UniformBinFrag<and> i64:$src0, (UniformUnaryFrag<not> i64:$src1)))]
751>;
752
753def S_ORN2_B32 : SOP2_32 <"s_orn2_b32",
754  [(set i32:$sdst, (UniformBinFrag<or> i32:$src0, (UniformUnaryFrag<not> i32:$src1)))]
755>;
756
757def S_ORN2_B64 : SOP2_64 <"s_orn2_b64",
758  [(set i64:$sdst, (UniformBinFrag<or> i64:$src0, (UniformUnaryFrag<not> i64:$src1)))]
759>;
760} // End Defs = [SCC]
761
762// Use added complexity so these patterns are preferred to the VALU patterns.
763let AddedComplexity = 1 in {
764
765let Defs = [SCC] in {
766// TODO: b64 versions require VOP3 change since v_lshlrev_b64 is VOP3
767def S_LSHL_B32 : SOP2_32 <"s_lshl_b32",
768  [(set SReg_32:$sdst, (UniformBinFrag<cshl_32> (i32 SSrc_b32:$src0), (i32 SSrc_b32:$src1)))]
769>;
770def S_LSHL_B64 : SOP2_64_32 <"s_lshl_b64",
771  [(set SReg_64:$sdst, (UniformBinFrag<cshl_64> (i64 SSrc_b64:$src0), (i32 SSrc_b32:$src1)))]
772>;
773def S_LSHR_B32 : SOP2_32 <"s_lshr_b32",
774  [(set SReg_32:$sdst, (UniformBinFrag<csrl_32> (i32 SSrc_b32:$src0), (i32 SSrc_b32:$src1)))]
775>;
776def S_LSHR_B64 : SOP2_64_32 <"s_lshr_b64",
777  [(set SReg_64:$sdst, (UniformBinFrag<csrl_64> (i64 SSrc_b64:$src0), (i32 SSrc_b32:$src1)))]
778>;
779def S_ASHR_I32 : SOP2_32 <"s_ashr_i32",
780  [(set SReg_32:$sdst, (UniformBinFrag<csra_32> (i32 SSrc_b32:$src0), (i32 SSrc_b32:$src1)))]
781>;
782def S_ASHR_I64 : SOP2_64_32 <"s_ashr_i64",
783  [(set SReg_64:$sdst, (UniformBinFrag<csra_64> (i64 SSrc_b64:$src0), (i32 SSrc_b32:$src1)))]
784>;
785} // End Defs = [SCC]
786
787let isReMaterializable = 1 in {
788def S_BFM_B32 : SOP2_32 <"s_bfm_b32",
789  [(set i32:$sdst, (UniformBinFrag<AMDGPUbfm> i32:$src0, i32:$src1))]>;
790def S_BFM_B64 : SOP2_64_32_32 <"s_bfm_b64">;
791
792def S_MUL_I32 : SOP2_32 <"s_mul_i32",
793  [(set i32:$sdst, (UniformBinFrag<mul> i32:$src0, i32:$src1))]> {
794  let isCommutable = 1;
795}
796} // End isReMaterializable = 1
797} // End AddedComplexity = 1
798
799let Defs = [SCC] in {
800def S_BFE_U32 : SOP2_32 <"s_bfe_u32">;
801def S_BFE_I32 : SOP2_32 <"s_bfe_i32">;
802def S_BFE_U64 : SOP2_64_32 <"s_bfe_u64">;
803def S_BFE_I64 : SOP2_64_32 <"s_bfe_i64">;
804} // End Defs = [SCC]
805
806def S_CBRANCH_G_FORK : SOP2_Pseudo <
807  "s_cbranch_g_fork", (outs),
808  (ins SCSrc_b64:$src0, SCSrc_b64:$src1),
809  "$src0, $src1"
810> {
811  let has_sdst = 0;
812  let SubtargetPredicate = isGFX6GFX7GFX8GFX9;
813}
814
815let Defs = [SCC] in {
816def S_ABSDIFF_I32 : SOP2_32 <"s_absdiff_i32">;
817} // End Defs = [SCC]
818
819let SubtargetPredicate = isGFX8GFX9 in {
820  def S_RFE_RESTORE_B64 : SOP2_Pseudo <
821    "s_rfe_restore_b64", (outs),
822    (ins SSrc_b64:$src0, SSrc_b32:$src1),
823    "$src0, $src1"
824  > {
825    let hasSideEffects = 1;
826    let has_sdst = 0;
827  }
828}
829
830let SubtargetPredicate = isGFX9Plus in {
831  let isReMaterializable = 1 in {
832    def S_PACK_LL_B32_B16 : SOP2_32<"s_pack_ll_b32_b16">;
833    def S_PACK_LH_B32_B16 : SOP2_32<"s_pack_lh_b32_b16">;
834    def S_PACK_HH_B32_B16 : SOP2_32<"s_pack_hh_b32_b16">;
835  } // End isReMaterializable = 1
836
837  let Defs = [SCC] in {
838    def S_LSHL1_ADD_U32 : SOP2_32<"s_lshl1_add_u32",
839      [(set i32:$sdst, (shl1_add SSrc_b32:$src0, SSrc_b32:$src1))]
840    >;
841    def S_LSHL2_ADD_U32 : SOP2_32<"s_lshl2_add_u32",
842      [(set i32:$sdst, (shl2_add SSrc_b32:$src0, SSrc_b32:$src1))]
843    >;
844    def S_LSHL3_ADD_U32 : SOP2_32<"s_lshl3_add_u32",
845      [(set i32:$sdst, (shl3_add SSrc_b32:$src0, SSrc_b32:$src1))]
846    >;
847    def S_LSHL4_ADD_U32 : SOP2_32<"s_lshl4_add_u32",
848      [(set i32:$sdst, (shl4_add SSrc_b32:$src0, SSrc_b32:$src1))]
849    >;
850  } // End Defs = [SCC]
851
852  let isCommutable = 1, isReMaterializable = 1 in {
853    def S_MUL_HI_U32 : SOP2_32<"s_mul_hi_u32",
854      [(set i32:$sdst, (UniformBinFrag<mulhu> SSrc_b32:$src0, SSrc_b32:$src1))]>;
855    def S_MUL_HI_I32 : SOP2_32<"s_mul_hi_i32",
856      [(set i32:$sdst, (UniformBinFrag<mulhs> SSrc_b32:$src0, SSrc_b32:$src1))]>;
857  } // End isCommutable = 1, isReMaterializable = 1
858} // End SubtargetPredicate = isGFX9Plus
859
860let SubtargetPredicate = isGFX11Plus in {
861  def S_PACK_HL_B32_B16 : SOP2_32<"s_pack_hl_b32_b16">;
862} // End SubtargetPredicate = isGFX11Plus
863
864class SOP2_F32_Inst<string opName, SDPatternOperator Op, ValueType dstVt=f32> :
865  SOP2_F32<opName,
866    [(set dstVt:$sdst, (UniformBinFrag<Op> SSrc_f32:$src0, SSrc_f32:$src1))]>;
867
868class SOP2_F16_Inst<string opName, SDPatternOperator Op> :
869  SOP2_F16<opName,
870    [(set f16:$sdst, (UniformBinFrag<Op> SSrc_f16:$src0, SSrc_f16:$src1))]>;
871
872let SubtargetPredicate = HasSALUFloatInsts, mayRaiseFPException = 1,
873    Uses = [MODE], SchedRW = [WriteSFPU] in {
874  let isReMaterializable = 1 in {
875    let isCommutable = 1 in {
876      def S_ADD_F32 : SOP2_F32_Inst<"s_add_f32", any_fadd>;
877      def S_MIN_F32 : SOP2_F32_Inst<"s_min_f32", fminnum_like>;
878      def S_MAX_F32 : SOP2_F32_Inst<"s_max_f32", fmaxnum_like>;
879      def S_MUL_F32 : SOP2_F32_Inst<"s_mul_f32", any_fmul>;
880
881      let FixedSize = 1 in
882      def S_FMAAK_F32 : SOP2_Pseudo<
883        "s_fmaak_f32", (outs SReg_32:$sdst),
884        (ins SSrc_f32_Deferred:$src0, SSrc_f32_Deferred:$src1, KImmFP32:$imm),
885        "$sdst, $src0, $src1, $imm"
886      >;
887
888      let FPDPRounding = 1 in {
889        def S_ADD_F16 : SOP2_F16_Inst<"s_add_f16", any_fadd>;
890        def S_MUL_F16 : SOP2_F16_Inst<"s_mul_f16", any_fmul>;
891      } // End FPDPRounding
892
893      def S_MIN_F16 : SOP2_F16_Inst<"s_min_f16", fminnum_like>;
894      def S_MAX_F16 : SOP2_F16_Inst<"s_max_f16", fmaxnum_like>;
895    } // End isCommutable = 1
896
897    let FPDPRounding = 1 in
898      def S_SUB_F16 : SOP2_F16_Inst<"s_sub_f16", any_fsub>;
899
900    def S_SUB_F32            : SOP2_F32_Inst<"s_sub_f32", any_fsub>;
901    def S_CVT_PK_RTZ_F16_F32 : SOP2_F32_Inst<"s_cvt_pk_rtz_f16_f32",
902                                             AMDGPUpkrtz_f16_f32, v2f16>;
903
904    let FixedSize = 1 in
905    def S_FMAMK_F32 : SOP2_Pseudo<
906      "s_fmamk_f32", (outs SReg_32:$sdst),
907      (ins SSrc_f32_Deferred:$src0, KImmFP32:$imm, SSrc_f32_Deferred:$src1),
908      "$sdst, $src0, $imm, $src1"
909    >;
910  } // End isReMaterializable = 1
911
912  let Constraints = "$sdst = $src2", DisableEncoding="$src2",
913      isCommutable = 1, AddedComplexity = 20 in {
914    def S_FMAC_F32 : SOP2_Pseudo<
915      "s_fmac_f32", (outs SReg_32:$sdst),
916      (ins SSrc_f32:$src0, SSrc_f32:$src1, SReg_32:$src2),
917      "$sdst, $src0, $src1",
918      [(set f32:$sdst, (UniformTernaryFrag<any_fma> SSrc_f32:$src0, SSrc_f32:$src1, SReg_32:$src2))]
919    >;
920
921    def S_FMAC_F16 : SOP2_Pseudo<
922      "s_fmac_f16", (outs SReg_32:$sdst),
923      (ins SSrc_f16:$src0, SSrc_f16:$src1, SReg_32:$src2),
924      "$sdst, $src0, $src1",
925      [(set f16:$sdst, (UniformTernaryFrag<any_fma> SSrc_f16:$src0, SSrc_f16:$src1, SReg_32:$src2))]
926    >;
927  } // End Constraints = "$sdst = $src2", DisableEncoding="$src2",
928    // isCommutable = 1, AddedComplexity = 20
929} // End SubtargetPredicate = HasSALUFloatInsts, mayRaiseFPException = 1,
930  // Uses = [MODE], SchedRW = [WriteSFPU]
931
932// On GFX12 MIN/MAX instructions do not read MODE register.
933let SubtargetPredicate = isGFX12Plus, mayRaiseFPException = 1, isCommutable = 1,
934    isReMaterializable = 1, SchedRW = [WriteSFPU] in {
935  def S_MINIMUM_F32 : SOP2_F32_Inst<"s_minimum_f32", fminimum>;
936  def S_MAXIMUM_F32 : SOP2_F32_Inst<"s_maximum_f32", fmaximum>;
937  def S_MINIMUM_F16 : SOP2_F16_Inst<"s_minimum_f16", fminimum>;
938  def S_MAXIMUM_F16 : SOP2_F16_Inst<"s_maximum_f16", fmaximum>;
939}
940
941//===----------------------------------------------------------------------===//
942// SOPK Instructions
943//===----------------------------------------------------------------------===//
944
945class SOPK_Pseudo <string opName, dag outs, dag ins,
946                   string asmOps, list<dag> pattern=[]> :
947  SOP_Pseudo<opName, outs, ins, " " # asmOps, pattern> {
948  let mayLoad = 0;
949  let mayStore = 0;
950  let hasSideEffects = 0;
951  let SALU = 1;
952  let SOPK = 1;
953  let FixedSize = 1;
954  let SchedRW = [WriteSALU];
955  let UseNamedOperandTable = 1;
956
957  let has_sdst = 1;
958}
959
960class SOPK_Real<SOPK_Pseudo ps, string real_name = ps.Mnemonic> :
961  InstSI <ps.OutOperandList, ps.InOperandList,
962          real_name # ps.AsmOperands> {
963  let SALU = 1;
964  let SOPK = 1;
965  let isPseudo = 0;
966  let isCodeGenOnly = 0;
967  let UseNamedOperandTable = 1;
968
969  // copy relevant pseudo op flags
970  let SubtargetPredicate = ps.SubtargetPredicate;
971  let AsmMatchConverter  = ps.AsmMatchConverter;
972  let DisableEncoding    = ps.DisableEncoding;
973  let Constraints        = ps.Constraints;
974  let SchedRW            = ps.SchedRW;
975  let mayLoad            = ps.mayLoad;
976  let mayStore           = ps.mayStore;
977  let isBranch           = ps.isBranch;
978  let isCall             = ps.isCall;
979
980  // encoding
981  bits<7>  sdst;
982  bits<16> simm16;
983  bits<32> imm;
984}
985
986class SOPK_Real32<bits<5> op, SOPK_Pseudo ps, string real_name = ps.Mnemonic> :
987  SOPK_Real <ps, real_name>,
988  Enc32 {
989  let Inst{15-0}  = simm16;
990  let Inst{22-16} = !if(ps.has_sdst, sdst, ?);
991  let Inst{27-23} = op;
992  let Inst{31-28} = 0xb; //encoding
993}
994
995class SOPK_Real64<bits<5> op, SOPK_Pseudo ps> :
996  SOPK_Real<ps>,
997  Enc64 {
998  let Inst{15-0}  = simm16;
999  let Inst{22-16} = !if(ps.has_sdst, sdst, ?);
1000  let Inst{27-23} = op;
1001  let Inst{31-28} = 0xb; //encoding
1002  let Inst{63-32} = imm;
1003}
1004
1005class SOPKInstTable <bit is_sopk, string cmpOp = ""> {
1006  bit IsSOPK = is_sopk;
1007  string BaseCmpOp = cmpOp;
1008}
1009
1010class SOPK_32 <string opName, list<dag> pattern=[]> : SOPK_Pseudo <
1011  opName,
1012  (outs SReg_32:$sdst),
1013  (ins s16imm:$simm16),
1014  "$sdst, $simm16",
1015  pattern>;
1016
1017class SOPK_32_BR <string opName, list<dag> pattern=[]> : SOPK_Pseudo <
1018  opName,
1019  (outs),
1020  (ins SOPPBrTarget:$simm16, SReg_32:$sdst),
1021  "$sdst, $simm16",
1022  pattern> {
1023  let Defs = [EXEC];
1024  let Uses = [EXEC];
1025  let isBranch = 1;
1026  let isTerminator = 1;
1027  let SchedRW = [WriteBranch];
1028}
1029
1030class SOPK_SCC <string opName, string base_op, bit isSignExt> : SOPK_Pseudo <
1031  opName,
1032  (outs),
1033  !if(isSignExt,
1034      (ins SReg_32:$sdst, s16imm:$simm16),
1035      (ins SReg_32:$sdst, u16imm:$simm16)),
1036  "$sdst, $simm16">,
1037  SOPKInstTable<1, base_op>{
1038  let Defs = [SCC];
1039}
1040
1041class SOPK_32TIE <string opName, list<dag> pattern=[]> : SOPK_Pseudo <
1042  opName,
1043  (outs SReg_32:$sdst),
1044  (ins SReg_32:$src0, s16imm:$simm16),
1045  "$sdst, $simm16",
1046  pattern
1047>;
1048
1049let isReMaterializable = 1, isMoveImm = 1 in {
1050def S_MOVK_I32 : SOPK_32 <"s_movk_i32">;
1051} // End isReMaterializable = 1
1052let Uses = [SCC] in {
1053def S_CMOVK_I32 : SOPK_32 <"s_cmovk_i32">;
1054}
1055
1056let isCompare = 1 in {
1057
1058// This instruction is disabled for now until we can figure out how to teach
1059// the instruction selector to correctly use the  S_CMP* vs V_CMP*
1060// instructions.
1061//
1062// When this instruction is enabled the code generator sometimes produces this
1063// invalid sequence:
1064//
1065// SCC = S_CMPK_EQ_I32 SGPR0, imm
1066// VCC = COPY SCC
1067// VGPR0 = V_CNDMASK VCC, VGPR0, VGPR1
1068//
1069// def S_CMPK_EQ_I32 : SOPK_SCC <"s_cmpk_eq_i32",
1070//   [(set i1:$dst, (setcc i32:$src0, imm:$src1, SETEQ))]
1071// >;
1072
1073def S_CMPK_EQ_I32 : SOPK_SCC <"s_cmpk_eq_i32", "s_cmp_eq_i32", 1>;
1074def S_CMPK_LG_I32 : SOPK_SCC <"s_cmpk_lg_i32", "s_cmp_lg_i32", 1>;
1075def S_CMPK_GT_I32 : SOPK_SCC <"s_cmpk_gt_i32", "s_cmp_gt_i32", 1>;
1076def S_CMPK_GE_I32 : SOPK_SCC <"s_cmpk_ge_i32", "s_cmp_ge_i32", 1>;
1077def S_CMPK_LT_I32 : SOPK_SCC <"s_cmpk_lt_i32", "s_cmp_lt_i32", 1>;
1078def S_CMPK_LE_I32 : SOPK_SCC <"s_cmpk_le_i32", "s_cmp_le_i32", 1>;
1079
1080let SOPKZext = 1 in {
1081def S_CMPK_EQ_U32 : SOPK_SCC <"s_cmpk_eq_u32", "s_cmp_eq_u32", 0>;
1082def S_CMPK_LG_U32 : SOPK_SCC <"s_cmpk_lg_u32", "s_cmp_lg_u32", 0>;
1083def S_CMPK_GT_U32 : SOPK_SCC <"s_cmpk_gt_u32", "s_cmp_gt_u32", 0>;
1084def S_CMPK_GE_U32 : SOPK_SCC <"s_cmpk_ge_u32", "s_cmp_ge_u32", 0>;
1085def S_CMPK_LT_U32 : SOPK_SCC <"s_cmpk_lt_u32", "s_cmp_lt_u32", 0>;
1086def S_CMPK_LE_U32 : SOPK_SCC <"s_cmpk_le_u32", "s_cmp_le_u32", 0>;
1087} // End SOPKZext = 1
1088} // End isCompare = 1
1089
1090let isCommutable = 1, DisableEncoding = "$src0",
1091    Constraints = "$sdst = $src0" in {
1092  let Defs = [SCC] in
1093    def S_ADDK_I32 : SOPK_32TIE <"s_addk_i32">;
1094  def S_MULK_I32 : SOPK_32TIE <"s_mulk_i32">;
1095}
1096
1097let SubtargetPredicate = isGFX6GFX7GFX8GFX9 in
1098def S_CBRANCH_I_FORK : SOPK_Pseudo <
1099  "s_cbranch_i_fork",
1100  (outs), (ins SReg_64:$sdst, SOPPBrTarget:$simm16),
1101  "$sdst, $simm16"
1102>;
1103
1104// This is hasSideEffects to allow its use in readcyclecounter selection.
1105// FIXME: Need to truncate immediate to 16-bits.
1106// FIXME: Missing mode register use. Should have separate pseudos for
1107// known may read MODE and only read MODE.
1108def S_GETREG_B32 : SOPK_Pseudo <
1109  "s_getreg_b32",
1110  (outs SReg_32:$sdst), (ins hwreg:$simm16),
1111  "$sdst, $simm16",
1112  [(set i32:$sdst, (int_amdgcn_s_getreg (i32 timm:$simm16)))]> {
1113  let SOPKZext = 1;
1114  let hasSideEffects = 1;
1115}
1116
1117let Defs = [MODE], Uses = [MODE] in {
1118
1119// FIXME: Need to truncate immediate to 16-bits.
1120class S_SETREG_B32_Pseudo <list<dag> pattern=[]> : SOPK_Pseudo <
1121  "s_setreg_b32",
1122  (outs), (ins SReg_32:$sdst, hwreg:$simm16),
1123  "$simm16, $sdst",
1124  pattern>;
1125
1126def S_SETREG_B32 : S_SETREG_B32_Pseudo <
1127  [(int_amdgcn_s_setreg (i32 timm:$simm16), i32:$sdst)]> {
1128  // Use custom inserter to optimize some cases to
1129  // S_DENORM_MODE/S_ROUND_MODE/S_SETREG_B32_mode.
1130  let usesCustomInserter = 1;
1131  let hasSideEffects = 1;
1132}
1133
1134// Variant of SETREG that is guaranteed to only touch FP bits in the MODE
1135// register, so doesn't have unmodeled side effects.
1136def S_SETREG_B32_mode : S_SETREG_B32_Pseudo {
1137  let hasSideEffects = 0;
1138}
1139
1140// FIXME: Not on SI?
1141//def S_GETREG_REGRD_B32 : SOPK_32 <sopk<0x14, 0x13>, "s_getreg_regrd_b32">;
1142
1143class S_SETREG_IMM32_B32_Pseudo : SOPK_Pseudo <
1144  "s_setreg_imm32_b32",
1145  (outs), (ins i32imm:$imm, hwreg:$simm16),
1146  "$simm16, $imm"> {
1147  let Size = 8; // Unlike every other SOPK instruction.
1148  let has_sdst = 0;
1149}
1150
1151def S_SETREG_IMM32_B32 : S_SETREG_IMM32_B32_Pseudo {
1152  let hasSideEffects = 1;
1153}
1154
1155// Variant of SETREG_IMM32 that is guaranteed to only touch FP bits in the MODE
1156// register, so doesn't have unmodeled side effects.
1157def S_SETREG_IMM32_B32_mode : S_SETREG_IMM32_B32_Pseudo {
1158  let hasSideEffects = 0;
1159}
1160
1161} // End Defs = [MODE], Uses = [MODE]
1162
1163class SOPK_WAITCNT<string opName, list<dag> pat=[]> :
1164    SOPK_Pseudo<
1165        opName,
1166        (outs),
1167        (ins SReg_32:$sdst, s16imm:$simm16),
1168        "$sdst, $simm16",
1169        pat> {
1170  let hasSideEffects = 1;
1171  let mayLoad = 1;
1172  let mayStore = 1;
1173  let has_sdst = 1; // First source takes place of sdst in encoding
1174}
1175
1176let SubtargetPredicate = isGFX9Plus in {
1177  def S_CALL_B64 : SOPK_Pseudo<
1178      "s_call_b64",
1179      (outs SReg_64:$sdst),
1180      (ins SOPPBrTarget:$simm16),
1181      "$sdst, $simm16"> {
1182    let isCall = 1;
1183  }
1184} // End SubtargetPredicate = isGFX9Plus
1185
1186let SubtargetPredicate = isGFX10Plus in {
1187  def S_VERSION : SOPK_Pseudo<
1188      "s_version",
1189      (outs),
1190      (ins s16imm:$simm16),
1191      "$simm16"> {
1192    let has_sdst = 0;
1193  }
1194} // End SubtargetPredicate = isGFX10Plus
1195
1196let SubtargetPredicate = isGFX10GFX11 in {
1197  def S_SUBVECTOR_LOOP_BEGIN : SOPK_32_BR<"s_subvector_loop_begin">;
1198  def S_SUBVECTOR_LOOP_END   : SOPK_32_BR<"s_subvector_loop_end">;
1199
1200  def S_WAITCNT_VSCNT   : SOPK_WAITCNT<"s_waitcnt_vscnt">;
1201  def S_WAITCNT_VMCNT   : SOPK_WAITCNT<"s_waitcnt_vmcnt">;
1202  def S_WAITCNT_EXPCNT  : SOPK_WAITCNT<"s_waitcnt_expcnt">;
1203  def S_WAITCNT_LGKMCNT : SOPK_WAITCNT<"s_waitcnt_lgkmcnt">;
1204} // End SubtargetPredicate = isGFX10GFX11
1205
1206//===----------------------------------------------------------------------===//
1207// SOPC Instructions
1208//===----------------------------------------------------------------------===//
1209
1210class SOPC_Pseudo<string opName, dag outs, dag ins,
1211                  string asmOps, list<dag> pattern=[]> :
1212  SOP_Pseudo<opName, outs, ins, " " # asmOps, pattern> {
1213  let mayLoad = 0;
1214  let mayStore = 0;
1215  let hasSideEffects = 0;
1216  let SALU = 1;
1217  let SOPC = 1;
1218  let Defs = [SCC];
1219  let SchedRW = [WriteSALU];
1220  let UseNamedOperandTable = 1;
1221}
1222
1223class SOPC_Real<bits<7> op, SOPC_Pseudo ps> :
1224  InstSI <ps.OutOperandList, ps.InOperandList,
1225          ps.Mnemonic # ps.AsmOperands>,
1226  Enc32 {
1227  let SALU = 1;
1228  let SOPC = 1;
1229  let isPseudo = 0;
1230  let isCodeGenOnly = 0;
1231
1232  // copy relevant pseudo op flags
1233  let SubtargetPredicate   = ps.SubtargetPredicate;
1234  let OtherPredicates      = ps.OtherPredicates;
1235  let AsmMatchConverter    = ps.AsmMatchConverter;
1236  let UseNamedOperandTable = ps.UseNamedOperandTable;
1237  let TSFlags              = ps.TSFlags;
1238  let SchedRW              = ps.SchedRW;
1239  let mayLoad              = ps.mayLoad;
1240  let mayStore             = ps.mayStore;
1241
1242  // encoding
1243  bits<8> src0;
1244  bits<8> src1;
1245
1246  let Inst{7-0} = src0;
1247  let Inst{15-8} = src1;
1248  let Inst{22-16} = op;
1249  let Inst{31-23} = 0x17e;
1250}
1251
1252class SOPC_Base <RegisterOperand rc0, RegisterOperand rc1,
1253                 string opName, list<dag> pattern = []> : SOPC_Pseudo <
1254  opName, (outs), (ins rc0:$src0, rc1:$src1),
1255  "$src0, $src1", pattern > {
1256}
1257
1258class SOPC_Helper <RegisterOperand rc, ValueType vt,
1259                    string opName, SDPatternOperator cond> : SOPC_Base <
1260  rc, rc, opName,
1261  [(set SCC, (UniformTernaryFrag<setcc> vt:$src0, vt:$src1, cond))] > {
1262}
1263
1264class SOPC_CMP_32<string opName,
1265                  SDPatternOperator cond = COND_NULL, string revOp = opName>
1266  : SOPC_Helper<SSrc_b32, i32, opName, cond>,
1267    Commutable_REV<revOp, !eq(revOp, opName)>,
1268    SOPKInstTable<0, opName> {
1269  let isCompare = 1;
1270  let isCommutable = 1;
1271}
1272
1273class SOPC_CMP_F32<string opName,
1274                  SDPatternOperator cond = COND_NULL, string revOp = opName>
1275  : SOPC_Helper<SSrc_b32, f32, opName, cond>,
1276    Commutable_REV<revOp, !eq(revOp, opName)>,
1277    SOPKInstTable<0, opName> {
1278  let isCompare = 1;
1279  let isCommutable = 1;
1280  let mayRaiseFPException = 1;
1281  let Uses = [MODE];
1282  let SchedRW = [WriteSFPU];
1283}
1284
1285class SOPC_CMP_F16<string opName,
1286                  SDPatternOperator cond = COND_NULL, string revOp = opName>
1287  : SOPC_Helper<SSrc_b16, f16, opName, cond>,
1288    Commutable_REV<revOp, !eq(revOp, opName)>,
1289    SOPKInstTable<0, opName> {
1290  let isCompare = 1;
1291  let isCommutable = 1;
1292  let mayRaiseFPException = 1;
1293  let Uses = [MODE];
1294  let SchedRW = [WriteSFPU];
1295}
1296
1297class SOPC_CMP_64<string opName,
1298                  SDPatternOperator cond = COND_NULL, string revOp = opName>
1299  : SOPC_Helper<SSrc_b64, i64, opName, cond>,
1300    Commutable_REV<revOp, !eq(revOp, opName)> {
1301  let isCompare = 1;
1302  let isCommutable = 1;
1303}
1304
1305class SOPC_32<string opName, list<dag> pattern = []>
1306  : SOPC_Base<SSrc_b32, SSrc_b32, opName, pattern>;
1307
1308class SOPC_64_32<string opName, list<dag> pattern = []>
1309  : SOPC_Base<SSrc_b64, SSrc_b32, opName, pattern>;
1310
1311def S_CMP_EQ_I32 : SOPC_CMP_32 <"s_cmp_eq_i32">;
1312def S_CMP_LG_I32 : SOPC_CMP_32 <"s_cmp_lg_i32">;
1313def S_CMP_GT_I32 : SOPC_CMP_32 <"s_cmp_gt_i32", COND_SGT>;
1314def S_CMP_GE_I32 : SOPC_CMP_32 <"s_cmp_ge_i32", COND_SGE>;
1315def S_CMP_LT_I32 : SOPC_CMP_32 <"s_cmp_lt_i32", COND_SLT, "s_cmp_gt_i32">;
1316def S_CMP_LE_I32 : SOPC_CMP_32 <"s_cmp_le_i32", COND_SLE, "s_cmp_ge_i32">;
1317def S_CMP_EQ_U32 : SOPC_CMP_32 <"s_cmp_eq_u32", COND_EQ>;
1318def S_CMP_LG_U32 : SOPC_CMP_32 <"s_cmp_lg_u32", COND_NE>;
1319def S_CMP_GT_U32 : SOPC_CMP_32 <"s_cmp_gt_u32", COND_UGT>;
1320def S_CMP_GE_U32 : SOPC_CMP_32 <"s_cmp_ge_u32", COND_UGE>;
1321def S_CMP_LT_U32 : SOPC_CMP_32 <"s_cmp_lt_u32", COND_ULT, "s_cmp_gt_u32">;
1322def S_CMP_LE_U32 : SOPC_CMP_32 <"s_cmp_le_u32", COND_ULE, "s_cmp_ge_u32">;
1323
1324def S_BITCMP0_B32 : SOPC_32 <"s_bitcmp0_b32">;
1325def S_BITCMP1_B32 : SOPC_32 <"s_bitcmp1_b32">;
1326def S_BITCMP0_B64 : SOPC_64_32 <"s_bitcmp0_b64">;
1327def S_BITCMP1_B64 : SOPC_64_32 <"s_bitcmp1_b64">;
1328let SubtargetPredicate = isGFX6GFX7GFX8GFX9 in
1329def S_SETVSKIP : SOPC_32 <"s_setvskip">;
1330
1331let SubtargetPredicate = isGFX8Plus in {
1332def S_CMP_EQ_U64 : SOPC_CMP_64 <"s_cmp_eq_u64", COND_EQ>;
1333def S_CMP_LG_U64 : SOPC_CMP_64 <"s_cmp_lg_u64", COND_NE>;
1334} // End SubtargetPredicate = isGFX8Plus
1335
1336let SubtargetPredicate = HasVGPRIndexMode in {
1337// Setting the GPR index mode is really writing the fields in the mode
1338// register. We don't want to add mode register uses to every
1339// instruction, and it's too complicated to deal with anyway. This is
1340// modeled just as a side effect.
1341def S_SET_GPR_IDX_ON : SOPC_Pseudo <
1342  "s_set_gpr_idx_on" ,
1343  (outs),
1344  (ins SSrc_b32:$src0, GPRIdxMode:$src1),
1345  "$src0, $src1"> {
1346  let Defs = [M0, MODE]; // No scc def
1347  let Uses = [M0, MODE]; // Other bits of mode, m0 unmodified.
1348  let hasSideEffects = 1; // Sets mode.gpr_idx_en
1349  let FixedSize = 1;
1350}
1351}
1352
1353let SubtargetPredicate = HasSALUFloatInsts in {
1354
1355def S_CMP_LT_F32  : SOPC_CMP_F32<"s_cmp_lt_f32", COND_OLT, "s_cmp_gt_f32">;
1356def S_CMP_EQ_F32  : SOPC_CMP_F32<"s_cmp_eq_f32", COND_OEQ>;
1357def S_CMP_LE_F32  : SOPC_CMP_F32<"s_cmp_le_f32", COND_OLE, "s_cmp_ge_f32">;
1358def S_CMP_GT_F32  : SOPC_CMP_F32<"s_cmp_gt_f32", COND_OGT>;
1359def S_CMP_LG_F32  : SOPC_CMP_F32<"s_cmp_lg_f32", COND_ONE>;
1360def S_CMP_GE_F32  : SOPC_CMP_F32<"s_cmp_ge_f32", COND_OGE>;
1361def S_CMP_O_F32   : SOPC_CMP_F32<"s_cmp_o_f32", COND_O>;
1362def S_CMP_U_F32   : SOPC_CMP_F32<"s_cmp_u_f32", COND_UO>;
1363def S_CMP_NGE_F32 : SOPC_CMP_F32<"s_cmp_nge_f32", COND_ULT, "s_cmp_nle_f32">;
1364def S_CMP_NLG_F32 : SOPC_CMP_F32<"s_cmp_nlg_f32", COND_UEQ>;
1365def S_CMP_NGT_F32 : SOPC_CMP_F32<"s_cmp_ngt_f32", COND_ULE, "s_cmp_nlt_f32">;
1366def S_CMP_NLE_F32 : SOPC_CMP_F32<"s_cmp_nle_f32", COND_UGT>;
1367def S_CMP_NEQ_F32 : SOPC_CMP_F32<"s_cmp_neq_f32", COND_UNE>;
1368def S_CMP_NLT_F32 : SOPC_CMP_F32<"s_cmp_nlt_f32", COND_UGE>;
1369
1370def S_CMP_LT_F16  : SOPC_CMP_F16<"s_cmp_lt_f16", COND_OLT, "s_cmp_gt_f16">;
1371def S_CMP_EQ_F16  : SOPC_CMP_F16<"s_cmp_eq_f16", COND_OEQ>;
1372def S_CMP_LE_F16  : SOPC_CMP_F16<"s_cmp_le_f16", COND_OLE, "s_cmp_ge_f16">;
1373def S_CMP_GT_F16  : SOPC_CMP_F16<"s_cmp_gt_f16", COND_OGT>;
1374def S_CMP_LG_F16  : SOPC_CMP_F16<"s_cmp_lg_f16", COND_ONE>;
1375def S_CMP_GE_F16  : SOPC_CMP_F16<"s_cmp_ge_f16", COND_OGE>;
1376def S_CMP_O_F16   : SOPC_CMP_F16<"s_cmp_o_f16", COND_O>;
1377def S_CMP_U_F16   : SOPC_CMP_F16<"s_cmp_u_f16", COND_UO>;
1378def S_CMP_NGE_F16 : SOPC_CMP_F16<"s_cmp_nge_f16", COND_ULT, "s_cmp_nle_f16">;
1379def S_CMP_NLG_F16 : SOPC_CMP_F16<"s_cmp_nlg_f16", COND_UEQ>;
1380def S_CMP_NGT_F16 : SOPC_CMP_F16<"s_cmp_ngt_f16", COND_ULE, "s_cmp_nlt_f16">;
1381def S_CMP_NLE_F16 : SOPC_CMP_F16<"s_cmp_nle_f16", COND_UGT>;
1382def S_CMP_NEQ_F16 : SOPC_CMP_F16<"s_cmp_neq_f16", COND_UNE>;
1383def S_CMP_NLT_F16 : SOPC_CMP_F16<"s_cmp_nlt_f16", COND_UGE>;
1384
1385} // End SubtargetPredicate = HasSALUFloatInsts
1386
1387//===----------------------------------------------------------------------===//
1388// SOPP Instructions
1389//===----------------------------------------------------------------------===//
1390
1391class SOPP_Pseudo<string opName, dag ins,
1392                  string asmOps = "", list<dag> pattern=[],
1393                  string sep = !if(!empty(asmOps), "", " "),
1394                  string keyName = opName> :
1395  SOP_Pseudo<opName, (outs), ins, sep # asmOps, pattern> {
1396  let mayLoad = 0;
1397  let mayStore = 0;
1398  let hasSideEffects = 0;
1399  let SALU = 1;
1400  let SOPP = 1;
1401  let FixedSize = 1;
1402  let SchedRW = [WriteSALU];
1403  let UseNamedOperandTable = 1;
1404  bits <16> simm16;
1405  bits <1> fixed_imm = 0;
1406  string KeyName = keyName;
1407}
1408
1409class SOPPRelaxTable <bit isRelaxed, string keyName, string gfxip> {
1410  bit IsRelaxed = isRelaxed;
1411  string KeyName = keyName # gfxip;
1412}
1413
1414class SOPP_Real<SOPP_Pseudo ps, string real_name = ps.Mnemonic> :
1415  InstSI <ps.OutOperandList, ps.InOperandList,
1416          real_name # ps.AsmOperands> {
1417  let SALU = 1;
1418  let SOPP = 1;
1419  let isPseudo = 0;
1420  let isCodeGenOnly = 0;
1421
1422  // copy relevant pseudo op flags
1423  let SubtargetPredicate   = ps.SubtargetPredicate;
1424  let OtherPredicates      = ps.OtherPredicates;
1425  let AsmMatchConverter    = ps.AsmMatchConverter;
1426  let UseNamedOperandTable = ps.UseNamedOperandTable;
1427  let TSFlags              = ps.TSFlags;
1428  let SchedRW              = ps.SchedRW;
1429  let mayLoad              = ps.mayLoad;
1430  let mayStore             = ps.mayStore;
1431  bits <16> simm16;
1432}
1433
1434class SOPP_Real_32 <bits<7> op, SOPP_Pseudo ps, string real_name = ps.Mnemonic> : SOPP_Real<ps, real_name>,
1435Enc32 {
1436  let Inst{15-0} = !if(ps.fixed_imm, ps.simm16, simm16);
1437  let Inst{22-16} = op;
1438  let Inst{31-23} = 0x17f;
1439}
1440
1441class SOPP_Real_64 <bits<7> op, SOPP_Pseudo ps, string real_name = ps.Mnemonic> : SOPP_Real<ps, real_name>,
1442Enc64 {
1443  // encoding
1444  let Inst{15-0} = !if(ps.fixed_imm, ps.simm16, simm16);
1445  let Inst{22-16} = op;
1446  let Inst{31-23} = 0x17f;
1447  //effectively a nop
1448  let Inst{47-32} = 0x0;
1449  let Inst{54-48} = 0x0;
1450  let Inst{63-55} = 0x17f;
1451}
1452
1453multiclass SOPP_With_Relaxation <string opName, dag ins,
1454                  string asmOps, list<dag> pattern=[]> {
1455  def "" : SOPP_Pseudo <opName, ins, asmOps, pattern>;
1456  def _pad_s_nop : SOPP_Pseudo <opName # "_pad_s_nop", ins, asmOps, pattern, " ", opName>;
1457}
1458
1459def S_NOP : SOPP_Pseudo<"s_nop" , (ins i16imm:$simm16), "$simm16",
1460  [(int_amdgcn_s_nop timm:$simm16)]> {
1461  let hasSideEffects = 1;
1462}
1463
1464let isTerminator = 1 in {
1465def S_ENDPGM : SOPP_Pseudo<"s_endpgm", (ins Endpgm:$simm16), "$simm16", [], ""> {
1466  let isBarrier = 1;
1467  let isReturn = 1;
1468  let hasSideEffects = 1;
1469}
1470
1471def S_ENDPGM_SAVED : SOPP_Pseudo<"s_endpgm_saved", (ins)> {
1472  let SubtargetPredicate = isGFX8Plus;
1473  let simm16 = 0;
1474  let fixed_imm = 1;
1475  let isBarrier = 1;
1476  let isReturn = 1;
1477}
1478
1479let SubtargetPredicate = isGFX9GFX10 in {
1480  let isBarrier = 1, isReturn = 1, simm16 = 0, fixed_imm = 1 in {
1481    def S_ENDPGM_ORDERED_PS_DONE :
1482      SOPP_Pseudo<"s_endpgm_ordered_ps_done", (ins)>;
1483  } // End isBarrier = 1, isReturn = 1, simm16 = 0, fixed_imm = 1
1484} // End SubtargetPredicate = isGFX9GFX10
1485
1486let SubtargetPredicate = isGFX10Plus in {
1487  let isBarrier = 1, isReturn = 1, simm16 = 0, fixed_imm = 1 in {
1488    def S_CODE_END :
1489      SOPP_Pseudo<"s_code_end", (ins)>;
1490  } // End isBarrier = 1, isReturn = 1, simm16 = 0, fixed_imm = 1
1491} // End SubtargetPredicate = isGFX10Plus
1492
1493let isBranch = 1, SchedRW = [WriteBranch] in {
1494let isBarrier = 1 in {
1495defm S_BRANCH : SOPP_With_Relaxation<
1496  "s_branch" , (ins SOPPBrTarget:$simm16), "$simm16",
1497  [(br bb:$simm16)]>;
1498}
1499
1500let Uses = [SCC] in {
1501defm S_CBRANCH_SCC0 : SOPP_With_Relaxation<
1502  "s_cbranch_scc0" , (ins SOPPBrTarget:$simm16),
1503  "$simm16"
1504>;
1505defm S_CBRANCH_SCC1 : SOPP_With_Relaxation <
1506  "s_cbranch_scc1" , (ins SOPPBrTarget:$simm16),
1507  "$simm16"
1508>;
1509} // End Uses = [SCC]
1510
1511let Uses = [VCC] in {
1512defm S_CBRANCH_VCCZ : SOPP_With_Relaxation <
1513  "s_cbranch_vccz" , (ins SOPPBrTarget:$simm16),
1514  "$simm16"
1515>;
1516defm S_CBRANCH_VCCNZ : SOPP_With_Relaxation <
1517  "s_cbranch_vccnz" , (ins SOPPBrTarget:$simm16),
1518  "$simm16"
1519>;
1520} // End Uses = [VCC]
1521
1522let Uses = [EXEC] in {
1523defm S_CBRANCH_EXECZ : SOPP_With_Relaxation <
1524  "s_cbranch_execz" , (ins SOPPBrTarget:$simm16),
1525  "$simm16"
1526>;
1527defm S_CBRANCH_EXECNZ : SOPP_With_Relaxation <
1528  "s_cbranch_execnz" , (ins SOPPBrTarget:$simm16),
1529  "$simm16"
1530>;
1531} // End Uses = [EXEC]
1532
1533defm S_CBRANCH_CDBGSYS : SOPP_With_Relaxation <
1534  "s_cbranch_cdbgsys" , (ins SOPPBrTarget:$simm16),
1535  "$simm16"
1536>;
1537
1538defm S_CBRANCH_CDBGSYS_AND_USER : SOPP_With_Relaxation <
1539  "s_cbranch_cdbgsys_and_user" , (ins SOPPBrTarget:$simm16),
1540  "$simm16"
1541>;
1542
1543defm S_CBRANCH_CDBGSYS_OR_USER : SOPP_With_Relaxation <
1544  "s_cbranch_cdbgsys_or_user" , (ins SOPPBrTarget:$simm16),
1545  "$simm16"
1546>;
1547
1548defm S_CBRANCH_CDBGUSER : SOPP_With_Relaxation <
1549  "s_cbranch_cdbguser" , (ins SOPPBrTarget:$simm16),
1550  "$simm16"
1551>;
1552
1553} // End isBranch = 1
1554} // End isTerminator = 1
1555
1556let hasSideEffects = 1 in {
1557def S_BARRIER : SOPP_Pseudo <"s_barrier", (ins), "",
1558  [(int_amdgcn_s_barrier)]> {
1559  let SchedRW = [WriteBarrier];
1560  let simm16 = 0;
1561  let fixed_imm = 1;
1562  let isConvergent = 1;
1563}
1564
1565def S_BARRIER_WAIT : SOPP_Pseudo <"s_barrier_wait", (ins i16imm:$simm16), "$simm16",
1566  [(int_amdgcn_s_barrier_wait timm:$simm16)]> {
1567  let SchedRW = [WriteBarrier];
1568  let isConvergent = 1;
1569}
1570
1571def S_BARRIER_LEAVE : SOPP_Pseudo <"s_barrier_leave", (ins), "",
1572  [(set SCC, (int_amdgcn_s_barrier_leave))]> {
1573  let SchedRW = [WriteBarrier];
1574  let simm16 = 0;
1575  let fixed_imm = 1;
1576  let isConvergent = 1;
1577  let Defs = [SCC];
1578}
1579
1580def S_WAKEUP : SOPP_Pseudo <"s_wakeup", (ins) > {
1581  let SubtargetPredicate = isGFX8Plus;
1582  let simm16 = 0;
1583  let fixed_imm = 1;
1584  let mayLoad = 1;
1585  let mayStore = 1;
1586}
1587
1588def S_WAITCNT : SOPP_Pseudo <"s_waitcnt" , (ins SWaitCnt:$simm16), "$simm16",
1589    [(int_amdgcn_s_waitcnt timm:$simm16)]>;
1590
1591// "_soft" waitcnts are waitcnts that are either relaxed into their non-soft
1592// counterpart, or completely removed.
1593//
1594// These are inserted by SIMemoryLegalizer to resolve memory dependencies
1595// and later optimized by SIInsertWaitcnts
1596// For example, a S_WAITCNT_soft 0 can be completely removed in a function
1597// that doesn't access memory.
1598def S_WAITCNT_soft : SOPP_Pseudo <"s_soft_waitcnt" , (ins SWaitCnt:$simm16), "$simm16">;
1599def S_WAITCNT_VSCNT_soft : SOPK_WAITCNT<"s_soft_waitcnt_vscnt">;
1600
1601def S_SETHALT : SOPP_Pseudo <"s_sethalt" , (ins i32imm:$simm16), "$simm16",
1602    [(int_amdgcn_s_sethalt timm:$simm16)]>;
1603def S_SETKILL : SOPP_Pseudo <"s_setkill" , (ins i16imm:$simm16), "$simm16">;
1604
1605// On SI the documentation says sleep for approximately 64 * low 2
1606// bits, consistent with the reported maximum of 448. On VI the
1607// maximum reported is 960 cycles, so 960 / 64 = 15 max, so is the
1608// maximum really 15 on VI?
1609def S_SLEEP : SOPP_Pseudo <"s_sleep", (ins i32imm:$simm16),
1610  "$simm16", [(int_amdgcn_s_sleep timm:$simm16)]> {
1611}
1612
1613def S_SLEEP_VAR : SOP1_0_32 <"s_sleep_var", [(int_amdgcn_s_sleep_var SSrc_b32:$src0)]> {
1614  let hasSideEffects = 1;
1615}
1616
1617def S_SETPRIO : SOPP_Pseudo <"s_setprio", (ins i16imm:$simm16), "$simm16",
1618  [(int_amdgcn_s_setprio timm:$simm16)]> {
1619}
1620
1621let Uses = [EXEC, M0] in {
1622def S_SENDMSG : SOPP_Pseudo <"s_sendmsg" , (ins SendMsg:$simm16), "$simm16",
1623  [(int_amdgcn_s_sendmsg (i32 timm:$simm16), M0)]> {
1624}
1625
1626def S_SENDMSGHALT : SOPP_Pseudo <"s_sendmsghalt" , (ins SendMsg:$simm16), "$simm16",
1627  [(int_amdgcn_s_sendmsghalt (i32 timm:$simm16), M0)]> {
1628}
1629
1630} // End Uses = [EXEC, M0]
1631
1632def S_TRAP : SOPP_Pseudo <"s_trap" , (ins i16imm:$simm16), "$simm16"> {
1633  let isTrap = 1;
1634}
1635
1636def S_ICACHE_INV : SOPP_Pseudo <"s_icache_inv", (ins)> {
1637  let simm16 = 0;
1638  let fixed_imm = 1;
1639}
1640def S_INCPERFLEVEL : SOPP_Pseudo <"s_incperflevel", (ins i32imm:$simm16), "$simm16",
1641  [(int_amdgcn_s_incperflevel timm:$simm16)]> {
1642}
1643def S_DECPERFLEVEL : SOPP_Pseudo <"s_decperflevel", (ins i32imm:$simm16), "$simm16",
1644  [(int_amdgcn_s_decperflevel timm:$simm16)]> {
1645}
1646
1647let Uses = [M0] in
1648def S_TTRACEDATA : SOPP_Pseudo <"s_ttracedata", (ins), "",
1649                                [(int_amdgcn_s_ttracedata M0)]> {
1650  let simm16 = 0;
1651  let fixed_imm = 1;
1652}
1653
1654let SubtargetPredicate = HasVGPRIndexMode in {
1655def S_SET_GPR_IDX_OFF : SOPP_Pseudo<"s_set_gpr_idx_off", (ins) > {
1656  let simm16 = 0;
1657  let fixed_imm = 1;
1658  let Defs = [MODE];
1659  let Uses = [MODE];
1660}
1661}
1662} // End hasSideEffects
1663
1664let SubtargetPredicate = HasVGPRIndexMode in {
1665def S_SET_GPR_IDX_MODE : SOPP_Pseudo<"s_set_gpr_idx_mode", (ins GPRIdxMode:$simm16),
1666  "$simm16"> {
1667  let Defs = [M0, MODE];
1668  let Uses = [MODE];
1669}
1670}
1671
1672let SubtargetPredicate = isGFX10Plus in {
1673  def S_INST_PREFETCH :
1674    SOPP_Pseudo<"s_inst_prefetch", (ins s16imm:$simm16), "$simm16">;
1675  def S_CLAUSE :
1676    SOPP_Pseudo<"s_clause", (ins s16imm:$simm16), "$simm16">;
1677  def S_WAIT_IDLE :
1678    SOPP_Pseudo <"s_wait_idle", (ins)> {
1679      let simm16 = 0;
1680      let fixed_imm = 1;
1681    }
1682  def S_WAITCNT_DEPCTR :
1683    SOPP_Pseudo <"s_waitcnt_depctr" , (ins DepCtr:$simm16), "$simm16">;
1684
1685  let hasSideEffects = 0, Uses = [MODE], Defs = [MODE] in {
1686    def S_ROUND_MODE :
1687      SOPP_Pseudo<"s_round_mode", (ins s16imm:$simm16), "$simm16">;
1688    def S_DENORM_MODE :
1689      SOPP_Pseudo<"s_denorm_mode", (ins i32imm:$simm16), "$simm16",
1690      [(SIdenorm_mode (i32 timm:$simm16))]>;
1691  }
1692
1693  let hasSideEffects = 1 in
1694  def S_TTRACEDATA_IMM :
1695    SOPP_Pseudo<"s_ttracedata_imm", (ins s16imm:$simm16), "$simm16",
1696                [(int_amdgcn_s_ttracedata_imm timm:$simm16)]>;
1697} // End SubtargetPredicate = isGFX10Plus
1698
1699let SubtargetPredicate = isGFX11Plus in {
1700  def S_WAIT_EVENT : SOPP_Pseudo<"s_wait_event", (ins s16imm:$simm16),
1701                                 "$simm16"> {
1702                                   let hasSideEffects = 1;
1703                                 }
1704  def S_DELAY_ALU : SOPP_Pseudo<"s_delay_alu", (ins SDelayALU:$simm16),
1705                                "$simm16">;
1706} // End SubtargetPredicate = isGFX11Plus
1707
1708let SubtargetPredicate = HasVGPRSingleUseHintInsts in {
1709  def S_SINGLEUSE_VDST :
1710    SOPP_Pseudo<"s_singleuse_vdst", (ins s16imm:$simm16), "$simm16">;
1711} // End SubtargetPredicate = HasVGPRSingeUseHintInsts
1712
1713let SubtargetPredicate = isGFX12Plus, hasSideEffects = 1 in {
1714  def S_WAIT_LOADCNT :
1715    SOPP_Pseudo<"s_wait_loadcnt", (ins s16imm:$simm16), "$simm16">;
1716  def S_WAIT_LOADCNT_DSCNT :
1717    SOPP_Pseudo<"s_wait_loadcnt_dscnt", (ins s16imm:$simm16), "$simm16">;
1718  def S_WAIT_STORECNT :
1719    SOPP_Pseudo<"s_wait_storecnt", (ins s16imm:$simm16), "$simm16">;
1720  def S_WAIT_STORECNT_DSCNT :
1721    SOPP_Pseudo<"s_wait_storecnt_dscnt", (ins s16imm:$simm16), "$simm16">;
1722  def S_WAIT_SAMPLECNT :
1723    SOPP_Pseudo<"s_wait_samplecnt", (ins s16imm:$simm16), "$simm16">;
1724  def S_WAIT_BVHCNT :
1725    SOPP_Pseudo<"s_wait_bvhcnt", (ins s16imm:$simm16), "$simm16">;
1726  def S_WAIT_EXPCNT :
1727    SOPP_Pseudo<"s_wait_expcnt", (ins s16imm:$simm16), "$simm16">;
1728  def S_WAIT_DSCNT :
1729    SOPP_Pseudo<"s_wait_dscnt", (ins s16imm:$simm16), "$simm16">;
1730  def S_WAIT_KMCNT :
1731    SOPP_Pseudo<"s_wait_kmcnt", (ins s16imm:$simm16), "$simm16">;
1732} // End SubtargetPredicate = isGFX12Plus, hasSideEffects = 1
1733
1734//===----------------------------------------------------------------------===//
1735// SOP1 Patterns
1736//===----------------------------------------------------------------------===//
1737
1738def : GCNPat <
1739  (AMDGPUendpgm),
1740    (S_ENDPGM (i16 0))
1741>;
1742
1743def : GCNPat <
1744  (int_amdgcn_endpgm),
1745    (S_ENDPGM (i16 0))
1746>;
1747
1748def : GCNPat <
1749  (i64 (UniformUnaryFrag<ctpop> i64:$src)),
1750    (i64 (REG_SEQUENCE SReg_64,
1751     (i32 (COPY_TO_REGCLASS (S_BCNT1_I32_B64 $src), SReg_32)), sub0,
1752     (S_MOV_B32 (i32 0)), sub1))
1753>;
1754
1755def : GCNPat <
1756  (i32 (UniformBinFrag<smax> i32:$x, (i32 (ineg i32:$x)))),
1757  (S_ABS_I32 SReg_32:$x)
1758>;
1759
1760def : GCNPat <
1761  (i16 imm:$imm),
1762  (S_MOV_B32 imm:$imm)
1763>;
1764
1765// Same as a 32-bit inreg
1766def : GCNPat<
1767  (i32 (UniformUnaryFrag<sext> i16:$src)),
1768  (S_SEXT_I32_I16 $src)
1769>;
1770
1771def : GCNPat <
1772  (int_amdgcn_s_wait_event_export_ready),
1773    (S_WAIT_EVENT (i16 0))
1774>;
1775
1776// The first 10 bits of the mode register are the core FP mode on all
1777// subtargets.
1778//
1779// The high bits include additional fields, intermixed with some
1780// non-floating point environment information. We extract the full
1781// register and clear non-relevant bits.
1782//
1783// EXCP_EN covers floating point exceptions, but also some other
1784// non-FP exceptions.
1785//
1786// Bits 12-18 cover the relevant exception mask on all subtargets.
1787//
1788// FIXME: Bit 18 is int_div0, should this be in the FP environment? I
1789// think the only source is v_rcp_iflag_i32.
1790//
1791// On GFX9+:
1792// Bit 23 is the additional FP16_OVFL mode.
1793//
1794// Bits 19, 20, and 21 cover non-FP exceptions and differ between
1795// gfx9/10/11, so we ignore them here.
1796
1797// TODO: Would it be cheaper to emit multiple s_getreg_b32 calls for
1798// the ranges and combine the results?
1799
1800defvar fp_round_mask = !add(!shl(1, 4), -1);
1801defvar fp_denorm_mask = !shl(!add(!shl(1, 4), -1), 4);
1802defvar dx10_clamp_mask = !shl(1, 8);
1803defvar ieee_mode_mask = !shl(1, 9);
1804
1805// Covers fp_round, fp_denorm, dx10_clamp, and IEEE bit.
1806defvar fpmode_mask =
1807  !or(fp_round_mask, fp_denorm_mask, dx10_clamp_mask, ieee_mode_mask);
1808
1809defvar fp_excp_en_mask = !shl(!add(!shl(1, 7), -1), 12);
1810defvar fp16_ovfl = !shl(1, 23);
1811defvar fpmode_mask_gfx6plus = !or(fpmode_mask, fp_excp_en_mask);
1812defvar fpmode_mask_gfx9plus = !or(fpmode_mask_gfx6plus, fp16_ovfl);
1813
1814class GetFPModePat<int fpmode_mask> : GCNPat<
1815  (i32 get_fpmode),
1816  (S_AND_B32 (i32 fpmode_mask),
1817             (S_GETREG_B32 getHwRegImm<
1818                HWREG.MODE, 0,
1819                !add(!logtwo(fpmode_mask), 1)>.ret))
1820>;
1821
1822// TODO: Might be worth moving to custom lowering so the and is
1823// exposed to demanded bits optimizations. Most users probably only
1824// care about the rounding or denorm mode bits. We also can reduce the
1825// demanded read from the getreg immediate.
1826let SubtargetPredicate = isGFX9Plus in {
1827// Last bit = FP16_OVFL
1828def : GetFPModePat<fpmode_mask_gfx9plus>;
1829}
1830
1831// Last bit = EXCP_EN.int_div0
1832let SubtargetPredicate = isNotGFX9Plus in {
1833def : GetFPModePat<fpmode_mask_gfx6plus>;
1834}
1835
1836//===----------------------------------------------------------------------===//
1837// SOP2 Patterns
1838//===----------------------------------------------------------------------===//
1839
1840def UniformSelect : PatFrag<
1841  (ops node:$src0, node:$src1),
1842  (select SCC, $src0, $src1),
1843  [{ return !N->isDivergent(); }]
1844>;
1845
1846let AddedComplexity = 20 in {
1847  def : GCNPat<
1848    (i32 (UniformSelect i32:$src0, i32:$src1)),
1849    (S_CSELECT_B32 SSrc_b32:$src0, SSrc_b32:$src1)
1850  >;
1851
1852  // TODO: The predicate should not be necessary, but enabling this pattern for
1853  // all subtargets generates worse code in some cases.
1854  let OtherPredicates = [HasPseudoScalarTrans] in
1855  def : GCNPat<
1856    (f32 (UniformSelect f32:$src0, f32:$src1)),
1857    (S_CSELECT_B32 SSrc_b32:$src0, SSrc_b32:$src1)
1858  >;
1859}
1860
1861// V_ADD_I32_e32/S_ADD_U32 produces carry in VCC/SCC. For the vector
1862// case, the sgpr-copies pass will fix this to use the vector version.
1863def : GCNPat <
1864  (i32 (addc i32:$src0, i32:$src1)),
1865  (S_ADD_U32 $src0, $src1)
1866>;
1867
1868// FIXME: We need to use COPY_TO_REGCLASS to work-around the fact that
1869// REG_SEQUENCE patterns don't support instructions with multiple
1870// outputs.
1871def : GCNPat<
1872  (i64 (UniformUnaryFrag<zext> i16:$src)),
1873    (REG_SEQUENCE SReg_64,
1874      (i32 (COPY_TO_REGCLASS (S_AND_B32 $src, (S_MOV_B32 (i32 0xffff))), SGPR_32)), sub0,
1875      (S_MOV_B32 (i32 0)), sub1)
1876>;
1877
1878def : GCNPat <
1879  (i64 (UniformUnaryFrag<sext> i16:$src)),
1880    (REG_SEQUENCE SReg_64, (i32 (S_SEXT_I32_I16 $src)), sub0,
1881    (i32 (COPY_TO_REGCLASS (S_ASHR_I32 (i32 (S_SEXT_I32_I16 $src)), (S_MOV_B32 (i32 31))), SGPR_32)), sub1)
1882>;
1883
1884def : GCNPat<
1885  (i32 (UniformUnaryFrag<zext> i16:$src)),
1886  (S_AND_B32 (S_MOV_B32 (i32 0xffff)), $src)
1887>;
1888
1889// FIXME: ValueType should have isVector field
1890class ScalarNot2Pat<Instruction inst, SDPatternOperator op, ValueType vt,
1891                    bit isVector = 1> : GCNPat<
1892  (UniformBinFrag<op> vt:$src0, (UniformUnaryFrag<!if(isVector, vnot, not)> vt:$src1)),
1893  (inst getSOPSrcForVT<vt>.ret:$src0, getSOPSrcForVT<vt>.ret:$src1)
1894>;
1895
1896// Match these for some more types
1897// TODO: i1
1898def : ScalarNot2Pat<S_ANDN2_B32, and, i16, 0>;
1899def : ScalarNot2Pat<S_ANDN2_B32, and, v2i16>;
1900def : ScalarNot2Pat<S_ANDN2_B64, and, v4i16>;
1901def : ScalarNot2Pat<S_ANDN2_B64, and, v2i32>;
1902
1903def : ScalarNot2Pat<S_ORN2_B32, or, i16, 0>;
1904def : ScalarNot2Pat<S_ORN2_B32, or, v2i16>;
1905def : ScalarNot2Pat<S_ORN2_B64, or, v4i16>;
1906def : ScalarNot2Pat<S_ORN2_B64, or, v2i32>;
1907
1908//===----------------------------------------------------------------------===//
1909// Target-specific instruction encodings.
1910//===----------------------------------------------------------------------===//
1911
1912class Select_gfx12<string opName> : SIMCInstr<opName, SIEncodingFamily.GFX12> {
1913  Predicate AssemblerPredicate = isGFX12Only;
1914  string DecoderNamespace      = "GFX12";
1915}
1916
1917class Select_gfx11<string opName> : SIMCInstr<opName, SIEncodingFamily.GFX11> {
1918  Predicate AssemblerPredicate = isGFX11Only;
1919  string DecoderNamespace      = "GFX11";
1920}
1921
1922class Select_gfx10<string opName> : SIMCInstr<opName, SIEncodingFamily.GFX10> {
1923  Predicate AssemblerPredicate = isGFX10Only;
1924  string DecoderNamespace      = "GFX10";
1925}
1926
1927class Select_vi<string opName> : SIMCInstr<opName, SIEncodingFamily.VI> {
1928  Predicate AssemblerPredicate = isGFX8GFX9;
1929  string DecoderNamespace = "GFX8";
1930}
1931
1932class Select_gfx6_gfx7<string opName> : SIMCInstr<opName, SIEncodingFamily.SI> {
1933  Predicate AssemblerPredicate = isGFX6GFX7;
1934  string DecoderNamespace      = "GFX6GFX7";
1935}
1936
1937//===----------------------------------------------------------------------===//
1938//  SOP1 - GFX11, GFX12
1939//===----------------------------------------------------------------------===//
1940
1941multiclass SOP1_Real_gfx12<bits<8> op> {
1942  def _gfx12 : SOP1_Real<op, !cast<SOP1_Pseudo>(NAME)>,
1943               Select_gfx12<!cast<SOP1_Pseudo>(NAME).Mnemonic>;
1944}
1945
1946multiclass SOP1_M0_Real_gfx12<bits<8> op> {
1947  def _gfx12 : SOP1_Real<op, !cast<SOP1_Pseudo>(NAME)>,
1948               Select_gfx12<!cast<SOP1_Pseudo>(NAME).Mnemonic> {
1949    let Inst{7-0} = M0_gfx11plus.HWEncoding{7-0}; // Set Src0 encoding to M0
1950  }
1951}
1952
1953multiclass SOP1_Real_gfx11<bits<8> op> {
1954  def _gfx11 : SOP1_Real<op, !cast<SOP1_Pseudo>(NAME)>,
1955               Select_gfx11<!cast<SOP1_Pseudo>(NAME).Mnemonic>;
1956}
1957
1958multiclass SOP1_Real_Renamed_gfx12<bits<8> op, SOP1_Pseudo backing_pseudo, string real_name> {
1959  def _gfx12 : SOP1_Real<op, backing_pseudo, real_name>,
1960               Select_gfx12<backing_pseudo.Mnemonic>,
1961               MnemonicAlias<backing_pseudo.Mnemonic, real_name>, Requires<[isGFX12Plus]>;
1962}
1963
1964multiclass SOP1_Real_Renamed_gfx11<bits<8> op, SOP1_Pseudo backing_pseudo, string real_name> {
1965  def _gfx11 : SOP1_Real<op, backing_pseudo, real_name>,
1966               Select_gfx11<backing_pseudo.Mnemonic>,
1967               MnemonicAlias<backing_pseudo.Mnemonic, real_name>, Requires<[isGFX11Only]>;
1968}
1969
1970multiclass SOP1_Real_gfx11_gfx12<bits<8> op> :
1971  SOP1_Real_gfx11<op>, SOP1_Real_gfx12<op>;
1972
1973multiclass SOP1_Real_Renamed_gfx11_gfx12<bits<8> op, SOP1_Pseudo backing_pseudo, string real_name> :
1974  SOP1_Real_Renamed_gfx11<op, backing_pseudo, real_name>,
1975  SOP1_Real_Renamed_gfx12<op, backing_pseudo, real_name>;
1976
1977defm S_MOV_B32                    : SOP1_Real_gfx11_gfx12<0x000>;
1978defm S_MOV_B64                    : SOP1_Real_gfx11_gfx12<0x001>;
1979defm S_CMOV_B32                   : SOP1_Real_gfx11_gfx12<0x002>;
1980defm S_CMOV_B64                   : SOP1_Real_gfx11_gfx12<0x003>;
1981defm S_BREV_B32                   : SOP1_Real_gfx11_gfx12<0x004>;
1982defm S_BREV_B64                   : SOP1_Real_gfx11_gfx12<0x005>;
1983defm S_CTZ_I32_B32                : SOP1_Real_Renamed_gfx11_gfx12<0x008, S_FF1_I32_B32, "s_ctz_i32_b32">;
1984defm S_CTZ_I32_B64                : SOP1_Real_Renamed_gfx11_gfx12<0x009, S_FF1_I32_B64, "s_ctz_i32_b64">;
1985defm S_CLZ_I32_U32                : SOP1_Real_Renamed_gfx11_gfx12<0x00a, S_FLBIT_I32_B32, "s_clz_i32_u32">;
1986defm S_CLZ_I32_U64                : SOP1_Real_Renamed_gfx11_gfx12<0x00b, S_FLBIT_I32_B64, "s_clz_i32_u64">;
1987defm S_CLS_I32                    : SOP1_Real_Renamed_gfx11_gfx12<0x00c, S_FLBIT_I32, "s_cls_i32">;
1988defm S_CLS_I32_I64                : SOP1_Real_Renamed_gfx11_gfx12<0x00d, S_FLBIT_I32_I64, "s_cls_i32_i64">;
1989defm S_SEXT_I32_I8                : SOP1_Real_gfx11_gfx12<0x00e>;
1990defm S_SEXT_I32_I16               : SOP1_Real_gfx11_gfx12<0x00f>;
1991defm S_BITSET0_B32                : SOP1_Real_gfx11_gfx12<0x010>;
1992defm S_BITSET0_B64                : SOP1_Real_gfx11_gfx12<0x011>;
1993defm S_BITSET1_B32                : SOP1_Real_gfx11_gfx12<0x012>;
1994defm S_BITSET1_B64                : SOP1_Real_gfx11_gfx12<0x013>;
1995defm S_BITREPLICATE_B64_B32       : SOP1_Real_gfx11_gfx12<0x014>;
1996defm S_ABS_I32                    : SOP1_Real_gfx11_gfx12<0x015>;
1997defm S_BCNT0_I32_B32              : SOP1_Real_gfx11_gfx12<0x016>;
1998defm S_BCNT0_I32_B64              : SOP1_Real_gfx11_gfx12<0x017>;
1999defm S_BCNT1_I32_B32              : SOP1_Real_gfx11_gfx12<0x018>;
2000defm S_BCNT1_I32_B64              : SOP1_Real_gfx11_gfx12<0x019>;
2001defm S_QUADMASK_B32               : SOP1_Real_gfx11_gfx12<0x01a>;
2002defm S_QUADMASK_B64               : SOP1_Real_gfx11_gfx12<0x01b>;
2003defm S_WQM_B32                    : SOP1_Real_gfx11_gfx12<0x01c>;
2004defm S_WQM_B64                    : SOP1_Real_gfx11_gfx12<0x01d>;
2005defm S_NOT_B32                    : SOP1_Real_gfx11_gfx12<0x01e>;
2006defm S_NOT_B64                    : SOP1_Real_gfx11_gfx12<0x01f>;
2007defm S_AND_SAVEEXEC_B32           : SOP1_Real_gfx11_gfx12<0x020>;
2008defm S_AND_SAVEEXEC_B64           : SOP1_Real_gfx11_gfx12<0x021>;
2009defm S_OR_SAVEEXEC_B32            : SOP1_Real_gfx11_gfx12<0x022>;
2010defm S_OR_SAVEEXEC_B64            : SOP1_Real_gfx11_gfx12<0x023>;
2011defm S_XOR_SAVEEXEC_B32           : SOP1_Real_gfx11_gfx12<0x024>;
2012defm S_XOR_SAVEEXEC_B64           : SOP1_Real_gfx11_gfx12<0x025>;
2013defm S_NAND_SAVEEXEC_B32          : SOP1_Real_gfx11_gfx12<0x026>;
2014defm S_NAND_SAVEEXEC_B64          : SOP1_Real_gfx11_gfx12<0x027>;
2015defm S_NOR_SAVEEXEC_B32           : SOP1_Real_gfx11_gfx12<0x028>;
2016defm S_NOR_SAVEEXEC_B64           : SOP1_Real_gfx11_gfx12<0x029>;
2017defm S_XNOR_SAVEEXEC_B32          : SOP1_Real_gfx11_gfx12<0x02a>;
2018/*defm S_XNOR_SAVEEXEC_B64        : SOP1_Real_gfx11_gfx12<0x02b>; //same as older arch, handled there*/
2019defm S_AND_NOT0_SAVEEXEC_B32      : SOP1_Real_Renamed_gfx11_gfx12<0x02c, S_ANDN1_SAVEEXEC_B32, "s_and_not0_saveexec_b32">;
2020defm S_AND_NOT0_SAVEEXEC_B64      : SOP1_Real_Renamed_gfx11_gfx12<0x02d, S_ANDN1_SAVEEXEC_B64, "s_and_not0_saveexec_b64">;
2021defm S_OR_NOT0_SAVEEXEC_B32       : SOP1_Real_Renamed_gfx11_gfx12<0x02e, S_ORN1_SAVEEXEC_B32, "s_or_not0_saveexec_b32">;
2022defm S_OR_NOT0_SAVEEXEC_B64       : SOP1_Real_Renamed_gfx11_gfx12<0x02f, S_ORN1_SAVEEXEC_B64, "s_or_not0_saveexec_b64">;
2023defm S_AND_NOT1_SAVEEXEC_B32      : SOP1_Real_Renamed_gfx11_gfx12<0x030, S_ANDN2_SAVEEXEC_B32, "s_and_not1_saveexec_b32">;
2024defm S_AND_NOT1_SAVEEXEC_B64      : SOP1_Real_Renamed_gfx11_gfx12<0x031, S_ANDN2_SAVEEXEC_B64, "s_and_not1_saveexec_b64">;
2025defm S_OR_NOT1_SAVEEXEC_B32       : SOP1_Real_Renamed_gfx11_gfx12<0x032, S_ORN2_SAVEEXEC_B32, "s_or_not1_saveexec_b32">;
2026defm S_OR_NOT1_SAVEEXEC_B64       : SOP1_Real_Renamed_gfx11_gfx12<0x033, S_ORN2_SAVEEXEC_B64, "s_or_not1_saveexec_b64">;
2027defm S_AND_NOT0_WREXEC_B32        : SOP1_Real_Renamed_gfx11_gfx12<0x034, S_ANDN1_WREXEC_B32, "s_and_not0_wrexec_b32">;
2028defm S_AND_NOT0_WREXEC_B64        : SOP1_Real_Renamed_gfx11_gfx12<0x035, S_ANDN1_WREXEC_B64, "s_and_not0_wrexec_b64">;
2029defm S_AND_NOT1_WREXEC_B32        : SOP1_Real_Renamed_gfx11_gfx12<0x036, S_ANDN2_WREXEC_B32, "s_and_not1_wrexec_b32">;
2030defm S_AND_NOT1_WREXEC_B64        : SOP1_Real_Renamed_gfx11_gfx12<0x037, S_ANDN2_WREXEC_B64, "s_and_not1_wrexec_b64">;
2031defm S_MOVRELS_B32                : SOP1_Real_gfx11_gfx12<0x040>;
2032defm S_MOVRELS_B64                : SOP1_Real_gfx11_gfx12<0x041>;
2033defm S_MOVRELD_B32                : SOP1_Real_gfx11_gfx12<0x042>;
2034defm S_MOVRELD_B64                : SOP1_Real_gfx11_gfx12<0x043>;
2035defm S_MOVRELSD_2_B32             : SOP1_Real_gfx11_gfx12<0x044>;
2036defm S_GETPC_B64                  : SOP1_Real_gfx11_gfx12<0x047>;
2037defm S_SETPC_B64                  : SOP1_Real_gfx11_gfx12<0x048>;
2038defm S_SWAPPC_B64                 : SOP1_Real_gfx11_gfx12<0x049>;
2039defm S_RFE_B64                    : SOP1_Real_gfx11_gfx12<0x04a>;
2040defm S_SENDMSG_RTN_B32            : SOP1_Real_gfx11_gfx12<0x04c>;
2041defm S_SENDMSG_RTN_B64            : SOP1_Real_gfx11_gfx12<0x04d>;
2042defm S_BARRIER_SIGNAL_M0          : SOP1_M0_Real_gfx12<0x04e>;
2043defm S_BARRIER_SIGNAL_ISFIRST_M0  : SOP1_M0_Real_gfx12<0x04f>;
2044defm S_GET_BARRIER_STATE_M0       : SOP1_M0_Real_gfx12<0x050>;
2045defm S_BARRIER_INIT_M0            : SOP1_M0_Real_gfx12<0x051>;
2046defm S_BARRIER_JOIN_M0            : SOP1_M0_Real_gfx12<0x052>;
2047defm S_WAKEUP_BARRIER_M0          : SOP1_M0_Real_gfx12<0x057>;
2048defm S_BARRIER_SIGNAL_IMM         : SOP1_Real_gfx12<0x04e>;
2049defm S_BARRIER_SIGNAL_ISFIRST_IMM : SOP1_Real_gfx12<0x04f>;
2050defm S_GET_BARRIER_STATE_IMM      : SOP1_Real_gfx12<0x050>;
2051defm S_BARRIER_INIT_IMM           : SOP1_Real_gfx12<0x051>;
2052defm S_BARRIER_JOIN_IMM           : SOP1_Real_gfx12<0x052>;
2053defm S_WAKEUP_BARRIER_IMM         : SOP1_Real_gfx12<0x057>;
2054defm S_SLEEP_VAR                  : SOP1_Real_gfx12<0x058>;
2055
2056//===----------------------------------------------------------------------===//
2057// SOP1 - GFX1150, GFX12
2058//===----------------------------------------------------------------------===//
2059
2060defm S_CEIL_F32          : SOP1_Real_gfx11_gfx12<0x060>;
2061defm S_FLOOR_F32         : SOP1_Real_gfx11_gfx12<0x061>;
2062defm S_TRUNC_F32         : SOP1_Real_gfx11_gfx12<0x062>;
2063defm S_RNDNE_F32         : SOP1_Real_gfx11_gfx12<0x063>;
2064defm S_CVT_F32_I32       : SOP1_Real_gfx11_gfx12<0x064>;
2065defm S_CVT_F32_U32       : SOP1_Real_gfx11_gfx12<0x065>;
2066defm S_CVT_I32_F32       : SOP1_Real_gfx11_gfx12<0x066>;
2067defm S_CVT_U32_F32       : SOP1_Real_gfx11_gfx12<0x067>;
2068defm S_CVT_F16_F32       : SOP1_Real_gfx11_gfx12<0x068>;
2069defm S_CVT_F32_F16       : SOP1_Real_gfx11_gfx12<0x069>;
2070defm S_CVT_HI_F32_F16    : SOP1_Real_gfx11_gfx12<0x06a>;
2071defm S_CEIL_F16          : SOP1_Real_gfx11_gfx12<0x06b>;
2072defm S_FLOOR_F16         : SOP1_Real_gfx11_gfx12<0x06c>;
2073defm S_TRUNC_F16         : SOP1_Real_gfx11_gfx12<0x06d>;
2074defm S_RNDNE_F16         : SOP1_Real_gfx11_gfx12<0x06e>;
2075
2076//===----------------------------------------------------------------------===//
2077// SOP1 - GFX10.
2078//===----------------------------------------------------------------------===//
2079
2080multiclass SOP1_Real_gfx10<bits<8> op> {
2081  defvar ps = !cast<SOP1_Pseudo>(NAME);
2082  def _gfx10 : SOP1_Real<op, ps>,
2083               Select_gfx10<ps.Mnemonic>;
2084}
2085
2086multiclass SOP1_Real_gfx10_gfx11_gfx12<bits<8> op> :
2087  SOP1_Real_gfx10<op>, SOP1_Real_gfx11_gfx12<op>;
2088
2089defm S_ANDN1_SAVEEXEC_B64   : SOP1_Real_gfx10<0x037>;
2090defm S_ORN1_SAVEEXEC_B64    : SOP1_Real_gfx10<0x038>;
2091defm S_ANDN1_WREXEC_B64     : SOP1_Real_gfx10<0x039>;
2092defm S_ANDN2_WREXEC_B64     : SOP1_Real_gfx10<0x03a>;
2093defm S_BITREPLICATE_B64_B32 : SOP1_Real_gfx10<0x03b>;
2094defm S_AND_SAVEEXEC_B32     : SOP1_Real_gfx10<0x03c>;
2095defm S_OR_SAVEEXEC_B32      : SOP1_Real_gfx10<0x03d>;
2096defm S_XOR_SAVEEXEC_B32     : SOP1_Real_gfx10<0x03e>;
2097defm S_ANDN2_SAVEEXEC_B32   : SOP1_Real_gfx10<0x03f>;
2098defm S_ORN2_SAVEEXEC_B32    : SOP1_Real_gfx10<0x040>;
2099defm S_NAND_SAVEEXEC_B32    : SOP1_Real_gfx10<0x041>;
2100defm S_NOR_SAVEEXEC_B32     : SOP1_Real_gfx10<0x042>;
2101defm S_XNOR_SAVEEXEC_B32    : SOP1_Real_gfx10<0x043>;
2102defm S_ANDN1_SAVEEXEC_B32   : SOP1_Real_gfx10<0x044>;
2103defm S_ORN1_SAVEEXEC_B32    : SOP1_Real_gfx10<0x045>;
2104defm S_ANDN1_WREXEC_B32     : SOP1_Real_gfx10<0x046>;
2105defm S_ANDN2_WREXEC_B32     : SOP1_Real_gfx10<0x047>;
2106defm S_MOVRELSD_2_B32       : SOP1_Real_gfx10<0x049>;
2107
2108//===----------------------------------------------------------------------===//
2109// SOP1 - GFX6, GFX7, GFX10, GFX11.
2110//===----------------------------------------------------------------------===//
2111
2112
2113multiclass SOP1_Real_gfx6_gfx7<bits<8> op> {
2114  defvar ps = !cast<SOP1_Pseudo>(NAME);
2115  def _gfx6_gfx7 : SOP1_Real<op, ps>,
2116                   Select_gfx6_gfx7<ps.Mnemonic>;
2117}
2118
2119multiclass SOP1_Real_gfx6_gfx7_gfx10<bits<8> op> :
2120  SOP1_Real_gfx6_gfx7<op>, SOP1_Real_gfx10<op>;
2121
2122multiclass SOP1_Real_gfx6_gfx7_gfx10_gfx11_gfx12<bits<8> op> :
2123  SOP1_Real_gfx6_gfx7<op>, SOP1_Real_gfx10_gfx11_gfx12<op>;
2124
2125defm S_CBRANCH_JOIN  : SOP1_Real_gfx6_gfx7<0x032>;
2126
2127defm S_MOV_B32            : SOP1_Real_gfx6_gfx7_gfx10<0x003>;
2128defm S_MOV_B64            : SOP1_Real_gfx6_gfx7_gfx10<0x004>;
2129defm S_CMOV_B32           : SOP1_Real_gfx6_gfx7_gfx10<0x005>;
2130defm S_CMOV_B64           : SOP1_Real_gfx6_gfx7_gfx10<0x006>;
2131defm S_NOT_B32            : SOP1_Real_gfx6_gfx7_gfx10<0x007>;
2132defm S_NOT_B64            : SOP1_Real_gfx6_gfx7_gfx10<0x008>;
2133defm S_WQM_B32            : SOP1_Real_gfx6_gfx7_gfx10<0x009>;
2134defm S_WQM_B64            : SOP1_Real_gfx6_gfx7_gfx10<0x00a>;
2135defm S_BREV_B32           : SOP1_Real_gfx6_gfx7_gfx10<0x00b>;
2136defm S_BREV_B64           : SOP1_Real_gfx6_gfx7_gfx10<0x00c>;
2137defm S_BCNT0_I32_B32      : SOP1_Real_gfx6_gfx7_gfx10<0x00d>;
2138defm S_BCNT0_I32_B64      : SOP1_Real_gfx6_gfx7_gfx10<0x00e>;
2139defm S_BCNT1_I32_B32      : SOP1_Real_gfx6_gfx7_gfx10<0x00f>;
2140defm S_BCNT1_I32_B64      : SOP1_Real_gfx6_gfx7_gfx10<0x010>;
2141defm S_FF0_I32_B32        : SOP1_Real_gfx6_gfx7_gfx10<0x011>;
2142defm S_FF0_I32_B64        : SOP1_Real_gfx6_gfx7_gfx10<0x012>;
2143defm S_FF1_I32_B32        : SOP1_Real_gfx6_gfx7_gfx10<0x013>;
2144defm S_FF1_I32_B64        : SOP1_Real_gfx6_gfx7_gfx10<0x014>;
2145defm S_FLBIT_I32_B32      : SOP1_Real_gfx6_gfx7_gfx10<0x015>;
2146defm S_FLBIT_I32_B64      : SOP1_Real_gfx6_gfx7_gfx10<0x016>;
2147defm S_FLBIT_I32          : SOP1_Real_gfx6_gfx7_gfx10<0x017>;
2148defm S_FLBIT_I32_I64      : SOP1_Real_gfx6_gfx7_gfx10<0x018>;
2149defm S_SEXT_I32_I8        : SOP1_Real_gfx6_gfx7_gfx10<0x019>;
2150defm S_SEXT_I32_I16       : SOP1_Real_gfx6_gfx7_gfx10<0x01a>;
2151defm S_BITSET0_B32        : SOP1_Real_gfx6_gfx7_gfx10<0x01b>;
2152defm S_BITSET0_B64        : SOP1_Real_gfx6_gfx7_gfx10<0x01c>;
2153defm S_BITSET1_B32        : SOP1_Real_gfx6_gfx7_gfx10<0x01d>;
2154defm S_BITSET1_B64        : SOP1_Real_gfx6_gfx7_gfx10<0x01e>;
2155defm S_GETPC_B64          : SOP1_Real_gfx6_gfx7_gfx10<0x01f>;
2156defm S_SETPC_B64          : SOP1_Real_gfx6_gfx7_gfx10<0x020>;
2157defm S_SWAPPC_B64         : SOP1_Real_gfx6_gfx7_gfx10<0x021>;
2158defm S_RFE_B64            : SOP1_Real_gfx6_gfx7_gfx10<0x022>;
2159defm S_AND_SAVEEXEC_B64   : SOP1_Real_gfx6_gfx7_gfx10<0x024>;
2160defm S_OR_SAVEEXEC_B64    : SOP1_Real_gfx6_gfx7_gfx10<0x025>;
2161defm S_XOR_SAVEEXEC_B64   : SOP1_Real_gfx6_gfx7_gfx10<0x026>;
2162defm S_ANDN2_SAVEEXEC_B64 : SOP1_Real_gfx6_gfx7_gfx10<0x027>;
2163defm S_ORN2_SAVEEXEC_B64  : SOP1_Real_gfx6_gfx7_gfx10<0x028>;
2164defm S_NAND_SAVEEXEC_B64  : SOP1_Real_gfx6_gfx7_gfx10<0x029>;
2165defm S_NOR_SAVEEXEC_B64   : SOP1_Real_gfx6_gfx7_gfx10<0x02a>;
2166defm S_XNOR_SAVEEXEC_B64  : SOP1_Real_gfx6_gfx7_gfx10_gfx11_gfx12<0x02b>;
2167defm S_QUADMASK_B32       : SOP1_Real_gfx6_gfx7_gfx10<0x02c>;
2168defm S_QUADMASK_B64       : SOP1_Real_gfx6_gfx7_gfx10<0x02d>;
2169defm S_MOVRELS_B32        : SOP1_Real_gfx6_gfx7_gfx10<0x02e>;
2170defm S_MOVRELS_B64        : SOP1_Real_gfx6_gfx7_gfx10<0x02f>;
2171defm S_MOVRELD_B32        : SOP1_Real_gfx6_gfx7_gfx10<0x030>;
2172defm S_MOVRELD_B64        : SOP1_Real_gfx6_gfx7_gfx10<0x031>;
2173defm S_ABS_I32            : SOP1_Real_gfx6_gfx7_gfx10<0x034>;
2174
2175//===----------------------------------------------------------------------===//
2176// SOP2 - GFX12
2177//===----------------------------------------------------------------------===//
2178
2179multiclass SOP2_Real_gfx12<bits<7> op> {
2180  def _gfx12 : SOP2_Real32<op, !cast<SOP2_Pseudo>(NAME)>,
2181               Select_gfx12<!cast<SOP2_Pseudo>(NAME).Mnemonic>;
2182}
2183
2184multiclass SOP2_Real_Renamed_gfx12<bits<7> op, SOP2_Pseudo backing_pseudo, string real_name> {
2185  def _gfx12 : SOP2_Real32<op, backing_pseudo, real_name>,
2186               Select_gfx12<backing_pseudo.Mnemonic>,
2187               MnemonicAlias<backing_pseudo.Mnemonic, real_name>, Requires<[isGFX12Plus]>;
2188}
2189
2190defm S_MIN_NUM_F32 : SOP2_Real_Renamed_gfx12<0x042, S_MIN_F32, "s_min_num_f32">;
2191defm S_MAX_NUM_F32 : SOP2_Real_Renamed_gfx12<0x043, S_MAX_F32, "s_max_num_f32">;
2192defm S_MIN_NUM_F16 : SOP2_Real_Renamed_gfx12<0x04b, S_MIN_F16, "s_min_num_f16">;
2193defm S_MAX_NUM_F16 : SOP2_Real_Renamed_gfx12<0x04c, S_MAX_F16, "s_max_num_f16">;
2194defm S_MINIMUM_F32 : SOP2_Real_gfx12<0x04f>;
2195defm S_MAXIMUM_F32 : SOP2_Real_gfx12<0x050>;
2196defm S_MINIMUM_F16 : SOP2_Real_gfx12<0x051>;
2197defm S_MAXIMUM_F16 : SOP2_Real_gfx12<0x052>;
2198
2199defm S_ADD_CO_U32    : SOP2_Real_Renamed_gfx12<0x000, S_ADD_U32, "s_add_co_u32">;
2200defm S_SUB_CO_U32    : SOP2_Real_Renamed_gfx12<0x001, S_SUB_U32, "s_sub_co_u32">;
2201defm S_ADD_CO_I32    : SOP2_Real_Renamed_gfx12<0x002, S_ADD_I32, "s_add_co_i32">;
2202defm S_SUB_CO_I32    : SOP2_Real_Renamed_gfx12<0x003, S_SUB_I32, "s_sub_co_i32">;
2203defm S_ADD_CO_CI_U32 : SOP2_Real_Renamed_gfx12<0x004, S_ADDC_U32, "s_add_co_ci_u32">;
2204defm S_SUB_CO_CI_U32 : SOP2_Real_Renamed_gfx12<0x005, S_SUBB_U32, "s_sub_co_ci_u32">;
2205
2206//===----------------------------------------------------------------------===//
2207// SOP2 - GFX11, GFX12.
2208//===----------------------------------------------------------------------===//
2209
2210multiclass SOP2_Real_gfx11<bits<7> op> {
2211  def _gfx11 : SOP2_Real32<op, !cast<SOP2_Pseudo>(NAME)>,
2212               Select_gfx11<!cast<SOP2_Pseudo>(NAME).Mnemonic>;
2213}
2214
2215multiclass SOP2_Real_Renamed_gfx11<bits<7> op, SOP2_Pseudo backing_pseudo, string real_name> {
2216  def _gfx11 : SOP2_Real32<op, backing_pseudo, real_name>,
2217               Select_gfx11<backing_pseudo.Mnemonic>,
2218               MnemonicAlias<backing_pseudo.Mnemonic, real_name>, Requires<[isGFX11Only]>;
2219}
2220
2221multiclass SOP2_Real_gfx11_gfx12<bits<7> op> :
2222  SOP2_Real_gfx11<op>, SOP2_Real_gfx12<op>;
2223
2224multiclass SOP2_Real_Renamed_gfx11_gfx12<bits<8> op, SOP2_Pseudo backing_pseudo, string real_name> :
2225  SOP2_Real_Renamed_gfx11<op, backing_pseudo, real_name>,
2226  SOP2_Real_Renamed_gfx12<op, backing_pseudo, real_name>;
2227
2228defm S_ABSDIFF_I32     : SOP2_Real_gfx11_gfx12<0x006>;
2229defm S_LSHL_B32        : SOP2_Real_gfx11_gfx12<0x008>;
2230defm S_LSHL_B64        : SOP2_Real_gfx11_gfx12<0x009>;
2231defm S_LSHR_B32        : SOP2_Real_gfx11_gfx12<0x00a>;
2232defm S_LSHR_B64        : SOP2_Real_gfx11_gfx12<0x00b>;
2233defm S_ASHR_I32        : SOP2_Real_gfx11_gfx12<0x00c>;
2234defm S_ASHR_I64        : SOP2_Real_gfx11_gfx12<0x00d>;
2235defm S_LSHL1_ADD_U32   : SOP2_Real_gfx11_gfx12<0x00e>;
2236defm S_LSHL2_ADD_U32   : SOP2_Real_gfx11_gfx12<0x00f>;
2237defm S_LSHL3_ADD_U32   : SOP2_Real_gfx11_gfx12<0x010>;
2238defm S_LSHL4_ADD_U32   : SOP2_Real_gfx11_gfx12<0x011>;
2239defm S_MIN_I32         : SOP2_Real_gfx11_gfx12<0x012>;
2240defm S_MIN_U32         : SOP2_Real_gfx11_gfx12<0x013>;
2241defm S_MAX_I32         : SOP2_Real_gfx11_gfx12<0x014>;
2242defm S_MAX_U32         : SOP2_Real_gfx11_gfx12<0x015>;
2243defm S_AND_B32         : SOP2_Real_gfx11_gfx12<0x016>;
2244defm S_AND_B64         : SOP2_Real_gfx11_gfx12<0x017>;
2245defm S_OR_B32          : SOP2_Real_gfx11_gfx12<0x018>;
2246defm S_OR_B64          : SOP2_Real_gfx11_gfx12<0x019>;
2247defm S_XOR_B32         : SOP2_Real_gfx11_gfx12<0x01a>;
2248defm S_XOR_B64         : SOP2_Real_gfx11_gfx12<0x01b>;
2249defm S_NAND_B32        : SOP2_Real_gfx11_gfx12<0x01c>;
2250defm S_NAND_B64        : SOP2_Real_gfx11_gfx12<0x01d>;
2251defm S_NOR_B32         : SOP2_Real_gfx11_gfx12<0x01e>;
2252defm S_NOR_B64         : SOP2_Real_gfx11_gfx12<0x01f>;
2253defm S_XNOR_B32        : SOP2_Real_gfx11_gfx12<0x020>;
2254defm S_XNOR_B64        : SOP2_Real_gfx11_gfx12<0x021>;
2255defm S_AND_NOT1_B32    : SOP2_Real_Renamed_gfx11_gfx12<0x022, S_ANDN2_B32, "s_and_not1_b32">;
2256defm S_AND_NOT1_B64    : SOP2_Real_Renamed_gfx11_gfx12<0x023, S_ANDN2_B64, "s_and_not1_b64">;
2257defm S_OR_NOT1_B32     : SOP2_Real_Renamed_gfx11_gfx12<0x024, S_ORN2_B32, "s_or_not1_b32">;
2258defm S_OR_NOT1_B64     : SOP2_Real_Renamed_gfx11_gfx12<0x025, S_ORN2_B64, "s_or_not1_b64">;
2259defm S_BFE_U32         : SOP2_Real_gfx11_gfx12<0x026>;
2260defm S_BFE_I32         : SOP2_Real_gfx11_gfx12<0x027>;
2261defm S_BFE_U64         : SOP2_Real_gfx11_gfx12<0x028>;
2262defm S_BFE_I64         : SOP2_Real_gfx11_gfx12<0x029>;
2263defm S_BFM_B32         : SOP2_Real_gfx11_gfx12<0x02a>;
2264defm S_BFM_B64         : SOP2_Real_gfx11_gfx12<0x02b>;
2265defm S_MUL_I32         : SOP2_Real_gfx11_gfx12<0x02c>;
2266defm S_MUL_HI_U32      : SOP2_Real_gfx11_gfx12<0x02d>;
2267defm S_MUL_HI_I32      : SOP2_Real_gfx11_gfx12<0x02e>;
2268defm S_CSELECT_B32     : SOP2_Real_gfx11_gfx12<0x030>;
2269defm S_CSELECT_B64     : SOP2_Real_gfx11_gfx12<0x031>;
2270defm S_PACK_HL_B32_B16 : SOP2_Real_gfx11_gfx12<0x035>;
2271defm S_ADD_NC_U64      : SOP2_Real_Renamed_gfx12<0x053, S_ADD_U64, "s_add_nc_u64">;
2272defm S_SUB_NC_U64      : SOP2_Real_Renamed_gfx12<0x054, S_SUB_U64, "s_sub_nc_u64">;
2273defm S_MUL_U64         : SOP2_Real_gfx12<0x055>;
2274
2275//===----------------------------------------------------------------------===//
2276// SOP2 - GFX1150, GFX12
2277//===----------------------------------------------------------------------===//
2278
2279multiclass SOP2_Real_FMAK_gfx12<bits<7> op> {
2280  def _gfx12 : SOP2_Real64<op, !cast<SOP2_Pseudo>(NAME)>,
2281               Select_gfx12<!cast<SOP2_Pseudo>(NAME).Mnemonic>;
2282}
2283
2284multiclass SOP2_Real_FMAK_gfx11<bits<7> op> {
2285  def _gfx11 : SOP2_Real64<op, !cast<SOP2_Pseudo>(NAME)>,
2286               Select_gfx11<!cast<SOP2_Pseudo>(NAME).Mnemonic>;
2287}
2288
2289multiclass SOP2_Real_FMAK_gfx11_gfx12<bits<7> op> :
2290  SOP2_Real_FMAK_gfx11<op>, SOP2_Real_FMAK_gfx12<op>;
2291
2292defm S_ADD_F32            : SOP2_Real_gfx11_gfx12<0x040>;
2293defm S_SUB_F32            : SOP2_Real_gfx11_gfx12<0x041>;
2294defm S_MUL_F32            : SOP2_Real_gfx11_gfx12<0x044>;
2295defm S_FMAAK_F32          : SOP2_Real_FMAK_gfx11_gfx12<0x045>;
2296defm S_FMAMK_F32          : SOP2_Real_FMAK_gfx11_gfx12<0x046>;
2297defm S_FMAC_F32           : SOP2_Real_gfx11_gfx12<0x047>;
2298defm S_CVT_PK_RTZ_F16_F32 : SOP2_Real_gfx11_gfx12<0x048>;
2299defm S_ADD_F16            : SOP2_Real_gfx11_gfx12<0x049>;
2300defm S_SUB_F16            : SOP2_Real_gfx11_gfx12<0x04a>;
2301defm S_MUL_F16            : SOP2_Real_gfx11_gfx12<0x04d>;
2302defm S_FMAC_F16           : SOP2_Real_gfx11_gfx12<0x04e>;
2303
2304//===----------------------------------------------------------------------===//
2305// SOP2 - GFX1150
2306//===----------------------------------------------------------------------===//
2307
2308defm S_MIN_F32 : SOP2_Real_gfx11<0x042>;
2309defm S_MAX_F32 : SOP2_Real_gfx11<0x043>;
2310defm S_MIN_F16 : SOP2_Real_gfx11<0x04b>;
2311defm S_MAX_F16 : SOP2_Real_gfx11<0x04c>;
2312
2313//===----------------------------------------------------------------------===//
2314// SOP2 - GFX10.
2315//===----------------------------------------------------------------------===//
2316
2317multiclass SOP2_Real_gfx10<bits<7> op> {
2318  defvar ps = !cast<SOP2_Pseudo>(NAME);
2319  def _gfx10 : SOP2_Real32<op, ps>,
2320               Select_gfx10<ps.Mnemonic>;
2321}
2322
2323multiclass SOP2_Real_gfx10_gfx11_gfx12<bits<7> op> :
2324  SOP2_Real_gfx10<op>, SOP2_Real_gfx11_gfx12<op>;
2325
2326defm S_LSHL1_ADD_U32   : SOP2_Real_gfx10<0x02e>;
2327defm S_LSHL2_ADD_U32   : SOP2_Real_gfx10<0x02f>;
2328defm S_LSHL3_ADD_U32   : SOP2_Real_gfx10<0x030>;
2329defm S_LSHL4_ADD_U32   : SOP2_Real_gfx10<0x031>;
2330defm S_PACK_LL_B32_B16 : SOP2_Real_gfx10_gfx11_gfx12<0x032>;
2331defm S_PACK_LH_B32_B16 : SOP2_Real_gfx10_gfx11_gfx12<0x033>;
2332defm S_PACK_HH_B32_B16 : SOP2_Real_gfx10_gfx11_gfx12<0x034>;
2333defm S_MUL_HI_U32      : SOP2_Real_gfx10<0x035>;
2334defm S_MUL_HI_I32      : SOP2_Real_gfx10<0x036>;
2335
2336//===----------------------------------------------------------------------===//
2337// SOP2 - GFX6, GFX7.
2338//===----------------------------------------------------------------------===//
2339
2340multiclass SOP2_Real_gfx6_gfx7<bits<7> op> {
2341  defvar ps = !cast<SOP_Pseudo>(NAME);
2342  def _gfx6_gfx7 : SOP2_Real32<op, ps>,
2343                   Select_gfx6_gfx7<ps.Mnemonic>;
2344}
2345
2346multiclass SOP2_Real_gfx6_gfx7_gfx10<bits<7> op> :
2347  SOP2_Real_gfx6_gfx7<op>, SOP2_Real_gfx10<op>;
2348
2349multiclass SOP2_Real_gfx6_gfx7_gfx10_gfx11<bits<7> op> :
2350  SOP2_Real_gfx6_gfx7<op>, SOP2_Real_gfx10<op>, SOP2_Real_gfx11<op>;
2351
2352multiclass SOP2_Real_gfx6_gfx7_gfx10_gfx11_gfx12<bits<7> op> :
2353  SOP2_Real_gfx6_gfx7<op>, SOP2_Real_gfx10_gfx11_gfx12<op>;
2354
2355defm S_CBRANCH_G_FORK : SOP2_Real_gfx6_gfx7<0x02b>;
2356
2357defm S_ADD_U32     : SOP2_Real_gfx6_gfx7_gfx10_gfx11<0x000>;
2358defm S_SUB_U32     : SOP2_Real_gfx6_gfx7_gfx10_gfx11<0x001>;
2359defm S_ADD_I32     : SOP2_Real_gfx6_gfx7_gfx10_gfx11<0x002>;
2360defm S_SUB_I32     : SOP2_Real_gfx6_gfx7_gfx10_gfx11<0x003>;
2361defm S_ADDC_U32    : SOP2_Real_gfx6_gfx7_gfx10_gfx11<0x004>;
2362defm S_SUBB_U32    : SOP2_Real_gfx6_gfx7_gfx10_gfx11<0x005>;
2363defm S_MIN_I32     : SOP2_Real_gfx6_gfx7_gfx10<0x006>;
2364defm S_MIN_U32     : SOP2_Real_gfx6_gfx7_gfx10<0x007>;
2365defm S_MAX_I32     : SOP2_Real_gfx6_gfx7_gfx10<0x008>;
2366defm S_MAX_U32     : SOP2_Real_gfx6_gfx7_gfx10<0x009>;
2367defm S_CSELECT_B32 : SOP2_Real_gfx6_gfx7_gfx10<0x00a>;
2368defm S_CSELECT_B64 : SOP2_Real_gfx6_gfx7_gfx10<0x00b>;
2369defm S_AND_B32     : SOP2_Real_gfx6_gfx7_gfx10<0x00e>;
2370defm S_AND_B64     : SOP2_Real_gfx6_gfx7_gfx10<0x00f>;
2371defm S_OR_B32      : SOP2_Real_gfx6_gfx7_gfx10<0x010>;
2372defm S_OR_B64      : SOP2_Real_gfx6_gfx7_gfx10<0x011>;
2373defm S_XOR_B32     : SOP2_Real_gfx6_gfx7_gfx10<0x012>;
2374defm S_XOR_B64     : SOP2_Real_gfx6_gfx7_gfx10<0x013>;
2375defm S_ANDN2_B32   : SOP2_Real_gfx6_gfx7_gfx10<0x014>;
2376defm S_ANDN2_B64   : SOP2_Real_gfx6_gfx7_gfx10<0x015>;
2377defm S_ORN2_B32    : SOP2_Real_gfx6_gfx7_gfx10<0x016>;
2378defm S_ORN2_B64    : SOP2_Real_gfx6_gfx7_gfx10<0x017>;
2379defm S_NAND_B32    : SOP2_Real_gfx6_gfx7_gfx10<0x018>;
2380defm S_NAND_B64    : SOP2_Real_gfx6_gfx7_gfx10<0x019>;
2381defm S_NOR_B32     : SOP2_Real_gfx6_gfx7_gfx10<0x01a>;
2382defm S_NOR_B64     : SOP2_Real_gfx6_gfx7_gfx10<0x01b>;
2383defm S_XNOR_B32    : SOP2_Real_gfx6_gfx7_gfx10<0x01c>;
2384defm S_XNOR_B64    : SOP2_Real_gfx6_gfx7_gfx10<0x01d>;
2385defm S_LSHL_B32    : SOP2_Real_gfx6_gfx7_gfx10<0x01e>;
2386defm S_LSHL_B64    : SOP2_Real_gfx6_gfx7_gfx10<0x01f>;
2387defm S_LSHR_B32    : SOP2_Real_gfx6_gfx7_gfx10<0x020>;
2388defm S_LSHR_B64    : SOP2_Real_gfx6_gfx7_gfx10<0x021>;
2389defm S_ASHR_I32    : SOP2_Real_gfx6_gfx7_gfx10<0x022>;
2390defm S_ASHR_I64    : SOP2_Real_gfx6_gfx7_gfx10<0x023>;
2391defm S_BFM_B32     : SOP2_Real_gfx6_gfx7_gfx10<0x024>;
2392defm S_BFM_B64     : SOP2_Real_gfx6_gfx7_gfx10<0x025>;
2393defm S_MUL_I32     : SOP2_Real_gfx6_gfx7_gfx10<0x026>;
2394defm S_BFE_U32     : SOP2_Real_gfx6_gfx7_gfx10<0x027>;
2395defm S_BFE_I32     : SOP2_Real_gfx6_gfx7_gfx10<0x028>;
2396defm S_BFE_U64     : SOP2_Real_gfx6_gfx7_gfx10<0x029>;
2397defm S_BFE_I64     : SOP2_Real_gfx6_gfx7_gfx10<0x02a>;
2398defm S_ABSDIFF_I32 : SOP2_Real_gfx6_gfx7_gfx10<0x02c>;
2399
2400//===----------------------------------------------------------------------===//
2401// SOPK - GFX11, GFX12.
2402//===----------------------------------------------------------------------===//
2403
2404multiclass SOPK_Real32_gfx12<bits<5> op> {
2405  def _gfx12 : SOPK_Real32<op, !cast<SOPK_Pseudo>(NAME)>,
2406               Select_gfx12<!cast<SOPK_Pseudo>(NAME).Mnemonic>;
2407}
2408
2409multiclass SOPK_Real32_Renamed_gfx12<bits<5> op, SOPK_Pseudo backing_pseudo, string real_name> {
2410  def _gfx12 : SOPK_Real32<op, backing_pseudo, real_name>,
2411               Select_gfx12<backing_pseudo.Mnemonic>,
2412               MnemonicAlias<backing_pseudo.Mnemonic, real_name>, Requires<[isGFX12Plus]>;
2413}
2414
2415multiclass SOPK_Real32_gfx11<bits<5> op> {
2416  def _gfx11 : SOPK_Real32<op, !cast<SOPK_Pseudo>(NAME)>,
2417               Select_gfx11<!cast<SOPK_Pseudo>(NAME).Mnemonic>;
2418}
2419
2420multiclass SOPK_Real64_gfx12<bits<5> op> {
2421  def _gfx12 : SOPK_Real64<op, !cast<SOPK_Pseudo>(NAME)>,
2422               Select_gfx12<!cast<SOPK_Pseudo>(NAME).Mnemonic>;
2423}
2424
2425multiclass SOPK_Real64_gfx11<bits<5> op> {
2426  def _gfx11 : SOPK_Real64<op, !cast<SOPK_Pseudo>(NAME)>,
2427               Select_gfx11<!cast<SOPK_Pseudo>(NAME).Mnemonic>;
2428}
2429
2430multiclass SOPK_Real32_gfx11_gfx12<bits<5> op> :
2431  SOPK_Real32_gfx11<op>, SOPK_Real32_gfx12<op>;
2432
2433multiclass SOPK_Real64_gfx11_gfx12<bits<5> op> :
2434  SOPK_Real64_gfx11<op>, SOPK_Real64_gfx12<op>;
2435
2436defm S_ADDK_CO_I32          : SOPK_Real32_Renamed_gfx12<0x00f, S_ADDK_I32, "s_addk_co_i32">;
2437defm S_GETREG_B32           : SOPK_Real32_gfx11_gfx12<0x011>;
2438defm S_SETREG_B32           : SOPK_Real32_gfx11_gfx12<0x012>;
2439defm S_SETREG_IMM32_B32     : SOPK_Real64_gfx11_gfx12<0x013>;
2440defm S_CALL_B64             : SOPK_Real32_gfx11_gfx12<0x014>;
2441defm S_SUBVECTOR_LOOP_BEGIN : SOPK_Real32_gfx11<0x016>;
2442defm S_SUBVECTOR_LOOP_END   : SOPK_Real32_gfx11<0x017>;
2443defm S_WAITCNT_VSCNT        : SOPK_Real32_gfx11<0x018>;
2444defm S_WAITCNT_VMCNT        : SOPK_Real32_gfx11<0x019>;
2445defm S_WAITCNT_EXPCNT       : SOPK_Real32_gfx11<0x01a>;
2446defm S_WAITCNT_LGKMCNT      : SOPK_Real32_gfx11<0x01b>;
2447
2448//===----------------------------------------------------------------------===//
2449// SOPK - GFX10.
2450//===----------------------------------------------------------------------===//
2451
2452multiclass SOPK_Real32_gfx10<bits<5> op> {
2453  defvar ps = !cast<SOPK_Pseudo>(NAME);
2454  def _gfx10 : SOPK_Real32<op, ps>,
2455               Select_gfx10<ps.Mnemonic>;
2456}
2457
2458multiclass SOPK_Real64_gfx10<bits<5> op> {
2459  defvar ps = !cast<SOPK_Pseudo>(NAME);
2460  def _gfx10 : SOPK_Real64<op, ps>,
2461               Select_gfx10<ps.Mnemonic>;
2462}
2463
2464multiclass SOPK_Real32_gfx10_gfx11<bits<5> op> :
2465  SOPK_Real32_gfx10<op>, SOPK_Real32_gfx11<op>;
2466
2467multiclass SOPK_Real32_gfx10_gfx11_gfx12<bits<5> op> :
2468  SOPK_Real32_gfx10<op>, SOPK_Real32_gfx11_gfx12<op>;
2469
2470defm S_VERSION              : SOPK_Real32_gfx10_gfx11_gfx12<0x001>;
2471defm S_CALL_B64             : SOPK_Real32_gfx10<0x016>;
2472defm S_WAITCNT_VSCNT        : SOPK_Real32_gfx10<0x017>;
2473defm S_WAITCNT_VMCNT        : SOPK_Real32_gfx10<0x018>;
2474defm S_WAITCNT_EXPCNT       : SOPK_Real32_gfx10<0x019>;
2475defm S_WAITCNT_LGKMCNT      : SOPK_Real32_gfx10<0x01a>;
2476defm S_SUBVECTOR_LOOP_BEGIN : SOPK_Real32_gfx10<0x01b>;
2477defm S_SUBVECTOR_LOOP_END   : SOPK_Real32_gfx10<0x01c>;
2478
2479//===----------------------------------------------------------------------===//
2480// SOPK - GFX6, GFX7.
2481//===----------------------------------------------------------------------===//
2482
2483multiclass SOPK_Real32_gfx6_gfx7<bits<5> op> {
2484  defvar ps = !cast<SOPK_Pseudo>(NAME);
2485  def _gfx6_gfx7 : SOPK_Real32<op, ps>,
2486                   Select_gfx6_gfx7<ps.Mnemonic>;
2487}
2488
2489multiclass SOPK_Real64_gfx6_gfx7<bits<5> op> {
2490  defvar ps = !cast<SOPK_Pseudo>(NAME);
2491  def _gfx6_gfx7 : SOPK_Real64<op, ps>,
2492                   Select_gfx6_gfx7<ps.Mnemonic>;
2493}
2494
2495multiclass SOPK_Real32_gfx6_gfx7_gfx10<bits<5> op> :
2496  SOPK_Real32_gfx6_gfx7<op>, SOPK_Real32_gfx10<op>;
2497
2498multiclass SOPK_Real64_gfx6_gfx7_gfx10<bits<5> op> :
2499  SOPK_Real64_gfx6_gfx7<op>, SOPK_Real64_gfx10<op>;
2500
2501multiclass SOPK_Real32_gfx6_gfx7_gfx10_gfx11<bits<5> op> :
2502  SOPK_Real32_gfx6_gfx7<op>, SOPK_Real32_gfx10_gfx11<op>;
2503
2504multiclass SOPK_Real32_gfx6_gfx7_gfx10_gfx11_gfx12<bits<5> op> :
2505  SOPK_Real32_gfx6_gfx7<op>, SOPK_Real32_gfx10_gfx11_gfx12<op>;
2506
2507defm S_CBRANCH_I_FORK : SOPK_Real32_gfx6_gfx7<0x011>;
2508
2509defm S_MOVK_I32         : SOPK_Real32_gfx6_gfx7_gfx10_gfx11_gfx12<0x000>;
2510defm S_CMOVK_I32        : SOPK_Real32_gfx6_gfx7_gfx10_gfx11_gfx12<0x002>;
2511defm S_CMPK_EQ_I32      : SOPK_Real32_gfx6_gfx7_gfx10_gfx11<0x003>;
2512defm S_CMPK_LG_I32      : SOPK_Real32_gfx6_gfx7_gfx10_gfx11<0x004>;
2513defm S_CMPK_GT_I32      : SOPK_Real32_gfx6_gfx7_gfx10_gfx11<0x005>;
2514defm S_CMPK_GE_I32      : SOPK_Real32_gfx6_gfx7_gfx10_gfx11<0x006>;
2515defm S_CMPK_LT_I32      : SOPK_Real32_gfx6_gfx7_gfx10_gfx11<0x007>;
2516defm S_CMPK_LE_I32      : SOPK_Real32_gfx6_gfx7_gfx10_gfx11<0x008>;
2517defm S_CMPK_EQ_U32      : SOPK_Real32_gfx6_gfx7_gfx10_gfx11<0x009>;
2518defm S_CMPK_LG_U32      : SOPK_Real32_gfx6_gfx7_gfx10_gfx11<0x00a>;
2519defm S_CMPK_GT_U32      : SOPK_Real32_gfx6_gfx7_gfx10_gfx11<0x00b>;
2520defm S_CMPK_GE_U32      : SOPK_Real32_gfx6_gfx7_gfx10_gfx11<0x00c>;
2521defm S_CMPK_LT_U32      : SOPK_Real32_gfx6_gfx7_gfx10_gfx11<0x00d>;
2522defm S_CMPK_LE_U32      : SOPK_Real32_gfx6_gfx7_gfx10_gfx11<0x00e>;
2523defm S_ADDK_I32         : SOPK_Real32_gfx6_gfx7_gfx10_gfx11<0x00f>;
2524defm S_MULK_I32         : SOPK_Real32_gfx6_gfx7_gfx10_gfx11_gfx12<0x010>;
2525defm S_GETREG_B32       : SOPK_Real32_gfx6_gfx7_gfx10<0x012>;
2526defm S_SETREG_B32       : SOPK_Real32_gfx6_gfx7_gfx10<0x013>;
2527defm S_SETREG_IMM32_B32 : SOPK_Real64_gfx6_gfx7_gfx10<0x015>;
2528
2529//===----------------------------------------------------------------------===//
2530// SOPP - GFX12 only.
2531//===----------------------------------------------------------------------===//
2532
2533multiclass SOPP_Real_32_gfx12<bits<7> op> {
2534  def _gfx12 : SOPP_Real_32<op, !cast<SOPP_Pseudo>(NAME), !cast<SOPP_Pseudo>(NAME).Mnemonic>,
2535               Select_gfx12<!cast<SOPP_Pseudo>(NAME).Mnemonic>,
2536               SOPPRelaxTable<0, !cast<SOPP_Pseudo>(NAME).KeyName, "_gfx12">;
2537}
2538
2539multiclass SOPP_Real_32_Renamed_gfx12<bits<7> op, SOPP_Pseudo backing_pseudo, string real_name> {
2540  def _gfx12 : SOPP_Real_32<op, backing_pseudo, real_name>,
2541               Select_gfx12<backing_pseudo.Mnemonic>,
2542               MnemonicAlias<backing_pseudo.Mnemonic, real_name>, Requires<[isGFX12Plus]>;
2543}
2544
2545defm S_WAIT_ALU             : SOPP_Real_32_Renamed_gfx12<0x008, S_WAITCNT_DEPCTR, "s_wait_alu">;
2546defm S_BARRIER_WAIT         : SOPP_Real_32_gfx12<0x014>;
2547defm S_BARRIER_LEAVE        : SOPP_Real_32_gfx12<0x015>;
2548defm S_WAIT_LOADCNT         : SOPP_Real_32_gfx12<0x040>;
2549defm S_WAIT_STORECNT        : SOPP_Real_32_gfx12<0x041>;
2550defm S_WAIT_SAMPLECNT       : SOPP_Real_32_gfx12<0x042>;
2551defm S_WAIT_BVHCNT          : SOPP_Real_32_gfx12<0x043>;
2552defm S_WAIT_EXPCNT          : SOPP_Real_32_gfx12<0x044>;
2553defm S_WAIT_DSCNT           : SOPP_Real_32_gfx12<0x046>;
2554defm S_WAIT_KMCNT           : SOPP_Real_32_gfx12<0x047>;
2555defm S_WAIT_LOADCNT_DSCNT   : SOPP_Real_32_gfx12<0x048>;
2556defm S_WAIT_STORECNT_DSCNT  : SOPP_Real_32_gfx12<0x049>;
2557
2558//===----------------------------------------------------------------------===//
2559// SOPP - GFX11, GFX12.
2560//===----------------------------------------------------------------------===//
2561
2562
2563multiclass SOPP_Real_32_gfx11<bits<7> op> {
2564  def _gfx11 : SOPP_Real_32<op, !cast<SOPP_Pseudo>(NAME), !cast<SOPP_Pseudo>(NAME).Mnemonic>,
2565               Select_gfx11<!cast<SOPP_Pseudo>(NAME).Mnemonic>,
2566               SOPPRelaxTable<0, !cast<SOPP_Pseudo>(NAME).KeyName, "_gfx11">;
2567}
2568
2569multiclass SOPP_Real_64_gfx12<bits<7> op> {
2570  def _gfx12 : SOPP_Real_64<op, !cast<SOPP_Pseudo>(NAME), !cast<SOPP_Pseudo>(NAME).Mnemonic>,
2571               Select_gfx12<!cast<SOPP_Pseudo>(NAME).Mnemonic>,
2572               SOPPRelaxTable<1, !cast<SOPP_Pseudo>(NAME).KeyName, "_gfx12">;
2573}
2574
2575multiclass SOPP_Real_64_gfx11<bits<7> op> {
2576  def _gfx11 : SOPP_Real_64<op, !cast<SOPP_Pseudo>(NAME), !cast<SOPP_Pseudo>(NAME).Mnemonic>,
2577               Select_gfx11<!cast<SOPP_Pseudo>(NAME).Mnemonic>,
2578               SOPPRelaxTable<1, !cast<SOPP_Pseudo>(NAME).KeyName, "_gfx11">;
2579}
2580
2581multiclass SOPP_Real_32_Renamed_gfx11<bits<7> op, SOPP_Pseudo backing_pseudo, string real_name> {
2582  def _gfx11 : SOPP_Real_32<op, backing_pseudo, real_name>,
2583               Select_gfx11<backing_pseudo.Mnemonic>,
2584               MnemonicAlias<backing_pseudo.Mnemonic, real_name>, Requires<[isGFX11Only]>;
2585}
2586
2587multiclass SOPP_Real_32_gfx11_gfx12<bits<7> op> :
2588  SOPP_Real_32_gfx11<op>, SOPP_Real_32_gfx12<op>;
2589
2590multiclass SOPP_Real_64_gfx11_gfx12<bits<7> op> :
2591  SOPP_Real_64_gfx11<op>, SOPP_Real_64_gfx12<op>;
2592
2593multiclass SOPP_Real_32_Renamed_gfx11_gfx12<bits<7> op, SOPP_Pseudo backing_pseudo, string real_name> :
2594  SOPP_Real_32_Renamed_gfx11<op, backing_pseudo, real_name>,
2595  SOPP_Real_32_Renamed_gfx12<op, backing_pseudo, real_name>;
2596
2597multiclass SOPP_Real_With_Relaxation_gfx12<bits<7> op> {
2598  defm "" : SOPP_Real_32_gfx12<op>;
2599  defm _pad_s_nop : SOPP_Real_64_gfx12<op>;
2600}
2601
2602multiclass SOPP_Real_With_Relaxation_gfx11<bits<7> op> {
2603  defm "" : SOPP_Real_32_gfx11<op>;
2604  defm _pad_s_nop : SOPP_Real_64_gfx11<op>;
2605}
2606
2607multiclass SOPP_Real_With_Relaxation_gfx11_gfx12<bits<7>op> :
2608  SOPP_Real_With_Relaxation_gfx11<op>, SOPP_Real_With_Relaxation_gfx12<op>;
2609
2610defm S_SETKILL                    : SOPP_Real_32_gfx11_gfx12<0x001>;
2611defm S_SETHALT                    : SOPP_Real_32_gfx11_gfx12<0x002>;
2612defm S_SLEEP                      : SOPP_Real_32_gfx11_gfx12<0x003>;
2613defm S_SET_INST_PREFETCH_DISTANCE : SOPP_Real_32_Renamed_gfx11_gfx12<0x004, S_INST_PREFETCH, "s_set_inst_prefetch_distance">;
2614defm S_CLAUSE                     : SOPP_Real_32_gfx11_gfx12<0x005>;
2615defm S_DELAY_ALU                  : SOPP_Real_32_gfx11_gfx12<0x007>;
2616defm S_WAITCNT_DEPCTR             : SOPP_Real_32_gfx11<0x008>;
2617defm S_WAITCNT                    : SOPP_Real_32_gfx11_gfx12<0x009>;
2618defm S_WAIT_IDLE                  : SOPP_Real_32_gfx11_gfx12<0x00a>;
2619defm S_WAIT_EVENT                 : SOPP_Real_32_gfx11_gfx12<0x00b>;
2620defm S_TRAP                       : SOPP_Real_32_gfx11_gfx12<0x010>;
2621defm S_ROUND_MODE                 : SOPP_Real_32_gfx11_gfx12<0x011>;
2622defm S_DENORM_MODE                : SOPP_Real_32_gfx11_gfx12<0x012>;
2623defm S_BRANCH                     : SOPP_Real_With_Relaxation_gfx11_gfx12<0x020>;
2624defm S_CBRANCH_SCC0               : SOPP_Real_With_Relaxation_gfx11_gfx12<0x021>;
2625defm S_CBRANCH_SCC1               : SOPP_Real_With_Relaxation_gfx11_gfx12<0x022>;
2626defm S_CBRANCH_VCCZ               : SOPP_Real_With_Relaxation_gfx11_gfx12<0x023>;
2627defm S_CBRANCH_VCCNZ              : SOPP_Real_With_Relaxation_gfx11_gfx12<0x024>;
2628defm S_CBRANCH_EXECZ              : SOPP_Real_With_Relaxation_gfx11_gfx12<0x025>;
2629defm S_CBRANCH_EXECNZ             : SOPP_Real_With_Relaxation_gfx11_gfx12<0x026>;
2630defm S_CBRANCH_CDBGSYS            : SOPP_Real_With_Relaxation_gfx11<0x027>;
2631defm S_CBRANCH_CDBGUSER           : SOPP_Real_With_Relaxation_gfx11<0x028>;
2632defm S_CBRANCH_CDBGSYS_OR_USER    : SOPP_Real_With_Relaxation_gfx11<0x029>;
2633defm S_CBRANCH_CDBGSYS_AND_USER   : SOPP_Real_With_Relaxation_gfx11<0x02a>;
2634defm S_ENDPGM                     : SOPP_Real_32_gfx11_gfx12<0x030>;
2635defm S_ENDPGM_SAVED               : SOPP_Real_32_gfx11_gfx12<0x031>;
2636defm S_WAKEUP                     : SOPP_Real_32_gfx11_gfx12<0x034>;
2637defm S_SETPRIO                    : SOPP_Real_32_gfx11_gfx12<0x035>;
2638defm S_SENDMSG                    : SOPP_Real_32_gfx11_gfx12<0x036>;
2639defm S_SENDMSGHALT                : SOPP_Real_32_gfx11_gfx12<0x037>;
2640defm S_INCPERFLEVEL               : SOPP_Real_32_gfx11_gfx12<0x038>;
2641defm S_DECPERFLEVEL               : SOPP_Real_32_gfx11_gfx12<0x039>;
2642defm S_TTRACEDATA                 : SOPP_Real_32_gfx11_gfx12<0x03a>;
2643defm S_TTRACEDATA_IMM             : SOPP_Real_32_gfx11_gfx12<0x03b>;
2644defm S_ICACHE_INV                 : SOPP_Real_32_gfx11_gfx12<0x03c>;
2645defm S_BARRIER                    : SOPP_Real_32_gfx11_gfx12<0x03d>;
2646
2647//===----------------------------------------------------------------------===//
2648// SOPP - GFX1150, GFX12.
2649//===----------------------------------------------------------------------===//
2650
2651defm S_SINGLEUSE_VDST             : SOPP_Real_32_gfx11_gfx12<0x013>;
2652
2653//===----------------------------------------------------------------------===//
2654// SOPP - GFX6, GFX7, GFX8, GFX9, GFX10
2655//===----------------------------------------------------------------------===//
2656
2657multiclass SOPP_Real_32_gfx6_gfx7<bits<7> op> {
2658  defvar ps = !cast<SOPP_Pseudo>(NAME);
2659  def _gfx6_gfx7 : SOPP_Real_32<op, ps, !cast<SOPP_Pseudo>(NAME).Mnemonic>,
2660                   Select_gfx6_gfx7<ps.Mnemonic>,
2661                   SOPPRelaxTable<0, ps.KeyName, "_gfx6_gfx7">;
2662}
2663
2664multiclass SOPP_Real_32_gfx8_gfx9<bits<7> op> {
2665  defvar ps = !cast<SOPP_Pseudo>(NAME);
2666  def _vi : SOPP_Real_32<op, ps>,
2667            Select_vi<ps.Mnemonic>,
2668            SOPPRelaxTable<0, ps.KeyName, "_vi">;
2669}
2670
2671multiclass SOPP_Real_32_gfx10<bits<7> op> {
2672  defvar ps = !cast<SOPP_Pseudo>(NAME);
2673  def _gfx10 : SOPP_Real_32<op, ps>,
2674               Select_gfx10<ps.Mnemonic>,
2675               SOPPRelaxTable<0, ps.KeyName, "_gfx10">;
2676}
2677
2678multiclass SOPP_Real_32_gfx8_gfx9_gfx10<bits<7> op> :
2679  SOPP_Real_32_gfx8_gfx9<op>, SOPP_Real_32_gfx10<op>;
2680
2681multiclass SOPP_Real_32_gfx6_gfx7_gfx8_gfx9<bits<7> op> :
2682  SOPP_Real_32_gfx6_gfx7<op>, SOPP_Real_32_gfx8_gfx9<op>;
2683
2684multiclass SOPP_Real_32_gfx6_gfx7_gfx8_gfx9_gfx10<bits<7> op> :
2685  SOPP_Real_32_gfx6_gfx7_gfx8_gfx9<op>, SOPP_Real_32_gfx10<op>;
2686
2687multiclass SOPP_Real_32_gfx6_gfx7_gfx8_gfx9_gfx10_gfx11_gfx12<bits<7> op> :
2688  SOPP_Real_32_gfx6_gfx7_gfx8_gfx9_gfx10<op>, SOPP_Real_32_gfx11_gfx12<op>;
2689
2690multiclass SOPP_Real_32_gfx10_gfx11_gfx12<bits<7> op> :
2691  SOPP_Real_32_gfx10<op>, SOPP_Real_32_gfx11_gfx12<op>;
2692
2693//64 bit encodings, for Relaxation
2694multiclass SOPP_Real_64_gfx6_gfx7<bits<7> op> {
2695  defvar ps = !cast<SOPP_Pseudo>(NAME);
2696  def _gfx6_gfx7 : SOPP_Real_64<op, ps>,
2697                   Select_gfx6_gfx7<ps.Mnemonic>,
2698                   SOPPRelaxTable<1, ps.KeyName, "_gfx6_gfx7">;
2699}
2700
2701multiclass SOPP_Real_64_gfx8_gfx9<bits<7> op> {
2702  defvar ps = !cast<SOPP_Pseudo>(NAME);
2703  def _vi : SOPP_Real_64<op, ps>,
2704            Select_vi<ps.Mnemonic>,
2705            SOPPRelaxTable<1, ps.KeyName, "_vi">;
2706}
2707
2708multiclass SOPP_Real_64_gfx10<bits<7> op> {
2709  defvar ps = !cast<SOPP_Pseudo>(NAME);
2710  def _gfx10 : SOPP_Real_64<op, ps>,
2711               Select_gfx10<ps.Mnemonic>,
2712               SOPPRelaxTable<1, ps.KeyName, "_gfx10">;
2713}
2714
2715multiclass SOPP_Real_64_gfx8_gfx9_gfx10<bits<7> op> :
2716  SOPP_Real_64_gfx8_gfx9<op>, SOPP_Real_64_gfx10<op>;
2717
2718multiclass SOPP_Real_64_gfx6_gfx7_gfx8_gfx9<bits<7> op> :
2719  SOPP_Real_64_gfx6_gfx7<op>, SOPP_Real_64_gfx8_gfx9<op>;
2720
2721multiclass SOPP_Real_64_gfx6_gfx7_gfx8_gfx9_gfx10<bits<7> op> :
2722  SOPP_Real_64_gfx6_gfx7_gfx8_gfx9<op>, SOPP_Real_64_gfx10<op>;
2723
2724multiclass SOPP_Real_64_gfx6_gfx7_gfx8_gfx9_gfx10_gfx11_gfx12<bits<7> op> :
2725  SOPP_Real_64_gfx6_gfx7_gfx8_gfx9_gfx10<op>, SOPP_Real_64_gfx11_gfx12<op>;
2726
2727//relaxation for insts with no operands not implemented
2728multiclass SOPP_Real_With_Relaxation_gfx6_gfx7_gfx8_gfx9_gfx10<bits<7> op> {
2729  defm "" : SOPP_Real_32_gfx6_gfx7_gfx8_gfx9_gfx10<op>;
2730  defm _pad_s_nop : SOPP_Real_64_gfx6_gfx7_gfx8_gfx9_gfx10<op>;
2731}
2732
2733defm S_NOP                      : SOPP_Real_32_gfx6_gfx7_gfx8_gfx9_gfx10_gfx11_gfx12<0x000>;
2734defm S_ENDPGM                   : SOPP_Real_32_gfx6_gfx7_gfx8_gfx9_gfx10<0x001>;
2735defm S_WAKEUP                   : SOPP_Real_32_gfx8_gfx9_gfx10<0x003>;
2736defm S_BARRIER                  : SOPP_Real_32_gfx6_gfx7_gfx8_gfx9_gfx10<0x00a>;
2737defm S_WAITCNT                  : SOPP_Real_32_gfx6_gfx7_gfx8_gfx9_gfx10<0x00c>;
2738defm S_SETHALT                  : SOPP_Real_32_gfx6_gfx7_gfx8_gfx9_gfx10<0x00d>;
2739defm S_SETKILL                  : SOPP_Real_32_gfx6_gfx7_gfx8_gfx9_gfx10<0x00b>;
2740defm S_SLEEP                    : SOPP_Real_32_gfx6_gfx7_gfx8_gfx9_gfx10<0x00e>;
2741defm S_SETPRIO                  : SOPP_Real_32_gfx6_gfx7_gfx8_gfx9_gfx10<0x00f>;
2742defm S_SENDMSG                  : SOPP_Real_32_gfx6_gfx7_gfx8_gfx9_gfx10<0x010>;
2743defm S_SENDMSGHALT              : SOPP_Real_32_gfx6_gfx7_gfx8_gfx9_gfx10<0x011>;
2744defm S_TRAP                     : SOPP_Real_32_gfx6_gfx7_gfx8_gfx9_gfx10<0x012>;
2745defm S_ICACHE_INV               : SOPP_Real_32_gfx6_gfx7_gfx8_gfx9_gfx10<0x013>;
2746defm S_INCPERFLEVEL             : SOPP_Real_32_gfx6_gfx7_gfx8_gfx9_gfx10<0x014>;
2747defm S_DECPERFLEVEL             : SOPP_Real_32_gfx6_gfx7_gfx8_gfx9_gfx10<0x015>;
2748defm S_TTRACEDATA               : SOPP_Real_32_gfx6_gfx7_gfx8_gfx9_gfx10<0x016>;
2749defm S_ENDPGM_SAVED             : SOPP_Real_32_gfx6_gfx7_gfx8_gfx9_gfx10<0x01B>;
2750defm S_SET_GPR_IDX_OFF          : SOPP_Real_32_gfx8_gfx9<0x01c>;
2751defm S_SET_GPR_IDX_MODE         : SOPP_Real_32_gfx8_gfx9<0x01d>;
2752defm S_ENDPGM_ORDERED_PS_DONE   : SOPP_Real_32_gfx8_gfx9_gfx10<0x01e>;
2753defm S_CODE_END                 : SOPP_Real_32_gfx10_gfx11_gfx12<0x01f>;
2754defm S_INST_PREFETCH            : SOPP_Real_32_gfx10<0x020>;
2755defm S_CLAUSE                   : SOPP_Real_32_gfx10<0x021>;
2756defm S_WAIT_IDLE                : SOPP_Real_32_gfx10<0x022>;
2757defm S_WAITCNT_DEPCTR           : SOPP_Real_32_gfx10<0x023>;
2758defm S_ROUND_MODE               : SOPP_Real_32_gfx10<0x024>;
2759defm S_DENORM_MODE              : SOPP_Real_32_gfx10<0x025>;
2760defm S_TTRACEDATA_IMM           : SOPP_Real_32_gfx10<0x028>;
2761
2762let isBranch = 1 in {
2763defm S_BRANCH                   : SOPP_Real_With_Relaxation_gfx6_gfx7_gfx8_gfx9_gfx10<0x002>;
2764defm S_CBRANCH_SCC0             : SOPP_Real_With_Relaxation_gfx6_gfx7_gfx8_gfx9_gfx10<0x004>;
2765defm S_CBRANCH_SCC1             : SOPP_Real_With_Relaxation_gfx6_gfx7_gfx8_gfx9_gfx10<0x005>;
2766defm S_CBRANCH_VCCZ             : SOPP_Real_With_Relaxation_gfx6_gfx7_gfx8_gfx9_gfx10<0x006>;
2767defm S_CBRANCH_VCCNZ            : SOPP_Real_With_Relaxation_gfx6_gfx7_gfx8_gfx9_gfx10<0x007>;
2768defm S_CBRANCH_EXECZ            : SOPP_Real_With_Relaxation_gfx6_gfx7_gfx8_gfx9_gfx10<0x008>;
2769defm S_CBRANCH_EXECNZ           : SOPP_Real_With_Relaxation_gfx6_gfx7_gfx8_gfx9_gfx10<0x009>;
2770defm S_CBRANCH_CDBGSYS          : SOPP_Real_With_Relaxation_gfx6_gfx7_gfx8_gfx9_gfx10<0x017>;
2771defm S_CBRANCH_CDBGUSER         : SOPP_Real_With_Relaxation_gfx6_gfx7_gfx8_gfx9_gfx10<0x018>;
2772defm S_CBRANCH_CDBGSYS_OR_USER  : SOPP_Real_With_Relaxation_gfx6_gfx7_gfx8_gfx9_gfx10<0x019>;
2773defm S_CBRANCH_CDBGSYS_AND_USER : SOPP_Real_With_Relaxation_gfx6_gfx7_gfx8_gfx9_gfx10<0x01A>;
2774}
2775
2776//===----------------------------------------------------------------------===//
2777// SOPC - GFX11, GFX12.
2778//===----------------------------------------------------------------------===//
2779
2780multiclass SOPC_Real_gfx12<bits<7> op> {
2781  def _gfx12 : SOPC_Real<op, !cast<SOPC_Pseudo>(NAME)>,
2782               Select_gfx12<!cast<SOPC_Pseudo>(NAME).Mnemonic>;
2783}
2784
2785multiclass SOPC_Real_gfx11<bits<7> op> {
2786  def _gfx11 : SOPC_Real<op, !cast<SOPC_Pseudo>(NAME)>,
2787               Select_gfx11<!cast<SOPC_Pseudo>(NAME).Mnemonic>;
2788}
2789
2790multiclass SOPC_Real_gfx11_gfx12<bits<7> op> :
2791  SOPC_Real_gfx11<op>, SOPC_Real_gfx12<op>;
2792
2793defm S_CMP_EQ_I32     : SOPC_Real_gfx11_gfx12<0x00>;
2794defm S_CMP_LG_I32     : SOPC_Real_gfx11_gfx12<0x01>;
2795defm S_CMP_GT_I32     : SOPC_Real_gfx11_gfx12<0x02>;
2796defm S_CMP_GE_I32     : SOPC_Real_gfx11_gfx12<0x03>;
2797defm S_CMP_LT_I32     : SOPC_Real_gfx11_gfx12<0x04>;
2798defm S_CMP_LE_I32     : SOPC_Real_gfx11_gfx12<0x05>;
2799defm S_CMP_EQ_U32     : SOPC_Real_gfx11_gfx12<0x06>;
2800defm S_CMP_LG_U32     : SOPC_Real_gfx11_gfx12<0x07>;
2801defm S_CMP_GT_U32     : SOPC_Real_gfx11_gfx12<0x08>;
2802defm S_CMP_GE_U32     : SOPC_Real_gfx11_gfx12<0x09>;
2803defm S_CMP_LT_U32     : SOPC_Real_gfx11_gfx12<0x0a>;
2804defm S_CMP_LE_U32     : SOPC_Real_gfx11_gfx12<0x0b>;
2805defm S_BITCMP0_B32    : SOPC_Real_gfx11_gfx12<0x0c>;
2806defm S_BITCMP1_B32    : SOPC_Real_gfx11_gfx12<0x0d>;
2807defm S_BITCMP0_B64    : SOPC_Real_gfx11_gfx12<0x0e>;
2808defm S_BITCMP1_B64    : SOPC_Real_gfx11_gfx12<0x0f>;
2809defm S_CMP_EQ_U64     : SOPC_Real_gfx11_gfx12<0x10>;
2810defm S_CMP_LG_U64     : SOPC_Real_gfx11_gfx12<0x11>;
2811
2812//===----------------------------------------------------------------------===//
2813// SOPC - GFX1150, GFX12
2814//===----------------------------------------------------------------------===//
2815
2816defm S_CMP_LT_F32  : SOPC_Real_gfx11_gfx12<0x41>;
2817defm S_CMP_EQ_F32  : SOPC_Real_gfx11_gfx12<0x42>;
2818defm S_CMP_LE_F32  : SOPC_Real_gfx11_gfx12<0x43>;
2819defm S_CMP_GT_F32  : SOPC_Real_gfx11_gfx12<0x44>;
2820defm S_CMP_LG_F32  : SOPC_Real_gfx11_gfx12<0x45>;
2821defm S_CMP_GE_F32  : SOPC_Real_gfx11_gfx12<0x46>;
2822defm S_CMP_O_F32   : SOPC_Real_gfx11_gfx12<0x47>;
2823defm S_CMP_U_F32   : SOPC_Real_gfx11_gfx12<0x48>;
2824defm S_CMP_NGE_F32 : SOPC_Real_gfx11_gfx12<0x49>;
2825defm S_CMP_NLG_F32 : SOPC_Real_gfx11_gfx12<0x4a>;
2826defm S_CMP_NGT_F32 : SOPC_Real_gfx11_gfx12<0x4b>;
2827defm S_CMP_NLE_F32 : SOPC_Real_gfx11_gfx12<0x4c>;
2828defm S_CMP_NEQ_F32 : SOPC_Real_gfx11_gfx12<0x4d>;
2829defm S_CMP_NLT_F32 : SOPC_Real_gfx11_gfx12<0x4e>;
2830
2831defm S_CMP_LT_F16  : SOPC_Real_gfx11_gfx12<0x51>;
2832defm S_CMP_EQ_F16  : SOPC_Real_gfx11_gfx12<0x52>;
2833defm S_CMP_LE_F16  : SOPC_Real_gfx11_gfx12<0x53>;
2834defm S_CMP_GT_F16  : SOPC_Real_gfx11_gfx12<0x54>;
2835defm S_CMP_LG_F16  : SOPC_Real_gfx11_gfx12<0x55>;
2836defm S_CMP_GE_F16  : SOPC_Real_gfx11_gfx12<0x56>;
2837defm S_CMP_O_F16   : SOPC_Real_gfx11_gfx12<0x57>;
2838defm S_CMP_U_F16   : SOPC_Real_gfx11_gfx12<0x58>;
2839defm S_CMP_NGE_F16 : SOPC_Real_gfx11_gfx12<0x59>;
2840defm S_CMP_NLG_F16 : SOPC_Real_gfx11_gfx12<0x5a>;
2841defm S_CMP_NGT_F16 : SOPC_Real_gfx11_gfx12<0x5b>;
2842defm S_CMP_NLE_F16 : SOPC_Real_gfx11_gfx12<0x5c>;
2843defm S_CMP_NEQ_F16 : SOPC_Real_gfx11_gfx12<0x5d>;
2844defm S_CMP_NLT_F16 : SOPC_Real_gfx11_gfx12<0x5e>;
2845
2846//===----------------------------------------------------------------------===//
2847// SOPC - GFX6, GFX7, GFX8, GFX9, GFX10
2848//===----------------------------------------------------------------------===//
2849
2850multiclass SOPC_Real_gfx6_gfx7<bits<7> op> {
2851  defvar ps = !cast<SOPC_Pseudo>(NAME);
2852  def _gfx6_gfx7 : SOPC_Real<op, ps>,
2853                   Select_gfx6_gfx7<ps.Mnemonic>;
2854}
2855
2856multiclass SOPC_Real_gfx8_gfx9<bits<7> op> {
2857  defvar ps = !cast<SOPC_Pseudo>(NAME);
2858  def _vi : SOPC_Real<op, ps>,
2859            Select_vi<ps.Mnemonic>;
2860}
2861
2862multiclass SOPC_Real_gfx10<bits<7> op> {
2863  defvar ps = !cast<SOPC_Pseudo>(NAME);
2864  def _gfx10 : SOPC_Real<op, ps>,
2865               Select_gfx10<ps.Mnemonic>;
2866}
2867
2868multiclass SOPC_Real_gfx8_gfx9_gfx10<bits<7> op> :
2869  SOPC_Real_gfx8_gfx9<op>, SOPC_Real_gfx10<op>;
2870
2871multiclass SOPC_Real_gfx6_gfx7_gfx8_gfx9<bits<7> op> :
2872  SOPC_Real_gfx6_gfx7<op>, SOPC_Real_gfx8_gfx9<op>;
2873
2874multiclass SOPC_Real_gfx6_gfx7_gfx8_gfx9_gfx10<bits<7> op> :
2875  SOPC_Real_gfx6_gfx7_gfx8_gfx9<op>, SOPC_Real_gfx10<op>;
2876
2877defm S_CMP_EQ_I32     : SOPC_Real_gfx6_gfx7_gfx8_gfx9_gfx10<0x00>;
2878defm S_CMP_LG_I32     : SOPC_Real_gfx6_gfx7_gfx8_gfx9_gfx10<0x01>;
2879defm S_CMP_GT_I32     : SOPC_Real_gfx6_gfx7_gfx8_gfx9_gfx10<0x02>;
2880defm S_CMP_GE_I32     : SOPC_Real_gfx6_gfx7_gfx8_gfx9_gfx10<0x03>;
2881defm S_CMP_LT_I32     : SOPC_Real_gfx6_gfx7_gfx8_gfx9_gfx10<0x04>;
2882defm S_CMP_LE_I32     : SOPC_Real_gfx6_gfx7_gfx8_gfx9_gfx10<0x05>;
2883defm S_CMP_EQ_U32     : SOPC_Real_gfx6_gfx7_gfx8_gfx9_gfx10<0x06>;
2884defm S_CMP_LG_U32     : SOPC_Real_gfx6_gfx7_gfx8_gfx9_gfx10<0x07>;
2885defm S_CMP_GT_U32     : SOPC_Real_gfx6_gfx7_gfx8_gfx9_gfx10<0x08>;
2886defm S_CMP_GE_U32     : SOPC_Real_gfx6_gfx7_gfx8_gfx9_gfx10<0x09>;
2887defm S_CMP_LT_U32     : SOPC_Real_gfx6_gfx7_gfx8_gfx9_gfx10<0x0a>;
2888defm S_CMP_LE_U32     : SOPC_Real_gfx6_gfx7_gfx8_gfx9_gfx10<0x0b>;
2889defm S_BITCMP0_B32    : SOPC_Real_gfx6_gfx7_gfx8_gfx9_gfx10<0x0c>;
2890defm S_BITCMP1_B32    : SOPC_Real_gfx6_gfx7_gfx8_gfx9_gfx10<0x0d>;
2891defm S_BITCMP0_B64    : SOPC_Real_gfx6_gfx7_gfx8_gfx9_gfx10<0x0e>;
2892defm S_BITCMP1_B64    : SOPC_Real_gfx6_gfx7_gfx8_gfx9_gfx10<0x0f>;
2893defm S_SETVSKIP       : SOPC_Real_gfx6_gfx7_gfx8_gfx9<0x10>;
2894defm S_SET_GPR_IDX_ON : SOPC_Real_gfx8_gfx9<0x11>;
2895defm S_CMP_EQ_U64     : SOPC_Real_gfx8_gfx9_gfx10<0x12>;
2896defm S_CMP_LG_U64     : SOPC_Real_gfx8_gfx9_gfx10<0x13>;
2897
2898//===----------------------------------------------------------------------===//
2899// GFX8 (VI), GFX9.
2900//===----------------------------------------------------------------------===//
2901
2902class SOP1_Real_vi<bits<8> op, SOP1_Pseudo ps> :
2903  SOP1_Real<op, ps>,
2904  Select_vi<ps.Mnemonic>;
2905
2906class SOP2_Real_vi<bits<7> op, SOP2_Pseudo ps> :
2907  SOP2_Real32<op, ps>,
2908  Select_vi<ps.Mnemonic>;
2909
2910class SOPK_Real_vi<bits<5> op, SOPK_Pseudo ps> :
2911  SOPK_Real32<op, ps>,
2912  Select_vi<ps.Mnemonic>;
2913
2914def S_MOV_B32_vi           : SOP1_Real_vi <0x00, S_MOV_B32>;
2915def S_MOV_B64_vi           : SOP1_Real_vi <0x01, S_MOV_B64>;
2916def S_CMOV_B32_vi          : SOP1_Real_vi <0x02, S_CMOV_B32>;
2917def S_CMOV_B64_vi          : SOP1_Real_vi <0x03, S_CMOV_B64>;
2918def S_NOT_B32_vi           : SOP1_Real_vi <0x04, S_NOT_B32>;
2919def S_NOT_B64_vi           : SOP1_Real_vi <0x05, S_NOT_B64>;
2920def S_WQM_B32_vi           : SOP1_Real_vi <0x06, S_WQM_B32>;
2921def S_WQM_B64_vi           : SOP1_Real_vi <0x07, S_WQM_B64>;
2922def S_BREV_B32_vi          : SOP1_Real_vi <0x08, S_BREV_B32>;
2923def S_BREV_B64_vi          : SOP1_Real_vi <0x09, S_BREV_B64>;
2924def S_BCNT0_I32_B32_vi     : SOP1_Real_vi <0x0a, S_BCNT0_I32_B32>;
2925def S_BCNT0_I32_B64_vi     : SOP1_Real_vi <0x0b, S_BCNT0_I32_B64>;
2926def S_BCNT1_I32_B32_vi     : SOP1_Real_vi <0x0c, S_BCNT1_I32_B32>;
2927def S_BCNT1_I32_B64_vi     : SOP1_Real_vi <0x0d, S_BCNT1_I32_B64>;
2928def S_FF0_I32_B32_vi       : SOP1_Real_vi <0x0e, S_FF0_I32_B32>;
2929def S_FF0_I32_B64_vi       : SOP1_Real_vi <0x0f, S_FF0_I32_B64>;
2930def S_FF1_I32_B32_vi       : SOP1_Real_vi <0x10, S_FF1_I32_B32>;
2931def S_FF1_I32_B64_vi       : SOP1_Real_vi <0x11, S_FF1_I32_B64>;
2932def S_FLBIT_I32_B32_vi     : SOP1_Real_vi <0x12, S_FLBIT_I32_B32>;
2933def S_FLBIT_I32_B64_vi     : SOP1_Real_vi <0x13, S_FLBIT_I32_B64>;
2934def S_FLBIT_I32_vi         : SOP1_Real_vi <0x14, S_FLBIT_I32>;
2935def S_FLBIT_I32_I64_vi     : SOP1_Real_vi <0x15, S_FLBIT_I32_I64>;
2936def S_SEXT_I32_I8_vi       : SOP1_Real_vi <0x16, S_SEXT_I32_I8>;
2937def S_SEXT_I32_I16_vi      : SOP1_Real_vi <0x17, S_SEXT_I32_I16>;
2938def S_BITSET0_B32_vi       : SOP1_Real_vi <0x18, S_BITSET0_B32>;
2939def S_BITSET0_B64_vi       : SOP1_Real_vi <0x19, S_BITSET0_B64>;
2940def S_BITSET1_B32_vi       : SOP1_Real_vi <0x1a, S_BITSET1_B32>;
2941def S_BITSET1_B64_vi       : SOP1_Real_vi <0x1b, S_BITSET1_B64>;
2942def S_GETPC_B64_vi         : SOP1_Real_vi <0x1c, S_GETPC_B64>;
2943def S_SETPC_B64_vi         : SOP1_Real_vi <0x1d, S_SETPC_B64>;
2944def S_SWAPPC_B64_vi        : SOP1_Real_vi <0x1e, S_SWAPPC_B64>;
2945def S_RFE_B64_vi           : SOP1_Real_vi <0x1f, S_RFE_B64>;
2946def S_AND_SAVEEXEC_B64_vi  : SOP1_Real_vi <0x20, S_AND_SAVEEXEC_B64>;
2947def S_OR_SAVEEXEC_B64_vi   : SOP1_Real_vi <0x21, S_OR_SAVEEXEC_B64>;
2948def S_XOR_SAVEEXEC_B64_vi  : SOP1_Real_vi <0x22, S_XOR_SAVEEXEC_B64>;
2949def S_ANDN2_SAVEEXEC_B64_vi: SOP1_Real_vi <0x23, S_ANDN2_SAVEEXEC_B64>;
2950def S_ORN2_SAVEEXEC_B64_vi : SOP1_Real_vi <0x24, S_ORN2_SAVEEXEC_B64>;
2951def S_NAND_SAVEEXEC_B64_vi : SOP1_Real_vi <0x25, S_NAND_SAVEEXEC_B64>;
2952def S_NOR_SAVEEXEC_B64_vi  : SOP1_Real_vi <0x26, S_NOR_SAVEEXEC_B64>;
2953def S_XNOR_SAVEEXEC_B64_vi : SOP1_Real_vi <0x27, S_XNOR_SAVEEXEC_B64>;
2954def S_QUADMASK_B32_vi      : SOP1_Real_vi <0x28, S_QUADMASK_B32>;
2955def S_QUADMASK_B64_vi      : SOP1_Real_vi <0x29, S_QUADMASK_B64>;
2956def S_MOVRELS_B32_vi       : SOP1_Real_vi <0x2a, S_MOVRELS_B32>;
2957def S_MOVRELS_B64_vi       : SOP1_Real_vi <0x2b, S_MOVRELS_B64>;
2958def S_MOVRELD_B32_vi       : SOP1_Real_vi <0x2c, S_MOVRELD_B32>;
2959def S_MOVRELD_B64_vi       : SOP1_Real_vi <0x2d, S_MOVRELD_B64>;
2960def S_CBRANCH_JOIN_vi      : SOP1_Real_vi <0x2e, S_CBRANCH_JOIN>;
2961def S_ABS_I32_vi           : SOP1_Real_vi <0x30, S_ABS_I32>;
2962def S_SET_GPR_IDX_IDX_vi   : SOP1_Real_vi <0x32, S_SET_GPR_IDX_IDX>;
2963
2964def S_ADD_U32_vi           : SOP2_Real_vi <0x00, S_ADD_U32>;
2965def S_ADD_I32_vi           : SOP2_Real_vi <0x02, S_ADD_I32>;
2966def S_SUB_U32_vi           : SOP2_Real_vi <0x01, S_SUB_U32>;
2967def S_SUB_I32_vi           : SOP2_Real_vi <0x03, S_SUB_I32>;
2968def S_ADDC_U32_vi          : SOP2_Real_vi <0x04, S_ADDC_U32>;
2969def S_SUBB_U32_vi          : SOP2_Real_vi <0x05, S_SUBB_U32>;
2970def S_MIN_I32_vi           : SOP2_Real_vi <0x06, S_MIN_I32>;
2971def S_MIN_U32_vi           : SOP2_Real_vi <0x07, S_MIN_U32>;
2972def S_MAX_I32_vi           : SOP2_Real_vi <0x08, S_MAX_I32>;
2973def S_MAX_U32_vi           : SOP2_Real_vi <0x09, S_MAX_U32>;
2974def S_CSELECT_B32_vi       : SOP2_Real_vi <0x0a, S_CSELECT_B32>;
2975def S_CSELECT_B64_vi       : SOP2_Real_vi <0x0b, S_CSELECT_B64>;
2976def S_AND_B32_vi           : SOP2_Real_vi <0x0c, S_AND_B32>;
2977def S_AND_B64_vi           : SOP2_Real_vi <0x0d, S_AND_B64>;
2978def S_OR_B32_vi            : SOP2_Real_vi <0x0e, S_OR_B32>;
2979def S_OR_B64_vi            : SOP2_Real_vi <0x0f, S_OR_B64>;
2980def S_XOR_B32_vi           : SOP2_Real_vi <0x10, S_XOR_B32>;
2981def S_XOR_B64_vi           : SOP2_Real_vi <0x11, S_XOR_B64>;
2982def S_ANDN2_B32_vi         : SOP2_Real_vi <0x12, S_ANDN2_B32>;
2983def S_ANDN2_B64_vi         : SOP2_Real_vi <0x13, S_ANDN2_B64>;
2984def S_ORN2_B32_vi          : SOP2_Real_vi <0x14, S_ORN2_B32>;
2985def S_ORN2_B64_vi          : SOP2_Real_vi <0x15, S_ORN2_B64>;
2986def S_NAND_B32_vi          : SOP2_Real_vi <0x16, S_NAND_B32>;
2987def S_NAND_B64_vi          : SOP2_Real_vi <0x17, S_NAND_B64>;
2988def S_NOR_B32_vi           : SOP2_Real_vi <0x18, S_NOR_B32>;
2989def S_NOR_B64_vi           : SOP2_Real_vi <0x19, S_NOR_B64>;
2990def S_XNOR_B32_vi          : SOP2_Real_vi <0x1a, S_XNOR_B32>;
2991def S_XNOR_B64_vi          : SOP2_Real_vi <0x1b, S_XNOR_B64>;
2992def S_LSHL_B32_vi          : SOP2_Real_vi <0x1c, S_LSHL_B32>;
2993def S_LSHL_B64_vi          : SOP2_Real_vi <0x1d, S_LSHL_B64>;
2994def S_LSHR_B32_vi          : SOP2_Real_vi <0x1e, S_LSHR_B32>;
2995def S_LSHR_B64_vi          : SOP2_Real_vi <0x1f, S_LSHR_B64>;
2996def S_ASHR_I32_vi          : SOP2_Real_vi <0x20, S_ASHR_I32>;
2997def S_ASHR_I64_vi          : SOP2_Real_vi <0x21, S_ASHR_I64>;
2998def S_BFM_B32_vi           : SOP2_Real_vi <0x22, S_BFM_B32>;
2999def S_BFM_B64_vi           : SOP2_Real_vi <0x23, S_BFM_B64>;
3000def S_MUL_I32_vi           : SOP2_Real_vi <0x24, S_MUL_I32>;
3001def S_BFE_U32_vi           : SOP2_Real_vi <0x25, S_BFE_U32>;
3002def S_BFE_I32_vi           : SOP2_Real_vi <0x26, S_BFE_I32>;
3003def S_BFE_U64_vi           : SOP2_Real_vi <0x27, S_BFE_U64>;
3004def S_BFE_I64_vi           : SOP2_Real_vi <0x28, S_BFE_I64>;
3005def S_CBRANCH_G_FORK_vi    : SOP2_Real_vi <0x29, S_CBRANCH_G_FORK>;
3006def S_ABSDIFF_I32_vi       : SOP2_Real_vi <0x2a, S_ABSDIFF_I32>;
3007def S_PACK_LL_B32_B16_vi   : SOP2_Real_vi <0x32, S_PACK_LL_B32_B16>;
3008def S_PACK_LH_B32_B16_vi   : SOP2_Real_vi <0x33, S_PACK_LH_B32_B16>;
3009def S_PACK_HH_B32_B16_vi   : SOP2_Real_vi <0x34, S_PACK_HH_B32_B16>;
3010def S_RFE_RESTORE_B64_vi   : SOP2_Real_vi <0x2b, S_RFE_RESTORE_B64>;
3011
3012def S_MOVK_I32_vi          : SOPK_Real_vi <0x00, S_MOVK_I32>;
3013def S_CMOVK_I32_vi         : SOPK_Real_vi <0x01, S_CMOVK_I32>;
3014def S_CMPK_EQ_I32_vi       : SOPK_Real_vi <0x02, S_CMPK_EQ_I32>;
3015def S_CMPK_LG_I32_vi       : SOPK_Real_vi <0x03, S_CMPK_LG_I32>;
3016def S_CMPK_GT_I32_vi       : SOPK_Real_vi <0x04, S_CMPK_GT_I32>;
3017def S_CMPK_GE_I32_vi       : SOPK_Real_vi <0x05, S_CMPK_GE_I32>;
3018def S_CMPK_LT_I32_vi       : SOPK_Real_vi <0x06, S_CMPK_LT_I32>;
3019def S_CMPK_LE_I32_vi       : SOPK_Real_vi <0x07, S_CMPK_LE_I32>;
3020def S_CMPK_EQ_U32_vi       : SOPK_Real_vi <0x08, S_CMPK_EQ_U32>;
3021def S_CMPK_LG_U32_vi       : SOPK_Real_vi <0x09, S_CMPK_LG_U32>;
3022def S_CMPK_GT_U32_vi       : SOPK_Real_vi <0x0A, S_CMPK_GT_U32>;
3023def S_CMPK_GE_U32_vi       : SOPK_Real_vi <0x0B, S_CMPK_GE_U32>;
3024def S_CMPK_LT_U32_vi       : SOPK_Real_vi <0x0C, S_CMPK_LT_U32>;
3025def S_CMPK_LE_U32_vi       : SOPK_Real_vi <0x0D, S_CMPK_LE_U32>;
3026def S_ADDK_I32_vi          : SOPK_Real_vi <0x0E, S_ADDK_I32>;
3027def S_MULK_I32_vi          : SOPK_Real_vi <0x0F, S_MULK_I32>;
3028def S_CBRANCH_I_FORK_vi    : SOPK_Real_vi <0x10, S_CBRANCH_I_FORK>;
3029def S_GETREG_B32_vi        : SOPK_Real_vi <0x11, S_GETREG_B32>;
3030def S_SETREG_B32_vi        : SOPK_Real_vi <0x12, S_SETREG_B32>;
3031//def S_GETREG_REGRD_B32_vi  : SOPK_Real_vi <0x13, S_GETREG_REGRD_B32>; // see pseudo for comments
3032def S_SETREG_IMM32_B32_vi  : SOPK_Real64<0x14, S_SETREG_IMM32_B32>,
3033                             Select_vi<S_SETREG_IMM32_B32.Mnemonic>;
3034
3035def S_CALL_B64_vi          : SOPK_Real_vi <0x15, S_CALL_B64>;
3036
3037//===----------------------------------------------------------------------===//
3038// SOP1 - GFX9.
3039//===----------------------------------------------------------------------===//
3040
3041def S_ANDN1_SAVEEXEC_B64_vi   : SOP1_Real_vi<0x33, S_ANDN1_SAVEEXEC_B64>;
3042def S_ORN1_SAVEEXEC_B64_vi    : SOP1_Real_vi<0x34, S_ORN1_SAVEEXEC_B64>;
3043def S_ANDN1_WREXEC_B64_vi     : SOP1_Real_vi<0x35, S_ANDN1_WREXEC_B64>;
3044def S_ANDN2_WREXEC_B64_vi     : SOP1_Real_vi<0x36, S_ANDN2_WREXEC_B64>;
3045def S_BITREPLICATE_B64_B32_vi : SOP1_Real_vi<0x37, S_BITREPLICATE_B64_B32>;
3046
3047//===----------------------------------------------------------------------===//
3048// SOP2 - GFX9.
3049//===----------------------------------------------------------------------===//
3050
3051def S_LSHL1_ADD_U32_vi   : SOP2_Real_vi<0x2e, S_LSHL1_ADD_U32>;
3052def S_LSHL2_ADD_U32_vi   : SOP2_Real_vi<0x2f, S_LSHL2_ADD_U32>;
3053def S_LSHL3_ADD_U32_vi   : SOP2_Real_vi<0x30, S_LSHL3_ADD_U32>;
3054def S_LSHL4_ADD_U32_vi   : SOP2_Real_vi<0x31, S_LSHL4_ADD_U32>;
3055def S_MUL_HI_U32_vi      : SOP2_Real_vi<0x2c, S_MUL_HI_U32>;
3056def S_MUL_HI_I32_vi      : SOP2_Real_vi<0x2d, S_MUL_HI_I32>;
3057