xref: /freebsd/contrib/llvm-project/llvm/lib/Target/AMDGPU/SOPInstructions.td (revision 8a271827e7b5d5310e06df1f9f49ba0ef9efd263)
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 GPRIdxModeMatchClass : AsmOperandClass {
10  let Name = "GPRIdxMode";
11  let PredicateMethod = "isGPRIdxMode";
12  let ParserMethod = "parseGPRIdxMode";
13  let RenderMethod = "addImmOperands";
14}
15
16def GPRIdxMode : Operand<i32> {
17  let PrintMethod = "printVGPRIndexMode";
18  let ParserMatchClass = GPRIdxModeMatchClass;
19  let OperandType = "OPERAND_IMMEDIATE";
20}
21
22class SOP_Pseudo<string opName, dag outs, dag ins, string asmOps,
23                  list<dag> pattern=[]> :
24    InstSI<outs, ins, "", pattern>,
25    SIMCInstr<opName, SIEncodingFamily.NONE> {
26
27  let isPseudo = 1;
28  let isCodeGenOnly = 1;
29
30  string Mnemonic = opName;
31  string AsmOperands = asmOps;
32
33  bits<1> has_sdst = 0;
34}
35
36//===----------------------------------------------------------------------===//
37// SOP1 Instructions
38//===----------------------------------------------------------------------===//
39
40class SOP1_Pseudo <string opName, dag outs, dag ins,
41                   string asmOps, list<dag> pattern=[]> :
42  SOP_Pseudo<opName, outs, ins, asmOps, pattern> {
43
44  let mayLoad = 0;
45  let mayStore = 0;
46  let hasSideEffects = 0;
47  let SALU = 1;
48  let SOP1 = 1;
49  let SchedRW = [WriteSALU];
50  let Size = 4;
51  let UseNamedOperandTable = 1;
52
53  bits<1> has_src0 = 1;
54  bits<1> has_sdst = 1;
55}
56
57class SOP1_Real<bits<8> op, SOP1_Pseudo ps, string real_name = ps.Mnemonic> :
58  InstSI <ps.OutOperandList, ps.InOperandList,
59          real_name # " " # ps.AsmOperands, []>,
60  Enc32 {
61
62  let SALU = 1;
63  let SOP1 = 1;
64  let isPseudo = 0;
65  let isCodeGenOnly = 0;
66  let Size = 4;
67
68  // copy relevant pseudo op flags
69  let SubtargetPredicate = ps.SubtargetPredicate;
70  let AsmMatchConverter  = ps.AsmMatchConverter;
71  let SchedRW            = ps.SchedRW;
72  let mayLoad            = ps.mayLoad;
73  let mayStore           = ps.mayStore;
74
75  // encoding
76  bits<7> sdst;
77  bits<8> src0;
78
79  let Inst{7-0} = !if(ps.has_src0, src0, ?);
80  let Inst{15-8} = op;
81  let Inst{22-16} = !if(ps.has_sdst, sdst, ?);
82  let Inst{31-23} = 0x17d; //encoding;
83}
84
85class SOP1_32 <string opName, list<dag> pattern=[], bit tied_in = 0> : SOP1_Pseudo <
86  opName, (outs SReg_32:$sdst),
87  !if(tied_in, (ins SSrc_b32:$src0, SReg_32:$sdst_in),
88               (ins SSrc_b32:$src0)),
89  "$sdst, $src0", pattern> {
90  let Constraints = !if(tied_in, "$sdst = $sdst_in", "");
91}
92
93// Only register input allowed.
94class SOP1_32R <string opName, list<dag> pattern=[]> : SOP1_Pseudo <
95  opName, (outs SReg_32:$sdst), (ins SReg_32:$src0),
96  "$sdst, $src0", pattern>;
97
98// 32-bit input, no output.
99class SOP1_0_32 <string opName, list<dag> pattern = []> : SOP1_Pseudo <
100  opName, (outs), (ins SSrc_b32:$src0),
101  "$src0", pattern> {
102  let has_sdst = 0;
103}
104
105// Special case for movreld where sdst is treated as a use operand.
106class SOP1_32_movreld <string opName, list<dag> pattern=[]> : SOP1_Pseudo <
107  opName, (outs), (ins SReg_32:$sdst, SSrc_b32:$src0),
108  "$sdst, $src0", pattern>;
109
110// Special case for movreld where sdst is treated as a use operand.
111class SOP1_64_movreld <string opName, list<dag> pattern=[]> : SOP1_Pseudo <
112  opName, (outs), (ins SReg_64:$sdst, SSrc_b64:$src0),
113  "$sdst, $src0", pattern
114>;
115
116class SOP1_0_32R <string opName, list<dag> pattern = []> : SOP1_Pseudo <
117  opName, (outs), (ins SReg_32:$src0),
118  "$src0", pattern> {
119  let has_sdst = 0;
120}
121
122class SOP1_64 <string opName, list<dag> pattern=[]> : SOP1_Pseudo <
123  opName, (outs SReg_64:$sdst), (ins SSrc_b64:$src0),
124  "$sdst, $src0", pattern
125>;
126
127// Only register input allowed.
128class SOP1_64R <string opName, list<dag> pattern=[]> : SOP1_Pseudo <
129  opName, (outs SReg_64:$sdst), (ins SReg_64:$src0),
130  "$sdst, $src0", pattern
131>;
132
133// 64-bit input, 32-bit output.
134class SOP1_32_64 <string opName, list<dag> pattern=[]> : SOP1_Pseudo <
135  opName, (outs SReg_32:$sdst), (ins SSrc_b64:$src0),
136  "$sdst, $src0", pattern
137>;
138
139// 32-bit input, 64-bit output.
140class SOP1_64_32 <string opName, list<dag> pattern=[], bit tied_in = 0> : SOP1_Pseudo <
141  opName, (outs SReg_64:$sdst),
142  !if(tied_in, (ins SSrc_b32:$src0, SReg_64:$sdst_in),
143               (ins SSrc_b32:$src0)),
144  "$sdst, $src0", pattern> {
145  let Constraints = !if(tied_in, "$sdst = $sdst_in", "");
146}
147
148// no input, 64-bit output.
149class SOP1_64_0 <string opName, list<dag> pattern=[]> : SOP1_Pseudo <
150  opName, (outs SReg_64:$sdst), (ins), "$sdst", pattern> {
151  let has_src0 = 0;
152}
153
154// 64-bit input, no output
155class SOP1_1 <string opName, list<dag> pattern=[]> : SOP1_Pseudo <
156  opName, (outs), (ins SReg_64:$src0), "$src0", pattern> {
157  let has_sdst = 0;
158}
159
160class UniformUnaryFrag<SDPatternOperator Op> : PatFrag <
161  (ops node:$src0),
162  (Op $src0),
163  [{ return !N->isDivergent(); }]> {
164  // This check is unnecessary as it's captured by the result register
165  // bank constraint.
166  //
167  // FIXME: Should add a way for the emitter to recognize this is a
168  // trivially true predicate to eliminate the check.
169  let GISelPredicateCode = [{return true;}];
170}
171
172class UniformBinFrag<SDPatternOperator Op> : PatFrag <
173  (ops node:$src0, node:$src1),
174  (Op $src0, $src1),
175  [{ return !N->isDivergent(); }]> {
176  // This check is unnecessary as it's captured by the result register
177  // bank constraint.
178  //
179  // FIXME: Should add a way for the emitter to recognize this is a
180  // trivially true predicate to eliminate the check.
181  let GISelPredicateCode = [{return true;}];
182}
183
184class DivergentBinFrag<SDPatternOperator Op> : PatFrag <
185  (ops node:$src0, node:$src1),
186  (Op $src0, $src1),
187  [{ return N->isDivergent(); }]> {
188  // This check is unnecessary as it's captured by the result register
189  // bank constraint.
190  //
191  // FIXME: Should add a way for the emitter to recognize this is a
192  // trivially true predicate to eliminate the check.
193  let GISelPredicateCode = [{return true;}];
194}
195
196
197let isMoveImm = 1 in {
198  let isReMaterializable = 1, isAsCheapAsAMove = 1 in {
199    def S_MOV_B32 : SOP1_32 <"s_mov_b32">;
200    def S_MOV_B64 : SOP1_64 <"s_mov_b64">;
201  } // End isReMaterializable = 1
202
203  let Uses = [SCC] in {
204    def S_CMOV_B32 : SOP1_32 <"s_cmov_b32">;
205    def S_CMOV_B64 : SOP1_64 <"s_cmov_b64">;
206  } // End Uses = [SCC]
207} // End isMoveImm = 1
208
209let Defs = [SCC] in {
210  def S_NOT_B32 : SOP1_32 <"s_not_b32",
211    [(set i32:$sdst, (UniformUnaryFrag<not> i32:$src0))]
212  >;
213
214  def S_NOT_B64 : SOP1_64 <"s_not_b64",
215    [(set i64:$sdst, (UniformUnaryFrag<not> i64:$src0))]
216  >;
217  def S_WQM_B32 : SOP1_32 <"s_wqm_b32">;
218  def S_WQM_B64 : SOP1_64 <"s_wqm_b64">;
219} // End Defs = [SCC]
220
221
222let WaveSizePredicate = isWave32 in {
223def : GCNPat <
224  (int_amdgcn_wqm_vote i1:$src0),
225  (S_WQM_B32 SSrc_b32:$src0)
226>;
227}
228
229let WaveSizePredicate = isWave64 in {
230def : GCNPat <
231  (int_amdgcn_wqm_vote i1:$src0),
232  (S_WQM_B64 SSrc_b64:$src0)
233>;
234}
235
236let isReMaterializable = 1, isAsCheapAsAMove = 1 in {
237def S_BREV_B32 : SOP1_32 <"s_brev_b32",
238  [(set i32:$sdst, (UniformUnaryFrag<bitreverse> i32:$src0))]
239>;
240def S_BREV_B64 : SOP1_64 <"s_brev_b64",
241  [(set i64:$sdst, (UniformUnaryFrag<bitreverse> i64:$src0))]
242>;
243} // End isReMaterializable = 1, isAsCheapAsAMove = 1
244
245let Defs = [SCC] in {
246def S_BCNT0_I32_B32 : SOP1_32 <"s_bcnt0_i32_b32">;
247def S_BCNT0_I32_B64 : SOP1_32_64 <"s_bcnt0_i32_b64">;
248def S_BCNT1_I32_B32 : SOP1_32 <"s_bcnt1_i32_b32",
249  [(set i32:$sdst, (UniformUnaryFrag<ctpop> i32:$src0))]
250>;
251def S_BCNT1_I32_B64 : SOP1_32_64 <"s_bcnt1_i32_b64",
252  [(set i32:$sdst, (UniformUnaryFrag<ctpop> i64:$src0))]
253>;
254} // End Defs = [SCC]
255
256let isReMaterializable = 1 in {
257def S_FF0_I32_B32 : SOP1_32 <"s_ff0_i32_b32">;
258def S_FF0_I32_B64 : SOP1_32_64 <"s_ff0_i32_b64">;
259def S_FF1_I32_B64 : SOP1_32_64 <"s_ff1_i32_b64",
260  [(set i32:$sdst, (UniformUnaryFrag<AMDGPUffbl_b32> i64:$src0))]
261>;
262
263def S_FF1_I32_B32 : SOP1_32 <"s_ff1_i32_b32",
264  [(set i32:$sdst, (UniformUnaryFrag<AMDGPUffbl_b32> i32:$src0))]
265>;
266
267def S_FLBIT_I32_B32 : SOP1_32 <"s_flbit_i32_b32",
268  [(set i32:$sdst, (UniformUnaryFrag<AMDGPUffbh_u32> i32:$src0))]
269>;
270
271def S_FLBIT_I32_B64 : SOP1_32_64 <"s_flbit_i32_b64",
272  [(set i32:$sdst, (UniformUnaryFrag<AMDGPUffbh_u32> i64:$src0))]
273>;
274def S_FLBIT_I32 : SOP1_32 <"s_flbit_i32",
275  [(set i32:$sdst, (UniformUnaryFrag<AMDGPUffbh_i32> i32:$src0))]
276>;
277def S_FLBIT_I32_I64 : SOP1_32_64 <"s_flbit_i32_i64">;
278def S_SEXT_I32_I8 : SOP1_32 <"s_sext_i32_i8",
279  [(set i32:$sdst, (UniformSextInreg<i8> i32:$src0))]
280>;
281def S_SEXT_I32_I16 : SOP1_32 <"s_sext_i32_i16",
282  [(set i32:$sdst, (UniformSextInreg<i16> i32:$src0))]
283>;
284} // End isReMaterializable = 1
285
286def S_BITSET0_B32 : SOP1_32    <"s_bitset0_b32", [], 1>;
287def S_BITSET0_B64 : SOP1_64_32 <"s_bitset0_b64", [], 1>;
288def S_BITSET1_B32 : SOP1_32    <"s_bitset1_b32", [], 1>;
289def S_BITSET1_B64 : SOP1_64_32 <"s_bitset1_b64", [], 1>;
290
291def S_GETPC_B64 : SOP1_64_0  <"s_getpc_b64",
292  [(set i64:$sdst, (int_amdgcn_s_getpc))]
293>;
294
295let isTerminator = 1, isBarrier = 1, SchedRW = [WriteBranch] in {
296
297let isBranch = 1, isIndirectBranch = 1 in {
298def S_SETPC_B64 : SOP1_1  <"s_setpc_b64">;
299} // End isBranch = 1, isIndirectBranch = 1
300
301let isReturn = 1 in {
302// Define variant marked as return rather than branch.
303def S_SETPC_B64_return : SOP1_1<"">;
304}
305} // End isTerminator = 1, isBarrier = 1
306
307let isCall = 1 in {
308def S_SWAPPC_B64 : SOP1_64 <"s_swappc_b64"
309>;
310}
311
312def S_RFE_B64 : SOP1_1  <"s_rfe_b64">;
313
314let hasSideEffects = 1, Uses = [EXEC], Defs = [EXEC, SCC] in {
315
316def S_AND_SAVEEXEC_B64 : SOP1_64 <"s_and_saveexec_b64">;
317def S_OR_SAVEEXEC_B64 : SOP1_64 <"s_or_saveexec_b64">;
318def S_XOR_SAVEEXEC_B64 : SOP1_64 <"s_xor_saveexec_b64">;
319def S_ANDN2_SAVEEXEC_B64 : SOP1_64 <"s_andn2_saveexec_b64">;
320def S_ORN2_SAVEEXEC_B64 : SOP1_64 <"s_orn2_saveexec_b64">;
321def S_NAND_SAVEEXEC_B64 : SOP1_64 <"s_nand_saveexec_b64">;
322def S_NOR_SAVEEXEC_B64 : SOP1_64 <"s_nor_saveexec_b64">;
323def S_XNOR_SAVEEXEC_B64 : SOP1_64 <"s_xnor_saveexec_b64">;
324
325} // End hasSideEffects = 1, Uses = [EXEC], Defs = [EXEC, SCC]
326
327def S_QUADMASK_B32 : SOP1_32 <"s_quadmask_b32">;
328def S_QUADMASK_B64 : SOP1_64 <"s_quadmask_b64">;
329
330let Uses = [M0] in {
331def S_MOVRELS_B32 : SOP1_32R <"s_movrels_b32">;
332def S_MOVRELS_B64 : SOP1_64R <"s_movrels_b64">;
333def S_MOVRELD_B32 : SOP1_32_movreld <"s_movreld_b32">;
334def S_MOVRELD_B64 : SOP1_64_movreld <"s_movreld_b64">;
335} // End Uses = [M0]
336
337let SubtargetPredicate = isGFX6GFX7GFX8GFX9 in {
338def S_CBRANCH_JOIN : SOP1_0_32R <"s_cbranch_join">;
339} // End SubtargetPredicate = isGFX6GFX7GFX8GFX9
340
341let Defs = [SCC] in {
342def S_ABS_I32 : SOP1_32 <"s_abs_i32",
343    [(set i32:$sdst, (UniformUnaryFrag<abs> i32:$src0))]
344  >;
345} // End Defs = [SCC]
346
347let SubtargetPredicate = HasVGPRIndexMode in {
348def S_SET_GPR_IDX_IDX : SOP1_0_32<"s_set_gpr_idx_idx"> {
349  let Uses = [M0, MODE];
350  let Defs = [M0, MODE];
351}
352}
353
354let SubtargetPredicate = isGFX9Plus in {
355  let hasSideEffects = 1, Defs = [EXEC, SCC], Uses = [EXEC] in {
356    def S_ANDN1_SAVEEXEC_B64 : SOP1_64<"s_andn1_saveexec_b64">;
357    def S_ORN1_SAVEEXEC_B64  : SOP1_64<"s_orn1_saveexec_b64">;
358    def S_ANDN1_WREXEC_B64   : SOP1_64<"s_andn1_wrexec_b64">;
359    def S_ANDN2_WREXEC_B64   : SOP1_64<"s_andn2_wrexec_b64">;
360  } // End hasSideEffects = 1, Defs = [EXEC, SCC], Uses = [EXEC]
361
362  let isReMaterializable = 1 in
363  def S_BITREPLICATE_B64_B32 : SOP1_64_32<"s_bitreplicate_b64_b32">;
364} // End SubtargetPredicate = isGFX9Plus
365
366let SubtargetPredicate = isGFX10Plus in {
367  let hasSideEffects = 1, Defs = [EXEC, SCC], Uses = [EXEC] in {
368    def S_AND_SAVEEXEC_B32   : SOP1_32<"s_and_saveexec_b32">;
369    def S_OR_SAVEEXEC_B32    : SOP1_32<"s_or_saveexec_b32">;
370    def S_XOR_SAVEEXEC_B32   : SOP1_32<"s_xor_saveexec_b32">;
371    def S_ANDN2_SAVEEXEC_B32 : SOP1_32<"s_andn2_saveexec_b32">;
372    def S_ORN2_SAVEEXEC_B32  : SOP1_32<"s_orn2_saveexec_b32">;
373    def S_NAND_SAVEEXEC_B32  : SOP1_32<"s_nand_saveexec_b32">;
374    def S_NOR_SAVEEXEC_B32   : SOP1_32<"s_nor_saveexec_b32">;
375    def S_XNOR_SAVEEXEC_B32  : SOP1_32<"s_xnor_saveexec_b32">;
376    def S_ANDN1_SAVEEXEC_B32 : SOP1_32<"s_andn1_saveexec_b32">;
377    def S_ORN1_SAVEEXEC_B32  : SOP1_32<"s_orn1_saveexec_b32">;
378    def S_ANDN1_WREXEC_B32   : SOP1_32<"s_andn1_wrexec_b32">;
379    def S_ANDN2_WREXEC_B32   : SOP1_32<"s_andn2_wrexec_b32">;
380  } // End hasSideEffects = 1, Defs = [EXEC, SCC], Uses = [EXEC]
381
382  let Uses = [M0] in {
383    def S_MOVRELSD_2_B32 : SOP1_32<"s_movrelsd_2_b32">;
384  } // End Uses = [M0]
385} // End SubtargetPredicate = isGFX10Plus
386
387let SubtargetPredicate = isGFX11Plus in {
388  let hasSideEffects = 1 in {
389    // For s_sendmsg_rtn_* the src0 field encodes the message type directly; it
390    // is not an SGPR number.
391    def S_SENDMSG_RTN_B32 : SOP1_Pseudo<
392      "s_sendmsg_rtn_b32", (outs SReg_32:$sdst), (ins SendMsgImm:$src0),
393      "$sdst, $src0", [(set i32:$sdst, (int_amdgcn_s_sendmsg_rtn timm:$src0))]
394    >;
395    def S_SENDMSG_RTN_B64 : SOP1_Pseudo<
396      "s_sendmsg_rtn_b64", (outs SReg_64:$sdst), (ins SendMsgImm:$src0),
397      "$sdst, $src0", [(set i64:$sdst, (int_amdgcn_s_sendmsg_rtn timm:$src0))]
398    >;
399  }
400} // End SubtargetPredicate = isGFX11Plus
401
402//===----------------------------------------------------------------------===//
403// SOP2 Instructions
404//===----------------------------------------------------------------------===//
405
406class SOP2_Pseudo<string opName, dag outs, dag ins,
407                  string asmOps, list<dag> pattern=[]> :
408  SOP_Pseudo<opName, outs, ins, asmOps, pattern> {
409
410  let mayLoad = 0;
411  let mayStore = 0;
412  let hasSideEffects = 0;
413  let SALU = 1;
414  let SOP2 = 1;
415  let SchedRW = [WriteSALU];
416  let UseNamedOperandTable = 1;
417
418  let has_sdst = 1;
419
420  // Pseudo instructions have no encodings, but adding this field here allows
421  // us to do:
422  // let sdst = xxx in {
423  // for multiclasses that include both real and pseudo instructions.
424  // field bits<7> sdst = 0;
425  // let Size = 4; // Do we need size here?
426}
427
428class SOP2_Real<bits<7> op, SOP_Pseudo ps, string real_name = ps.Mnemonic> :
429  InstSI <ps.OutOperandList, ps.InOperandList,
430          real_name # " " # ps.AsmOperands, []>,
431  Enc32 {
432  let SALU = 1;
433  let SOP2 = 1;
434  let isPseudo = 0;
435  let isCodeGenOnly = 0;
436
437  // copy relevant pseudo op flags
438  let SubtargetPredicate   = ps.SubtargetPredicate;
439  let AsmMatchConverter    = ps.AsmMatchConverter;
440  let UseNamedOperandTable = ps.UseNamedOperandTable;
441  let TSFlags              = ps.TSFlags;
442  let SchedRW              = ps.SchedRW;
443  let mayLoad              = ps.mayLoad;
444  let mayStore             = ps.mayStore;
445
446  // encoding
447  bits<7> sdst;
448  bits<8> src0;
449  bits<8> src1;
450
451  let Inst{7-0}   = src0;
452  let Inst{15-8}  = src1;
453  let Inst{22-16} = !if(ps.has_sdst, sdst, ?);
454  let Inst{29-23} = op;
455  let Inst{31-30} = 0x2; // encoding
456}
457
458
459class SOP2_32 <string opName, list<dag> pattern=[]> : SOP2_Pseudo <
460  opName, (outs SReg_32:$sdst), (ins SSrc_b32:$src0, SSrc_b32:$src1),
461  "$sdst, $src0, $src1", pattern
462>;
463
464class SOP2_64 <string opName, list<dag> pattern=[]> : SOP2_Pseudo <
465  opName, (outs SReg_64:$sdst), (ins SSrc_b64:$src0, SSrc_b64:$src1),
466  "$sdst, $src0, $src1", pattern
467>;
468
469class SOP2_64_32 <string opName, list<dag> pattern=[]> : SOP2_Pseudo <
470  opName, (outs SReg_64:$sdst), (ins SSrc_b64:$src0, SSrc_b32:$src1),
471  "$sdst, $src0, $src1", pattern
472>;
473
474class SOP2_64_32_32 <string opName, list<dag> pattern=[]> : SOP2_Pseudo <
475  opName, (outs SReg_64:$sdst), (ins SSrc_b32:$src0, SSrc_b32:$src1),
476  "$sdst, $src0, $src1", pattern
477>;
478
479
480let Defs = [SCC] in { // Carry out goes to SCC
481let isCommutable = 1 in {
482def S_ADD_U32 : SOP2_32 <"s_add_u32">;
483def S_ADD_I32 : SOP2_32 <"s_add_i32",
484  [(set i32:$sdst, (UniformBinFrag<add> SSrc_b32:$src0, SSrc_b32:$src1))]
485>;
486} // End isCommutable = 1
487
488def S_SUB_U32 : SOP2_32 <"s_sub_u32">;
489def S_SUB_I32 : SOP2_32 <"s_sub_i32",
490  [(set i32:$sdst, (UniformBinFrag<sub> SSrc_b32:$src0, SSrc_b32:$src1))]
491>;
492
493let Uses = [SCC] in { // Carry in comes from SCC
494let isCommutable = 1 in {
495def S_ADDC_U32 : SOP2_32 <"s_addc_u32",
496  [(set i32:$sdst, (UniformBinFrag<adde> (i32 SSrc_b32:$src0), (i32 SSrc_b32:$src1)))]>;
497} // End isCommutable = 1
498
499def S_SUBB_U32 : SOP2_32 <"s_subb_u32",
500  [(set i32:$sdst, (UniformBinFrag<sube> (i32 SSrc_b32:$src0), (i32 SSrc_b32:$src1)))]>;
501} // End Uses = [SCC]
502
503let isCommutable = 1 in {
504def S_MIN_I32 : SOP2_32 <"s_min_i32",
505  [(set i32:$sdst, (UniformBinFrag<smin> i32:$src0, i32:$src1))]
506>;
507def S_MIN_U32 : SOP2_32 <"s_min_u32",
508  [(set i32:$sdst, (UniformBinFrag<umin> i32:$src0, i32:$src1))]
509>;
510def S_MAX_I32 : SOP2_32 <"s_max_i32",
511  [(set i32:$sdst, (UniformBinFrag<smax> i32:$src0, i32:$src1))]
512>;
513def S_MAX_U32 : SOP2_32 <"s_max_u32",
514  [(set i32:$sdst, (UniformBinFrag<umax> i32:$src0, i32:$src1))]
515>;
516} // End isCommutable = 1
517} // End Defs = [SCC]
518
519// This pattern is restricted to certain subtargets (practically GFX8Plus)
520// because isel sometimes produces an sreg_64 copy to SCC as a by-product
521// of this pattern, and only for subtargets with hasScalarCompareEq64
522// is it possible to map such copy to a single instruction (S_CMP_LG_U64).
523class SelectPat<SDPatternOperator select> : PatFrag <
524  (ops node:$src1, node:$src2),
525  (select SCC, $src1, $src2),
526  [{ return Subtarget->hasScalarCompareEq64() &&
527            N->getOperand(0)->hasOneUse() && !N->isDivergent(); }]
528>;
529
530let Uses = [SCC] in {
531  let AddedComplexity = 20 in {
532    def S_CSELECT_B32 : SOP2_32 <"s_cselect_b32",
533      [(set i32:$sdst, (SelectPat<select> i32:$src0, i32:$src1))]
534    >;
535  }
536
537  def S_CSELECT_B64 : SOP2_64 <"s_cselect_b64">;
538} // End Uses = [SCC]
539
540let Defs = [SCC] in {
541let isCommutable = 1 in {
542def S_AND_B32 : SOP2_32 <"s_and_b32",
543  [(set i32:$sdst, (UniformBinFrag<and> i32:$src0, i32:$src1))]
544>;
545
546def S_AND_B64 : SOP2_64 <"s_and_b64",
547  [(set i64:$sdst, (UniformBinFrag<and> i64:$src0, i64:$src1))]
548>;
549
550def S_OR_B32 : SOP2_32 <"s_or_b32",
551  [(set i32:$sdst, (UniformBinFrag<or> i32:$src0, i32:$src1))]
552>;
553
554def S_OR_B64 : SOP2_64 <"s_or_b64",
555  [(set i64:$sdst, (UniformBinFrag<or> i64:$src0, i64:$src1))]
556>;
557
558def S_XOR_B32 : SOP2_32 <"s_xor_b32",
559  [(set i32:$sdst, (UniformBinFrag<xor> i32:$src0, i32:$src1))]
560>;
561
562def S_XOR_B64 : SOP2_64 <"s_xor_b64",
563  [(set i64:$sdst, (UniformBinFrag<xor> i64:$src0, i64:$src1))]
564>;
565
566def S_XNOR_B32 : SOP2_32 <"s_xnor_b32",
567  [(set i32:$sdst, (UniformUnaryFrag<not> (xor_oneuse i32:$src0, i32:$src1)))]
568>;
569
570def S_XNOR_B64 : SOP2_64 <"s_xnor_b64",
571  [(set i64:$sdst, (UniformUnaryFrag<not> (xor_oneuse i64:$src0, i64:$src1)))]
572>;
573
574def S_NAND_B32 : SOP2_32 <"s_nand_b32",
575  [(set i32:$sdst, (UniformUnaryFrag<not> (and_oneuse i32:$src0, i32:$src1)))]
576>;
577
578def S_NAND_B64 : SOP2_64 <"s_nand_b64",
579  [(set i64:$sdst, (UniformUnaryFrag<not> (and_oneuse i64:$src0, i64:$src1)))]
580>;
581
582def S_NOR_B32 : SOP2_32 <"s_nor_b32",
583  [(set i32:$sdst, (UniformUnaryFrag<not> (or_oneuse i32:$src0, i32:$src1)))]
584>;
585
586def S_NOR_B64 : SOP2_64 <"s_nor_b64",
587  [(set i64:$sdst, (UniformUnaryFrag<not> (or_oneuse i64:$src0, i64:$src1)))]
588>;
589} // End isCommutable = 1
590
591// There are also separate patterns for types other than i32
592def S_ANDN2_B32 : SOP2_32 <"s_andn2_b32",
593  [(set i32:$sdst, (UniformBinFrag<and> i32:$src0, (UniformUnaryFrag<not> i32:$src1)))]
594>;
595
596def S_ANDN2_B64 : SOP2_64 <"s_andn2_b64",
597  [(set i64:$sdst, (UniformBinFrag<and> i64:$src0, (UniformUnaryFrag<not> i64:$src1)))]
598>;
599
600def S_ORN2_B32 : SOP2_32 <"s_orn2_b32",
601  [(set i32:$sdst, (UniformBinFrag<or> i32:$src0, (UniformUnaryFrag<not> i32:$src1)))]
602>;
603
604def S_ORN2_B64 : SOP2_64 <"s_orn2_b64",
605  [(set i64:$sdst, (UniformBinFrag<or> i64:$src0, (UniformUnaryFrag<not> i64:$src1)))]
606>;
607} // End Defs = [SCC]
608
609// Use added complexity so these patterns are preferred to the VALU patterns.
610let AddedComplexity = 1 in {
611
612let Defs = [SCC] in {
613// TODO: b64 versions require VOP3 change since v_lshlrev_b64 is VOP3
614def S_LSHL_B32 : SOP2_32 <"s_lshl_b32",
615  [(set SReg_32:$sdst, (UniformBinFrag<cshl_32> (i32 SSrc_b32:$src0), (i32 SSrc_b32:$src1)))]
616>;
617def S_LSHL_B64 : SOP2_64_32 <"s_lshl_b64",
618  [(set SReg_64:$sdst, (UniformBinFrag<cshl_64> (i64 SSrc_b64:$src0), (i32 SSrc_b32:$src1)))]
619>;
620def S_LSHR_B32 : SOP2_32 <"s_lshr_b32",
621  [(set SReg_32:$sdst, (UniformBinFrag<csrl_32> (i32 SSrc_b32:$src0), (i32 SSrc_b32:$src1)))]
622>;
623def S_LSHR_B64 : SOP2_64_32 <"s_lshr_b64",
624  [(set SReg_64:$sdst, (UniformBinFrag<csrl_64> (i64 SSrc_b64:$src0), (i32 SSrc_b32:$src1)))]
625>;
626def S_ASHR_I32 : SOP2_32 <"s_ashr_i32",
627  [(set SReg_32:$sdst, (UniformBinFrag<csra_32> (i32 SSrc_b32:$src0), (i32 SSrc_b32:$src1)))]
628>;
629def S_ASHR_I64 : SOP2_64_32 <"s_ashr_i64",
630  [(set SReg_64:$sdst, (UniformBinFrag<csra_64> (i64 SSrc_b64:$src0), (i32 SSrc_b32:$src1)))]
631>;
632} // End Defs = [SCC]
633
634let isReMaterializable = 1 in {
635def S_BFM_B32 : SOP2_32 <"s_bfm_b32",
636  [(set i32:$sdst, (UniformBinFrag<AMDGPUbfm> i32:$src0, i32:$src1))]>;
637def S_BFM_B64 : SOP2_64_32_32 <"s_bfm_b64">;
638
639def S_MUL_I32 : SOP2_32 <"s_mul_i32",
640  [(set i32:$sdst, (UniformBinFrag<mul> i32:$src0, i32:$src1))]> {
641  let isCommutable = 1;
642}
643} // End isReMaterializable = 1
644} // End AddedComplexity = 1
645
646let Defs = [SCC] in {
647def S_BFE_U32 : SOP2_32 <"s_bfe_u32">;
648def S_BFE_I32 : SOP2_32 <"s_bfe_i32">;
649def S_BFE_U64 : SOP2_64_32 <"s_bfe_u64">;
650def S_BFE_I64 : SOP2_64_32 <"s_bfe_i64">;
651} // End Defs = [SCC]
652
653def S_CBRANCH_G_FORK : SOP2_Pseudo <
654  "s_cbranch_g_fork", (outs),
655  (ins SCSrc_b64:$src0, SCSrc_b64:$src1),
656  "$src0, $src1"
657> {
658  let has_sdst = 0;
659  let SubtargetPredicate = isGFX6GFX7GFX8GFX9;
660}
661
662let Defs = [SCC] in {
663def S_ABSDIFF_I32 : SOP2_32 <"s_absdiff_i32">;
664} // End Defs = [SCC]
665
666let SubtargetPredicate = isGFX8GFX9 in {
667  def S_RFE_RESTORE_B64 : SOP2_Pseudo <
668    "s_rfe_restore_b64", (outs),
669    (ins SSrc_b64:$src0, SSrc_b32:$src1),
670    "$src0, $src1"
671  > {
672    let hasSideEffects = 1;
673    let has_sdst = 0;
674  }
675}
676
677let SubtargetPredicate = isGFX9Plus in {
678  let isReMaterializable = 1 in {
679    def S_PACK_LL_B32_B16 : SOP2_32<"s_pack_ll_b32_b16">;
680    def S_PACK_LH_B32_B16 : SOP2_32<"s_pack_lh_b32_b16">;
681    def S_PACK_HH_B32_B16 : SOP2_32<"s_pack_hh_b32_b16">;
682  } // End isReMaterializable = 1
683
684  let Defs = [SCC] in {
685    def S_LSHL1_ADD_U32 : SOP2_32<"s_lshl1_add_u32",
686      [(set i32:$sdst, (shl1_add SSrc_b32:$src0, SSrc_b32:$src1))]
687    >;
688    def S_LSHL2_ADD_U32 : SOP2_32<"s_lshl2_add_u32",
689      [(set i32:$sdst, (shl2_add SSrc_b32:$src0, SSrc_b32:$src1))]
690    >;
691    def S_LSHL3_ADD_U32 : SOP2_32<"s_lshl3_add_u32",
692      [(set i32:$sdst, (shl3_add SSrc_b32:$src0, SSrc_b32:$src1))]
693    >;
694    def S_LSHL4_ADD_U32 : SOP2_32<"s_lshl4_add_u32",
695      [(set i32:$sdst, (shl4_add SSrc_b32:$src0, SSrc_b32:$src1))]
696    >;
697  } // End Defs = [SCC]
698
699  let isCommutable = 1, isReMaterializable = 1 in {
700    def S_MUL_HI_U32 : SOP2_32<"s_mul_hi_u32",
701      [(set i32:$sdst, (UniformBinFrag<mulhu> SSrc_b32:$src0, SSrc_b32:$src1))]>;
702    def S_MUL_HI_I32 : SOP2_32<"s_mul_hi_i32",
703      [(set i32:$sdst, (UniformBinFrag<mulhs> SSrc_b32:$src0, SSrc_b32:$src1))]>;
704  } // End isCommutable = 1, isReMaterializable = 1
705} // End SubtargetPredicate = isGFX9Plus
706
707let SubtargetPredicate = isGFX11Plus in {
708  def S_PACK_HL_B32_B16 : SOP2_32<"s_pack_hl_b32_b16">;
709} // End SubtargetPredicate = isGFX11Plus
710
711//===----------------------------------------------------------------------===//
712// SOPK Instructions
713//===----------------------------------------------------------------------===//
714
715class SOPK_Pseudo <string opName, dag outs, dag ins,
716                   string asmOps, list<dag> pattern=[]> :
717  InstSI <outs, ins, "", pattern>,
718  SIMCInstr<opName, SIEncodingFamily.NONE> {
719  let isPseudo = 1;
720  let isCodeGenOnly = 1;
721  let mayLoad = 0;
722  let mayStore = 0;
723  let hasSideEffects = 0;
724  let SALU = 1;
725  let SOPK = 1;
726  let SchedRW = [WriteSALU];
727  let UseNamedOperandTable = 1;
728  string Mnemonic = opName;
729  string AsmOperands = asmOps;
730
731  bits<1> has_sdst = 1;
732}
733
734class SOPK_Real<SOPK_Pseudo ps> :
735  InstSI <ps.OutOperandList, ps.InOperandList,
736          ps.Mnemonic # " " # ps.AsmOperands, []> {
737  let SALU = 1;
738  let SOPK = 1;
739  let isPseudo = 0;
740  let isCodeGenOnly = 0;
741
742  // copy relevant pseudo op flags
743  let SubtargetPredicate = ps.SubtargetPredicate;
744  let AsmMatchConverter  = ps.AsmMatchConverter;
745  let DisableEncoding    = ps.DisableEncoding;
746  let Constraints        = ps.Constraints;
747  let SchedRW            = ps.SchedRW;
748  let mayLoad            = ps.mayLoad;
749  let mayStore           = ps.mayStore;
750  let isBranch           = ps.isBranch;
751  let isCall             = ps.isCall;
752
753  // encoding
754  bits<7>  sdst;
755  bits<16> simm16;
756  bits<32> imm;
757}
758
759class SOPK_Real32<bits<5> op, SOPK_Pseudo ps> :
760  SOPK_Real <ps>,
761  Enc32 {
762  let Inst{15-0}  = simm16;
763  let Inst{22-16} = !if(ps.has_sdst, sdst, ?);
764  let Inst{27-23} = op;
765  let Inst{31-28} = 0xb; //encoding
766}
767
768class SOPK_Real64<bits<5> op, SOPK_Pseudo ps> :
769  SOPK_Real<ps>,
770  Enc64 {
771  let Inst{15-0}  = simm16;
772  let Inst{22-16} = !if(ps.has_sdst, sdst, ?);
773  let Inst{27-23} = op;
774  let Inst{31-28} = 0xb; //encoding
775  let Inst{63-32} = imm;
776}
777
778class SOPKInstTable <bit is_sopk, string cmpOp = ""> {
779  bit IsSOPK = is_sopk;
780  string BaseCmpOp = cmpOp;
781}
782
783class SOPK_32 <string opName, list<dag> pattern=[]> : SOPK_Pseudo <
784  opName,
785  (outs SReg_32:$sdst),
786  (ins s16imm:$simm16),
787  "$sdst, $simm16",
788  pattern>;
789
790class SOPK_32_BR <string opName, list<dag> pattern=[]> : SOPK_Pseudo <
791  opName,
792  (outs),
793  (ins sopp_brtarget:$simm16, SReg_32:$sdst),
794  "$sdst, $simm16",
795  pattern> {
796  let Defs = [EXEC];
797  let Uses = [EXEC];
798  let isBranch = 1;
799  let isTerminator = 1;
800  let SchedRW = [WriteBranch];
801}
802
803class SOPK_SCC <string opName, string base_op, bit isSignExt> : SOPK_Pseudo <
804  opName,
805  (outs),
806  !if(isSignExt,
807      (ins SReg_32:$sdst, s16imm:$simm16),
808      (ins SReg_32:$sdst, u16imm:$simm16)),
809  "$sdst, $simm16", []>,
810  SOPKInstTable<1, base_op>{
811  let Defs = [SCC];
812}
813
814class SOPK_32TIE <string opName, list<dag> pattern=[]> : SOPK_Pseudo <
815  opName,
816  (outs SReg_32:$sdst),
817  (ins SReg_32:$src0, s16imm:$simm16),
818  "$sdst, $simm16",
819  pattern
820>;
821
822let isReMaterializable = 1, isMoveImm = 1 in {
823def S_MOVK_I32 : SOPK_32 <"s_movk_i32">;
824} // End isReMaterializable = 1
825let Uses = [SCC] in {
826def S_CMOVK_I32 : SOPK_32 <"s_cmovk_i32">;
827}
828
829let isCompare = 1 in {
830
831// This instruction is disabled for now until we can figure out how to teach
832// the instruction selector to correctly use the  S_CMP* vs V_CMP*
833// instructions.
834//
835// When this instruction is enabled the code generator sometimes produces this
836// invalid sequence:
837//
838// SCC = S_CMPK_EQ_I32 SGPR0, imm
839// VCC = COPY SCC
840// VGPR0 = V_CNDMASK VCC, VGPR0, VGPR1
841//
842// def S_CMPK_EQ_I32 : SOPK_SCC <"s_cmpk_eq_i32",
843//   [(set i1:$dst, (setcc i32:$src0, imm:$src1, SETEQ))]
844// >;
845
846def S_CMPK_EQ_I32 : SOPK_SCC <"s_cmpk_eq_i32", "s_cmp_eq_i32", 1>;
847def S_CMPK_LG_I32 : SOPK_SCC <"s_cmpk_lg_i32", "s_cmp_lg_i32", 1>;
848def S_CMPK_GT_I32 : SOPK_SCC <"s_cmpk_gt_i32", "s_cmp_gt_i32", 1>;
849def S_CMPK_GE_I32 : SOPK_SCC <"s_cmpk_ge_i32", "s_cmp_ge_i32", 1>;
850def S_CMPK_LT_I32 : SOPK_SCC <"s_cmpk_lt_i32", "s_cmp_lt_i32", 1>;
851def S_CMPK_LE_I32 : SOPK_SCC <"s_cmpk_le_i32", "s_cmp_le_i32", 1>;
852
853let SOPKZext = 1 in {
854def S_CMPK_EQ_U32 : SOPK_SCC <"s_cmpk_eq_u32", "s_cmp_eq_u32", 0>;
855def S_CMPK_LG_U32 : SOPK_SCC <"s_cmpk_lg_u32", "s_cmp_lg_u32", 0>;
856def S_CMPK_GT_U32 : SOPK_SCC <"s_cmpk_gt_u32", "s_cmp_gt_u32", 0>;
857def S_CMPK_GE_U32 : SOPK_SCC <"s_cmpk_ge_u32", "s_cmp_ge_u32", 0>;
858def S_CMPK_LT_U32 : SOPK_SCC <"s_cmpk_lt_u32", "s_cmp_lt_u32", 0>;
859def S_CMPK_LE_U32 : SOPK_SCC <"s_cmpk_le_u32", "s_cmp_le_u32", 0>;
860} // End SOPKZext = 1
861} // End isCompare = 1
862
863let Defs = [SCC], isCommutable = 1, DisableEncoding = "$src0",
864    Constraints = "$sdst = $src0" in {
865  def S_ADDK_I32 : SOPK_32TIE <"s_addk_i32">;
866  def S_MULK_I32 : SOPK_32TIE <"s_mulk_i32">;
867}
868
869let SubtargetPredicate = isGFX6GFX7GFX8GFX9 in
870def S_CBRANCH_I_FORK : SOPK_Pseudo <
871  "s_cbranch_i_fork",
872  (outs), (ins SReg_64:$sdst, sopp_brtarget:$simm16),
873  "$sdst, $simm16"
874>;
875
876// This is hasSideEffects to allow its use in readcyclecounter selection.
877// FIXME: Need to truncate immediate to 16-bits.
878def S_GETREG_B32 : SOPK_Pseudo <
879  "s_getreg_b32",
880  (outs SReg_32:$sdst), (ins hwreg:$simm16),
881  "$sdst, $simm16",
882  [(set i32:$sdst, (int_amdgcn_s_getreg (i32 timm:$simm16)))]> {
883  let SOPKZext = 1;
884  let hasSideEffects = 1;
885}
886
887let Defs = [MODE], Uses = [MODE] in {
888
889// FIXME: Need to truncate immediate to 16-bits.
890class S_SETREG_B32_Pseudo <list<dag> pattern=[]> : SOPK_Pseudo <
891  "s_setreg_b32",
892  (outs), (ins SReg_32:$sdst, hwreg:$simm16),
893  "$simm16, $sdst",
894  pattern>;
895
896def S_SETREG_B32 : S_SETREG_B32_Pseudo <
897  [(int_amdgcn_s_setreg (i32 timm:$simm16), i32:$sdst)]> {
898  // Use custom inserter to optimize some cases to
899  // S_DENORM_MODE/S_ROUND_MODE/S_SETREG_B32_mode.
900  let usesCustomInserter = 1;
901  let hasSideEffects = 1;
902}
903
904// Variant of SETREG that is guaranteed to only touch FP bits in the MODE
905// register, so doesn't have unmodeled side effects.
906def S_SETREG_B32_mode : S_SETREG_B32_Pseudo {
907  let hasSideEffects = 0;
908}
909
910// FIXME: Not on SI?
911//def S_GETREG_REGRD_B32 : SOPK_32 <sopk<0x14, 0x13>, "s_getreg_regrd_b32">;
912
913class S_SETREG_IMM32_B32_Pseudo : SOPK_Pseudo <
914  "s_setreg_imm32_b32",
915  (outs), (ins i32imm:$imm, hwreg:$simm16),
916  "$simm16, $imm"> {
917  let Size = 8; // Unlike every other SOPK instruction.
918  let has_sdst = 0;
919}
920
921def S_SETREG_IMM32_B32 : S_SETREG_IMM32_B32_Pseudo {
922  let hasSideEffects = 1;
923}
924
925// Variant of SETREG_IMM32 that is guaranteed to only touch FP bits in the MODE
926// register, so doesn't have unmodeled side effects.
927def S_SETREG_IMM32_B32_mode : S_SETREG_IMM32_B32_Pseudo {
928  let hasSideEffects = 0;
929}
930
931} // End Defs = [MODE], Uses = [MODE]
932
933class SOPK_WAITCNT<string opName, list<dag> pat=[]> :
934    SOPK_Pseudo<
935        opName,
936        (outs),
937        (ins SReg_32:$sdst, s16imm:$simm16),
938        "$sdst, $simm16",
939        pat> {
940  let hasSideEffects = 1;
941  let mayLoad = 1;
942  let mayStore = 1;
943  let has_sdst = 1; // First source takes place of sdst in encoding
944}
945
946let SubtargetPredicate = isGFX9Plus in {
947  def S_CALL_B64 : SOPK_Pseudo<
948      "s_call_b64",
949      (outs SReg_64:$sdst),
950      (ins sopp_brtarget:$simm16),
951      "$sdst, $simm16"> {
952    let isCall = 1;
953  }
954} // End SubtargetPredicate = isGFX9Plus
955
956let SubtargetPredicate = isGFX10Plus in {
957  def S_VERSION : SOPK_Pseudo<
958      "s_version",
959      (outs),
960      (ins s16imm:$simm16),
961      "$simm16"> {
962    let has_sdst = 0;
963  }
964
965  def S_SUBVECTOR_LOOP_BEGIN : SOPK_32_BR<"s_subvector_loop_begin">;
966  def S_SUBVECTOR_LOOP_END   : SOPK_32_BR<"s_subvector_loop_end">;
967
968  def S_WAITCNT_VSCNT   : SOPK_WAITCNT<"s_waitcnt_vscnt">;
969  def S_WAITCNT_VMCNT   : SOPK_WAITCNT<"s_waitcnt_vmcnt">;
970  def S_WAITCNT_EXPCNT  : SOPK_WAITCNT<"s_waitcnt_expcnt">;
971  def S_WAITCNT_LGKMCNT : SOPK_WAITCNT<"s_waitcnt_lgkmcnt">;
972} // End SubtargetPredicate = isGFX10Plus
973
974//===----------------------------------------------------------------------===//
975// SOPC Instructions
976//===----------------------------------------------------------------------===//
977
978class SOPC_Pseudo<string opName, dag outs, dag ins,
979                  string asmOps, list<dag> pattern=[]> :
980  SOP_Pseudo<opName, outs, ins, asmOps, pattern> {
981  let mayLoad = 0;
982  let mayStore = 0;
983  let hasSideEffects = 0;
984  let SALU = 1;
985  let SOPC = 1;
986  let Defs = [SCC];
987  let SchedRW = [WriteSALU];
988  let UseNamedOperandTable = 1;
989}
990
991class SOPC_Real<bits<7> op, SOPC_Pseudo ps, string real_name = ps.Mnemonic> :
992  InstSI <ps.OutOperandList, ps.InOperandList,
993          real_name # " " # ps.AsmOperands, []>,
994  Enc32 {
995  let SALU = 1;
996  let SOPC = 1;
997  let isPseudo = 0;
998  let isCodeGenOnly = 0;
999
1000  // copy relevant pseudo op flags
1001  let SubtargetPredicate   = ps.SubtargetPredicate;
1002  let OtherPredicates      = ps.OtherPredicates;
1003  let AsmMatchConverter    = ps.AsmMatchConverter;
1004  let UseNamedOperandTable = ps.UseNamedOperandTable;
1005  let TSFlags              = ps.TSFlags;
1006  let SchedRW              = ps.SchedRW;
1007  let mayLoad              = ps.mayLoad;
1008  let mayStore             = ps.mayStore;
1009
1010  // encoding
1011  bits<8> src0;
1012  bits<8> src1;
1013
1014  let Inst{7-0} = src0;
1015  let Inst{15-8} = src1;
1016  let Inst{22-16} = op;
1017  let Inst{31-23} = 0x17e;
1018}
1019
1020class SOPC_Base <RegisterOperand rc0, RegisterOperand rc1,
1021                 string opName, list<dag> pattern = []> : SOPC_Pseudo <
1022  opName, (outs), (ins rc0:$src0, rc1:$src1),
1023  "$src0, $src1", pattern > {
1024}
1025
1026class SOPC_Helper <RegisterOperand rc, ValueType vt,
1027                    string opName, SDPatternOperator cond> : SOPC_Base <
1028  rc, rc, opName,
1029  [(set SCC, (si_setcc_uniform vt:$src0, vt:$src1, cond))] > {
1030}
1031
1032class SOPC_CMP_32<string opName,
1033                  SDPatternOperator cond = COND_NULL, string revOp = opName>
1034  : SOPC_Helper<SSrc_b32, i32, opName, cond>,
1035    Commutable_REV<revOp, !eq(revOp, opName)>,
1036    SOPKInstTable<0, opName> {
1037  let isCompare = 1;
1038  let isCommutable = 1;
1039}
1040
1041class SOPC_CMP_64<string opName,
1042                  SDPatternOperator cond = COND_NULL, string revOp = opName>
1043  : SOPC_Helper<SSrc_b64, i64, opName, cond>,
1044    Commutable_REV<revOp, !eq(revOp, opName)> {
1045  let isCompare = 1;
1046  let isCommutable = 1;
1047}
1048
1049class SOPC_32<string opName, list<dag> pattern = []>
1050  : SOPC_Base<SSrc_b32, SSrc_b32, opName, pattern>;
1051
1052class SOPC_64_32<string opName, list<dag> pattern = []>
1053  : SOPC_Base<SSrc_b64, SSrc_b32, opName, pattern>;
1054
1055def S_CMP_EQ_I32 : SOPC_CMP_32 <"s_cmp_eq_i32">;
1056def S_CMP_LG_I32 : SOPC_CMP_32 <"s_cmp_lg_i32">;
1057def S_CMP_GT_I32 : SOPC_CMP_32 <"s_cmp_gt_i32", COND_SGT>;
1058def S_CMP_GE_I32 : SOPC_CMP_32 <"s_cmp_ge_i32", COND_SGE>;
1059def S_CMP_LT_I32 : SOPC_CMP_32 <"s_cmp_lt_i32", COND_SLT, "s_cmp_gt_i32">;
1060def S_CMP_LE_I32 : SOPC_CMP_32 <"s_cmp_le_i32", COND_SLE, "s_cmp_ge_i32">;
1061def S_CMP_EQ_U32 : SOPC_CMP_32 <"s_cmp_eq_u32", COND_EQ>;
1062def S_CMP_LG_U32 : SOPC_CMP_32 <"s_cmp_lg_u32", COND_NE>;
1063def S_CMP_GT_U32 : SOPC_CMP_32 <"s_cmp_gt_u32", COND_UGT>;
1064def S_CMP_GE_U32 : SOPC_CMP_32 <"s_cmp_ge_u32", COND_UGE>;
1065def S_CMP_LT_U32 : SOPC_CMP_32 <"s_cmp_lt_u32", COND_ULT, "s_cmp_gt_u32">;
1066def S_CMP_LE_U32 : SOPC_CMP_32 <"s_cmp_le_u32", COND_ULE, "s_cmp_ge_u32">;
1067
1068def S_BITCMP0_B32 : SOPC_32 <"s_bitcmp0_b32">;
1069def S_BITCMP1_B32 : SOPC_32 <"s_bitcmp1_b32">;
1070def S_BITCMP0_B64 : SOPC_64_32 <"s_bitcmp0_b64">;
1071def S_BITCMP1_B64 : SOPC_64_32 <"s_bitcmp1_b64">;
1072let SubtargetPredicate = isGFX6GFX7GFX8GFX9 in
1073def S_SETVSKIP : SOPC_32 <"s_setvskip">;
1074
1075let SubtargetPredicate = isGFX8Plus in {
1076def S_CMP_EQ_U64 : SOPC_CMP_64 <"s_cmp_eq_u64", COND_EQ>;
1077def S_CMP_LG_U64 : SOPC_CMP_64 <"s_cmp_lg_u64", COND_NE>;
1078} // End SubtargetPredicate = isGFX8Plus
1079
1080let SubtargetPredicate = HasVGPRIndexMode in {
1081// Setting the GPR index mode is really writing the fields in the mode
1082// register. We don't want to add mode register uses to every
1083// instruction, and it's too complicated to deal with anyway. This is
1084// modeled just as a side effect.
1085def S_SET_GPR_IDX_ON : SOPC_Pseudo <
1086  "s_set_gpr_idx_on" ,
1087  (outs),
1088  (ins SSrc_b32:$src0, GPRIdxMode:$src1),
1089  "$src0, $src1"> {
1090  let Defs = [M0, MODE]; // No scc def
1091  let Uses = [M0, MODE]; // Other bits of mode, m0 unmodified.
1092  let hasSideEffects = 1; // Sets mode.gpr_idx_en
1093  let FixedSize = 1;
1094}
1095}
1096
1097//===----------------------------------------------------------------------===//
1098// SOPP Instructions
1099//===----------------------------------------------------------------------===//
1100
1101class SOPP_Pseudo<string opName, dag ins,
1102                  string asmOps = "", list<dag> pattern=[], string keyName = opName> :
1103  SOP_Pseudo<opName, (outs), ins, asmOps, pattern> {
1104  let isPseudo = 1;
1105  let isCodeGenOnly = 1;
1106  let mayLoad = 0;
1107  let mayStore = 0;
1108  let hasSideEffects = 0;
1109  let SALU = 1;
1110  let SOPP = 1;
1111  let FixedSize = 1;
1112  let SchedRW = [WriteSALU];
1113  let UseNamedOperandTable = 1;
1114  bits <16> simm16;
1115  bits <1> fixed_imm = 0;
1116  string KeyName = keyName;
1117}
1118
1119class SOPPRelaxTable <bit isRelaxed, string keyName, string gfxip> {
1120  bit IsRelaxed = isRelaxed;
1121  string KeyName = keyName # gfxip;
1122}
1123
1124//spaces inserted in realname on instantiation of this record to allow s_endpgm to omit whitespace
1125class SOPP_Real<SOPP_Pseudo ps, string real_name = ps.Mnemonic> :
1126  InstSI <ps.OutOperandList, ps.InOperandList,
1127          real_name # ps.AsmOperands, []> {
1128  let SALU = 1;
1129  let SOPP = 1;
1130  let isPseudo = 0;
1131  let isCodeGenOnly = 0;
1132
1133  // copy relevant pseudo op flags
1134  let SubtargetPredicate   = ps.SubtargetPredicate;
1135  let OtherPredicates      = ps.OtherPredicates;
1136  let AsmMatchConverter    = ps.AsmMatchConverter;
1137  let UseNamedOperandTable = ps.UseNamedOperandTable;
1138  let TSFlags              = ps.TSFlags;
1139  let SchedRW              = ps.SchedRW;
1140  let mayLoad              = ps.mayLoad;
1141  let mayStore             = ps.mayStore;
1142  bits <16> simm16;
1143}
1144
1145class SOPP_Real_32 <bits<7> op, SOPP_Pseudo ps, string real_name = ps.Mnemonic> : SOPP_Real<ps, real_name>,
1146Enc32 {
1147  let Inst{15-0} = !if(ps.fixed_imm, ps.simm16, simm16);
1148  let Inst{22-16} = op;
1149  let Inst{31-23} = 0x17f;
1150}
1151
1152class SOPP_Real_64 <bits<7> op, SOPP_Pseudo ps, string real_name = ps.Mnemonic> : SOPP_Real<ps, real_name>,
1153Enc64 {
1154  // encoding
1155  let Inst{15-0} = !if(ps.fixed_imm, ps.simm16, simm16);
1156  let Inst{22-16} = op;
1157  let Inst{31-23} = 0x17f;
1158  //effectively a nop
1159  let Inst{47-32} = 0x0;
1160  let Inst{54-48} = 0x0;
1161  let Inst{63-55} = 0x17f;
1162}
1163
1164multiclass SOPP_With_Relaxation <string opName, dag ins,
1165                  string asmOps, list<dag> pattern=[]> {
1166  def "" : SOPP_Pseudo <opName, ins, asmOps, pattern>;
1167  def _pad_s_nop : SOPP_Pseudo <opName # "_pad_s_nop", ins, asmOps, pattern, opName>;
1168}
1169
1170def S_NOP : SOPP_Pseudo<"s_nop" , (ins i16imm:$simm16), "$simm16">;
1171
1172let isTerminator = 1 in {
1173def S_ENDPGM : SOPP_Pseudo<"s_endpgm", (ins EndpgmImm:$simm16), "$simm16"> {
1174  let isBarrier = 1;
1175  let isReturn = 1;
1176  let hasSideEffects = 1;
1177}
1178
1179def S_ENDPGM_SAVED : SOPP_Pseudo<"s_endpgm_saved", (ins)> {
1180  let SubtargetPredicate = isGFX8Plus;
1181  let simm16 = 0;
1182  let fixed_imm = 1;
1183  let isBarrier = 1;
1184  let isReturn = 1;
1185}
1186
1187let SubtargetPredicate = isGFX9GFX10 in {
1188  let isBarrier = 1, isReturn = 1, simm16 = 0, fixed_imm = 1 in {
1189    def S_ENDPGM_ORDERED_PS_DONE :
1190      SOPP_Pseudo<"s_endpgm_ordered_ps_done", (ins)>;
1191  } // End isBarrier = 1, isReturn = 1, simm16 = 0, fixed_imm = 1
1192} // End SubtargetPredicate = isGFX9GFX10
1193
1194let SubtargetPredicate = isGFX10Plus in {
1195  let isBarrier = 1, isReturn = 1, simm16 = 0, fixed_imm = 1 in {
1196    def S_CODE_END :
1197      SOPP_Pseudo<"s_code_end", (ins)>;
1198  } // End isBarrier = 1, isReturn = 1, simm16 = 0, fixed_imm = 1
1199} // End SubtargetPredicate = isGFX10Plus
1200
1201let isBranch = 1, SchedRW = [WriteBranch] in {
1202let isBarrier = 1 in {
1203defm S_BRANCH : SOPP_With_Relaxation<
1204  "s_branch" , (ins sopp_brtarget:$simm16), "$simm16",
1205  [(br bb:$simm16)]>;
1206}
1207
1208let Uses = [SCC] in {
1209defm S_CBRANCH_SCC0 : SOPP_With_Relaxation<
1210  "s_cbranch_scc0" , (ins sopp_brtarget:$simm16),
1211  "$simm16"
1212>;
1213defm S_CBRANCH_SCC1 : SOPP_With_Relaxation <
1214  "s_cbranch_scc1" , (ins sopp_brtarget:$simm16),
1215  "$simm16"
1216>;
1217} // End Uses = [SCC]
1218
1219let Uses = [VCC] in {
1220defm S_CBRANCH_VCCZ : SOPP_With_Relaxation <
1221  "s_cbranch_vccz" , (ins sopp_brtarget:$simm16),
1222  "$simm16"
1223>;
1224defm S_CBRANCH_VCCNZ : SOPP_With_Relaxation <
1225  "s_cbranch_vccnz" , (ins sopp_brtarget:$simm16),
1226  "$simm16"
1227>;
1228} // End Uses = [VCC]
1229
1230let Uses = [EXEC] in {
1231defm S_CBRANCH_EXECZ : SOPP_With_Relaxation <
1232  "s_cbranch_execz" , (ins sopp_brtarget:$simm16),
1233  "$simm16"
1234>;
1235defm S_CBRANCH_EXECNZ : SOPP_With_Relaxation <
1236  "s_cbranch_execnz" , (ins sopp_brtarget:$simm16),
1237  "$simm16"
1238>;
1239} // End Uses = [EXEC]
1240
1241defm S_CBRANCH_CDBGSYS : SOPP_With_Relaxation <
1242  "s_cbranch_cdbgsys" , (ins sopp_brtarget:$simm16),
1243  "$simm16"
1244>;
1245
1246defm S_CBRANCH_CDBGSYS_AND_USER : SOPP_With_Relaxation <
1247  "s_cbranch_cdbgsys_and_user" , (ins sopp_brtarget:$simm16),
1248  "$simm16"
1249>;
1250
1251defm S_CBRANCH_CDBGSYS_OR_USER : SOPP_With_Relaxation <
1252  "s_cbranch_cdbgsys_or_user" , (ins sopp_brtarget:$simm16),
1253  "$simm16"
1254>;
1255
1256defm S_CBRANCH_CDBGUSER : SOPP_With_Relaxation <
1257  "s_cbranch_cdbguser" , (ins sopp_brtarget:$simm16),
1258  "$simm16"
1259>;
1260
1261} // End isBranch = 1
1262} // End isTerminator = 1
1263
1264let hasSideEffects = 1 in {
1265def S_BARRIER : SOPP_Pseudo <"s_barrier", (ins), "",
1266  [(int_amdgcn_s_barrier)]> {
1267  let SchedRW = [WriteBarrier];
1268  let simm16 = 0;
1269  let fixed_imm = 1;
1270  let isConvergent = 1;
1271}
1272
1273def S_WAKEUP : SOPP_Pseudo <"s_wakeup", (ins) > {
1274  let SubtargetPredicate = isGFX8Plus;
1275  let simm16 = 0;
1276  let fixed_imm = 1;
1277  let mayLoad = 1;
1278  let mayStore = 1;
1279}
1280
1281let hasSideEffects = 1 in
1282def S_WAITCNT : SOPP_Pseudo <"s_waitcnt" , (ins WAIT_FLAG:$simm16), "$simm16",
1283    [(int_amdgcn_s_waitcnt timm:$simm16)]>;
1284def S_SETHALT : SOPP_Pseudo <"s_sethalt" , (ins i32imm:$simm16), "$simm16",
1285    [(int_amdgcn_s_sethalt timm:$simm16)]>;
1286def S_SETKILL : SOPP_Pseudo <"s_setkill" , (ins i16imm:$simm16), "$simm16">;
1287
1288// On SI the documentation says sleep for approximately 64 * low 2
1289// bits, consistent with the reported maximum of 448. On VI the
1290// maximum reported is 960 cycles, so 960 / 64 = 15 max, so is the
1291// maximum really 15 on VI?
1292def S_SLEEP : SOPP_Pseudo <"s_sleep", (ins i32imm:$simm16),
1293  "$simm16", [(int_amdgcn_s_sleep timm:$simm16)]> {
1294  let hasSideEffects = 1;
1295}
1296
1297def S_SETPRIO : SOPP_Pseudo <"s_setprio", (ins i16imm:$simm16), "$simm16",
1298  [(int_amdgcn_s_setprio timm:$simm16)]> {
1299  let hasSideEffects = 1;
1300}
1301
1302let Uses = [EXEC, M0] in {
1303def S_SENDMSG : SOPP_Pseudo <"s_sendmsg" , (ins SendMsgImm:$simm16), "$simm16",
1304  [(int_amdgcn_s_sendmsg (i32 timm:$simm16), M0)]> {
1305  let hasSideEffects = 1;
1306}
1307
1308def S_SENDMSGHALT : SOPP_Pseudo <"s_sendmsghalt" , (ins SendMsgImm:$simm16), "$simm16",
1309  [(int_amdgcn_s_sendmsghalt (i32 timm:$simm16), M0)]> {
1310  let hasSideEffects = 1;
1311}
1312
1313} // End Uses = [EXEC, M0]
1314
1315def S_TRAP : SOPP_Pseudo <"s_trap" , (ins i16imm:$simm16), "$simm16"> {
1316  let isTrap = 1;
1317}
1318
1319def S_ICACHE_INV : SOPP_Pseudo <"s_icache_inv", (ins)> {
1320  let simm16 = 0;
1321  let fixed_imm = 1;
1322}
1323def S_INCPERFLEVEL : SOPP_Pseudo <"s_incperflevel", (ins i32imm:$simm16), "$simm16",
1324  [(int_amdgcn_s_incperflevel timm:$simm16)]> {
1325  let hasSideEffects = 1;
1326}
1327def S_DECPERFLEVEL : SOPP_Pseudo <"s_decperflevel", (ins i32imm:$simm16), "$simm16",
1328  [(int_amdgcn_s_decperflevel timm:$simm16)]> {
1329  let hasSideEffects = 1;
1330}
1331def S_TTRACEDATA : SOPP_Pseudo <"s_ttracedata", (ins)> {
1332  let simm16 = 0;
1333  let fixed_imm = 1;
1334}
1335
1336let SubtargetPredicate = HasVGPRIndexMode in {
1337def S_SET_GPR_IDX_OFF : SOPP_Pseudo<"s_set_gpr_idx_off", (ins) > {
1338  let simm16 = 0;
1339  let fixed_imm = 1;
1340  let Defs = [MODE];
1341  let Uses = [MODE];
1342}
1343}
1344} // End hasSideEffects
1345
1346let SubtargetPredicate = HasVGPRIndexMode in {
1347def S_SET_GPR_IDX_MODE : SOPP_Pseudo<"s_set_gpr_idx_mode", (ins GPRIdxMode:$simm16),
1348  "$simm16"> {
1349  let Defs = [M0, MODE];
1350  let Uses = [MODE];
1351}
1352}
1353
1354let SubtargetPredicate = isGFX10Plus in {
1355  def S_INST_PREFETCH :
1356    SOPP_Pseudo<"s_inst_prefetch", (ins s16imm:$simm16), "$simm16">;
1357  def S_CLAUSE :
1358    SOPP_Pseudo<"s_clause", (ins s16imm:$simm16), "$simm16">;
1359  def S_WAIT_IDLE :
1360    SOPP_Pseudo <"s_wait_idle", (ins), ""> {
1361      let simm16 = 0;
1362      let fixed_imm = 1;
1363    }
1364  def S_WAITCNT_DEPCTR :
1365    SOPP_Pseudo <"s_waitcnt_depctr" , (ins DepCtrImm:$simm16), "$simm16">;
1366
1367  let hasSideEffects = 0, Uses = [MODE], Defs = [MODE] in {
1368    def S_ROUND_MODE :
1369      SOPP_Pseudo<"s_round_mode", (ins s16imm:$simm16), "$simm16">;
1370    def S_DENORM_MODE :
1371      SOPP_Pseudo<"s_denorm_mode", (ins i32imm:$simm16), "$simm16",
1372      [(SIdenorm_mode (i32 timm:$simm16))]>;
1373  }
1374
1375  def S_TTRACEDATA_IMM :
1376    SOPP_Pseudo<"s_ttracedata_imm", (ins s16imm:$simm16), "$simm16">;
1377} // End SubtargetPredicate = isGFX10Plus
1378
1379let SubtargetPredicate = isGFX11Plus in {
1380  def S_WAIT_EVENT : SOPP_Pseudo<"s_wait_event", (ins s16imm:$simm16),
1381                                 "$simm16">;
1382  def S_DELAY_ALU : SOPP_Pseudo<"s_delay_alu", (ins DELAY_FLAG:$simm16),
1383                                "$simm16">;
1384} // End SubtargetPredicate = isGFX11Plus
1385
1386//===----------------------------------------------------------------------===//
1387// SOP1 Patterns
1388//===----------------------------------------------------------------------===//
1389
1390def : GCNPat <
1391  (AMDGPUendpgm),
1392    (S_ENDPGM (i16 0))
1393>;
1394
1395def : GCNPat <
1396  (int_amdgcn_endpgm),
1397    (S_ENDPGM (i16 0))
1398>;
1399
1400def : GCNPat <
1401  (i64 (UniformUnaryFrag<ctpop> i64:$src)),
1402    (i64 (REG_SEQUENCE SReg_64,
1403     (i32 (COPY_TO_REGCLASS (S_BCNT1_I32_B64 $src), SReg_32)), sub0,
1404     (S_MOV_B32 (i32 0)), sub1))
1405>;
1406
1407def : GCNPat <
1408  (i32 (UniformBinFrag<smax> i32:$x, (i32 (ineg i32:$x)))),
1409  (S_ABS_I32 SReg_32:$x)
1410>;
1411
1412def : GCNPat <
1413  (i16 imm:$imm),
1414  (S_MOV_B32 imm:$imm)
1415>;
1416
1417// Same as a 32-bit inreg
1418def : GCNPat<
1419  (i32 (UniformUnaryFrag<sext> i16:$src)),
1420  (S_SEXT_I32_I16 $src)
1421>;
1422
1423
1424//===----------------------------------------------------------------------===//
1425// SOP2 Patterns
1426//===----------------------------------------------------------------------===//
1427
1428// V_ADD_I32_e32/S_ADD_U32 produces carry in VCC/SCC. For the vector
1429// case, the sgpr-copies pass will fix this to use the vector version.
1430def : GCNPat <
1431  (i32 (addc i32:$src0, i32:$src1)),
1432  (S_ADD_U32 $src0, $src1)
1433>;
1434
1435// FIXME: We need to use COPY_TO_REGCLASS to work-around the fact that
1436// REG_SEQUENCE patterns don't support instructions with multiple
1437// outputs.
1438def : GCNPat<
1439  (i64 (UniformUnaryFrag<zext> i16:$src)),
1440    (REG_SEQUENCE SReg_64,
1441      (i32 (COPY_TO_REGCLASS (S_AND_B32 $src, (S_MOV_B32 (i32 0xffff))), SGPR_32)), sub0,
1442      (S_MOV_B32 (i32 0)), sub1)
1443>;
1444
1445def : GCNPat <
1446  (i64 (UniformUnaryFrag<sext> i16:$src)),
1447    (REG_SEQUENCE SReg_64, (i32 (S_SEXT_I32_I16 $src)), sub0,
1448    (i32 (COPY_TO_REGCLASS (S_ASHR_I32 (i32 (S_SEXT_I32_I16 $src)), (S_MOV_B32 (i32 31))), SGPR_32)), sub1)
1449>;
1450
1451def : GCNPat<
1452  (i32 (UniformUnaryFrag<zext> i16:$src)),
1453  (S_AND_B32 (S_MOV_B32 (i32 0xffff)), $src)
1454>;
1455
1456// FIXME: ValueType should have isVector field
1457class ScalarNot2Pat<Instruction inst, SDPatternOperator op, ValueType vt,
1458                    bit isVector = 1> : GCNPat<
1459  (UniformBinFrag<op> vt:$src0, (UniformUnaryFrag<!if(isVector, vnot, not)> vt:$src1)),
1460  (inst getSOPSrcForVT<vt>.ret:$src0, getSOPSrcForVT<vt>.ret:$src1)
1461>;
1462
1463// Match these for some more types
1464// TODO: i1
1465def : ScalarNot2Pat<S_ANDN2_B32, and, i16, 0>;
1466def : ScalarNot2Pat<S_ANDN2_B32, and, v2i16>;
1467def : ScalarNot2Pat<S_ANDN2_B64, and, v4i16>;
1468def : ScalarNot2Pat<S_ANDN2_B64, and, v2i32>;
1469
1470def : ScalarNot2Pat<S_ORN2_B32, or, i16, 0>;
1471def : ScalarNot2Pat<S_ORN2_B32, or, v2i16>;
1472def : ScalarNot2Pat<S_ORN2_B64, or, v4i16>;
1473def : ScalarNot2Pat<S_ORN2_B64, or, v2i32>;
1474
1475//===----------------------------------------------------------------------===//
1476// Target-specific instruction encodings.
1477//===----------------------------------------------------------------------===//
1478
1479class Select_gfx11<string opName> : SIMCInstr<opName, SIEncodingFamily.GFX11> {
1480  Predicate AssemblerPredicate = isGFX11Only;
1481  string DecoderNamespace      = "GFX11";
1482}
1483
1484class Select_gfx10<string opName> : SIMCInstr<opName, SIEncodingFamily.GFX10> {
1485  Predicate AssemblerPredicate = isGFX10Only;
1486  string DecoderNamespace      = "GFX10";
1487}
1488
1489class Select_vi<string opName> : SIMCInstr<opName, SIEncodingFamily.VI> {
1490  Predicate AssemblerPredicate = isGFX8GFX9;
1491  string DecoderNamespace = "GFX8";
1492}
1493
1494class Select_gfx6_gfx7<string opName> : SIMCInstr<opName, SIEncodingFamily.SI> {
1495  Predicate AssemblerPredicate = isGFX6GFX7;
1496  string DecoderNamespace      = "GFX6GFX7";
1497}
1498
1499//===----------------------------------------------------------------------===//
1500//  GFX11.
1501//===----------------------------------------------------------------------===//
1502
1503multiclass SOP1_Real_gfx11<bits<8> op> {
1504  def _gfx11 : SOP1_Real<op, !cast<SOP1_Pseudo>(NAME)>,
1505               Select_gfx11<!cast<SOP1_Pseudo>(NAME).Mnemonic>;
1506}
1507
1508multiclass SOP1_Real_Renamed_gfx11<bits<8> op, SOP1_Pseudo backing_pseudo, string real_name> {
1509  def _gfx11 : SOP1_Real<op, backing_pseudo, real_name>,
1510               Select_gfx11<backing_pseudo.Mnemonic>,
1511               MnemonicAlias<backing_pseudo.Mnemonic, real_name>, Requires<[isGFX11Plus]>;
1512}
1513
1514defm S_MOV_B32               : SOP1_Real_gfx11<0x000>;
1515defm S_MOV_B64               : SOP1_Real_gfx11<0x001>;
1516defm S_CMOV_B32              : SOP1_Real_gfx11<0x002>;
1517defm S_CMOV_B64              : SOP1_Real_gfx11<0x003>;
1518defm S_BREV_B32              : SOP1_Real_gfx11<0x004>;
1519defm S_BREV_B64              : SOP1_Real_gfx11<0x005>;
1520defm S_CTZ_I32_B32           : SOP1_Real_Renamed_gfx11<0x008, S_FF1_I32_B32, "s_ctz_i32_b32">;
1521defm S_CTZ_I32_B64           : SOP1_Real_Renamed_gfx11<0x009, S_FF1_I32_B64, "s_ctz_i32_b64">;
1522defm S_CLZ_I32_U32           : SOP1_Real_Renamed_gfx11<0x00a, S_FLBIT_I32_B32, "s_clz_i32_u32">;
1523defm S_CLZ_I32_U64           : SOP1_Real_Renamed_gfx11<0x00b, S_FLBIT_I32_B64, "s_clz_i32_u64">;
1524defm S_CLS_I32               : SOP1_Real_Renamed_gfx11<0x00c, S_FLBIT_I32, "s_cls_i32">;
1525defm S_CLS_I32_I64           : SOP1_Real_Renamed_gfx11<0x00d, S_FLBIT_I32_I64, "s_cls_i32_i64">;
1526defm S_SEXT_I32_I8           : SOP1_Real_gfx11<0x00e>;
1527defm S_SEXT_I32_I16          : SOP1_Real_gfx11<0x00f>;
1528defm S_BITSET0_B32           : SOP1_Real_gfx11<0x010>;
1529defm S_BITSET0_B64           : SOP1_Real_gfx11<0x011>;
1530defm S_BITSET1_B32           : SOP1_Real_gfx11<0x012>;
1531defm S_BITSET1_B64           : SOP1_Real_gfx11<0x013>;
1532defm S_BITREPLICATE_B64_B32  : SOP1_Real_gfx11<0x014>;
1533defm S_ABS_I32               : SOP1_Real_gfx11<0x015>;
1534defm S_BCNT0_I32_B32         : SOP1_Real_gfx11<0x016>;
1535defm S_BCNT0_I32_B64         : SOP1_Real_gfx11<0x017>;
1536defm S_BCNT1_I32_B32         : SOP1_Real_gfx11<0x018>;
1537defm S_BCNT1_I32_B64         : SOP1_Real_gfx11<0x019>;
1538defm S_QUADMASK_B32          : SOP1_Real_gfx11<0x01a>;
1539defm S_QUADMASK_B64          : SOP1_Real_gfx11<0x01b>;
1540defm S_WQM_B32               : SOP1_Real_gfx11<0x01c>;
1541defm S_WQM_B64               : SOP1_Real_gfx11<0x01d>;
1542defm S_NOT_B32               : SOP1_Real_gfx11<0x01e>;
1543defm S_NOT_B64               : SOP1_Real_gfx11<0x01f>;
1544defm S_AND_SAVEEXEC_B32      : SOP1_Real_gfx11<0x020>;
1545defm S_AND_SAVEEXEC_B64      : SOP1_Real_gfx11<0x021>;
1546defm S_OR_SAVEEXEC_B32       : SOP1_Real_gfx11<0x022>;
1547defm S_OR_SAVEEXEC_B64       : SOP1_Real_gfx11<0x023>;
1548defm S_XOR_SAVEEXEC_B32      : SOP1_Real_gfx11<0x024>;
1549defm S_XOR_SAVEEXEC_B64      : SOP1_Real_gfx11<0x025>;
1550defm S_NAND_SAVEEXEC_B32     : SOP1_Real_gfx11<0x026>;
1551defm S_NAND_SAVEEXEC_B64     : SOP1_Real_gfx11<0x027>;
1552defm S_NOR_SAVEEXEC_B32      : SOP1_Real_gfx11<0x028>;
1553defm S_NOR_SAVEEXEC_B64      : SOP1_Real_gfx11<0x029>;
1554defm S_XNOR_SAVEEXEC_B32     : SOP1_Real_gfx11<0x02a>;
1555/*defm S_XNOR_SAVEEXEC_B64   : SOP1_Real_gfx11<0x02b>; //same as older arch, handled there*/
1556defm S_AND_NOT0_SAVEEXEC_B32 : SOP1_Real_Renamed_gfx11<0x02c, S_ANDN1_SAVEEXEC_B32, "s_and_not0_saveexec_b32">;
1557defm S_AND_NOT0_SAVEEXEC_B64 : SOP1_Real_Renamed_gfx11<0x02d, S_ANDN1_SAVEEXEC_B64, "s_and_not0_saveexec_b64">;
1558defm S_OR_NOT0_SAVEEXEC_B32  : SOP1_Real_Renamed_gfx11<0x02e, S_ORN1_SAVEEXEC_B32, "s_or_not0_saveexec_b32">;
1559defm S_OR_NOT0_SAVEEXEC_B64  : SOP1_Real_Renamed_gfx11<0x02f, S_ORN1_SAVEEXEC_B64, "s_or_not0_saveexec_b64">;
1560defm S_AND_NOT1_SAVEEXEC_B32 : SOP1_Real_Renamed_gfx11<0x030, S_ANDN2_SAVEEXEC_B32, "s_and_not1_saveexec_b32">;
1561defm S_AND_NOT1_SAVEEXEC_B64 : SOP1_Real_Renamed_gfx11<0x031, S_ANDN2_SAVEEXEC_B64, "s_and_not1_saveexec_b64">;
1562defm S_OR_NOT1_SAVEEXEC_B32  : SOP1_Real_Renamed_gfx11<0x032, S_ORN2_SAVEEXEC_B32, "s_or_not1_saveexec_b32">;
1563defm S_OR_NOT1_SAVEEXEC_B64  : SOP1_Real_Renamed_gfx11<0x033, S_ORN2_SAVEEXEC_B64, "s_or_not1_saveexec_b64">;
1564defm S_AND_NOT0_WREXEC_B32   : SOP1_Real_Renamed_gfx11<0x034, S_ANDN1_WREXEC_B32, "s_and_not0_wrexec_b32">;
1565defm S_AND_NOT0_WREXEC_B64   : SOP1_Real_Renamed_gfx11<0x035, S_ANDN1_WREXEC_B64, "s_and_not0_wrexec_b64">;
1566defm S_AND_NOT1_WREXEC_B32   : SOP1_Real_Renamed_gfx11<0x036, S_ANDN2_WREXEC_B32, "s_and_not1_wrexec_b32">;
1567defm S_AND_NOT1_WREXEC_B64   : SOP1_Real_Renamed_gfx11<0x037, S_ANDN2_WREXEC_B64, "s_and_not1_wrexec_b64">;
1568defm S_MOVRELS_B32           : SOP1_Real_gfx11<0x040>;
1569defm S_MOVRELS_B64           : SOP1_Real_gfx11<0x041>;
1570defm S_MOVRELD_B32           : SOP1_Real_gfx11<0x042>;
1571defm S_MOVRELD_B64           : SOP1_Real_gfx11<0x043>;
1572defm S_MOVRELSD_2_B32        : SOP1_Real_gfx11<0x044>;
1573defm S_GETPC_B64             : SOP1_Real_gfx11<0x047>;
1574defm S_SETPC_B64             : SOP1_Real_gfx11<0x048>;
1575defm S_SWAPPC_B64            : SOP1_Real_gfx11<0x049>;
1576defm S_RFE_B64               : SOP1_Real_gfx11<0x04a>;
1577defm S_SENDMSG_RTN_B32       : SOP1_Real_gfx11<0x04c>;
1578defm S_SENDMSG_RTN_B64       : SOP1_Real_gfx11<0x04d>;
1579
1580//===----------------------------------------------------------------------===//
1581// SOP1 - GFX10.
1582//===----------------------------------------------------------------------===//
1583
1584multiclass SOP1_Real_gfx10<bits<8> op> {
1585  defvar ps = !cast<SOP1_Pseudo>(NAME);
1586  def _gfx10 : SOP1_Real<op, ps>,
1587               Select_gfx10<ps.Mnemonic>;
1588}
1589
1590multiclass SOP1_Real_gfx10_gfx11<bits<8> op> :
1591  SOP1_Real_gfx10<op>, SOP1_Real_gfx11<op>;
1592
1593defm S_ANDN1_SAVEEXEC_B64   : SOP1_Real_gfx10<0x037>;
1594defm S_ORN1_SAVEEXEC_B64    : SOP1_Real_gfx10<0x038>;
1595defm S_ANDN1_WREXEC_B64     : SOP1_Real_gfx10<0x039>;
1596defm S_ANDN2_WREXEC_B64     : SOP1_Real_gfx10<0x03a>;
1597defm S_BITREPLICATE_B64_B32 : SOP1_Real_gfx10<0x03b>;
1598defm S_AND_SAVEEXEC_B32     : SOP1_Real_gfx10<0x03c>;
1599defm S_OR_SAVEEXEC_B32      : SOP1_Real_gfx10<0x03d>;
1600defm S_XOR_SAVEEXEC_B32     : SOP1_Real_gfx10<0x03e>;
1601defm S_ANDN2_SAVEEXEC_B32   : SOP1_Real_gfx10<0x03f>;
1602defm S_ORN2_SAVEEXEC_B32    : SOP1_Real_gfx10<0x040>;
1603defm S_NAND_SAVEEXEC_B32    : SOP1_Real_gfx10<0x041>;
1604defm S_NOR_SAVEEXEC_B32     : SOP1_Real_gfx10<0x042>;
1605defm S_XNOR_SAVEEXEC_B32    : SOP1_Real_gfx10<0x043>;
1606defm S_ANDN1_SAVEEXEC_B32   : SOP1_Real_gfx10<0x044>;
1607defm S_ORN1_SAVEEXEC_B32    : SOP1_Real_gfx10<0x045>;
1608defm S_ANDN1_WREXEC_B32     : SOP1_Real_gfx10<0x046>;
1609defm S_ANDN2_WREXEC_B32     : SOP1_Real_gfx10<0x047>;
1610defm S_MOVRELSD_2_B32       : SOP1_Real_gfx10<0x049>;
1611
1612//===----------------------------------------------------------------------===//
1613// SOP1 - GFX6, GFX7, GFX10, GFX11.
1614//===----------------------------------------------------------------------===//
1615
1616
1617multiclass SOP1_Real_gfx6_gfx7<bits<8> op> {
1618  defvar ps = !cast<SOP1_Pseudo>(NAME);
1619  def _gfx6_gfx7 : SOP1_Real<op, ps>,
1620                   Select_gfx6_gfx7<ps.Mnemonic>;
1621}
1622
1623multiclass SOP1_Real_gfx6_gfx7_gfx10<bits<8> op> :
1624  SOP1_Real_gfx6_gfx7<op>, SOP1_Real_gfx10<op>;
1625
1626multiclass SOP1_Real_gfx6_gfx7_gfx10_gfx11<bits<8> op> :
1627  SOP1_Real_gfx6_gfx7<op>, SOP1_Real_gfx10_gfx11<op>;
1628
1629defm S_CBRANCH_JOIN  : SOP1_Real_gfx6_gfx7<0x032>;
1630
1631defm S_MOV_B32            : SOP1_Real_gfx6_gfx7_gfx10<0x003>;
1632defm S_MOV_B64            : SOP1_Real_gfx6_gfx7_gfx10<0x004>;
1633defm S_CMOV_B32           : SOP1_Real_gfx6_gfx7_gfx10<0x005>;
1634defm S_CMOV_B64           : SOP1_Real_gfx6_gfx7_gfx10<0x006>;
1635defm S_NOT_B32            : SOP1_Real_gfx6_gfx7_gfx10<0x007>;
1636defm S_NOT_B64            : SOP1_Real_gfx6_gfx7_gfx10<0x008>;
1637defm S_WQM_B32            : SOP1_Real_gfx6_gfx7_gfx10<0x009>;
1638defm S_WQM_B64            : SOP1_Real_gfx6_gfx7_gfx10<0x00a>;
1639defm S_BREV_B32           : SOP1_Real_gfx6_gfx7_gfx10<0x00b>;
1640defm S_BREV_B64           : SOP1_Real_gfx6_gfx7_gfx10<0x00c>;
1641defm S_BCNT0_I32_B32      : SOP1_Real_gfx6_gfx7_gfx10<0x00d>;
1642defm S_BCNT0_I32_B64      : SOP1_Real_gfx6_gfx7_gfx10<0x00e>;
1643defm S_BCNT1_I32_B32      : SOP1_Real_gfx6_gfx7_gfx10<0x00f>;
1644defm S_BCNT1_I32_B64      : SOP1_Real_gfx6_gfx7_gfx10<0x010>;
1645defm S_FF0_I32_B32        : SOP1_Real_gfx6_gfx7_gfx10<0x011>;
1646defm S_FF0_I32_B64        : SOP1_Real_gfx6_gfx7_gfx10<0x012>;
1647defm S_FF1_I32_B32        : SOP1_Real_gfx6_gfx7_gfx10<0x013>;
1648defm S_FF1_I32_B64        : SOP1_Real_gfx6_gfx7_gfx10<0x014>;
1649defm S_FLBIT_I32_B32      : SOP1_Real_gfx6_gfx7_gfx10<0x015>;
1650defm S_FLBIT_I32_B64      : SOP1_Real_gfx6_gfx7_gfx10<0x016>;
1651defm S_FLBIT_I32          : SOP1_Real_gfx6_gfx7_gfx10<0x017>;
1652defm S_FLBIT_I32_I64      : SOP1_Real_gfx6_gfx7_gfx10<0x018>;
1653defm S_SEXT_I32_I8        : SOP1_Real_gfx6_gfx7_gfx10<0x019>;
1654defm S_SEXT_I32_I16       : SOP1_Real_gfx6_gfx7_gfx10<0x01a>;
1655defm S_BITSET0_B32        : SOP1_Real_gfx6_gfx7_gfx10<0x01b>;
1656defm S_BITSET0_B64        : SOP1_Real_gfx6_gfx7_gfx10<0x01c>;
1657defm S_BITSET1_B32        : SOP1_Real_gfx6_gfx7_gfx10<0x01d>;
1658defm S_BITSET1_B64        : SOP1_Real_gfx6_gfx7_gfx10<0x01e>;
1659defm S_GETPC_B64          : SOP1_Real_gfx6_gfx7_gfx10<0x01f>;
1660defm S_SETPC_B64          : SOP1_Real_gfx6_gfx7_gfx10<0x020>;
1661defm S_SWAPPC_B64         : SOP1_Real_gfx6_gfx7_gfx10<0x021>;
1662defm S_RFE_B64            : SOP1_Real_gfx6_gfx7_gfx10<0x022>;
1663defm S_AND_SAVEEXEC_B64   : SOP1_Real_gfx6_gfx7_gfx10<0x024>;
1664defm S_OR_SAVEEXEC_B64    : SOP1_Real_gfx6_gfx7_gfx10<0x025>;
1665defm S_XOR_SAVEEXEC_B64   : SOP1_Real_gfx6_gfx7_gfx10<0x026>;
1666defm S_ANDN2_SAVEEXEC_B64 : SOP1_Real_gfx6_gfx7_gfx10<0x027>;
1667defm S_ORN2_SAVEEXEC_B64  : SOP1_Real_gfx6_gfx7_gfx10<0x028>;
1668defm S_NAND_SAVEEXEC_B64  : SOP1_Real_gfx6_gfx7_gfx10<0x029>;
1669defm S_NOR_SAVEEXEC_B64   : SOP1_Real_gfx6_gfx7_gfx10<0x02a>;
1670defm S_XNOR_SAVEEXEC_B64  : SOP1_Real_gfx6_gfx7_gfx10_gfx11<0x02b>;
1671defm S_QUADMASK_B32       : SOP1_Real_gfx6_gfx7_gfx10<0x02c>;
1672defm S_QUADMASK_B64       : SOP1_Real_gfx6_gfx7_gfx10<0x02d>;
1673defm S_MOVRELS_B32        : SOP1_Real_gfx6_gfx7_gfx10<0x02e>;
1674defm S_MOVRELS_B64        : SOP1_Real_gfx6_gfx7_gfx10<0x02f>;
1675defm S_MOVRELD_B32        : SOP1_Real_gfx6_gfx7_gfx10<0x030>;
1676defm S_MOVRELD_B64        : SOP1_Real_gfx6_gfx7_gfx10<0x031>;
1677defm S_ABS_I32            : SOP1_Real_gfx6_gfx7_gfx10<0x034>;
1678
1679//===----------------------------------------------------------------------===//
1680// SOP2 - GFX11.
1681//===----------------------------------------------------------------------===//
1682
1683multiclass SOP2_Real_gfx11<bits<7> op> {
1684  def _gfx11 : SOP2_Real<op, !cast<SOP2_Pseudo>(NAME)>,
1685               Select_gfx11<!cast<SOP2_Pseudo>(NAME).Mnemonic>;
1686}
1687
1688multiclass SOP2_Real_Renamed_gfx11<bits<7> op, SOP2_Pseudo backing_pseudo, string real_name> {
1689  def _gfx11 : SOP2_Real<op, backing_pseudo, real_name>,
1690               Select_gfx11<backing_pseudo.Mnemonic>,
1691               MnemonicAlias<backing_pseudo.Mnemonic, real_name>, Requires<[isGFX11Plus]>;
1692}
1693
1694defm S_ABSDIFF_I32     : SOP2_Real_gfx11<0x006>;
1695defm S_LSHL_B32        : SOP2_Real_gfx11<0x008>;
1696defm S_LSHL_B64        : SOP2_Real_gfx11<0x009>;
1697defm S_LSHR_B32        : SOP2_Real_gfx11<0x00a>;
1698defm S_LSHR_B64        : SOP2_Real_gfx11<0x00b>;
1699defm S_ASHR_I32        : SOP2_Real_gfx11<0x00c>;
1700defm S_ASHR_I64        : SOP2_Real_gfx11<0x00d>;
1701defm S_LSHL1_ADD_U32   : SOP2_Real_gfx11<0x00e>;
1702defm S_LSHL2_ADD_U32   : SOP2_Real_gfx11<0x00f>;
1703defm S_LSHL3_ADD_U32   : SOP2_Real_gfx11<0x010>;
1704defm S_LSHL4_ADD_U32   : SOP2_Real_gfx11<0x011>;
1705defm S_MIN_I32         : SOP2_Real_gfx11<0x012>;
1706defm S_MIN_U32         : SOP2_Real_gfx11<0x013>;
1707defm S_MAX_I32         : SOP2_Real_gfx11<0x014>;
1708defm S_MAX_U32         : SOP2_Real_gfx11<0x015>;
1709defm S_AND_B32         : SOP2_Real_gfx11<0x016>;
1710defm S_AND_B64         : SOP2_Real_gfx11<0x017>;
1711defm S_OR_B32          : SOP2_Real_gfx11<0x018>;
1712defm S_OR_B64          : SOP2_Real_gfx11<0x019>;
1713defm S_XOR_B32         : SOP2_Real_gfx11<0x01a>;
1714defm S_XOR_B64         : SOP2_Real_gfx11<0x01b>;
1715defm S_NAND_B32        : SOP2_Real_gfx11<0x01c>;
1716defm S_NAND_B64        : SOP2_Real_gfx11<0x01d>;
1717defm S_NOR_B32         : SOP2_Real_gfx11<0x01e>;
1718defm S_NOR_B64         : SOP2_Real_gfx11<0x01f>;
1719defm S_XNOR_B32        : SOP2_Real_gfx11<0x020>;
1720defm S_XNOR_B64        : SOP2_Real_gfx11<0x021>;
1721defm S_AND_NOT1_B32    : SOP2_Real_Renamed_gfx11<0x022, S_ANDN2_B32, "s_and_not1_b32">;
1722defm S_AND_NOT1_B64    : SOP2_Real_Renamed_gfx11<0x023, S_ANDN2_B64, "s_and_not1_b64">;
1723defm S_OR_NOT1_B32     : SOP2_Real_Renamed_gfx11<0x024, S_ORN2_B32, "s_or_not1_b32">;
1724defm S_OR_NOT1_B64     : SOP2_Real_Renamed_gfx11<0x025, S_ORN2_B64, "s_or_not1_b64">;
1725defm S_BFE_U32         : SOP2_Real_gfx11<0x026>;
1726defm S_BFE_I32         : SOP2_Real_gfx11<0x027>;
1727defm S_BFE_U64         : SOP2_Real_gfx11<0x028>;
1728defm S_BFE_I64         : SOP2_Real_gfx11<0x029>;
1729defm S_BFM_B32         : SOP2_Real_gfx11<0x02a>;
1730defm S_BFM_B64         : SOP2_Real_gfx11<0x02b>;
1731defm S_MUL_I32         : SOP2_Real_gfx11<0x02c>;
1732defm S_MUL_HI_U32      : SOP2_Real_gfx11<0x02d>;
1733defm S_MUL_HI_I32      : SOP2_Real_gfx11<0x02e>;
1734defm S_CSELECT_B32     : SOP2_Real_gfx11<0x030>;
1735defm S_CSELECT_B64     : SOP2_Real_gfx11<0x031>;
1736defm S_PACK_HL_B32_B16 : SOP2_Real_gfx11<0x035>;
1737
1738//===----------------------------------------------------------------------===//
1739// SOP2 - GFX10.
1740//===----------------------------------------------------------------------===//
1741
1742multiclass SOP2_Real_gfx10<bits<7> op> {
1743  defvar ps = !cast<SOP2_Pseudo>(NAME);
1744  def _gfx10 : SOP2_Real<op, ps>,
1745               Select_gfx10<ps.Mnemonic>;
1746}
1747
1748multiclass SOP2_Real_gfx10_gfx11<bits<7> op> :
1749  SOP2_Real_gfx10<op>, SOP2_Real_gfx11<op>;
1750
1751defm S_LSHL1_ADD_U32   : SOP2_Real_gfx10<0x02e>;
1752defm S_LSHL2_ADD_U32   : SOP2_Real_gfx10<0x02f>;
1753defm S_LSHL3_ADD_U32   : SOP2_Real_gfx10<0x030>;
1754defm S_LSHL4_ADD_U32   : SOP2_Real_gfx10<0x031>;
1755defm S_PACK_LL_B32_B16 : SOP2_Real_gfx10_gfx11<0x032>;
1756defm S_PACK_LH_B32_B16 : SOP2_Real_gfx10_gfx11<0x033>;
1757defm S_PACK_HH_B32_B16 : SOP2_Real_gfx10_gfx11<0x034>;
1758defm S_MUL_HI_U32      : SOP2_Real_gfx10<0x035>;
1759defm S_MUL_HI_I32      : SOP2_Real_gfx10<0x036>;
1760
1761//===----------------------------------------------------------------------===//
1762// SOP2 - GFX6, GFX7.
1763//===----------------------------------------------------------------------===//
1764
1765multiclass SOP2_Real_gfx6_gfx7<bits<7> op> {
1766  defvar ps = !cast<SOP_Pseudo>(NAME);
1767  def _gfx6_gfx7 : SOP2_Real<op, ps>,
1768                   Select_gfx6_gfx7<ps.Mnemonic>;
1769}
1770
1771multiclass SOP2_Real_gfx6_gfx7_gfx10<bits<7> op> :
1772  SOP2_Real_gfx6_gfx7<op>, SOP2_Real_gfx10<op>;
1773
1774multiclass SOP2_Real_gfx6_gfx7_gfx10_gfx11<bits<7> op> :
1775  SOP2_Real_gfx6_gfx7<op>, SOP2_Real_gfx10_gfx11<op>;
1776
1777defm S_CBRANCH_G_FORK : SOP2_Real_gfx6_gfx7<0x02b>;
1778
1779defm S_ADD_U32     : SOP2_Real_gfx6_gfx7_gfx10_gfx11<0x000>;
1780defm S_SUB_U32     : SOP2_Real_gfx6_gfx7_gfx10_gfx11<0x001>;
1781defm S_ADD_I32     : SOP2_Real_gfx6_gfx7_gfx10_gfx11<0x002>;
1782defm S_SUB_I32     : SOP2_Real_gfx6_gfx7_gfx10_gfx11<0x003>;
1783defm S_ADDC_U32    : SOP2_Real_gfx6_gfx7_gfx10_gfx11<0x004>;
1784defm S_SUBB_U32    : SOP2_Real_gfx6_gfx7_gfx10_gfx11<0x005>;
1785defm S_MIN_I32     : SOP2_Real_gfx6_gfx7_gfx10<0x006>;
1786defm S_MIN_U32     : SOP2_Real_gfx6_gfx7_gfx10<0x007>;
1787defm S_MAX_I32     : SOP2_Real_gfx6_gfx7_gfx10<0x008>;
1788defm S_MAX_U32     : SOP2_Real_gfx6_gfx7_gfx10<0x009>;
1789defm S_CSELECT_B32 : SOP2_Real_gfx6_gfx7_gfx10<0x00a>;
1790defm S_CSELECT_B64 : SOP2_Real_gfx6_gfx7_gfx10<0x00b>;
1791defm S_AND_B32     : SOP2_Real_gfx6_gfx7_gfx10<0x00e>;
1792defm S_AND_B64     : SOP2_Real_gfx6_gfx7_gfx10<0x00f>;
1793defm S_OR_B32      : SOP2_Real_gfx6_gfx7_gfx10<0x010>;
1794defm S_OR_B64      : SOP2_Real_gfx6_gfx7_gfx10<0x011>;
1795defm S_XOR_B32     : SOP2_Real_gfx6_gfx7_gfx10<0x012>;
1796defm S_XOR_B64     : SOP2_Real_gfx6_gfx7_gfx10<0x013>;
1797defm S_ANDN2_B32   : SOP2_Real_gfx6_gfx7_gfx10<0x014>;
1798defm S_ANDN2_B64   : SOP2_Real_gfx6_gfx7_gfx10<0x015>;
1799defm S_ORN2_B32    : SOP2_Real_gfx6_gfx7_gfx10<0x016>;
1800defm S_ORN2_B64    : SOP2_Real_gfx6_gfx7_gfx10<0x017>;
1801defm S_NAND_B32    : SOP2_Real_gfx6_gfx7_gfx10<0x018>;
1802defm S_NAND_B64    : SOP2_Real_gfx6_gfx7_gfx10<0x019>;
1803defm S_NOR_B32     : SOP2_Real_gfx6_gfx7_gfx10<0x01a>;
1804defm S_NOR_B64     : SOP2_Real_gfx6_gfx7_gfx10<0x01b>;
1805defm S_XNOR_B32    : SOP2_Real_gfx6_gfx7_gfx10<0x01c>;
1806defm S_XNOR_B64    : SOP2_Real_gfx6_gfx7_gfx10<0x01d>;
1807defm S_LSHL_B32    : SOP2_Real_gfx6_gfx7_gfx10<0x01e>;
1808defm S_LSHL_B64    : SOP2_Real_gfx6_gfx7_gfx10<0x01f>;
1809defm S_LSHR_B32    : SOP2_Real_gfx6_gfx7_gfx10<0x020>;
1810defm S_LSHR_B64    : SOP2_Real_gfx6_gfx7_gfx10<0x021>;
1811defm S_ASHR_I32    : SOP2_Real_gfx6_gfx7_gfx10<0x022>;
1812defm S_ASHR_I64    : SOP2_Real_gfx6_gfx7_gfx10<0x023>;
1813defm S_BFM_B32     : SOP2_Real_gfx6_gfx7_gfx10<0x024>;
1814defm S_BFM_B64     : SOP2_Real_gfx6_gfx7_gfx10<0x025>;
1815defm S_MUL_I32     : SOP2_Real_gfx6_gfx7_gfx10<0x026>;
1816defm S_BFE_U32     : SOP2_Real_gfx6_gfx7_gfx10<0x027>;
1817defm S_BFE_I32     : SOP2_Real_gfx6_gfx7_gfx10<0x028>;
1818defm S_BFE_U64     : SOP2_Real_gfx6_gfx7_gfx10<0x029>;
1819defm S_BFE_I64     : SOP2_Real_gfx6_gfx7_gfx10<0x02a>;
1820defm S_ABSDIFF_I32 : SOP2_Real_gfx6_gfx7_gfx10<0x02c>;
1821
1822//===----------------------------------------------------------------------===//
1823// SOPK - GFX11.
1824//===----------------------------------------------------------------------===//
1825
1826multiclass SOPK_Real32_gfx11<bits<5> op> {
1827  def _gfx11 : SOPK_Real32<op, !cast<SOPK_Pseudo>(NAME)>,
1828               Select_gfx11<!cast<SOPK_Pseudo>(NAME).Mnemonic>;
1829}
1830
1831multiclass SOPK_Real64_gfx11<bits<5> op> {
1832  def _gfx11 : SOPK_Real64<op, !cast<SOPK_Pseudo>(NAME)>,
1833               Select_gfx11<!cast<SOPK_Pseudo>(NAME).Mnemonic>;
1834}
1835
1836defm S_GETREG_B32           : SOPK_Real32_gfx11<0x011>;
1837defm S_SETREG_B32           : SOPK_Real32_gfx11<0x012>;
1838defm S_SETREG_IMM32_B32     : SOPK_Real64_gfx11<0x013>;
1839defm S_CALL_B64             : SOPK_Real32_gfx11<0x014>;
1840defm S_SUBVECTOR_LOOP_BEGIN : SOPK_Real32_gfx11<0x016>;
1841defm S_SUBVECTOR_LOOP_END   : SOPK_Real32_gfx11<0x017>;
1842defm S_WAITCNT_VSCNT        : SOPK_Real32_gfx11<0x018>;
1843defm S_WAITCNT_VMCNT        : SOPK_Real32_gfx11<0x019>;
1844defm S_WAITCNT_EXPCNT       : SOPK_Real32_gfx11<0x01a>;
1845defm S_WAITCNT_LGKMCNT      : SOPK_Real32_gfx11<0x01b>;
1846
1847//===----------------------------------------------------------------------===//
1848// SOPK - GFX10.
1849//===----------------------------------------------------------------------===//
1850
1851multiclass SOPK_Real32_gfx10<bits<5> op> {
1852  defvar ps = !cast<SOPK_Pseudo>(NAME);
1853  def _gfx10 : SOPK_Real32<op, ps>,
1854               Select_gfx10<ps.Mnemonic>;
1855}
1856
1857multiclass SOPK_Real64_gfx10<bits<5> op> {
1858  defvar ps = !cast<SOPK_Pseudo>(NAME);
1859  def _gfx10 : SOPK_Real64<op, ps>,
1860               Select_gfx10<ps.Mnemonic>;
1861}
1862
1863multiclass SOPK_Real32_gfx10_gfx11<bits<5> op> :
1864  SOPK_Real32_gfx10<op>, SOPK_Real32_gfx11<op>;
1865
1866defm S_VERSION              : SOPK_Real32_gfx10_gfx11<0x001>;
1867defm S_CALL_B64             : SOPK_Real32_gfx10<0x016>;
1868defm S_WAITCNT_VSCNT        : SOPK_Real32_gfx10<0x017>;
1869defm S_WAITCNT_VMCNT        : SOPK_Real32_gfx10<0x018>;
1870defm S_WAITCNT_EXPCNT       : SOPK_Real32_gfx10<0x019>;
1871defm S_WAITCNT_LGKMCNT      : SOPK_Real32_gfx10<0x01a>;
1872defm S_SUBVECTOR_LOOP_BEGIN : SOPK_Real32_gfx10<0x01b>;
1873defm S_SUBVECTOR_LOOP_END   : SOPK_Real32_gfx10<0x01c>;
1874
1875//===----------------------------------------------------------------------===//
1876// SOPK - GFX6, GFX7.
1877//===----------------------------------------------------------------------===//
1878
1879multiclass SOPK_Real32_gfx6_gfx7<bits<5> op> {
1880  defvar ps = !cast<SOPK_Pseudo>(NAME);
1881  def _gfx6_gfx7 : SOPK_Real32<op, ps>,
1882                   Select_gfx6_gfx7<ps.Mnemonic>;
1883}
1884
1885multiclass SOPK_Real64_gfx6_gfx7<bits<5> op> {
1886  defvar ps = !cast<SOPK_Pseudo>(NAME);
1887  def _gfx6_gfx7 : SOPK_Real64<op, ps>,
1888                   Select_gfx6_gfx7<ps.Mnemonic>;
1889}
1890
1891multiclass SOPK_Real32_gfx6_gfx7_gfx10<bits<5> op> :
1892  SOPK_Real32_gfx6_gfx7<op>, SOPK_Real32_gfx10<op>;
1893
1894multiclass SOPK_Real64_gfx6_gfx7_gfx10<bits<5> op> :
1895  SOPK_Real64_gfx6_gfx7<op>, SOPK_Real64_gfx10<op>;
1896
1897multiclass SOPK_Real32_gfx6_gfx7_gfx10_gfx11<bits<5> op> :
1898  SOPK_Real32_gfx6_gfx7<op>, SOPK_Real32_gfx10_gfx11<op>;
1899
1900defm S_CBRANCH_I_FORK : SOPK_Real32_gfx6_gfx7<0x011>;
1901
1902defm S_MOVK_I32         : SOPK_Real32_gfx6_gfx7_gfx10_gfx11<0x000>;
1903defm S_CMOVK_I32        : SOPK_Real32_gfx6_gfx7_gfx10_gfx11<0x002>;
1904defm S_CMPK_EQ_I32      : SOPK_Real32_gfx6_gfx7_gfx10_gfx11<0x003>;
1905defm S_CMPK_LG_I32      : SOPK_Real32_gfx6_gfx7_gfx10_gfx11<0x004>;
1906defm S_CMPK_GT_I32      : SOPK_Real32_gfx6_gfx7_gfx10_gfx11<0x005>;
1907defm S_CMPK_GE_I32      : SOPK_Real32_gfx6_gfx7_gfx10_gfx11<0x006>;
1908defm S_CMPK_LT_I32      : SOPK_Real32_gfx6_gfx7_gfx10_gfx11<0x007>;
1909defm S_CMPK_LE_I32      : SOPK_Real32_gfx6_gfx7_gfx10_gfx11<0x008>;
1910defm S_CMPK_EQ_U32      : SOPK_Real32_gfx6_gfx7_gfx10_gfx11<0x009>;
1911defm S_CMPK_LG_U32      : SOPK_Real32_gfx6_gfx7_gfx10_gfx11<0x00a>;
1912defm S_CMPK_GT_U32      : SOPK_Real32_gfx6_gfx7_gfx10_gfx11<0x00b>;
1913defm S_CMPK_GE_U32      : SOPK_Real32_gfx6_gfx7_gfx10_gfx11<0x00c>;
1914defm S_CMPK_LT_U32      : SOPK_Real32_gfx6_gfx7_gfx10_gfx11<0x00d>;
1915defm S_CMPK_LE_U32      : SOPK_Real32_gfx6_gfx7_gfx10_gfx11<0x00e>;
1916defm S_ADDK_I32         : SOPK_Real32_gfx6_gfx7_gfx10_gfx11<0x00f>;
1917defm S_MULK_I32         : SOPK_Real32_gfx6_gfx7_gfx10_gfx11<0x010>;
1918defm S_GETREG_B32       : SOPK_Real32_gfx6_gfx7_gfx10<0x012>;
1919defm S_SETREG_B32       : SOPK_Real32_gfx6_gfx7_gfx10<0x013>;
1920defm S_SETREG_IMM32_B32 : SOPK_Real64_gfx6_gfx7_gfx10<0x015>;
1921
1922//===----------------------------------------------------------------------===//
1923// SOPP - GFX11
1924//===----------------------------------------------------------------------===//
1925
1926multiclass SOPP_Real_32_gfx11<bits<7> op, string real_name = !cast<SOPP_Pseudo>(NAME).Mnemonic # " "> {
1927  def _gfx11 : SOPP_Real_32<op, !cast<SOPP_Pseudo>(NAME), real_name>,
1928               Select_gfx11<!cast<SOPP_Pseudo>(NAME).Mnemonic>,
1929               SOPPRelaxTable<0, !cast<SOPP_Pseudo>(NAME).KeyName, "_gfx11">;
1930}
1931
1932multiclass SOPP_Real_64_gfx11<bits<7> op, string real_name = !cast<SOPP_Pseudo>(NAME).Mnemonic # " "> {
1933  def _gfx11 : SOPP_Real_64<op, !cast<SOPP_Pseudo>(NAME), real_name>,
1934               Select_gfx11<!cast<SOPP_Pseudo>(NAME).Mnemonic>,
1935               SOPPRelaxTable<1, !cast<SOPP_Pseudo>(NAME).KeyName, "_gfx11">;
1936}
1937
1938multiclass SOPP_Real_32_Renamed_gfx11<bits<7> op, SOPP_Pseudo backing_pseudo, string real_name> {
1939  def _gfx11 : SOPP_Real_32<op, backing_pseudo, real_name # " ">,
1940               Select_gfx11<backing_pseudo.Mnemonic>,
1941               MnemonicAlias<backing_pseudo.Mnemonic, real_name>, Requires<[isGFX11Plus]>;
1942}
1943
1944multiclass SOPP_Real_With_Relaxation_gfx11<bits<7> op> {
1945  defm "" : SOPP_Real_32_gfx11<op>;
1946  defm _pad_s_nop : SOPP_Real_64_gfx11<op>;
1947}
1948
1949defm S_SETKILL                    : SOPP_Real_32_gfx11<0x001>;
1950defm S_SETHALT                    : SOPP_Real_32_gfx11<0x002>;
1951defm S_SLEEP                      : SOPP_Real_32_gfx11<0x003>;
1952defm S_SET_INST_PREFETCH_DISTANCE : SOPP_Real_32_Renamed_gfx11<0x004, S_INST_PREFETCH, "s_set_inst_prefetch_distance">;
1953defm S_CLAUSE                     : SOPP_Real_32_gfx11<0x005>;
1954defm S_DELAY_ALU                  : SOPP_Real_32_gfx11<0x007>;
1955defm S_WAITCNT_DEPCTR             : SOPP_Real_32_gfx11<0x008>;
1956defm S_WAITCNT                    : SOPP_Real_32_gfx11<0x009>;
1957defm S_WAIT_IDLE                  : SOPP_Real_32_gfx11<0x00a>;
1958defm S_WAIT_EVENT                 : SOPP_Real_32_gfx11<0x00b>;
1959defm S_TRAP                       : SOPP_Real_32_gfx11<0x010>;
1960defm S_ROUND_MODE                 : SOPP_Real_32_gfx11<0x011>;
1961defm S_DENORM_MODE                : SOPP_Real_32_gfx11<0x012>;
1962defm S_BRANCH                     : SOPP_Real_With_Relaxation_gfx11<0x020>;
1963defm S_CBRANCH_SCC0               : SOPP_Real_With_Relaxation_gfx11<0x021>;
1964defm S_CBRANCH_SCC1               : SOPP_Real_With_Relaxation_gfx11<0x022>;
1965defm S_CBRANCH_VCCZ               : SOPP_Real_With_Relaxation_gfx11<0x023>;
1966defm S_CBRANCH_VCCNZ              : SOPP_Real_With_Relaxation_gfx11<0x024>;
1967defm S_CBRANCH_EXECZ              : SOPP_Real_With_Relaxation_gfx11<0x025>;
1968defm S_CBRANCH_EXECNZ             : SOPP_Real_With_Relaxation_gfx11<0x026>;
1969defm S_CBRANCH_CDBGSYS            : SOPP_Real_With_Relaxation_gfx11<0x027>;
1970defm S_CBRANCH_CDBGUSER           : SOPP_Real_With_Relaxation_gfx11<0x028>;
1971defm S_CBRANCH_CDBGSYS_OR_USER    : SOPP_Real_With_Relaxation_gfx11<0x029>;
1972defm S_CBRANCH_CDBGSYS_AND_USER   : SOPP_Real_With_Relaxation_gfx11<0x02a>;
1973defm S_ENDPGM                     : SOPP_Real_32_gfx11<0x030, "s_endpgm">;
1974defm S_ENDPGM_SAVED               : SOPP_Real_32_gfx11<0x031>;
1975defm S_WAKEUP                     : SOPP_Real_32_gfx11<0x034>;
1976defm S_SETPRIO                    : SOPP_Real_32_gfx11<0x035>;
1977defm S_SENDMSG                    : SOPP_Real_32_gfx11<0x036>;
1978defm S_SENDMSGHALT                : SOPP_Real_32_gfx11<0x037>;
1979defm S_INCPERFLEVEL               : SOPP_Real_32_gfx11<0x038>;
1980defm S_DECPERFLEVEL               : SOPP_Real_32_gfx11<0x039>;
1981defm S_TTRACEDATA                 : SOPP_Real_32_gfx11<0x03a>;
1982defm S_TTRACEDATA_IMM             : SOPP_Real_32_gfx11<0x03b>;
1983defm S_ICACHE_INV                 : SOPP_Real_32_gfx11<0x03c>;
1984defm S_BARRIER                    : SOPP_Real_32_gfx11<0x03d>;
1985
1986//===----------------------------------------------------------------------===//
1987// SOPP - GFX6, GFX7, GFX8, GFX9, GFX10
1988//===----------------------------------------------------------------------===//
1989
1990multiclass SOPP_Real_32_gfx6_gfx7<bits<7> op, string real_name = !cast<SOPP_Pseudo>(NAME).Mnemonic> {
1991  defvar ps = !cast<SOPP_Pseudo>(NAME);
1992  def _gfx6_gfx7 : SOPP_Real_32<op, ps, real_name>,
1993                   Select_gfx6_gfx7<ps.Mnemonic>,
1994                   SOPPRelaxTable<0, ps.KeyName, "_gfx6_gfx7">;
1995}
1996
1997multiclass SOPP_Real_32_gfx8_gfx9<bits<7> op, string real_name = !cast<SOPP_Pseudo>(NAME).Mnemonic # " "> {
1998  defvar ps = !cast<SOPP_Pseudo>(NAME);
1999  def _vi : SOPP_Real_32<op, ps, real_name>,
2000            Select_vi<ps.Mnemonic>,
2001            SOPPRelaxTable<0, ps.KeyName, "_vi">;
2002}
2003
2004multiclass SOPP_Real_32_gfx10<bits<7> op, string real_name = !cast<SOPP_Pseudo>(NAME).Mnemonic # " "> {
2005  defvar ps = !cast<SOPP_Pseudo>(NAME);
2006  def _gfx10 : SOPP_Real_32<op, ps, real_name>,
2007               Select_gfx10<ps.Mnemonic>,
2008               SOPPRelaxTable<0, ps.KeyName, "_gfx10">;
2009}
2010
2011multiclass SOPP_Real_32_gfx8_gfx9_gfx10<bits<7> op, string real_name = !cast<SOPP_Pseudo>(NAME).Mnemonic # " "> :
2012  SOPP_Real_32_gfx8_gfx9<op, real_name>, SOPP_Real_32_gfx10<op, real_name>;
2013
2014multiclass SOPP_Real_32_gfx6_gfx7_gfx8_gfx9<bits<7> op, string real_name = !cast<SOPP_Pseudo>(NAME).Mnemonic # " "> :
2015  SOPP_Real_32_gfx6_gfx7<op, real_name>, SOPP_Real_32_gfx8_gfx9<op, real_name>;
2016
2017multiclass SOPP_Real_32_gfx6_gfx7_gfx8_gfx9_gfx10<bits<7> op, string real_name = !cast<SOPP_Pseudo>(NAME).Mnemonic # " "> :
2018  SOPP_Real_32_gfx6_gfx7_gfx8_gfx9<op, real_name>, SOPP_Real_32_gfx10<op, real_name>;
2019
2020multiclass SOPP_Real_32_gfx6_gfx7_gfx8_gfx9_gfx10_gfx11<bits<7> op, string real_name = !cast<SOPP_Pseudo>(NAME).Mnemonic # " "> :
2021  SOPP_Real_32_gfx6_gfx7_gfx8_gfx9_gfx10<op, real_name>, SOPP_Real_32_gfx11<op, real_name>;
2022
2023multiclass SOPP_Real_32_gfx10_gfx11<bits<7> op, string real_name = !cast<SOPP_Pseudo>(NAME).Mnemonic # " "> :
2024  SOPP_Real_32_gfx10<op, real_name>, SOPP_Real_32_gfx11<op, real_name>;
2025
2026//64 bit encodings, for Relaxation
2027multiclass SOPP_Real_64_gfx6_gfx7<bits<7> op, string real_name = !cast<SOPP_Pseudo>(NAME).Mnemonic # " "> {
2028  defvar ps = !cast<SOPP_Pseudo>(NAME);
2029  def _gfx6_gfx7 : SOPP_Real_64<op, ps, real_name>,
2030                   Select_gfx6_gfx7<ps.Mnemonic>,
2031                   SOPPRelaxTable<1, ps.KeyName, "_gfx6_gfx7">;
2032}
2033
2034multiclass SOPP_Real_64_gfx8_gfx9<bits<7> op, string real_name = !cast<SOPP_Pseudo>(NAME).Mnemonic # " "> {
2035  defvar ps = !cast<SOPP_Pseudo>(NAME);
2036  def _vi : SOPP_Real_64<op, ps, real_name>,
2037            Select_vi<ps.Mnemonic>,
2038            SOPPRelaxTable<1, ps.KeyName, "_vi">;
2039}
2040
2041multiclass SOPP_Real_64_gfx10<bits<7> op, string real_name = !cast<SOPP_Pseudo>(NAME).Mnemonic # " "> {
2042  defvar ps = !cast<SOPP_Pseudo>(NAME);
2043  def _gfx10 : SOPP_Real_64<op, ps, real_name>,
2044               Select_gfx10<ps.Mnemonic>,
2045               SOPPRelaxTable<1, ps.KeyName, "_gfx10">;
2046}
2047
2048multiclass SOPP_Real_64_gfx8_gfx9_gfx10<bits<7> op, string real_name = !cast<SOPP_Pseudo>(NAME).Mnemonic # " "> :
2049  SOPP_Real_64_gfx8_gfx9<op, real_name>, SOPP_Real_64_gfx10<op, real_name>;
2050
2051multiclass SOPP_Real_64_gfx6_gfx7_gfx8_gfx9<bits<7> op, string real_name = !cast<SOPP_Pseudo>(NAME).Mnemonic # " "> :
2052  SOPP_Real_64_gfx6_gfx7<op, real_name>, SOPP_Real_64_gfx8_gfx9<op, real_name>;
2053
2054multiclass SOPP_Real_64_gfx6_gfx7_gfx8_gfx9_gfx10<bits<7> op, string real_name = !cast<SOPP_Pseudo>(NAME).Mnemonic # " "> :
2055  SOPP_Real_64_gfx6_gfx7_gfx8_gfx9<op, real_name>, SOPP_Real_64_gfx10<op, real_name>;
2056
2057multiclass SOPP_Real_64_gfx6_gfx7_gfx8_gfx9_gfx10_gfx11<bits<7> op, string real_name = !cast<SOPP_Pseudo>(NAME).Mnemonic # " "> :
2058  SOPP_Real_64_gfx6_gfx7_gfx8_gfx9_gfx10<op, real_name>, SOPP_Real_64_gfx11<op, real_name>;
2059
2060//relaxation for insts with no operands not implemented
2061multiclass SOPP_Real_With_Relaxation_gfx6_gfx7_gfx8_gfx9_gfx10<bits<7> op> {
2062  defm "" : SOPP_Real_32_gfx6_gfx7_gfx8_gfx9_gfx10<op>;
2063  defm _pad_s_nop : SOPP_Real_64_gfx6_gfx7_gfx8_gfx9_gfx10<op>;
2064}
2065
2066defm S_NOP                      : SOPP_Real_32_gfx6_gfx7_gfx8_gfx9_gfx10_gfx11<0x000>;
2067defm S_ENDPGM                   : SOPP_Real_32_gfx6_gfx7_gfx8_gfx9_gfx10<0x001, "s_endpgm">;
2068defm S_WAKEUP                   : SOPP_Real_32_gfx8_gfx9_gfx10<0x003>;
2069defm S_BARRIER                  : SOPP_Real_32_gfx6_gfx7_gfx8_gfx9_gfx10<0x00a>;
2070defm S_WAITCNT                  : SOPP_Real_32_gfx6_gfx7_gfx8_gfx9_gfx10<0x00c>;
2071defm S_SETHALT                  : SOPP_Real_32_gfx6_gfx7_gfx8_gfx9_gfx10<0x00d>;
2072defm S_SETKILL                  : SOPP_Real_32_gfx6_gfx7_gfx8_gfx9_gfx10<0x00b>;
2073defm S_SLEEP                    : SOPP_Real_32_gfx6_gfx7_gfx8_gfx9_gfx10<0x00e>;
2074defm S_SETPRIO                  : SOPP_Real_32_gfx6_gfx7_gfx8_gfx9_gfx10<0x00f>;
2075defm S_SENDMSG                  : SOPP_Real_32_gfx6_gfx7_gfx8_gfx9_gfx10<0x010>;
2076defm S_SENDMSGHALT              : SOPP_Real_32_gfx6_gfx7_gfx8_gfx9_gfx10<0x011>;
2077defm S_TRAP                     : SOPP_Real_32_gfx6_gfx7_gfx8_gfx9_gfx10<0x012>;
2078defm S_ICACHE_INV               : SOPP_Real_32_gfx6_gfx7_gfx8_gfx9_gfx10<0x013>;
2079defm S_INCPERFLEVEL             : SOPP_Real_32_gfx6_gfx7_gfx8_gfx9_gfx10<0x014>;
2080defm S_DECPERFLEVEL             : SOPP_Real_32_gfx6_gfx7_gfx8_gfx9_gfx10<0x015>;
2081defm S_TTRACEDATA               : SOPP_Real_32_gfx6_gfx7_gfx8_gfx9_gfx10<0x016>;
2082defm S_ENDPGM_SAVED             : SOPP_Real_32_gfx6_gfx7_gfx8_gfx9_gfx10<0x01B>;
2083defm S_SET_GPR_IDX_OFF          : SOPP_Real_32_gfx8_gfx9<0x01c>;
2084defm S_SET_GPR_IDX_MODE         : SOPP_Real_32_gfx8_gfx9<0x01d>;
2085defm S_ENDPGM_ORDERED_PS_DONE   : SOPP_Real_32_gfx8_gfx9_gfx10<0x01e>;
2086defm S_CODE_END                 : SOPP_Real_32_gfx10_gfx11<0x01f>;
2087defm S_INST_PREFETCH            : SOPP_Real_32_gfx10<0x020>;
2088defm S_CLAUSE                   : SOPP_Real_32_gfx10<0x021>;
2089defm S_WAIT_IDLE                : SOPP_Real_32_gfx10<0x022>;
2090defm S_WAITCNT_DEPCTR           : SOPP_Real_32_gfx10<0x023>;
2091defm S_ROUND_MODE               : SOPP_Real_32_gfx10<0x024>;
2092defm S_DENORM_MODE              : SOPP_Real_32_gfx10<0x025>;
2093defm S_TTRACEDATA_IMM           : SOPP_Real_32_gfx10<0x028>;
2094
2095let isBranch = 1 in {
2096defm S_BRANCH                   : SOPP_Real_With_Relaxation_gfx6_gfx7_gfx8_gfx9_gfx10<0x002>;
2097defm S_CBRANCH_SCC0             : SOPP_Real_With_Relaxation_gfx6_gfx7_gfx8_gfx9_gfx10<0x004>;
2098defm S_CBRANCH_SCC1             : SOPP_Real_With_Relaxation_gfx6_gfx7_gfx8_gfx9_gfx10<0x005>;
2099defm S_CBRANCH_VCCZ             : SOPP_Real_With_Relaxation_gfx6_gfx7_gfx8_gfx9_gfx10<0x006>;
2100defm S_CBRANCH_VCCNZ            : SOPP_Real_With_Relaxation_gfx6_gfx7_gfx8_gfx9_gfx10<0x007>;
2101defm S_CBRANCH_EXECZ            : SOPP_Real_With_Relaxation_gfx6_gfx7_gfx8_gfx9_gfx10<0x008>;
2102defm S_CBRANCH_EXECNZ           : SOPP_Real_With_Relaxation_gfx6_gfx7_gfx8_gfx9_gfx10<0x009>;
2103defm S_CBRANCH_CDBGSYS          : SOPP_Real_With_Relaxation_gfx6_gfx7_gfx8_gfx9_gfx10<0x017>;
2104defm S_CBRANCH_CDBGUSER         : SOPP_Real_With_Relaxation_gfx6_gfx7_gfx8_gfx9_gfx10<0x018>;
2105defm S_CBRANCH_CDBGSYS_OR_USER  : SOPP_Real_With_Relaxation_gfx6_gfx7_gfx8_gfx9_gfx10<0x019>;
2106defm S_CBRANCH_CDBGSYS_AND_USER : SOPP_Real_With_Relaxation_gfx6_gfx7_gfx8_gfx9_gfx10<0x01A>;
2107}
2108
2109//===----------------------------------------------------------------------===//
2110// SOPC - GFX11
2111//===----------------------------------------------------------------------===//
2112
2113multiclass SOPC_Real_gfx11<bits<7> op> {
2114  def _gfx11 : SOPC_Real<op, !cast<SOPC_Pseudo>(NAME)>,
2115               Select_gfx11<!cast<SOPC_Pseudo>(NAME).Mnemonic>;
2116}
2117
2118defm S_CMP_EQ_I32     : SOPC_Real_gfx11<0x00>;
2119defm S_CMP_LG_I32     : SOPC_Real_gfx11<0x01>;
2120defm S_CMP_GT_I32     : SOPC_Real_gfx11<0x02>;
2121defm S_CMP_GE_I32     : SOPC_Real_gfx11<0x03>;
2122defm S_CMP_LT_I32     : SOPC_Real_gfx11<0x04>;
2123defm S_CMP_LE_I32     : SOPC_Real_gfx11<0x05>;
2124defm S_CMP_EQ_U32     : SOPC_Real_gfx11<0x06>;
2125defm S_CMP_LG_U32     : SOPC_Real_gfx11<0x07>;
2126defm S_CMP_GT_U32     : SOPC_Real_gfx11<0x08>;
2127defm S_CMP_GE_U32     : SOPC_Real_gfx11<0x09>;
2128defm S_CMP_LT_U32     : SOPC_Real_gfx11<0x0a>;
2129defm S_CMP_LE_U32     : SOPC_Real_gfx11<0x0b>;
2130defm S_BITCMP0_B32    : SOPC_Real_gfx11<0x0c>;
2131defm S_BITCMP1_B32    : SOPC_Real_gfx11<0x0d>;
2132defm S_BITCMP0_B64    : SOPC_Real_gfx11<0x0e>;
2133defm S_BITCMP1_B64    : SOPC_Real_gfx11<0x0f>;
2134defm S_CMP_EQ_U64     : SOPC_Real_gfx11<0x10>;
2135defm S_CMP_LG_U64     : SOPC_Real_gfx11<0x11>;
2136
2137//===----------------------------------------------------------------------===//
2138// SOPC - GFX6, GFX7, GFX8, GFX9, GFX10
2139//===----------------------------------------------------------------------===//
2140
2141multiclass SOPC_Real_gfx6_gfx7<bits<7> op> {
2142  defvar ps = !cast<SOPC_Pseudo>(NAME);
2143  def _gfx6_gfx7 : SOPC_Real<op, ps>,
2144                   Select_gfx6_gfx7<ps.Mnemonic>;
2145}
2146
2147multiclass SOPC_Real_gfx8_gfx9<bits<7> op> {
2148  defvar ps = !cast<SOPC_Pseudo>(NAME);
2149  def _vi : SOPC_Real<op, ps>,
2150            Select_vi<ps.Mnemonic>;
2151}
2152
2153multiclass SOPC_Real_gfx10<bits<7> op> {
2154  defvar ps = !cast<SOPC_Pseudo>(NAME);
2155  def _gfx10 : SOPC_Real<op, ps>,
2156               Select_gfx10<ps.Mnemonic>;
2157}
2158
2159multiclass SOPC_Real_gfx8_gfx9_gfx10<bits<7> op> :
2160  SOPC_Real_gfx8_gfx9<op>, SOPC_Real_gfx10<op>;
2161
2162multiclass SOPC_Real_gfx6_gfx7_gfx8_gfx9<bits<7> op> :
2163  SOPC_Real_gfx6_gfx7<op>, SOPC_Real_gfx8_gfx9<op>;
2164
2165multiclass SOPC_Real_gfx6_gfx7_gfx8_gfx9_gfx10<bits<7> op> :
2166  SOPC_Real_gfx6_gfx7_gfx8_gfx9<op>, SOPC_Real_gfx10<op>;
2167
2168defm S_CMP_EQ_I32     : SOPC_Real_gfx6_gfx7_gfx8_gfx9_gfx10<0x00>;
2169defm S_CMP_LG_I32     : SOPC_Real_gfx6_gfx7_gfx8_gfx9_gfx10<0x01>;
2170defm S_CMP_GT_I32     : SOPC_Real_gfx6_gfx7_gfx8_gfx9_gfx10<0x02>;
2171defm S_CMP_GE_I32     : SOPC_Real_gfx6_gfx7_gfx8_gfx9_gfx10<0x03>;
2172defm S_CMP_LT_I32     : SOPC_Real_gfx6_gfx7_gfx8_gfx9_gfx10<0x04>;
2173defm S_CMP_LE_I32     : SOPC_Real_gfx6_gfx7_gfx8_gfx9_gfx10<0x05>;
2174defm S_CMP_EQ_U32     : SOPC_Real_gfx6_gfx7_gfx8_gfx9_gfx10<0x06>;
2175defm S_CMP_LG_U32     : SOPC_Real_gfx6_gfx7_gfx8_gfx9_gfx10<0x07>;
2176defm S_CMP_GT_U32     : SOPC_Real_gfx6_gfx7_gfx8_gfx9_gfx10<0x08>;
2177defm S_CMP_GE_U32     : SOPC_Real_gfx6_gfx7_gfx8_gfx9_gfx10<0x09>;
2178defm S_CMP_LT_U32     : SOPC_Real_gfx6_gfx7_gfx8_gfx9_gfx10<0x0a>;
2179defm S_CMP_LE_U32     : SOPC_Real_gfx6_gfx7_gfx8_gfx9_gfx10<0x0b>;
2180defm S_BITCMP0_B32    : SOPC_Real_gfx6_gfx7_gfx8_gfx9_gfx10<0x0c>;
2181defm S_BITCMP1_B32    : SOPC_Real_gfx6_gfx7_gfx8_gfx9_gfx10<0x0d>;
2182defm S_BITCMP0_B64    : SOPC_Real_gfx6_gfx7_gfx8_gfx9_gfx10<0x0e>;
2183defm S_BITCMP1_B64    : SOPC_Real_gfx6_gfx7_gfx8_gfx9_gfx10<0x0f>;
2184defm S_SETVSKIP       : SOPC_Real_gfx6_gfx7_gfx8_gfx9<0x10>;
2185defm S_SET_GPR_IDX_ON : SOPC_Real_gfx8_gfx9<0x11>;
2186defm S_CMP_EQ_U64     : SOPC_Real_gfx8_gfx9_gfx10<0x12>;
2187defm S_CMP_LG_U64     : SOPC_Real_gfx8_gfx9_gfx10<0x13>;
2188
2189//===----------------------------------------------------------------------===//
2190// GFX8 (VI), GFX9.
2191//===----------------------------------------------------------------------===//
2192
2193class SOP1_Real_vi<bits<8> op, SOP1_Pseudo ps> :
2194  SOP1_Real<op, ps>,
2195  Select_vi<ps.Mnemonic>;
2196
2197
2198class SOP2_Real_vi<bits<7> op, SOP2_Pseudo ps> :
2199  SOP2_Real<op, ps>,
2200  Select_vi<ps.Mnemonic>;
2201
2202class SOPK_Real_vi<bits<5> op, SOPK_Pseudo ps> :
2203  SOPK_Real32<op, ps>,
2204  Select_vi<ps.Mnemonic>;
2205
2206def S_MOV_B32_vi           : SOP1_Real_vi <0x00, S_MOV_B32>;
2207def S_MOV_B64_vi           : SOP1_Real_vi <0x01, S_MOV_B64>;
2208def S_CMOV_B32_vi          : SOP1_Real_vi <0x02, S_CMOV_B32>;
2209def S_CMOV_B64_vi          : SOP1_Real_vi <0x03, S_CMOV_B64>;
2210def S_NOT_B32_vi           : SOP1_Real_vi <0x04, S_NOT_B32>;
2211def S_NOT_B64_vi           : SOP1_Real_vi <0x05, S_NOT_B64>;
2212def S_WQM_B32_vi           : SOP1_Real_vi <0x06, S_WQM_B32>;
2213def S_WQM_B64_vi           : SOP1_Real_vi <0x07, S_WQM_B64>;
2214def S_BREV_B32_vi          : SOP1_Real_vi <0x08, S_BREV_B32>;
2215def S_BREV_B64_vi          : SOP1_Real_vi <0x09, S_BREV_B64>;
2216def S_BCNT0_I32_B32_vi     : SOP1_Real_vi <0x0a, S_BCNT0_I32_B32>;
2217def S_BCNT0_I32_B64_vi     : SOP1_Real_vi <0x0b, S_BCNT0_I32_B64>;
2218def S_BCNT1_I32_B32_vi     : SOP1_Real_vi <0x0c, S_BCNT1_I32_B32>;
2219def S_BCNT1_I32_B64_vi     : SOP1_Real_vi <0x0d, S_BCNT1_I32_B64>;
2220def S_FF0_I32_B32_vi       : SOP1_Real_vi <0x0e, S_FF0_I32_B32>;
2221def S_FF0_I32_B64_vi       : SOP1_Real_vi <0x0f, S_FF0_I32_B64>;
2222def S_FF1_I32_B32_vi       : SOP1_Real_vi <0x10, S_FF1_I32_B32>;
2223def S_FF1_I32_B64_vi       : SOP1_Real_vi <0x11, S_FF1_I32_B64>;
2224def S_FLBIT_I32_B32_vi     : SOP1_Real_vi <0x12, S_FLBIT_I32_B32>;
2225def S_FLBIT_I32_B64_vi     : SOP1_Real_vi <0x13, S_FLBIT_I32_B64>;
2226def S_FLBIT_I32_vi         : SOP1_Real_vi <0x14, S_FLBIT_I32>;
2227def S_FLBIT_I32_I64_vi     : SOP1_Real_vi <0x15, S_FLBIT_I32_I64>;
2228def S_SEXT_I32_I8_vi       : SOP1_Real_vi <0x16, S_SEXT_I32_I8>;
2229def S_SEXT_I32_I16_vi      : SOP1_Real_vi <0x17, S_SEXT_I32_I16>;
2230def S_BITSET0_B32_vi       : SOP1_Real_vi <0x18, S_BITSET0_B32>;
2231def S_BITSET0_B64_vi       : SOP1_Real_vi <0x19, S_BITSET0_B64>;
2232def S_BITSET1_B32_vi       : SOP1_Real_vi <0x1a, S_BITSET1_B32>;
2233def S_BITSET1_B64_vi       : SOP1_Real_vi <0x1b, S_BITSET1_B64>;
2234def S_GETPC_B64_vi         : SOP1_Real_vi <0x1c, S_GETPC_B64>;
2235def S_SETPC_B64_vi         : SOP1_Real_vi <0x1d, S_SETPC_B64>;
2236def S_SWAPPC_B64_vi        : SOP1_Real_vi <0x1e, S_SWAPPC_B64>;
2237def S_RFE_B64_vi           : SOP1_Real_vi <0x1f, S_RFE_B64>;
2238def S_AND_SAVEEXEC_B64_vi  : SOP1_Real_vi <0x20, S_AND_SAVEEXEC_B64>;
2239def S_OR_SAVEEXEC_B64_vi   : SOP1_Real_vi <0x21, S_OR_SAVEEXEC_B64>;
2240def S_XOR_SAVEEXEC_B64_vi  : SOP1_Real_vi <0x22, S_XOR_SAVEEXEC_B64>;
2241def S_ANDN2_SAVEEXEC_B64_vi: SOP1_Real_vi <0x23, S_ANDN2_SAVEEXEC_B64>;
2242def S_ORN2_SAVEEXEC_B64_vi : SOP1_Real_vi <0x24, S_ORN2_SAVEEXEC_B64>;
2243def S_NAND_SAVEEXEC_B64_vi : SOP1_Real_vi <0x25, S_NAND_SAVEEXEC_B64>;
2244def S_NOR_SAVEEXEC_B64_vi  : SOP1_Real_vi <0x26, S_NOR_SAVEEXEC_B64>;
2245def S_XNOR_SAVEEXEC_B64_vi : SOP1_Real_vi <0x27, S_XNOR_SAVEEXEC_B64>;
2246def S_QUADMASK_B32_vi      : SOP1_Real_vi <0x28, S_QUADMASK_B32>;
2247def S_QUADMASK_B64_vi      : SOP1_Real_vi <0x29, S_QUADMASK_B64>;
2248def S_MOVRELS_B32_vi       : SOP1_Real_vi <0x2a, S_MOVRELS_B32>;
2249def S_MOVRELS_B64_vi       : SOP1_Real_vi <0x2b, S_MOVRELS_B64>;
2250def S_MOVRELD_B32_vi       : SOP1_Real_vi <0x2c, S_MOVRELD_B32>;
2251def S_MOVRELD_B64_vi       : SOP1_Real_vi <0x2d, S_MOVRELD_B64>;
2252def S_CBRANCH_JOIN_vi      : SOP1_Real_vi <0x2e, S_CBRANCH_JOIN>;
2253def S_ABS_I32_vi           : SOP1_Real_vi <0x30, S_ABS_I32>;
2254def S_SET_GPR_IDX_IDX_vi   : SOP1_Real_vi <0x32, S_SET_GPR_IDX_IDX>;
2255
2256def S_ADD_U32_vi           : SOP2_Real_vi <0x00, S_ADD_U32>;
2257def S_ADD_I32_vi           : SOP2_Real_vi <0x02, S_ADD_I32>;
2258def S_SUB_U32_vi           : SOP2_Real_vi <0x01, S_SUB_U32>;
2259def S_SUB_I32_vi           : SOP2_Real_vi <0x03, S_SUB_I32>;
2260def S_ADDC_U32_vi          : SOP2_Real_vi <0x04, S_ADDC_U32>;
2261def S_SUBB_U32_vi          : SOP2_Real_vi <0x05, S_SUBB_U32>;
2262def S_MIN_I32_vi           : SOP2_Real_vi <0x06, S_MIN_I32>;
2263def S_MIN_U32_vi           : SOP2_Real_vi <0x07, S_MIN_U32>;
2264def S_MAX_I32_vi           : SOP2_Real_vi <0x08, S_MAX_I32>;
2265def S_MAX_U32_vi           : SOP2_Real_vi <0x09, S_MAX_U32>;
2266def S_CSELECT_B32_vi       : SOP2_Real_vi <0x0a, S_CSELECT_B32>;
2267def S_CSELECT_B64_vi       : SOP2_Real_vi <0x0b, S_CSELECT_B64>;
2268def S_AND_B32_vi           : SOP2_Real_vi <0x0c, S_AND_B32>;
2269def S_AND_B64_vi           : SOP2_Real_vi <0x0d, S_AND_B64>;
2270def S_OR_B32_vi            : SOP2_Real_vi <0x0e, S_OR_B32>;
2271def S_OR_B64_vi            : SOP2_Real_vi <0x0f, S_OR_B64>;
2272def S_XOR_B32_vi           : SOP2_Real_vi <0x10, S_XOR_B32>;
2273def S_XOR_B64_vi           : SOP2_Real_vi <0x11, S_XOR_B64>;
2274def S_ANDN2_B32_vi         : SOP2_Real_vi <0x12, S_ANDN2_B32>;
2275def S_ANDN2_B64_vi         : SOP2_Real_vi <0x13, S_ANDN2_B64>;
2276def S_ORN2_B32_vi          : SOP2_Real_vi <0x14, S_ORN2_B32>;
2277def S_ORN2_B64_vi          : SOP2_Real_vi <0x15, S_ORN2_B64>;
2278def S_NAND_B32_vi          : SOP2_Real_vi <0x16, S_NAND_B32>;
2279def S_NAND_B64_vi          : SOP2_Real_vi <0x17, S_NAND_B64>;
2280def S_NOR_B32_vi           : SOP2_Real_vi <0x18, S_NOR_B32>;
2281def S_NOR_B64_vi           : SOP2_Real_vi <0x19, S_NOR_B64>;
2282def S_XNOR_B32_vi          : SOP2_Real_vi <0x1a, S_XNOR_B32>;
2283def S_XNOR_B64_vi          : SOP2_Real_vi <0x1b, S_XNOR_B64>;
2284def S_LSHL_B32_vi          : SOP2_Real_vi <0x1c, S_LSHL_B32>;
2285def S_LSHL_B64_vi          : SOP2_Real_vi <0x1d, S_LSHL_B64>;
2286def S_LSHR_B32_vi          : SOP2_Real_vi <0x1e, S_LSHR_B32>;
2287def S_LSHR_B64_vi          : SOP2_Real_vi <0x1f, S_LSHR_B64>;
2288def S_ASHR_I32_vi          : SOP2_Real_vi <0x20, S_ASHR_I32>;
2289def S_ASHR_I64_vi          : SOP2_Real_vi <0x21, S_ASHR_I64>;
2290def S_BFM_B32_vi           : SOP2_Real_vi <0x22, S_BFM_B32>;
2291def S_BFM_B64_vi           : SOP2_Real_vi <0x23, S_BFM_B64>;
2292def S_MUL_I32_vi           : SOP2_Real_vi <0x24, S_MUL_I32>;
2293def S_BFE_U32_vi           : SOP2_Real_vi <0x25, S_BFE_U32>;
2294def S_BFE_I32_vi           : SOP2_Real_vi <0x26, S_BFE_I32>;
2295def S_BFE_U64_vi           : SOP2_Real_vi <0x27, S_BFE_U64>;
2296def S_BFE_I64_vi           : SOP2_Real_vi <0x28, S_BFE_I64>;
2297def S_CBRANCH_G_FORK_vi    : SOP2_Real_vi <0x29, S_CBRANCH_G_FORK>;
2298def S_ABSDIFF_I32_vi       : SOP2_Real_vi <0x2a, S_ABSDIFF_I32>;
2299def S_PACK_LL_B32_B16_vi   : SOP2_Real_vi <0x32, S_PACK_LL_B32_B16>;
2300def S_PACK_LH_B32_B16_vi   : SOP2_Real_vi <0x33, S_PACK_LH_B32_B16>;
2301def S_PACK_HH_B32_B16_vi   : SOP2_Real_vi <0x34, S_PACK_HH_B32_B16>;
2302def S_RFE_RESTORE_B64_vi   : SOP2_Real_vi <0x2b, S_RFE_RESTORE_B64>;
2303
2304def S_MOVK_I32_vi          : SOPK_Real_vi <0x00, S_MOVK_I32>;
2305def S_CMOVK_I32_vi         : SOPK_Real_vi <0x01, S_CMOVK_I32>;
2306def S_CMPK_EQ_I32_vi       : SOPK_Real_vi <0x02, S_CMPK_EQ_I32>;
2307def S_CMPK_LG_I32_vi       : SOPK_Real_vi <0x03, S_CMPK_LG_I32>;
2308def S_CMPK_GT_I32_vi       : SOPK_Real_vi <0x04, S_CMPK_GT_I32>;
2309def S_CMPK_GE_I32_vi       : SOPK_Real_vi <0x05, S_CMPK_GE_I32>;
2310def S_CMPK_LT_I32_vi       : SOPK_Real_vi <0x06, S_CMPK_LT_I32>;
2311def S_CMPK_LE_I32_vi       : SOPK_Real_vi <0x07, S_CMPK_LE_I32>;
2312def S_CMPK_EQ_U32_vi       : SOPK_Real_vi <0x08, S_CMPK_EQ_U32>;
2313def S_CMPK_LG_U32_vi       : SOPK_Real_vi <0x09, S_CMPK_LG_U32>;
2314def S_CMPK_GT_U32_vi       : SOPK_Real_vi <0x0A, S_CMPK_GT_U32>;
2315def S_CMPK_GE_U32_vi       : SOPK_Real_vi <0x0B, S_CMPK_GE_U32>;
2316def S_CMPK_LT_U32_vi       : SOPK_Real_vi <0x0C, S_CMPK_LT_U32>;
2317def S_CMPK_LE_U32_vi       : SOPK_Real_vi <0x0D, S_CMPK_LE_U32>;
2318def S_ADDK_I32_vi          : SOPK_Real_vi <0x0E, S_ADDK_I32>;
2319def S_MULK_I32_vi          : SOPK_Real_vi <0x0F, S_MULK_I32>;
2320def S_CBRANCH_I_FORK_vi    : SOPK_Real_vi <0x10, S_CBRANCH_I_FORK>;
2321def S_GETREG_B32_vi        : SOPK_Real_vi <0x11, S_GETREG_B32>;
2322def S_SETREG_B32_vi        : SOPK_Real_vi <0x12, S_SETREG_B32>;
2323//def S_GETREG_REGRD_B32_vi  : SOPK_Real_vi <0x13, S_GETREG_REGRD_B32>; // see pseudo for comments
2324def S_SETREG_IMM32_B32_vi  : SOPK_Real64<0x14, S_SETREG_IMM32_B32>,
2325                             Select_vi<S_SETREG_IMM32_B32.Mnemonic>;
2326
2327def S_CALL_B64_vi          : SOPK_Real_vi <0x15, S_CALL_B64>;
2328
2329//===----------------------------------------------------------------------===//
2330// SOP1 - GFX9.
2331//===----------------------------------------------------------------------===//
2332
2333def S_ANDN1_SAVEEXEC_B64_vi   : SOP1_Real_vi<0x33, S_ANDN1_SAVEEXEC_B64>;
2334def S_ORN1_SAVEEXEC_B64_vi    : SOP1_Real_vi<0x34, S_ORN1_SAVEEXEC_B64>;
2335def S_ANDN1_WREXEC_B64_vi     : SOP1_Real_vi<0x35, S_ANDN1_WREXEC_B64>;
2336def S_ANDN2_WREXEC_B64_vi     : SOP1_Real_vi<0x36, S_ANDN2_WREXEC_B64>;
2337def S_BITREPLICATE_B64_B32_vi : SOP1_Real_vi<0x37, S_BITREPLICATE_B64_B32>;
2338
2339//===----------------------------------------------------------------------===//
2340// SOP2 - GFX9.
2341//===----------------------------------------------------------------------===//
2342
2343def S_LSHL1_ADD_U32_vi   : SOP2_Real_vi<0x2e, S_LSHL1_ADD_U32>;
2344def S_LSHL2_ADD_U32_vi   : SOP2_Real_vi<0x2f, S_LSHL2_ADD_U32>;
2345def S_LSHL3_ADD_U32_vi   : SOP2_Real_vi<0x30, S_LSHL3_ADD_U32>;
2346def S_LSHL4_ADD_U32_vi   : SOP2_Real_vi<0x31, S_LSHL4_ADD_U32>;
2347def S_MUL_HI_U32_vi      : SOP2_Real_vi<0x2c, S_MUL_HI_U32>;
2348def S_MUL_HI_I32_vi      : SOP2_Real_vi<0x2d, S_MUL_HI_I32>;
2349