xref: /freebsd/contrib/llvm-project/llvm/lib/Target/AMDGPU/SOPInstructions.td (revision c66ec88fed842fbaad62c30d510644ceb7bd2d71)
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> :
58  InstSI <ps.OutOperandList, ps.InOperandList,
59          ps.Mnemonic # " " # ps.AsmOperands, []>,
60  Enc32 {
61
62  let isPseudo = 0;
63  let isCodeGenOnly = 0;
64  let Size = 4;
65
66  // copy relevant pseudo op flags
67  let SubtargetPredicate = ps.SubtargetPredicate;
68  let AsmMatchConverter  = ps.AsmMatchConverter;
69
70  // encoding
71  bits<7> sdst;
72  bits<8> src0;
73
74  let Inst{7-0} = !if(ps.has_src0, src0, ?);
75  let Inst{15-8} = op;
76  let Inst{22-16} = !if(ps.has_sdst, sdst, ?);
77  let Inst{31-23} = 0x17d; //encoding;
78}
79
80class SOP1_32 <string opName, list<dag> pattern=[], bit tied_in = 0> : SOP1_Pseudo <
81  opName, (outs SReg_32:$sdst),
82  !if(tied_in, (ins SSrc_b32:$src0, SReg_32:$sdst_in),
83               (ins SSrc_b32:$src0)),
84  "$sdst, $src0", pattern> {
85  let Constraints = !if(tied_in, "$sdst = $sdst_in", "");
86}
87
88// Only register input allowed.
89class SOP1_32R <string opName, list<dag> pattern=[]> : SOP1_Pseudo <
90  opName, (outs SReg_32:$sdst), (ins SReg_32:$src0),
91  "$sdst, $src0", pattern>;
92
93// 32-bit input, no output.
94class SOP1_0_32 <string opName, list<dag> pattern = []> : SOP1_Pseudo <
95  opName, (outs), (ins SSrc_b32:$src0),
96  "$src0", pattern> {
97  let has_sdst = 0;
98}
99
100// Special case for movreld where sdst is treated as a use operand.
101class SOP1_32_movreld <string opName, list<dag> pattern=[]> : SOP1_Pseudo <
102  opName, (outs), (ins SReg_32:$sdst, SSrc_b32:$src0),
103  "$sdst, $src0", pattern>;
104
105// Special case for movreld where sdst is treated as a use operand.
106class SOP1_64_movreld <string opName, list<dag> pattern=[]> : SOP1_Pseudo <
107  opName, (outs), (ins SReg_64:$sdst, SSrc_b64:$src0),
108  "$sdst, $src0", pattern
109>;
110
111class SOP1_0_32R <string opName, list<dag> pattern = []> : SOP1_Pseudo <
112  opName, (outs), (ins SReg_32:$src0),
113  "$src0", pattern> {
114  let has_sdst = 0;
115}
116
117class SOP1_64 <string opName, list<dag> pattern=[]> : SOP1_Pseudo <
118  opName, (outs SReg_64:$sdst), (ins SSrc_b64:$src0),
119  "$sdst, $src0", pattern
120>;
121
122// Only register input allowed.
123class SOP1_64R <string opName, list<dag> pattern=[]> : SOP1_Pseudo <
124  opName, (outs SReg_64:$sdst), (ins SReg_64:$src0),
125  "$sdst, $src0", pattern
126>;
127
128// 64-bit input, 32-bit output.
129class SOP1_32_64 <string opName, list<dag> pattern=[]> : SOP1_Pseudo <
130  opName, (outs SReg_32:$sdst), (ins SSrc_b64:$src0),
131  "$sdst, $src0", pattern
132>;
133
134// 32-bit input, 64-bit output.
135class SOP1_64_32 <string opName, list<dag> pattern=[], bit tied_in = 0> : SOP1_Pseudo <
136  opName, (outs SReg_64:$sdst),
137  !if(tied_in, (ins SSrc_b32:$src0, SReg_64:$sdst_in),
138               (ins SSrc_b32:$src0)),
139  "$sdst, $src0", pattern> {
140  let Constraints = !if(tied_in, "$sdst = $sdst_in", "");
141}
142
143// no input, 64-bit output.
144class SOP1_64_0 <string opName, list<dag> pattern=[]> : SOP1_Pseudo <
145  opName, (outs SReg_64:$sdst), (ins), "$sdst", pattern> {
146  let has_src0 = 0;
147}
148
149// 64-bit input, no output
150class SOP1_1 <string opName, RegisterClass rc = SReg_64, list<dag> pattern=[]> : SOP1_Pseudo <
151  opName, (outs), (ins rc:$src0), "$src0", pattern> {
152  let has_sdst = 0;
153}
154
155
156let isMoveImm = 1 in {
157  let isReMaterializable = 1, isAsCheapAsAMove = 1 in {
158    def S_MOV_B32 : SOP1_32 <"s_mov_b32">;
159    def S_MOV_B64 : SOP1_64 <"s_mov_b64">;
160  } // End isRematerializeable = 1
161
162  let Uses = [SCC] in {
163    def S_CMOV_B32 : SOP1_32 <"s_cmov_b32">;
164    def S_CMOV_B64 : SOP1_64 <"s_cmov_b64">;
165  } // End Uses = [SCC]
166} // End isMoveImm = 1
167
168let Defs = [SCC] in {
169  def S_NOT_B32 : SOP1_32 <"s_not_b32",
170    [(set i32:$sdst, (not i32:$src0))]
171  >;
172
173  def S_NOT_B64 : SOP1_64 <"s_not_b64",
174    [(set i64:$sdst, (not i64:$src0))]
175  >;
176  def S_WQM_B32 : SOP1_32 <"s_wqm_b32">;
177  def S_WQM_B64 : SOP1_64 <"s_wqm_b64">;
178} // End Defs = [SCC]
179
180
181let WaveSizePredicate = isWave32 in {
182def : GCNPat <
183  (int_amdgcn_wqm_vote i1:$src0),
184  (S_WQM_B32 SSrc_b32:$src0)
185>;
186}
187
188let WaveSizePredicate = isWave64 in {
189def : GCNPat <
190  (int_amdgcn_wqm_vote i1:$src0),
191  (S_WQM_B64 SSrc_b64:$src0)
192>;
193}
194
195def S_BREV_B32 : SOP1_32 <"s_brev_b32",
196  [(set i32:$sdst, (bitreverse i32:$src0))]
197>;
198def S_BREV_B64 : SOP1_64 <"s_brev_b64">;
199
200let Defs = [SCC] in {
201def S_BCNT0_I32_B32 : SOP1_32 <"s_bcnt0_i32_b32">;
202def S_BCNT0_I32_B64 : SOP1_32_64 <"s_bcnt0_i32_b64">;
203def S_BCNT1_I32_B32 : SOP1_32 <"s_bcnt1_i32_b32",
204  [(set i32:$sdst, (ctpop i32:$src0))]
205>;
206def S_BCNT1_I32_B64 : SOP1_32_64 <"s_bcnt1_i32_b64",
207  [(set i32:$sdst, (ctpop i64:$src0))]
208>;
209} // End Defs = [SCC]
210
211def S_FF0_I32_B32 : SOP1_32 <"s_ff0_i32_b32">;
212def S_FF0_I32_B64 : SOP1_32_64 <"s_ff0_i32_b64">;
213def S_FF1_I32_B64 : SOP1_32_64 <"s_ff1_i32_b64",
214  [(set i32:$sdst, (AMDGPUffbl_b32 i64:$src0))]
215>;
216
217def S_FF1_I32_B32 : SOP1_32 <"s_ff1_i32_b32",
218  [(set i32:$sdst, (AMDGPUffbl_b32 i32:$src0))]
219>;
220
221def S_FLBIT_I32_B32 : SOP1_32 <"s_flbit_i32_b32",
222  [(set i32:$sdst, (AMDGPUffbh_u32 i32:$src0))]
223>;
224
225def S_FLBIT_I32_B64 : SOP1_32_64 <"s_flbit_i32_b64",
226  [(set i32:$sdst, (AMDGPUffbh_u32 i64:$src0))]
227>;
228def S_FLBIT_I32 : SOP1_32 <"s_flbit_i32",
229  [(set i32:$sdst, (AMDGPUffbh_i32 i32:$src0))]
230>;
231def S_FLBIT_I32_I64 : SOP1_32_64 <"s_flbit_i32_i64">;
232def S_SEXT_I32_I8 : SOP1_32 <"s_sext_i32_i8",
233  [(set i32:$sdst, (sext_inreg i32:$src0, i8))]
234>;
235def S_SEXT_I32_I16 : SOP1_32 <"s_sext_i32_i16",
236  [(set i32:$sdst, (sext_inreg i32:$src0, i16))]
237>;
238
239def S_BITSET0_B32 : SOP1_32    <"s_bitset0_b32", [], 1>;
240def S_BITSET0_B64 : SOP1_64_32 <"s_bitset0_b64", [], 1>;
241def S_BITSET1_B32 : SOP1_32    <"s_bitset1_b32", [], 1>;
242def S_BITSET1_B64 : SOP1_64_32 <"s_bitset1_b64", [], 1>;
243def S_GETPC_B64 : SOP1_64_0  <"s_getpc_b64",
244  [(set i64:$sdst, (int_amdgcn_s_getpc))]
245>;
246
247let isTerminator = 1, isBarrier = 1, SchedRW = [WriteBranch] in {
248
249let isBranch = 1, isIndirectBranch = 1 in {
250def S_SETPC_B64 : SOP1_1  <"s_setpc_b64">;
251} // End isBranch = 1, isIndirectBranch = 1
252
253let isReturn = 1 in {
254// Define variant marked as return rather than branch.
255def S_SETPC_B64_return : SOP1_1<"", CCR_SGPR_64, [(AMDGPUret_flag i64:$src0)]>;
256}
257} // End isTerminator = 1, isBarrier = 1
258
259let isCall = 1 in {
260def S_SWAPPC_B64 : SOP1_64 <"s_swappc_b64"
261>;
262}
263
264def S_RFE_B64 : SOP1_1  <"s_rfe_b64">;
265
266let hasSideEffects = 1, Uses = [EXEC], Defs = [EXEC, SCC] in {
267
268def S_AND_SAVEEXEC_B64 : SOP1_64 <"s_and_saveexec_b64">;
269def S_OR_SAVEEXEC_B64 : SOP1_64 <"s_or_saveexec_b64">;
270def S_XOR_SAVEEXEC_B64 : SOP1_64 <"s_xor_saveexec_b64">;
271def S_ANDN2_SAVEEXEC_B64 : SOP1_64 <"s_andn2_saveexec_b64">;
272def S_ORN2_SAVEEXEC_B64 : SOP1_64 <"s_orn2_saveexec_b64">;
273def S_NAND_SAVEEXEC_B64 : SOP1_64 <"s_nand_saveexec_b64">;
274def S_NOR_SAVEEXEC_B64 : SOP1_64 <"s_nor_saveexec_b64">;
275def S_XNOR_SAVEEXEC_B64 : SOP1_64 <"s_xnor_saveexec_b64">;
276
277} // End hasSideEffects = 1, Uses = [EXEC], Defs = [EXEC, SCC]
278
279def S_QUADMASK_B32 : SOP1_32 <"s_quadmask_b32">;
280def S_QUADMASK_B64 : SOP1_64 <"s_quadmask_b64">;
281
282let Uses = [M0] in {
283def S_MOVRELS_B32 : SOP1_32R <"s_movrels_b32">;
284def S_MOVRELS_B64 : SOP1_64R <"s_movrels_b64">;
285def S_MOVRELD_B32 : SOP1_32_movreld <"s_movreld_b32">;
286def S_MOVRELD_B64 : SOP1_64_movreld <"s_movreld_b64">;
287} // End Uses = [M0]
288
289let SubtargetPredicate = isGFX6GFX7GFX8GFX9 in {
290def S_CBRANCH_JOIN : SOP1_0_32R <"s_cbranch_join">;
291def S_MOV_REGRD_B32 : SOP1_32 <"s_mov_regrd_b32">;
292} // End SubtargetPredicate = isGFX6GFX7GFX8GFX9
293
294let Defs = [SCC] in {
295def S_ABS_I32 : SOP1_32 <"s_abs_i32">;
296} // End Defs = [SCC]
297def S_MOV_FED_B32 : SOP1_32 <"s_mov_fed_b32">;
298
299let SubtargetPredicate = HasVGPRIndexMode in {
300def S_SET_GPR_IDX_IDX : SOP1_0_32<"s_set_gpr_idx_idx"> {
301  let Uses = [M0, MODE];
302  let Defs = [M0, MODE];
303}
304}
305
306let SubtargetPredicate = isGFX9Plus in {
307  let hasSideEffects = 1, Defs = [EXEC, SCC], Uses = [EXEC] in {
308    def S_ANDN1_SAVEEXEC_B64 : SOP1_64<"s_andn1_saveexec_b64">;
309    def S_ORN1_SAVEEXEC_B64  : SOP1_64<"s_orn1_saveexec_b64">;
310    def S_ANDN1_WREXEC_B64   : SOP1_64<"s_andn1_wrexec_b64">;
311    def S_ANDN2_WREXEC_B64   : SOP1_64<"s_andn2_wrexec_b64">;
312  } // End hasSideEffects = 1, Defs = [EXEC, SCC], Uses = [EXEC]
313
314  def S_BITREPLICATE_B64_B32 : SOP1_64_32<"s_bitreplicate_b64_b32">;
315} // End SubtargetPredicate = isGFX9Plus
316
317let SubtargetPredicate = isGFX10Plus in {
318  let hasSideEffects = 1, Defs = [EXEC, SCC], Uses = [EXEC] in {
319    def S_AND_SAVEEXEC_B32   : SOP1_32<"s_and_saveexec_b32">;
320    def S_OR_SAVEEXEC_B32    : SOP1_32<"s_or_saveexec_b32">;
321    def S_XOR_SAVEEXEC_B32   : SOP1_32<"s_xor_saveexec_b32">;
322    def S_ANDN2_SAVEEXEC_B32 : SOP1_32<"s_andn2_saveexec_b32">;
323    def S_ORN2_SAVEEXEC_B32  : SOP1_32<"s_orn2_saveexec_b32">;
324    def S_NAND_SAVEEXEC_B32  : SOP1_32<"s_nand_saveexec_b32">;
325    def S_NOR_SAVEEXEC_B32   : SOP1_32<"s_nor_saveexec_b32">;
326    def S_XNOR_SAVEEXEC_B32  : SOP1_32<"s_xnor_saveexec_b32">;
327    def S_ANDN1_SAVEEXEC_B32 : SOP1_32<"s_andn1_saveexec_b32">;
328    def S_ORN1_SAVEEXEC_B32  : SOP1_32<"s_orn1_saveexec_b32">;
329    def S_ANDN1_WREXEC_B32   : SOP1_32<"s_andn1_wrexec_b32">;
330    def S_ANDN2_WREXEC_B32   : SOP1_32<"s_andn2_wrexec_b32">;
331  } // End hasSideEffects = 1, Defs = [EXEC, SCC], Uses = [EXEC]
332
333  let Uses = [M0] in {
334    def S_MOVRELSD_2_B32 : SOP1_32<"s_movrelsd_2_b32">;
335  } // End Uses = [M0]
336} // End SubtargetPredicate = isGFX10Plus
337
338//===----------------------------------------------------------------------===//
339// SOP2 Instructions
340//===----------------------------------------------------------------------===//
341
342class SOP2_Pseudo<string opName, dag outs, dag ins,
343                  string asmOps, list<dag> pattern=[]> :
344  SOP_Pseudo<opName, outs, ins, asmOps, pattern> {
345
346  let mayLoad = 0;
347  let mayStore = 0;
348  let hasSideEffects = 0;
349  let SALU = 1;
350  let SOP2 = 1;
351  let SchedRW = [WriteSALU];
352  let UseNamedOperandTable = 1;
353
354  let has_sdst = 1;
355
356  // Pseudo instructions have no encodings, but adding this field here allows
357  // us to do:
358  // let sdst = xxx in {
359  // for multiclasses that include both real and pseudo instructions.
360  // field bits<7> sdst = 0;
361  // let Size = 4; // Do we need size here?
362}
363
364class SOP2_Real<bits<7> op, SOP_Pseudo ps> :
365  InstSI <ps.OutOperandList, ps.InOperandList,
366          ps.Mnemonic # " " # ps.AsmOperands, []>,
367  Enc32 {
368  let isPseudo = 0;
369  let isCodeGenOnly = 0;
370
371  // copy relevant pseudo op flags
372  let SubtargetPredicate = ps.SubtargetPredicate;
373  let AsmMatchConverter  = ps.AsmMatchConverter;
374  let UseNamedOperandTable = ps.UseNamedOperandTable;
375  let TSFlags = ps.TSFlags;
376
377  // encoding
378  bits<7> sdst;
379  bits<8> src0;
380  bits<8> src1;
381
382  let Inst{7-0}   = src0;
383  let Inst{15-8}  = src1;
384  let Inst{22-16} = !if(ps.has_sdst, sdst, ?);
385  let Inst{29-23} = op;
386  let Inst{31-30} = 0x2; // encoding
387}
388
389
390class SOP2_32 <string opName, list<dag> pattern=[]> : SOP2_Pseudo <
391  opName, (outs SReg_32:$sdst), (ins SSrc_b32:$src0, SSrc_b32:$src1),
392  "$sdst, $src0, $src1", pattern
393>;
394
395class SOP2_64 <string opName, list<dag> pattern=[]> : SOP2_Pseudo <
396  opName, (outs SReg_64:$sdst), (ins SSrc_b64:$src0, SSrc_b64:$src1),
397  "$sdst, $src0, $src1", pattern
398>;
399
400class SOP2_64_32 <string opName, list<dag> pattern=[]> : SOP2_Pseudo <
401  opName, (outs SReg_64:$sdst), (ins SSrc_b64:$src0, SSrc_b32:$src1),
402  "$sdst, $src0, $src1", pattern
403>;
404
405class SOP2_64_32_32 <string opName, list<dag> pattern=[]> : SOP2_Pseudo <
406  opName, (outs SReg_64:$sdst), (ins SSrc_b32:$src0, SSrc_b32:$src1),
407  "$sdst, $src0, $src1", pattern
408>;
409
410class UniformUnaryFrag<SDPatternOperator Op> : PatFrag <
411  (ops node:$src0),
412  (Op $src0),
413  [{ return !N->isDivergent(); }]
414>;
415
416class UniformBinFrag<SDPatternOperator Op> : PatFrag <
417  (ops node:$src0, node:$src1),
418  (Op $src0, $src1),
419  [{ return !N->isDivergent(); }]> {
420  // This check is unnecessary as it's captured by the result register
421  // bank constraint.
422  //
423  // FIXME: Should add a way for the emitter to recognize this is a
424  // trivially true predicate to eliminate the check.
425  let GISelPredicateCode = [{return true;}];
426}
427
428let Defs = [SCC] in { // Carry out goes to SCC
429let isCommutable = 1 in {
430def S_ADD_U32 : SOP2_32 <"s_add_u32">;
431def S_ADD_I32 : SOP2_32 <"s_add_i32",
432  [(set i32:$sdst, (UniformBinFrag<add> SSrc_b32:$src0, SSrc_b32:$src1))]
433>;
434} // End isCommutable = 1
435
436def S_SUB_U32 : SOP2_32 <"s_sub_u32">;
437def S_SUB_I32 : SOP2_32 <"s_sub_i32",
438  [(set i32:$sdst, (UniformBinFrag<sub> SSrc_b32:$src0, SSrc_b32:$src1))]
439>;
440
441let Uses = [SCC] in { // Carry in comes from SCC
442let isCommutable = 1 in {
443def S_ADDC_U32 : SOP2_32 <"s_addc_u32",
444  [(set i32:$sdst, (UniformBinFrag<adde> (i32 SSrc_b32:$src0), (i32 SSrc_b32:$src1)))]>;
445} // End isCommutable = 1
446
447def S_SUBB_U32 : SOP2_32 <"s_subb_u32",
448  [(set i32:$sdst, (UniformBinFrag<sube> (i32 SSrc_b32:$src0), (i32 SSrc_b32:$src1)))]>;
449} // End Uses = [SCC]
450
451
452let isCommutable = 1 in {
453def S_MIN_I32 : SOP2_32 <"s_min_i32",
454  [(set i32:$sdst, (smin i32:$src0, i32:$src1))]
455>;
456def S_MIN_U32 : SOP2_32 <"s_min_u32",
457  [(set i32:$sdst, (umin i32:$src0, i32:$src1))]
458>;
459def S_MAX_I32 : SOP2_32 <"s_max_i32",
460  [(set i32:$sdst, (smax i32:$src0, i32:$src1))]
461>;
462def S_MAX_U32 : SOP2_32 <"s_max_u32",
463  [(set i32:$sdst, (umax i32:$src0, i32:$src1))]
464>;
465} // End isCommutable = 1
466} // End Defs = [SCC]
467
468class SelectPat<SDPatternOperator select> : PatFrag <
469  (ops node:$src1, node:$src2),
470  (select SCC, $src1, $src2),
471  [{ return N->getOperand(0)->hasOneUse() && !N->isDivergent(); }]
472>;
473
474let Uses = [SCC] in {
475  let AddedComplexity = 20 in {
476    def S_CSELECT_B32 : SOP2_32 <"s_cselect_b32",
477      [(set i32:$sdst, (SelectPat<select> i32:$src0, i32:$src1))]
478    >;
479  }
480
481  def S_CSELECT_B64 : SOP2_64 <"s_cselect_b64">;
482} // End Uses = [SCC]
483
484let Defs = [SCC] in {
485let isCommutable = 1 in {
486def S_AND_B32 : SOP2_32 <"s_and_b32",
487  [(set i32:$sdst, (UniformBinFrag<and> i32:$src0, i32:$src1))]
488>;
489
490def S_AND_B64 : SOP2_64 <"s_and_b64",
491  [(set i64:$sdst, (UniformBinFrag<and> i64:$src0, i64:$src1))]
492>;
493
494def S_OR_B32 : SOP2_32 <"s_or_b32",
495  [(set i32:$sdst, (UniformBinFrag<or> i32:$src0, i32:$src1))]
496>;
497
498def S_OR_B64 : SOP2_64 <"s_or_b64",
499  [(set i64:$sdst, (UniformBinFrag<or> i64:$src0, i64:$src1))]
500>;
501
502def S_XOR_B32 : SOP2_32 <"s_xor_b32",
503  [(set i32:$sdst, (UniformBinFrag<xor> i32:$src0, i32:$src1))]
504>;
505
506def S_XOR_B64 : SOP2_64 <"s_xor_b64",
507  [(set i64:$sdst, (UniformBinFrag<xor> i64:$src0, i64:$src1))]
508>;
509
510def S_XNOR_B32 : SOP2_32 <"s_xnor_b32",
511  [(set i32:$sdst, (not (xor_oneuse i32:$src0, i32:$src1)))]
512>;
513
514def S_XNOR_B64 : SOP2_64 <"s_xnor_b64",
515  [(set i64:$sdst, (not (xor_oneuse i64:$src0, i64:$src1)))]
516>;
517
518def S_NAND_B32 : SOP2_32 <"s_nand_b32",
519  [(set i32:$sdst, (not (and_oneuse i32:$src0, i32:$src1)))]
520>;
521
522def S_NAND_B64 : SOP2_64 <"s_nand_b64",
523  [(set i64:$sdst, (not (and_oneuse i64:$src0, i64:$src1)))]
524>;
525
526def S_NOR_B32 : SOP2_32 <"s_nor_b32",
527  [(set i32:$sdst, (not (or_oneuse i32:$src0, i32:$src1)))]
528>;
529
530def S_NOR_B64 : SOP2_64 <"s_nor_b64",
531  [(set i64:$sdst, (not (or_oneuse i64:$src0, i64:$src1)))]
532>;
533} // End isCommutable = 1
534
535def S_ANDN2_B32 : SOP2_32 <"s_andn2_b32",
536  [(set i32:$sdst, (UniformBinFrag<and> i32:$src0, (UniformUnaryFrag<not> i32:$src1)))]
537>;
538
539def S_ANDN2_B64 : SOP2_64 <"s_andn2_b64",
540  [(set i64:$sdst, (UniformBinFrag<and> i64:$src0, (UniformUnaryFrag<not> i64:$src1)))]
541>;
542
543def S_ORN2_B32 : SOP2_32 <"s_orn2_b32",
544  [(set i32:$sdst, (UniformBinFrag<or> i32:$src0, (UniformUnaryFrag<not> i32:$src1)))]
545>;
546
547def S_ORN2_B64 : SOP2_64 <"s_orn2_b64",
548  [(set i64:$sdst, (UniformBinFrag<or> i64:$src0, (UniformUnaryFrag<not> i64:$src1)))]
549>;
550} // End Defs = [SCC]
551
552// Use added complexity so these patterns are preferred to the VALU patterns.
553let AddedComplexity = 1 in {
554
555let Defs = [SCC] in {
556// TODO: b64 versions require VOP3 change since v_lshlrev_b64 is VOP3
557def S_LSHL_B32 : SOP2_32 <"s_lshl_b32",
558  [(set SReg_32:$sdst, (UniformBinFrag<shl> (i32 SSrc_b32:$src0), (i32 SSrc_b32:$src1)))]
559>;
560def S_LSHL_B64 : SOP2_64_32 <"s_lshl_b64",
561  [(set SReg_64:$sdst, (UniformBinFrag<shl> (i64 SSrc_b64:$src0), (i32 SSrc_b32:$src1)))]
562>;
563def S_LSHR_B32 : SOP2_32 <"s_lshr_b32",
564  [(set SReg_32:$sdst, (UniformBinFrag<srl> (i32 SSrc_b32:$src0), (i32 SSrc_b32:$src1)))]
565>;
566def S_LSHR_B64 : SOP2_64_32 <"s_lshr_b64",
567  [(set SReg_64:$sdst, (UniformBinFrag<srl> (i64 SSrc_b64:$src0), (i32 SSrc_b32:$src1)))]
568>;
569def S_ASHR_I32 : SOP2_32 <"s_ashr_i32",
570  [(set SReg_32:$sdst, (UniformBinFrag<sra> (i32 SSrc_b32:$src0), (i32 SSrc_b32:$src1)))]
571>;
572def S_ASHR_I64 : SOP2_64_32 <"s_ashr_i64",
573  [(set SReg_64:$sdst, (UniformBinFrag<sra> (i64 SSrc_b64:$src0), (i32 SSrc_b32:$src1)))]
574>;
575} // End Defs = [SCC]
576
577def S_BFM_B32 : SOP2_32 <"s_bfm_b32",
578  [(set i32:$sdst, (UniformBinFrag<AMDGPUbfm> i32:$src0, i32:$src1))]>;
579def S_BFM_B64 : SOP2_64_32_32 <"s_bfm_b64">;
580
581// TODO: S_MUL_I32 require V_MUL_LO_I32 from VOP3 change
582def S_MUL_I32 : SOP2_32 <"s_mul_i32",
583  [(set i32:$sdst, (mul i32:$src0, i32:$src1))]> {
584  let isCommutable = 1;
585}
586
587} // End AddedComplexity = 1
588
589let Defs = [SCC] in {
590def S_BFE_U32 : SOP2_32 <"s_bfe_u32">;
591def S_BFE_I32 : SOP2_32 <"s_bfe_i32">;
592def S_BFE_U64 : SOP2_64_32 <"s_bfe_u64">;
593def S_BFE_I64 : SOP2_64_32 <"s_bfe_i64">;
594} // End Defs = [SCC]
595
596def S_CBRANCH_G_FORK : SOP2_Pseudo <
597  "s_cbranch_g_fork", (outs),
598  (ins SCSrc_b64:$src0, SCSrc_b64:$src1),
599  "$src0, $src1"
600> {
601  let has_sdst = 0;
602  let SubtargetPredicate = isGFX6GFX7GFX8GFX9;
603}
604
605let Defs = [SCC] in {
606def S_ABSDIFF_I32 : SOP2_32 <"s_absdiff_i32">;
607} // End Defs = [SCC]
608
609let SubtargetPredicate = isGFX8GFX9 in {
610  def S_RFE_RESTORE_B64 : SOP2_Pseudo <
611    "s_rfe_restore_b64", (outs),
612    (ins SSrc_b64:$src0, SSrc_b32:$src1),
613    "$src0, $src1"
614  > {
615    let hasSideEffects = 1;
616    let has_sdst = 0;
617  }
618}
619
620let SubtargetPredicate = isGFX9Plus in {
621  def S_PACK_LL_B32_B16 : SOP2_32<"s_pack_ll_b32_b16">;
622  def S_PACK_LH_B32_B16 : SOP2_32<"s_pack_lh_b32_b16">;
623  def S_PACK_HH_B32_B16 : SOP2_32<"s_pack_hh_b32_b16">;
624
625  let Defs = [SCC] in {
626    def S_LSHL1_ADD_U32 : SOP2_32<"s_lshl1_add_u32",
627      [(set i32:$sdst, (shl1_add SSrc_b32:$src0, SSrc_b32:$src1))]
628    >;
629    def S_LSHL2_ADD_U32 : SOP2_32<"s_lshl2_add_u32",
630      [(set i32:$sdst, (shl2_add SSrc_b32:$src0, SSrc_b32:$src1))]
631    >;
632    def S_LSHL3_ADD_U32 : SOP2_32<"s_lshl3_add_u32",
633      [(set i32:$sdst, (shl3_add SSrc_b32:$src0, SSrc_b32:$src1))]
634    >;
635    def S_LSHL4_ADD_U32 : SOP2_32<"s_lshl4_add_u32",
636      [(set i32:$sdst, (shl4_add SSrc_b32:$src0, SSrc_b32:$src1))]
637    >;
638  } // End Defs = [SCC]
639
640  let isCommutable = 1 in {
641    def S_MUL_HI_U32 : SOP2_32<"s_mul_hi_u32",
642      [(set i32:$sdst, (UniformBinFrag<mulhu> SSrc_b32:$src0, SSrc_b32:$src1))]>;
643    def S_MUL_HI_I32 : SOP2_32<"s_mul_hi_i32",
644      [(set i32:$sdst, (UniformBinFrag<mulhs> SSrc_b32:$src0, SSrc_b32:$src1))]>;
645  }
646} // End SubtargetPredicate = isGFX9Plus
647
648//===----------------------------------------------------------------------===//
649// SOPK Instructions
650//===----------------------------------------------------------------------===//
651
652class SOPK_Pseudo <string opName, dag outs, dag ins,
653                   string asmOps, list<dag> pattern=[]> :
654  InstSI <outs, ins, "", pattern>,
655  SIMCInstr<opName, SIEncodingFamily.NONE> {
656  let isPseudo = 1;
657  let isCodeGenOnly = 1;
658  let mayLoad = 0;
659  let mayStore = 0;
660  let hasSideEffects = 0;
661  let SALU = 1;
662  let SOPK = 1;
663  let SchedRW = [WriteSALU];
664  let UseNamedOperandTable = 1;
665  string Mnemonic = opName;
666  string AsmOperands = asmOps;
667
668  bits<1> has_sdst = 1;
669}
670
671class SOPK_Real<bits<5> op, SOPK_Pseudo ps> :
672  InstSI <ps.OutOperandList, ps.InOperandList,
673          ps.Mnemonic # " " # ps.AsmOperands, []> {
674  let isPseudo = 0;
675  let isCodeGenOnly = 0;
676
677  // copy relevant pseudo op flags
678  let SubtargetPredicate = ps.SubtargetPredicate;
679  let AsmMatchConverter  = ps.AsmMatchConverter;
680  let DisableEncoding    = ps.DisableEncoding;
681  let Constraints        = ps.Constraints;
682
683  // encoding
684  bits<7>  sdst;
685  bits<16> simm16;
686  bits<32> imm;
687}
688
689class SOPK_Real32<bits<5> op, SOPK_Pseudo ps> :
690  SOPK_Real <op, ps>,
691  Enc32 {
692  let Inst{15-0}  = simm16;
693  let Inst{22-16} = !if(ps.has_sdst, sdst, ?);
694  let Inst{27-23} = op;
695  let Inst{31-28} = 0xb; //encoding
696}
697
698class SOPK_Real64<bits<5> op, SOPK_Pseudo ps> :
699  SOPK_Real<op, ps>,
700  Enc64 {
701  let Inst{15-0}  = simm16;
702  let Inst{22-16} = !if(ps.has_sdst, sdst, ?);
703  let Inst{27-23} = op;
704  let Inst{31-28} = 0xb; //encoding
705  let Inst{63-32} = imm;
706}
707
708class SOPKInstTable <bit is_sopk, string cmpOp = ""> {
709  bit IsSOPK = is_sopk;
710  string BaseCmpOp = cmpOp;
711}
712
713class SOPK_32 <string opName, list<dag> pattern=[]> : SOPK_Pseudo <
714  opName,
715  (outs SReg_32:$sdst),
716  (ins s16imm:$simm16),
717  "$sdst, $simm16",
718  pattern>;
719
720class SOPK_32_BR <string opName, list<dag> pattern=[]> : SOPK_Pseudo <
721  opName,
722  (outs),
723  (ins sopp_brtarget:$simm16, SReg_32:$sdst),
724  "$sdst, $simm16",
725  pattern> {
726  let Defs = [EXEC];
727  let Uses = [EXEC];
728  let isBranch = 1;
729  let isTerminator = 1;
730  let SchedRW = [WriteBranch];
731}
732
733class SOPK_SCC <string opName, string base_op, bit isSignExt> : SOPK_Pseudo <
734  opName,
735  (outs),
736  !if(isSignExt,
737      (ins SReg_32:$sdst, s16imm:$simm16),
738      (ins SReg_32:$sdst, u16imm:$simm16)),
739  "$sdst, $simm16", []>,
740  SOPKInstTable<1, base_op>{
741  let Defs = [SCC];
742}
743
744class SOPK_32TIE <string opName, list<dag> pattern=[]> : SOPK_Pseudo <
745  opName,
746  (outs SReg_32:$sdst),
747  (ins SReg_32:$src0, s16imm:$simm16),
748  "$sdst, $simm16",
749  pattern
750>;
751
752let isReMaterializable = 1, isMoveImm = 1 in {
753def S_MOVK_I32 : SOPK_32 <"s_movk_i32">;
754} // End isReMaterializable = 1
755let Uses = [SCC] in {
756def S_CMOVK_I32 : SOPK_32 <"s_cmovk_i32">;
757}
758
759let isCompare = 1 in {
760
761// This instruction is disabled for now until we can figure out how to teach
762// the instruction selector to correctly use the  S_CMP* vs V_CMP*
763// instructions.
764//
765// When this instruction is enabled the code generator sometimes produces this
766// invalid sequence:
767//
768// SCC = S_CMPK_EQ_I32 SGPR0, imm
769// VCC = COPY SCC
770// VGPR0 = V_CNDMASK VCC, VGPR0, VGPR1
771//
772// def S_CMPK_EQ_I32 : SOPK_SCC <"s_cmpk_eq_i32",
773//   [(set i1:$dst, (setcc i32:$src0, imm:$src1, SETEQ))]
774// >;
775
776def S_CMPK_EQ_I32 : SOPK_SCC <"s_cmpk_eq_i32", "s_cmp_eq_i32", 1>;
777def S_CMPK_LG_I32 : SOPK_SCC <"s_cmpk_lg_i32", "s_cmp_lg_i32", 1>;
778def S_CMPK_GT_I32 : SOPK_SCC <"s_cmpk_gt_i32", "s_cmp_gt_i32", 1>;
779def S_CMPK_GE_I32 : SOPK_SCC <"s_cmpk_ge_i32", "s_cmp_ge_i32", 1>;
780def S_CMPK_LT_I32 : SOPK_SCC <"s_cmpk_lt_i32", "s_cmp_lt_i32", 1>;
781def S_CMPK_LE_I32 : SOPK_SCC <"s_cmpk_le_i32", "s_cmp_le_i32", 1>;
782
783let SOPKZext = 1 in {
784def S_CMPK_EQ_U32 : SOPK_SCC <"s_cmpk_eq_u32", "s_cmp_eq_u32", 0>;
785def S_CMPK_LG_U32 : SOPK_SCC <"s_cmpk_lg_u32", "s_cmp_lg_u32", 0>;
786def S_CMPK_GT_U32 : SOPK_SCC <"s_cmpk_gt_u32", "s_cmp_gt_u32", 0>;
787def S_CMPK_GE_U32 : SOPK_SCC <"s_cmpk_ge_u32", "s_cmp_ge_u32", 0>;
788def S_CMPK_LT_U32 : SOPK_SCC <"s_cmpk_lt_u32", "s_cmp_lt_u32", 0>;
789def S_CMPK_LE_U32 : SOPK_SCC <"s_cmpk_le_u32", "s_cmp_le_u32", 0>;
790} // End SOPKZext = 1
791} // End isCompare = 1
792
793let Defs = [SCC], isCommutable = 1, DisableEncoding = "$src0",
794    Constraints = "$sdst = $src0" in {
795  def S_ADDK_I32 : SOPK_32TIE <"s_addk_i32">;
796  def S_MULK_I32 : SOPK_32TIE <"s_mulk_i32">;
797}
798
799let SubtargetPredicate = isGFX6GFX7GFX8GFX9 in
800def S_CBRANCH_I_FORK : SOPK_Pseudo <
801  "s_cbranch_i_fork",
802  (outs), (ins SReg_64:$sdst, sopp_brtarget:$simm16),
803  "$sdst, $simm16"
804>;
805
806let hasSideEffects = 1 in {
807
808let mayLoad = 1 in {
809// s_getreg_b32 should use hasSideEffects = 1 for tablegen to allow
810// its use in the readcyclecounter selection.
811def S_GETREG_B32 : SOPK_Pseudo <
812  "s_getreg_b32",
813  (outs SReg_32:$sdst), (ins hwreg:$simm16),
814  "$sdst, $simm16"
815>;
816}
817
818let mayLoad = 0, mayStore =0 in {
819
820def S_SETREG_B32 : SOPK_Pseudo <
821  "s_setreg_b32",
822  (outs), (ins SReg_32:$sdst, hwreg:$simm16),
823  "$simm16, $sdst",
824  [(int_amdgcn_s_setreg (i32 timm:$simm16), i32:$sdst)]> {
825
826  // Use custom inserter to optimize some cases to
827  // S_DENORM_MODE/S_ROUND_MODE.
828  let usesCustomInserter = 1;
829  let Defs = [MODE];
830  let Uses = [MODE];
831}
832
833// FIXME: Not on SI?
834//def S_GETREG_REGRD_B32 : SOPK_32 <sopk<0x14, 0x13>, "s_getreg_regrd_b32">;
835
836def S_SETREG_IMM32_B32 : SOPK_Pseudo <
837  "s_setreg_imm32_b32",
838  (outs), (ins i32imm:$imm, hwreg:$simm16),
839  "$simm16, $imm"> {
840  let Size = 8; // Unlike every other SOPK instruction.
841  let has_sdst = 0;
842  let Defs = [MODE];
843  let Uses = [MODE];
844}
845
846}
847} // End hasSideEffects = 1
848
849class SOPK_WAITCNT<string opName, list<dag> pat=[]> :
850    SOPK_Pseudo<
851        opName,
852        (outs),
853        (ins SReg_32:$sdst, s16imm:$simm16),
854        "$sdst, $simm16",
855        pat> {
856  let hasSideEffects = 1;
857  let mayLoad = 1;
858  let mayStore = 1;
859  let has_sdst = 1; // First source takes place of sdst in encoding
860}
861
862let SubtargetPredicate = isGFX9Plus in {
863  def S_CALL_B64 : SOPK_Pseudo<
864      "s_call_b64",
865      (outs SReg_64:$sdst),
866      (ins sopp_brtarget:$simm16),
867      "$sdst, $simm16"> {
868    let isCall = 1;
869  }
870} // End SubtargetPredicate = isGFX9Plus
871
872let SubtargetPredicate = isGFX10Plus in {
873  def S_VERSION : SOPK_Pseudo<
874      "s_version",
875      (outs),
876      (ins s16imm:$simm16),
877      "$simm16"> {
878    let has_sdst = 0;
879  }
880
881  def S_SUBVECTOR_LOOP_BEGIN : SOPK_32_BR<"s_subvector_loop_begin">;
882  def S_SUBVECTOR_LOOP_END   : SOPK_32_BR<"s_subvector_loop_end">;
883
884  def S_WAITCNT_VSCNT   : SOPK_WAITCNT<"s_waitcnt_vscnt">;
885  def S_WAITCNT_VMCNT   : SOPK_WAITCNT<"s_waitcnt_vmcnt">;
886  def S_WAITCNT_EXPCNT  : SOPK_WAITCNT<"s_waitcnt_expcnt">;
887  def S_WAITCNT_LGKMCNT : SOPK_WAITCNT<"s_waitcnt_lgkmcnt">;
888} // End SubtargetPredicate = isGFX10Plus
889
890//===----------------------------------------------------------------------===//
891// SOPC Instructions
892//===----------------------------------------------------------------------===//
893
894class SOPCe <bits<7> op> : Enc32 {
895  bits<8> src0;
896  bits<8> src1;
897
898  let Inst{7-0} = src0;
899  let Inst{15-8} = src1;
900  let Inst{22-16} = op;
901  let Inst{31-23} = 0x17e;
902}
903
904class SOPC <bits<7> op, dag outs, dag ins, string asm,
905            list<dag> pattern = []> :
906  InstSI<outs, ins, asm, pattern>, SOPCe <op> {
907  let mayLoad = 0;
908  let mayStore = 0;
909  let hasSideEffects = 0;
910  let SALU = 1;
911  let SOPC = 1;
912  let isCodeGenOnly = 0;
913  let Defs = [SCC];
914  let SchedRW = [WriteSALU];
915  let UseNamedOperandTable = 1;
916}
917
918class SOPC_Base <bits<7> op, RegisterOperand rc0, RegisterOperand rc1,
919                 string opName, list<dag> pattern = []> : SOPC <
920  op, (outs), (ins rc0:$src0, rc1:$src1),
921  opName#" $src0, $src1", pattern > {
922  let Defs = [SCC];
923}
924class SOPC_Helper <bits<7> op, RegisterOperand rc, ValueType vt,
925                    string opName, SDPatternOperator cond> : SOPC_Base <
926  op, rc, rc, opName,
927  [(set SCC, (si_setcc_uniform vt:$src0, vt:$src1, cond))] > {
928}
929
930class SOPC_CMP_32<bits<7> op, string opName,
931                  SDPatternOperator cond = COND_NULL, string revOp = opName>
932  : SOPC_Helper<op, SSrc_b32, i32, opName, cond>,
933    Commutable_REV<revOp, !eq(revOp, opName)>,
934    SOPKInstTable<0, opName> {
935  let isCompare = 1;
936  let isCommutable = 1;
937}
938
939class SOPC_CMP_64<bits<7> op, string opName,
940                  SDPatternOperator cond = COND_NULL, string revOp = opName>
941  : SOPC_Helper<op, SSrc_b64, i64, opName, cond>,
942    Commutable_REV<revOp, !eq(revOp, opName)> {
943  let isCompare = 1;
944  let isCommutable = 1;
945}
946
947class SOPC_32<bits<7> op, string opName, list<dag> pattern = []>
948  : SOPC_Base<op, SSrc_b32, SSrc_b32, opName, pattern>;
949
950class SOPC_64_32<bits<7> op, string opName, list<dag> pattern = []>
951  : SOPC_Base<op, SSrc_b64, SSrc_b32, opName, pattern>;
952
953def S_CMP_EQ_I32 : SOPC_CMP_32 <0x00, "s_cmp_eq_i32">;
954def S_CMP_LG_I32 : SOPC_CMP_32 <0x01, "s_cmp_lg_i32">;
955def S_CMP_GT_I32 : SOPC_CMP_32 <0x02, "s_cmp_gt_i32", COND_SGT>;
956def S_CMP_GE_I32 : SOPC_CMP_32 <0x03, "s_cmp_ge_i32", COND_SGE>;
957def S_CMP_LT_I32 : SOPC_CMP_32 <0x04, "s_cmp_lt_i32", COND_SLT, "s_cmp_gt_i32">;
958def S_CMP_LE_I32 : SOPC_CMP_32 <0x05, "s_cmp_le_i32", COND_SLE, "s_cmp_ge_i32">;
959def S_CMP_EQ_U32 : SOPC_CMP_32 <0x06, "s_cmp_eq_u32", COND_EQ>;
960def S_CMP_LG_U32 : SOPC_CMP_32 <0x07, "s_cmp_lg_u32", COND_NE>;
961def S_CMP_GT_U32 : SOPC_CMP_32 <0x08, "s_cmp_gt_u32", COND_UGT>;
962def S_CMP_GE_U32 : SOPC_CMP_32 <0x09, "s_cmp_ge_u32", COND_UGE>;
963def S_CMP_LT_U32 : SOPC_CMP_32 <0x0a, "s_cmp_lt_u32", COND_ULT, "s_cmp_gt_u32">;
964def S_CMP_LE_U32 : SOPC_CMP_32 <0x0b, "s_cmp_le_u32", COND_ULE, "s_cmp_ge_u32">;
965
966def S_BITCMP0_B32 : SOPC_32 <0x0c, "s_bitcmp0_b32">;
967def S_BITCMP1_B32 : SOPC_32 <0x0d, "s_bitcmp1_b32">;
968def S_BITCMP0_B64 : SOPC_64_32 <0x0e, "s_bitcmp0_b64">;
969def S_BITCMP1_B64 : SOPC_64_32 <0x0f, "s_bitcmp1_b64">;
970let SubtargetPredicate = isGFX6GFX7GFX8GFX9 in
971def S_SETVSKIP : SOPC_32 <0x10, "s_setvskip">;
972
973let SubtargetPredicate = isGFX8Plus in {
974def S_CMP_EQ_U64 : SOPC_CMP_64 <0x12, "s_cmp_eq_u64", COND_EQ>;
975def S_CMP_LG_U64 : SOPC_CMP_64 <0x13, "s_cmp_lg_u64", COND_NE>;
976} // End SubtargetPredicate = isGFX8Plus
977
978let SubtargetPredicate = HasVGPRIndexMode in {
979// Setting the GPR index mode is really writing the fields in the mode
980// register. We don't want to add mode register uses to every
981// instruction, and it's too complicated to deal with anyway. This is
982// modeled just as a side effect.
983def S_SET_GPR_IDX_ON : SOPC <0x11,
984  (outs),
985  (ins SSrc_b32:$src0, GPRIdxMode:$src1),
986  "s_set_gpr_idx_on $src0,$src1"> {
987  let Defs = [M0, MODE]; // No scc def
988  let Uses = [M0, MODE]; // Other bits of mode, m0 unmodified.
989  let hasSideEffects = 1; // Sets mode.gpr_idx_en
990  let FixedSize = 1;
991}
992}
993
994//===----------------------------------------------------------------------===//
995// SOPP Instructions
996//===----------------------------------------------------------------------===//
997
998class Base_SOPP <string asm> {
999  string AsmString = asm;
1000}
1001
1002class SOPPe <bits<7> op> : Enc32 {
1003  bits <16> simm16;
1004
1005  let Inst{15-0} = simm16;
1006  let Inst{22-16} = op;
1007  let Inst{31-23} = 0x17f; // encoding
1008}
1009
1010class SOPP <bits<7> op, dag ins, string asm, list<dag> pattern = []> :
1011  InstSI <(outs), ins, asm, pattern >, SOPPe <op>, Base_SOPP <asm> {
1012
1013  let mayLoad = 0;
1014  let mayStore = 0;
1015  let hasSideEffects = 0;
1016  let SALU = 1;
1017  let SOPP = 1;
1018  let Size = 4;
1019  let SchedRW = [WriteSALU];
1020
1021  let UseNamedOperandTable = 1;
1022}
1023
1024def S_NOP : SOPP <0x00000000, (ins i16imm:$simm16), "s_nop $simm16">;
1025
1026class SOPP_w_nop_e <bits<7> op> : Enc64 {
1027  bits <16> simm16;
1028
1029  let Inst{15-0} = simm16;
1030  let Inst{22-16} = op;
1031  let Inst{31-23} = 0x17f; // encoding
1032  let Inst{47-32} = 0x0;
1033  let Inst{54-48} = S_NOP.Inst{22-16}; // opcode
1034  let Inst{63-55} = S_NOP.Inst{31-23}; // encoding
1035}
1036
1037class SOPP_w_nop <bits<7> op, dag ins, string asm, list<dag> pattern = []> :
1038  InstSI <(outs), ins, asm, pattern >, SOPP_w_nop_e <op>, Base_SOPP <asm> {
1039
1040  let mayLoad = 0;
1041  let mayStore = 0;
1042  let hasSideEffects = 0;
1043  let SALU = 1;
1044  let SOPP = 1;
1045  let Size = 8;
1046  let SchedRW = [WriteSALU];
1047
1048  let UseNamedOperandTable = 1;
1049}
1050
1051multiclass SOPP_With_Relaxation <bits<7> op, dag ins, string asm, list<dag> pattern = []> {
1052  def "" : SOPP <op, ins, asm, pattern>;
1053  def _pad_s_nop : SOPP_w_nop <op, ins, asm, pattern>;
1054}
1055
1056let isTerminator = 1 in {
1057
1058def S_ENDPGM : SOPP <0x00000001, (ins EndpgmImm:$simm16), "s_endpgm$simm16"> {
1059  let isBarrier = 1;
1060  let isReturn = 1;
1061}
1062
1063def S_ENDPGM_SAVED : SOPP <0x0000001B, (ins), "s_endpgm_saved"> {
1064  let SubtargetPredicate = isGFX8Plus;
1065  let simm16 = 0;
1066  let isBarrier = 1;
1067  let isReturn = 1;
1068}
1069
1070let SubtargetPredicate = isGFX9Plus in {
1071  let isBarrier = 1, isReturn = 1, simm16 = 0 in {
1072    def S_ENDPGM_ORDERED_PS_DONE :
1073      SOPP<0x01e, (ins), "s_endpgm_ordered_ps_done">;
1074  } // End isBarrier = 1, isReturn = 1, simm16 = 0
1075} // End SubtargetPredicate = isGFX9Plus
1076
1077let SubtargetPredicate = isGFX10Plus in {
1078  let isBarrier = 1, isReturn = 1, simm16 = 0 in {
1079    def S_CODE_END :
1080      SOPP<0x01f, (ins), "s_code_end">;
1081  } // End isBarrier = 1, isReturn = 1, simm16 = 0
1082} // End SubtargetPredicate = isGFX10Plus
1083
1084let isBranch = 1, SchedRW = [WriteBranch] in {
1085let isBarrier = 1 in {
1086defm S_BRANCH : SOPP_With_Relaxation <
1087  0x00000002, (ins sopp_brtarget:$simm16), "s_branch $simm16",
1088  [(br bb:$simm16)]>;
1089}
1090
1091let Uses = [SCC] in {
1092defm S_CBRANCH_SCC0 : SOPP_With_Relaxation <
1093  0x00000004, (ins sopp_brtarget:$simm16),
1094  "s_cbranch_scc0 $simm16"
1095>;
1096defm S_CBRANCH_SCC1 : SOPP_With_Relaxation <
1097  0x00000005, (ins sopp_brtarget:$simm16),
1098  "s_cbranch_scc1 $simm16"
1099>;
1100} // End Uses = [SCC]
1101
1102let Uses = [VCC] in {
1103defm S_CBRANCH_VCCZ : SOPP_With_Relaxation <
1104  0x00000006, (ins sopp_brtarget:$simm16),
1105  "s_cbranch_vccz $simm16"
1106>;
1107defm S_CBRANCH_VCCNZ : SOPP_With_Relaxation <
1108  0x00000007, (ins sopp_brtarget:$simm16),
1109  "s_cbranch_vccnz $simm16"
1110>;
1111} // End Uses = [VCC]
1112
1113let Uses = [EXEC] in {
1114defm S_CBRANCH_EXECZ : SOPP_With_Relaxation <
1115  0x00000008, (ins sopp_brtarget:$simm16),
1116  "s_cbranch_execz $simm16"
1117>;
1118defm S_CBRANCH_EXECNZ : SOPP_With_Relaxation <
1119  0x00000009, (ins sopp_brtarget:$simm16),
1120  "s_cbranch_execnz $simm16"
1121>;
1122} // End Uses = [EXEC]
1123
1124defm S_CBRANCH_CDBGSYS : SOPP_With_Relaxation <
1125  0x00000017, (ins sopp_brtarget:$simm16),
1126  "s_cbranch_cdbgsys $simm16"
1127>;
1128
1129defm S_CBRANCH_CDBGSYS_AND_USER : SOPP_With_Relaxation <
1130  0x0000001A, (ins sopp_brtarget:$simm16),
1131  "s_cbranch_cdbgsys_and_user $simm16"
1132>;
1133
1134defm S_CBRANCH_CDBGSYS_OR_USER : SOPP_With_Relaxation <
1135  0x00000019, (ins sopp_brtarget:$simm16),
1136  "s_cbranch_cdbgsys_or_user $simm16"
1137>;
1138
1139defm S_CBRANCH_CDBGUSER : SOPP_With_Relaxation <
1140  0x00000018, (ins sopp_brtarget:$simm16),
1141  "s_cbranch_cdbguser $simm16"
1142>;
1143
1144} // End isBranch = 1
1145} // End isTerminator = 1
1146
1147let hasSideEffects = 1 in {
1148def S_BARRIER : SOPP <0x0000000a, (ins), "s_barrier",
1149  [(int_amdgcn_s_barrier)]> {
1150  let SchedRW = [WriteBarrier];
1151  let simm16 = 0;
1152  let isConvergent = 1;
1153}
1154
1155def S_WAKEUP : SOPP <0x00000003, (ins), "s_wakeup"> {
1156  let SubtargetPredicate = isGFX8Plus;
1157  let simm16 = 0;
1158  let mayLoad = 1;
1159  let mayStore = 1;
1160}
1161
1162let mayLoad = 0, mayStore = 0, hasSideEffects = 1 in
1163def S_WAITCNT : SOPP <0x0000000c, (ins WAIT_FLAG:$simm16), "s_waitcnt $simm16",
1164    [(int_amdgcn_s_waitcnt timm:$simm16)]>;
1165def S_SETHALT : SOPP <0x0000000d, (ins i16imm:$simm16), "s_sethalt $simm16">;
1166def S_SETKILL : SOPP <0x0000000b, (ins i16imm:$simm16), "s_setkill $simm16">;
1167
1168// On SI the documentation says sleep for approximately 64 * low 2
1169// bits, consistent with the reported maximum of 448. On VI the
1170// maximum reported is 960 cycles, so 960 / 64 = 15 max, so is the
1171// maximum really 15 on VI?
1172def S_SLEEP : SOPP <0x0000000e, (ins i32imm:$simm16),
1173  "s_sleep $simm16", [(int_amdgcn_s_sleep timm:$simm16)]> {
1174  let hasSideEffects = 1;
1175  let mayLoad = 0;
1176  let mayStore = 0;
1177}
1178
1179def S_SETPRIO : SOPP <0x0000000f, (ins i16imm:$simm16), "s_setprio $simm16">;
1180
1181let Uses = [EXEC, M0] in {
1182// FIXME: Should this be mayLoad+mayStore?
1183def S_SENDMSG : SOPP <0x00000010, (ins SendMsgImm:$simm16), "s_sendmsg $simm16",
1184  [(int_amdgcn_s_sendmsg (i32 timm:$simm16), M0)]>;
1185
1186def S_SENDMSGHALT : SOPP <0x00000011, (ins SendMsgImm:$simm16), "s_sendmsghalt $simm16",
1187  [(int_amdgcn_s_sendmsghalt (i32 timm:$simm16), M0)]>;
1188
1189} // End Uses = [EXEC, M0]
1190
1191def S_TRAP : SOPP <0x00000012, (ins i16imm:$simm16), "s_trap $simm16"> {
1192  let isTrap = 1;
1193}
1194
1195def S_ICACHE_INV : SOPP <0x00000013, (ins), "s_icache_inv"> {
1196  let simm16 = 0;
1197}
1198def S_INCPERFLEVEL : SOPP <0x00000014, (ins i32imm:$simm16), "s_incperflevel $simm16",
1199  [(int_amdgcn_s_incperflevel timm:$simm16)]> {
1200  let hasSideEffects = 1;
1201  let mayLoad = 0;
1202  let mayStore = 0;
1203}
1204def S_DECPERFLEVEL : SOPP <0x00000015, (ins i32imm:$simm16), "s_decperflevel $simm16",
1205  [(int_amdgcn_s_decperflevel timm:$simm16)]> {
1206  let hasSideEffects = 1;
1207  let mayLoad = 0;
1208  let mayStore = 0;
1209}
1210def S_TTRACEDATA : SOPP <0x00000016, (ins), "s_ttracedata"> {
1211  let simm16 = 0;
1212}
1213
1214let SubtargetPredicate = HasVGPRIndexMode in {
1215def S_SET_GPR_IDX_OFF : SOPP<0x1c, (ins), "s_set_gpr_idx_off"> {
1216  let simm16 = 0;
1217  let Defs = [MODE];
1218  let Uses = [MODE];
1219}
1220}
1221} // End hasSideEffects
1222
1223let SubtargetPredicate = HasVGPRIndexMode in {
1224def S_SET_GPR_IDX_MODE : SOPP<0x1d, (ins GPRIdxMode:$simm16),
1225  "s_set_gpr_idx_mode$simm16"> {
1226  let Defs = [M0, MODE];
1227  let Uses = [MODE];
1228}
1229}
1230
1231let SubtargetPredicate = isGFX10Plus in {
1232  def S_INST_PREFETCH :
1233    SOPP<0x020, (ins s16imm:$simm16), "s_inst_prefetch $simm16">;
1234  def S_CLAUSE :
1235    SOPP<0x021, (ins s16imm:$simm16), "s_clause $simm16">;
1236  def S_WAITCNT_IDLE :
1237    SOPP <0x022, (ins), "s_wait_idle"> {
1238      let simm16 = 0;
1239    }
1240  def S_WAITCNT_DEPCTR :
1241    SOPP <0x023, (ins s16imm:$simm16), "s_waitcnt_depctr $simm16">;
1242
1243  let hasSideEffects = 0, Uses = [MODE], Defs = [MODE] in {
1244    def S_ROUND_MODE :
1245      SOPP<0x024, (ins s16imm:$simm16), "s_round_mode $simm16">;
1246    def S_DENORM_MODE :
1247      SOPP<0x025, (ins i32imm:$simm16), "s_denorm_mode $simm16",
1248      [(SIdenorm_mode (i32 timm:$simm16))]>;
1249  }
1250
1251  def S_TTRACEDATA_IMM :
1252    SOPP<0x028, (ins s16imm:$simm16), "s_ttracedata_imm $simm16">;
1253} // End SubtargetPredicate = isGFX10Plus
1254
1255//===----------------------------------------------------------------------===//
1256// S_GETREG_B32 Intrinsic Pattern.
1257//===----------------------------------------------------------------------===//
1258def : GCNPat <
1259  (int_amdgcn_s_getreg timm:$simm16),
1260  (S_GETREG_B32 (as_i16imm $simm16))
1261>;
1262
1263//===----------------------------------------------------------------------===//
1264// SOP1 Patterns
1265//===----------------------------------------------------------------------===//
1266
1267def : GCNPat <
1268  (AMDGPUendpgm),
1269    (S_ENDPGM (i16 0))
1270>;
1271
1272def : GCNPat <
1273  (i64 (ctpop i64:$src)),
1274    (i64 (REG_SEQUENCE SReg_64,
1275     (i32 (COPY_TO_REGCLASS (S_BCNT1_I32_B64 $src), SReg_32)), sub0,
1276     (S_MOV_B32 (i32 0)), sub1))
1277>;
1278
1279def : GCNPat <
1280  (i32 (smax i32:$x, (i32 (ineg i32:$x)))),
1281  (S_ABS_I32 SReg_32:$x)
1282>;
1283
1284def : GCNPat <
1285  (i16 imm:$imm),
1286  (S_MOV_B32 imm:$imm)
1287>;
1288
1289// Same as a 32-bit inreg
1290def : GCNPat<
1291  (i32 (UniformUnaryFrag<sext> i16:$src)),
1292  (S_SEXT_I32_I16 $src)
1293>;
1294
1295
1296//===----------------------------------------------------------------------===//
1297// SOP2 Patterns
1298//===----------------------------------------------------------------------===//
1299
1300// V_ADD_I32_e32/S_ADD_U32 produces carry in VCC/SCC. For the vector
1301// case, the sgpr-copies pass will fix this to use the vector version.
1302def : GCNPat <
1303  (i32 (addc i32:$src0, i32:$src1)),
1304  (S_ADD_U32 $src0, $src1)
1305>;
1306
1307// FIXME: We need to use COPY_TO_REGCLASS to work-around the fact that
1308// REG_SEQUENCE patterns don't support instructions with multiple
1309// outputs.
1310def : GCNPat<
1311  (i64 (zext i16:$src)),
1312    (REG_SEQUENCE SReg_64,
1313      (i32 (COPY_TO_REGCLASS (S_AND_B32 $src, (S_MOV_B32 (i32 0xffff))), SGPR_32)), sub0,
1314      (S_MOV_B32 (i32 0)), sub1)
1315>;
1316
1317def : GCNPat <
1318  (i64 (UniformUnaryFrag<sext> i16:$src)),
1319    (REG_SEQUENCE SReg_64, (i32 (S_SEXT_I32_I16 $src)), sub0,
1320    (i32 (COPY_TO_REGCLASS (S_ASHR_I32 (i32 (S_SEXT_I32_I16 $src)), (S_MOV_B32 (i32 31))), SGPR_32)), sub1)
1321>;
1322
1323def : GCNPat<
1324  (i32 (zext i16:$src)),
1325  (S_AND_B32 (S_MOV_B32 (i32 0xffff)), $src)
1326>;
1327
1328
1329//===----------------------------------------------------------------------===//
1330// Target-specific instruction encodings.
1331//===----------------------------------------------------------------------===//
1332
1333//===----------------------------------------------------------------------===//
1334// SOP1 - GFX10.
1335//===----------------------------------------------------------------------===//
1336
1337class Select_gfx10<string opName> : SIMCInstr<opName, SIEncodingFamily.GFX10> {
1338  Predicate AssemblerPredicate = isGFX10Plus;
1339  string DecoderNamespace      = "GFX10";
1340}
1341
1342multiclass SOP1_Real_gfx10<bits<8> op> {
1343  def _gfx10 : SOP1_Real<op, !cast<SOP1_Pseudo>(NAME)>,
1344               Select_gfx10<!cast<SOP1_Pseudo>(NAME).Mnemonic>;
1345}
1346
1347defm S_ANDN1_SAVEEXEC_B64   : SOP1_Real_gfx10<0x037>;
1348defm S_ORN1_SAVEEXEC_B64    : SOP1_Real_gfx10<0x038>;
1349defm S_ANDN1_WREXEC_B64     : SOP1_Real_gfx10<0x039>;
1350defm S_ANDN2_WREXEC_B64     : SOP1_Real_gfx10<0x03a>;
1351defm S_BITREPLICATE_B64_B32 : SOP1_Real_gfx10<0x03b>;
1352defm S_AND_SAVEEXEC_B32     : SOP1_Real_gfx10<0x03c>;
1353defm S_OR_SAVEEXEC_B32      : SOP1_Real_gfx10<0x03d>;
1354defm S_XOR_SAVEEXEC_B32     : SOP1_Real_gfx10<0x03e>;
1355defm S_ANDN2_SAVEEXEC_B32   : SOP1_Real_gfx10<0x03f>;
1356defm S_ORN2_SAVEEXEC_B32    : SOP1_Real_gfx10<0x040>;
1357defm S_NAND_SAVEEXEC_B32    : SOP1_Real_gfx10<0x041>;
1358defm S_NOR_SAVEEXEC_B32     : SOP1_Real_gfx10<0x042>;
1359defm S_XNOR_SAVEEXEC_B32    : SOP1_Real_gfx10<0x043>;
1360defm S_ANDN1_SAVEEXEC_B32   : SOP1_Real_gfx10<0x044>;
1361defm S_ORN1_SAVEEXEC_B32    : SOP1_Real_gfx10<0x045>;
1362defm S_ANDN1_WREXEC_B32     : SOP1_Real_gfx10<0x046>;
1363defm S_ANDN2_WREXEC_B32     : SOP1_Real_gfx10<0x047>;
1364defm S_MOVRELSD_2_B32       : SOP1_Real_gfx10<0x049>;
1365
1366//===----------------------------------------------------------------------===//
1367// SOP1 - GFX6, GFX7.
1368//===----------------------------------------------------------------------===//
1369
1370class Select_gfx6_gfx7<string opName> : SIMCInstr<opName, SIEncodingFamily.SI> {
1371  Predicate AssemblerPredicate = isGFX6GFX7;
1372  string DecoderNamespace      = "GFX6GFX7";
1373}
1374
1375multiclass SOP1_Real_gfx6_gfx7<bits<8> op> {
1376  def _gfx6_gfx7 : SOP1_Real<op, !cast<SOP1_Pseudo>(NAME)>,
1377                   Select_gfx6_gfx7<!cast<SOP1_Pseudo>(NAME).Mnemonic>;
1378}
1379
1380multiclass SOP1_Real_gfx6_gfx7_gfx10<bits<8> op> :
1381  SOP1_Real_gfx6_gfx7<op>, SOP1_Real_gfx10<op>;
1382
1383defm S_CBRANCH_JOIN  : SOP1_Real_gfx6_gfx7<0x032>;
1384defm S_MOV_REGRD_B32 : SOP1_Real_gfx6_gfx7<0x033>;
1385
1386defm S_MOV_B32            : SOP1_Real_gfx6_gfx7_gfx10<0x003>;
1387defm S_MOV_B64            : SOP1_Real_gfx6_gfx7_gfx10<0x004>;
1388defm S_CMOV_B32           : SOP1_Real_gfx6_gfx7_gfx10<0x005>;
1389defm S_CMOV_B64           : SOP1_Real_gfx6_gfx7_gfx10<0x006>;
1390defm S_NOT_B32            : SOP1_Real_gfx6_gfx7_gfx10<0x007>;
1391defm S_NOT_B64            : SOP1_Real_gfx6_gfx7_gfx10<0x008>;
1392defm S_WQM_B32            : SOP1_Real_gfx6_gfx7_gfx10<0x009>;
1393defm S_WQM_B64            : SOP1_Real_gfx6_gfx7_gfx10<0x00a>;
1394defm S_BREV_B32           : SOP1_Real_gfx6_gfx7_gfx10<0x00b>;
1395defm S_BREV_B64           : SOP1_Real_gfx6_gfx7_gfx10<0x00c>;
1396defm S_BCNT0_I32_B32      : SOP1_Real_gfx6_gfx7_gfx10<0x00d>;
1397defm S_BCNT0_I32_B64      : SOP1_Real_gfx6_gfx7_gfx10<0x00e>;
1398defm S_BCNT1_I32_B32      : SOP1_Real_gfx6_gfx7_gfx10<0x00f>;
1399defm S_BCNT1_I32_B64      : SOP1_Real_gfx6_gfx7_gfx10<0x010>;
1400defm S_FF0_I32_B32        : SOP1_Real_gfx6_gfx7_gfx10<0x011>;
1401defm S_FF0_I32_B64        : SOP1_Real_gfx6_gfx7_gfx10<0x012>;
1402defm S_FF1_I32_B32        : SOP1_Real_gfx6_gfx7_gfx10<0x013>;
1403defm S_FF1_I32_B64        : SOP1_Real_gfx6_gfx7_gfx10<0x014>;
1404defm S_FLBIT_I32_B32      : SOP1_Real_gfx6_gfx7_gfx10<0x015>;
1405defm S_FLBIT_I32_B64      : SOP1_Real_gfx6_gfx7_gfx10<0x016>;
1406defm S_FLBIT_I32          : SOP1_Real_gfx6_gfx7_gfx10<0x017>;
1407defm S_FLBIT_I32_I64      : SOP1_Real_gfx6_gfx7_gfx10<0x018>;
1408defm S_SEXT_I32_I8        : SOP1_Real_gfx6_gfx7_gfx10<0x019>;
1409defm S_SEXT_I32_I16       : SOP1_Real_gfx6_gfx7_gfx10<0x01a>;
1410defm S_BITSET0_B32        : SOP1_Real_gfx6_gfx7_gfx10<0x01b>;
1411defm S_BITSET0_B64        : SOP1_Real_gfx6_gfx7_gfx10<0x01c>;
1412defm S_BITSET1_B32        : SOP1_Real_gfx6_gfx7_gfx10<0x01d>;
1413defm S_BITSET1_B64        : SOP1_Real_gfx6_gfx7_gfx10<0x01e>;
1414defm S_GETPC_B64          : SOP1_Real_gfx6_gfx7_gfx10<0x01f>;
1415defm S_SETPC_B64          : SOP1_Real_gfx6_gfx7_gfx10<0x020>;
1416defm S_SWAPPC_B64         : SOP1_Real_gfx6_gfx7_gfx10<0x021>;
1417defm S_RFE_B64            : SOP1_Real_gfx6_gfx7_gfx10<0x022>;
1418defm S_AND_SAVEEXEC_B64   : SOP1_Real_gfx6_gfx7_gfx10<0x024>;
1419defm S_OR_SAVEEXEC_B64    : SOP1_Real_gfx6_gfx7_gfx10<0x025>;
1420defm S_XOR_SAVEEXEC_B64   : SOP1_Real_gfx6_gfx7_gfx10<0x026>;
1421defm S_ANDN2_SAVEEXEC_B64 : SOP1_Real_gfx6_gfx7_gfx10<0x027>;
1422defm S_ORN2_SAVEEXEC_B64  : SOP1_Real_gfx6_gfx7_gfx10<0x028>;
1423defm S_NAND_SAVEEXEC_B64  : SOP1_Real_gfx6_gfx7_gfx10<0x029>;
1424defm S_NOR_SAVEEXEC_B64   : SOP1_Real_gfx6_gfx7_gfx10<0x02a>;
1425defm S_XNOR_SAVEEXEC_B64  : SOP1_Real_gfx6_gfx7_gfx10<0x02b>;
1426defm S_QUADMASK_B32       : SOP1_Real_gfx6_gfx7_gfx10<0x02c>;
1427defm S_QUADMASK_B64       : SOP1_Real_gfx6_gfx7_gfx10<0x02d>;
1428defm S_MOVRELS_B32        : SOP1_Real_gfx6_gfx7_gfx10<0x02e>;
1429defm S_MOVRELS_B64        : SOP1_Real_gfx6_gfx7_gfx10<0x02f>;
1430defm S_MOVRELD_B32        : SOP1_Real_gfx6_gfx7_gfx10<0x030>;
1431defm S_MOVRELD_B64        : SOP1_Real_gfx6_gfx7_gfx10<0x031>;
1432defm S_ABS_I32            : SOP1_Real_gfx6_gfx7_gfx10<0x034>;
1433defm S_MOV_FED_B32        : SOP1_Real_gfx6_gfx7_gfx10<0x035>;
1434
1435//===----------------------------------------------------------------------===//
1436// SOP2 - GFX10.
1437//===----------------------------------------------------------------------===//
1438
1439multiclass SOP2_Real_gfx10<bits<7> op> {
1440  def _gfx10 : SOP2_Real<op, !cast<SOP2_Pseudo>(NAME)>,
1441               Select_gfx10<!cast<SOP2_Pseudo>(NAME).Mnemonic>;
1442}
1443
1444defm S_LSHL1_ADD_U32   : SOP2_Real_gfx10<0x02e>;
1445defm S_LSHL2_ADD_U32   : SOP2_Real_gfx10<0x02f>;
1446defm S_LSHL3_ADD_U32   : SOP2_Real_gfx10<0x030>;
1447defm S_LSHL4_ADD_U32   : SOP2_Real_gfx10<0x031>;
1448defm S_PACK_LL_B32_B16 : SOP2_Real_gfx10<0x032>;
1449defm S_PACK_LH_B32_B16 : SOP2_Real_gfx10<0x033>;
1450defm S_PACK_HH_B32_B16 : SOP2_Real_gfx10<0x034>;
1451defm S_MUL_HI_U32      : SOP2_Real_gfx10<0x035>;
1452defm S_MUL_HI_I32      : SOP2_Real_gfx10<0x036>;
1453
1454//===----------------------------------------------------------------------===//
1455// SOP2 - GFX6, GFX7.
1456//===----------------------------------------------------------------------===//
1457
1458multiclass SOP2_Real_gfx6_gfx7<bits<7> op> {
1459  def _gfx6_gfx7 : SOP2_Real<op, !cast<SOP_Pseudo>(NAME)>,
1460                   Select_gfx6_gfx7<!cast<SOP_Pseudo>(NAME).Mnemonic>;
1461}
1462
1463multiclass SOP2_Real_gfx6_gfx7_gfx10<bits<7> op> :
1464  SOP2_Real_gfx6_gfx7<op>, SOP2_Real_gfx10<op>;
1465
1466defm S_CBRANCH_G_FORK : SOP2_Real_gfx6_gfx7<0x02b>;
1467
1468defm S_ADD_U32     : SOP2_Real_gfx6_gfx7_gfx10<0x000>;
1469defm S_SUB_U32     : SOP2_Real_gfx6_gfx7_gfx10<0x001>;
1470defm S_ADD_I32     : SOP2_Real_gfx6_gfx7_gfx10<0x002>;
1471defm S_SUB_I32     : SOP2_Real_gfx6_gfx7_gfx10<0x003>;
1472defm S_ADDC_U32    : SOP2_Real_gfx6_gfx7_gfx10<0x004>;
1473defm S_SUBB_U32    : SOP2_Real_gfx6_gfx7_gfx10<0x005>;
1474defm S_MIN_I32     : SOP2_Real_gfx6_gfx7_gfx10<0x006>;
1475defm S_MIN_U32     : SOP2_Real_gfx6_gfx7_gfx10<0x007>;
1476defm S_MAX_I32     : SOP2_Real_gfx6_gfx7_gfx10<0x008>;
1477defm S_MAX_U32     : SOP2_Real_gfx6_gfx7_gfx10<0x009>;
1478defm S_CSELECT_B32 : SOP2_Real_gfx6_gfx7_gfx10<0x00a>;
1479defm S_CSELECT_B64 : SOP2_Real_gfx6_gfx7_gfx10<0x00b>;
1480defm S_AND_B32     : SOP2_Real_gfx6_gfx7_gfx10<0x00e>;
1481defm S_AND_B64     : SOP2_Real_gfx6_gfx7_gfx10<0x00f>;
1482defm S_OR_B32      : SOP2_Real_gfx6_gfx7_gfx10<0x010>;
1483defm S_OR_B64      : SOP2_Real_gfx6_gfx7_gfx10<0x011>;
1484defm S_XOR_B32     : SOP2_Real_gfx6_gfx7_gfx10<0x012>;
1485defm S_XOR_B64     : SOP2_Real_gfx6_gfx7_gfx10<0x013>;
1486defm S_ANDN2_B32   : SOP2_Real_gfx6_gfx7_gfx10<0x014>;
1487defm S_ANDN2_B64   : SOP2_Real_gfx6_gfx7_gfx10<0x015>;
1488defm S_ORN2_B32    : SOP2_Real_gfx6_gfx7_gfx10<0x016>;
1489defm S_ORN2_B64    : SOP2_Real_gfx6_gfx7_gfx10<0x017>;
1490defm S_NAND_B32    : SOP2_Real_gfx6_gfx7_gfx10<0x018>;
1491defm S_NAND_B64    : SOP2_Real_gfx6_gfx7_gfx10<0x019>;
1492defm S_NOR_B32     : SOP2_Real_gfx6_gfx7_gfx10<0x01a>;
1493defm S_NOR_B64     : SOP2_Real_gfx6_gfx7_gfx10<0x01b>;
1494defm S_XNOR_B32    : SOP2_Real_gfx6_gfx7_gfx10<0x01c>;
1495defm S_XNOR_B64    : SOP2_Real_gfx6_gfx7_gfx10<0x01d>;
1496defm S_LSHL_B32    : SOP2_Real_gfx6_gfx7_gfx10<0x01e>;
1497defm S_LSHL_B64    : SOP2_Real_gfx6_gfx7_gfx10<0x01f>;
1498defm S_LSHR_B32    : SOP2_Real_gfx6_gfx7_gfx10<0x020>;
1499defm S_LSHR_B64    : SOP2_Real_gfx6_gfx7_gfx10<0x021>;
1500defm S_ASHR_I32    : SOP2_Real_gfx6_gfx7_gfx10<0x022>;
1501defm S_ASHR_I64    : SOP2_Real_gfx6_gfx7_gfx10<0x023>;
1502defm S_BFM_B32     : SOP2_Real_gfx6_gfx7_gfx10<0x024>;
1503defm S_BFM_B64     : SOP2_Real_gfx6_gfx7_gfx10<0x025>;
1504defm S_MUL_I32     : SOP2_Real_gfx6_gfx7_gfx10<0x026>;
1505defm S_BFE_U32     : SOP2_Real_gfx6_gfx7_gfx10<0x027>;
1506defm S_BFE_I32     : SOP2_Real_gfx6_gfx7_gfx10<0x028>;
1507defm S_BFE_U64     : SOP2_Real_gfx6_gfx7_gfx10<0x029>;
1508defm S_BFE_I64     : SOP2_Real_gfx6_gfx7_gfx10<0x02a>;
1509defm S_ABSDIFF_I32 : SOP2_Real_gfx6_gfx7_gfx10<0x02c>;
1510
1511//===----------------------------------------------------------------------===//
1512// SOPK - GFX10.
1513//===----------------------------------------------------------------------===//
1514
1515multiclass SOPK_Real32_gfx10<bits<5> op> {
1516  def _gfx10 : SOPK_Real32<op, !cast<SOPK_Pseudo>(NAME)>,
1517               Select_gfx10<!cast<SOPK_Pseudo>(NAME).Mnemonic>;
1518}
1519
1520multiclass SOPK_Real64_gfx10<bits<5> op> {
1521  def _gfx10 : SOPK_Real64<op, !cast<SOPK_Pseudo>(NAME)>,
1522               Select_gfx10<!cast<SOPK_Pseudo>(NAME).Mnemonic>;
1523}
1524
1525defm S_VERSION              : SOPK_Real32_gfx10<0x001>;
1526defm S_CALL_B64             : SOPK_Real32_gfx10<0x016>;
1527defm S_WAITCNT_VSCNT        : SOPK_Real32_gfx10<0x017>;
1528defm S_WAITCNT_VMCNT        : SOPK_Real32_gfx10<0x018>;
1529defm S_WAITCNT_EXPCNT       : SOPK_Real32_gfx10<0x019>;
1530defm S_WAITCNT_LGKMCNT      : SOPK_Real32_gfx10<0x01a>;
1531defm S_SUBVECTOR_LOOP_BEGIN : SOPK_Real32_gfx10<0x01b>;
1532defm S_SUBVECTOR_LOOP_END   : SOPK_Real32_gfx10<0x01c>;
1533
1534//===----------------------------------------------------------------------===//
1535// SOPK - GFX6, GFX7.
1536//===----------------------------------------------------------------------===//
1537
1538multiclass SOPK_Real32_gfx6_gfx7<bits<5> op> {
1539  def _gfx6_gfx7 : SOPK_Real32<op, !cast<SOPK_Pseudo>(NAME)>,
1540                   Select_gfx6_gfx7<!cast<SOPK_Pseudo>(NAME).Mnemonic>;
1541}
1542
1543multiclass SOPK_Real64_gfx6_gfx7<bits<5> op> {
1544  def _gfx6_gfx7 : SOPK_Real64<op, !cast<SOPK_Pseudo>(NAME)>,
1545                   Select_gfx6_gfx7<!cast<SOPK_Pseudo>(NAME).Mnemonic>;
1546}
1547
1548multiclass SOPK_Real32_gfx6_gfx7_gfx10<bits<5> op> :
1549  SOPK_Real32_gfx6_gfx7<op>, SOPK_Real32_gfx10<op>;
1550
1551multiclass SOPK_Real64_gfx6_gfx7_gfx10<bits<5> op> :
1552  SOPK_Real64_gfx6_gfx7<op>, SOPK_Real64_gfx10<op>;
1553
1554defm S_CBRANCH_I_FORK : SOPK_Real32_gfx6_gfx7<0x011>;
1555
1556defm S_MOVK_I32         : SOPK_Real32_gfx6_gfx7_gfx10<0x000>;
1557defm S_CMOVK_I32        : SOPK_Real32_gfx6_gfx7_gfx10<0x002>;
1558defm S_CMPK_EQ_I32      : SOPK_Real32_gfx6_gfx7_gfx10<0x003>;
1559defm S_CMPK_LG_I32      : SOPK_Real32_gfx6_gfx7_gfx10<0x004>;
1560defm S_CMPK_GT_I32      : SOPK_Real32_gfx6_gfx7_gfx10<0x005>;
1561defm S_CMPK_GE_I32      : SOPK_Real32_gfx6_gfx7_gfx10<0x006>;
1562defm S_CMPK_LT_I32      : SOPK_Real32_gfx6_gfx7_gfx10<0x007>;
1563defm S_CMPK_LE_I32      : SOPK_Real32_gfx6_gfx7_gfx10<0x008>;
1564defm S_CMPK_EQ_U32      : SOPK_Real32_gfx6_gfx7_gfx10<0x009>;
1565defm S_CMPK_LG_U32      : SOPK_Real32_gfx6_gfx7_gfx10<0x00a>;
1566defm S_CMPK_GT_U32      : SOPK_Real32_gfx6_gfx7_gfx10<0x00b>;
1567defm S_CMPK_GE_U32      : SOPK_Real32_gfx6_gfx7_gfx10<0x00c>;
1568defm S_CMPK_LT_U32      : SOPK_Real32_gfx6_gfx7_gfx10<0x00d>;
1569defm S_CMPK_LE_U32      : SOPK_Real32_gfx6_gfx7_gfx10<0x00e>;
1570defm S_ADDK_I32         : SOPK_Real32_gfx6_gfx7_gfx10<0x00f>;
1571defm S_MULK_I32         : SOPK_Real32_gfx6_gfx7_gfx10<0x010>;
1572defm S_GETREG_B32       : SOPK_Real32_gfx6_gfx7_gfx10<0x012>;
1573defm S_SETREG_B32       : SOPK_Real32_gfx6_gfx7_gfx10<0x013>;
1574defm S_SETREG_IMM32_B32 : SOPK_Real64_gfx6_gfx7_gfx10<0x015>;
1575
1576//===----------------------------------------------------------------------===//
1577// GFX8, GFX9 (VI).
1578//===----------------------------------------------------------------------===//
1579
1580class Select_vi<string opName> :
1581  SIMCInstr<opName, SIEncodingFamily.VI> {
1582  Predicate AssemblerPredicate = isGFX8GFX9;
1583  string DecoderNamespace = "GFX8";
1584}
1585
1586class SOP1_Real_vi<bits<8> op, SOP1_Pseudo ps> :
1587  SOP1_Real<op, ps>,
1588  Select_vi<ps.Mnemonic>;
1589
1590
1591class SOP2_Real_vi<bits<7> op, SOP2_Pseudo ps> :
1592  SOP2_Real<op, ps>,
1593  Select_vi<ps.Mnemonic>;
1594
1595class SOPK_Real_vi<bits<5> op, SOPK_Pseudo ps> :
1596  SOPK_Real32<op, ps>,
1597  Select_vi<ps.Mnemonic>;
1598
1599def S_MOV_B32_vi           : SOP1_Real_vi <0x00, S_MOV_B32>;
1600def S_MOV_B64_vi           : SOP1_Real_vi <0x01, S_MOV_B64>;
1601def S_CMOV_B32_vi          : SOP1_Real_vi <0x02, S_CMOV_B32>;
1602def S_CMOV_B64_vi          : SOP1_Real_vi <0x03, S_CMOV_B64>;
1603def S_NOT_B32_vi           : SOP1_Real_vi <0x04, S_NOT_B32>;
1604def S_NOT_B64_vi           : SOP1_Real_vi <0x05, S_NOT_B64>;
1605def S_WQM_B32_vi           : SOP1_Real_vi <0x06, S_WQM_B32>;
1606def S_WQM_B64_vi           : SOP1_Real_vi <0x07, S_WQM_B64>;
1607def S_BREV_B32_vi          : SOP1_Real_vi <0x08, S_BREV_B32>;
1608def S_BREV_B64_vi          : SOP1_Real_vi <0x09, S_BREV_B64>;
1609def S_BCNT0_I32_B32_vi     : SOP1_Real_vi <0x0a, S_BCNT0_I32_B32>;
1610def S_BCNT0_I32_B64_vi     : SOP1_Real_vi <0x0b, S_BCNT0_I32_B64>;
1611def S_BCNT1_I32_B32_vi     : SOP1_Real_vi <0x0c, S_BCNT1_I32_B32>;
1612def S_BCNT1_I32_B64_vi     : SOP1_Real_vi <0x0d, S_BCNT1_I32_B64>;
1613def S_FF0_I32_B32_vi       : SOP1_Real_vi <0x0e, S_FF0_I32_B32>;
1614def S_FF0_I32_B64_vi       : SOP1_Real_vi <0x0f, S_FF0_I32_B64>;
1615def S_FF1_I32_B32_vi       : SOP1_Real_vi <0x10, S_FF1_I32_B32>;
1616def S_FF1_I32_B64_vi       : SOP1_Real_vi <0x11, S_FF1_I32_B64>;
1617def S_FLBIT_I32_B32_vi     : SOP1_Real_vi <0x12, S_FLBIT_I32_B32>;
1618def S_FLBIT_I32_B64_vi     : SOP1_Real_vi <0x13, S_FLBIT_I32_B64>;
1619def S_FLBIT_I32_vi         : SOP1_Real_vi <0x14, S_FLBIT_I32>;
1620def S_FLBIT_I32_I64_vi     : SOP1_Real_vi <0x15, S_FLBIT_I32_I64>;
1621def S_SEXT_I32_I8_vi       : SOP1_Real_vi <0x16, S_SEXT_I32_I8>;
1622def S_SEXT_I32_I16_vi      : SOP1_Real_vi <0x17, S_SEXT_I32_I16>;
1623def S_BITSET0_B32_vi       : SOP1_Real_vi <0x18, S_BITSET0_B32>;
1624def S_BITSET0_B64_vi       : SOP1_Real_vi <0x19, S_BITSET0_B64>;
1625def S_BITSET1_B32_vi       : SOP1_Real_vi <0x1a, S_BITSET1_B32>;
1626def S_BITSET1_B64_vi       : SOP1_Real_vi <0x1b, S_BITSET1_B64>;
1627def S_GETPC_B64_vi         : SOP1_Real_vi <0x1c, S_GETPC_B64>;
1628def S_SETPC_B64_vi         : SOP1_Real_vi <0x1d, S_SETPC_B64>;
1629def S_SWAPPC_B64_vi        : SOP1_Real_vi <0x1e, S_SWAPPC_B64>;
1630def S_RFE_B64_vi           : SOP1_Real_vi <0x1f, S_RFE_B64>;
1631def S_AND_SAVEEXEC_B64_vi  : SOP1_Real_vi <0x20, S_AND_SAVEEXEC_B64>;
1632def S_OR_SAVEEXEC_B64_vi   : SOP1_Real_vi <0x21, S_OR_SAVEEXEC_B64>;
1633def S_XOR_SAVEEXEC_B64_vi  : SOP1_Real_vi <0x22, S_XOR_SAVEEXEC_B64>;
1634def S_ANDN2_SAVEEXEC_B64_vi: SOP1_Real_vi <0x23, S_ANDN2_SAVEEXEC_B64>;
1635def S_ORN2_SAVEEXEC_B64_vi : SOP1_Real_vi <0x24, S_ORN2_SAVEEXEC_B64>;
1636def S_NAND_SAVEEXEC_B64_vi : SOP1_Real_vi <0x25, S_NAND_SAVEEXEC_B64>;
1637def S_NOR_SAVEEXEC_B64_vi  : SOP1_Real_vi <0x26, S_NOR_SAVEEXEC_B64>;
1638def S_XNOR_SAVEEXEC_B64_vi : SOP1_Real_vi <0x27, S_XNOR_SAVEEXEC_B64>;
1639def S_QUADMASK_B32_vi      : SOP1_Real_vi <0x28, S_QUADMASK_B32>;
1640def S_QUADMASK_B64_vi      : SOP1_Real_vi <0x29, S_QUADMASK_B64>;
1641def S_MOVRELS_B32_vi       : SOP1_Real_vi <0x2a, S_MOVRELS_B32>;
1642def S_MOVRELS_B64_vi       : SOP1_Real_vi <0x2b, S_MOVRELS_B64>;
1643def S_MOVRELD_B32_vi       : SOP1_Real_vi <0x2c, S_MOVRELD_B32>;
1644def S_MOVRELD_B64_vi       : SOP1_Real_vi <0x2d, S_MOVRELD_B64>;
1645def S_CBRANCH_JOIN_vi      : SOP1_Real_vi <0x2e, S_CBRANCH_JOIN>;
1646def S_MOV_REGRD_B32_vi     : SOP1_Real_vi <0x2f, S_MOV_REGRD_B32>;
1647def S_ABS_I32_vi           : SOP1_Real_vi <0x30, S_ABS_I32>;
1648def S_MOV_FED_B32_vi       : SOP1_Real_vi <0x31, S_MOV_FED_B32>;
1649def S_SET_GPR_IDX_IDX_vi   : SOP1_Real_vi <0x32, S_SET_GPR_IDX_IDX>;
1650
1651def S_ADD_U32_vi           : SOP2_Real_vi <0x00, S_ADD_U32>;
1652def S_ADD_I32_vi           : SOP2_Real_vi <0x02, S_ADD_I32>;
1653def S_SUB_U32_vi           : SOP2_Real_vi <0x01, S_SUB_U32>;
1654def S_SUB_I32_vi           : SOP2_Real_vi <0x03, S_SUB_I32>;
1655def S_ADDC_U32_vi          : SOP2_Real_vi <0x04, S_ADDC_U32>;
1656def S_SUBB_U32_vi          : SOP2_Real_vi <0x05, S_SUBB_U32>;
1657def S_MIN_I32_vi           : SOP2_Real_vi <0x06, S_MIN_I32>;
1658def S_MIN_U32_vi           : SOP2_Real_vi <0x07, S_MIN_U32>;
1659def S_MAX_I32_vi           : SOP2_Real_vi <0x08, S_MAX_I32>;
1660def S_MAX_U32_vi           : SOP2_Real_vi <0x09, S_MAX_U32>;
1661def S_CSELECT_B32_vi       : SOP2_Real_vi <0x0a, S_CSELECT_B32>;
1662def S_CSELECT_B64_vi       : SOP2_Real_vi <0x0b, S_CSELECT_B64>;
1663def S_AND_B32_vi           : SOP2_Real_vi <0x0c, S_AND_B32>;
1664def S_AND_B64_vi           : SOP2_Real_vi <0x0d, S_AND_B64>;
1665def S_OR_B32_vi            : SOP2_Real_vi <0x0e, S_OR_B32>;
1666def S_OR_B64_vi            : SOP2_Real_vi <0x0f, S_OR_B64>;
1667def S_XOR_B32_vi           : SOP2_Real_vi <0x10, S_XOR_B32>;
1668def S_XOR_B64_vi           : SOP2_Real_vi <0x11, S_XOR_B64>;
1669def S_ANDN2_B32_vi         : SOP2_Real_vi <0x12, S_ANDN2_B32>;
1670def S_ANDN2_B64_vi         : SOP2_Real_vi <0x13, S_ANDN2_B64>;
1671def S_ORN2_B32_vi          : SOP2_Real_vi <0x14, S_ORN2_B32>;
1672def S_ORN2_B64_vi          : SOP2_Real_vi <0x15, S_ORN2_B64>;
1673def S_NAND_B32_vi          : SOP2_Real_vi <0x16, S_NAND_B32>;
1674def S_NAND_B64_vi          : SOP2_Real_vi <0x17, S_NAND_B64>;
1675def S_NOR_B32_vi           : SOP2_Real_vi <0x18, S_NOR_B32>;
1676def S_NOR_B64_vi           : SOP2_Real_vi <0x19, S_NOR_B64>;
1677def S_XNOR_B32_vi          : SOP2_Real_vi <0x1a, S_XNOR_B32>;
1678def S_XNOR_B64_vi          : SOP2_Real_vi <0x1b, S_XNOR_B64>;
1679def S_LSHL_B32_vi          : SOP2_Real_vi <0x1c, S_LSHL_B32>;
1680def S_LSHL_B64_vi          : SOP2_Real_vi <0x1d, S_LSHL_B64>;
1681def S_LSHR_B32_vi          : SOP2_Real_vi <0x1e, S_LSHR_B32>;
1682def S_LSHR_B64_vi          : SOP2_Real_vi <0x1f, S_LSHR_B64>;
1683def S_ASHR_I32_vi          : SOP2_Real_vi <0x20, S_ASHR_I32>;
1684def S_ASHR_I64_vi          : SOP2_Real_vi <0x21, S_ASHR_I64>;
1685def S_BFM_B32_vi           : SOP2_Real_vi <0x22, S_BFM_B32>;
1686def S_BFM_B64_vi           : SOP2_Real_vi <0x23, S_BFM_B64>;
1687def S_MUL_I32_vi           : SOP2_Real_vi <0x24, S_MUL_I32>;
1688def S_BFE_U32_vi           : SOP2_Real_vi <0x25, S_BFE_U32>;
1689def S_BFE_I32_vi           : SOP2_Real_vi <0x26, S_BFE_I32>;
1690def S_BFE_U64_vi           : SOP2_Real_vi <0x27, S_BFE_U64>;
1691def S_BFE_I64_vi           : SOP2_Real_vi <0x28, S_BFE_I64>;
1692def S_CBRANCH_G_FORK_vi    : SOP2_Real_vi <0x29, S_CBRANCH_G_FORK>;
1693def S_ABSDIFF_I32_vi       : SOP2_Real_vi <0x2a, S_ABSDIFF_I32>;
1694def S_PACK_LL_B32_B16_vi   : SOP2_Real_vi <0x32, S_PACK_LL_B32_B16>;
1695def S_PACK_LH_B32_B16_vi   : SOP2_Real_vi <0x33, S_PACK_LH_B32_B16>;
1696def S_PACK_HH_B32_B16_vi   : SOP2_Real_vi <0x34, S_PACK_HH_B32_B16>;
1697def S_RFE_RESTORE_B64_vi   : SOP2_Real_vi <0x2b, S_RFE_RESTORE_B64>;
1698
1699def S_MOVK_I32_vi          : SOPK_Real_vi <0x00, S_MOVK_I32>;
1700def S_CMOVK_I32_vi         : SOPK_Real_vi <0x01, S_CMOVK_I32>;
1701def S_CMPK_EQ_I32_vi       : SOPK_Real_vi <0x02, S_CMPK_EQ_I32>;
1702def S_CMPK_LG_I32_vi       : SOPK_Real_vi <0x03, S_CMPK_LG_I32>;
1703def S_CMPK_GT_I32_vi       : SOPK_Real_vi <0x04, S_CMPK_GT_I32>;
1704def S_CMPK_GE_I32_vi       : SOPK_Real_vi <0x05, S_CMPK_GE_I32>;
1705def S_CMPK_LT_I32_vi       : SOPK_Real_vi <0x06, S_CMPK_LT_I32>;
1706def S_CMPK_LE_I32_vi       : SOPK_Real_vi <0x07, S_CMPK_LE_I32>;
1707def S_CMPK_EQ_U32_vi       : SOPK_Real_vi <0x08, S_CMPK_EQ_U32>;
1708def S_CMPK_LG_U32_vi       : SOPK_Real_vi <0x09, S_CMPK_LG_U32>;
1709def S_CMPK_GT_U32_vi       : SOPK_Real_vi <0x0A, S_CMPK_GT_U32>;
1710def S_CMPK_GE_U32_vi       : SOPK_Real_vi <0x0B, S_CMPK_GE_U32>;
1711def S_CMPK_LT_U32_vi       : SOPK_Real_vi <0x0C, S_CMPK_LT_U32>;
1712def S_CMPK_LE_U32_vi       : SOPK_Real_vi <0x0D, S_CMPK_LE_U32>;
1713def S_ADDK_I32_vi          : SOPK_Real_vi <0x0E, S_ADDK_I32>;
1714def S_MULK_I32_vi          : SOPK_Real_vi <0x0F, S_MULK_I32>;
1715def S_CBRANCH_I_FORK_vi    : SOPK_Real_vi <0x10, S_CBRANCH_I_FORK>;
1716def S_GETREG_B32_vi        : SOPK_Real_vi <0x11, S_GETREG_B32>;
1717def S_SETREG_B32_vi        : SOPK_Real_vi <0x12, S_SETREG_B32>;
1718//def S_GETREG_REGRD_B32_vi  : SOPK_Real_vi <0x13, S_GETREG_REGRD_B32>; // see pseudo for comments
1719def S_SETREG_IMM32_B32_vi  : SOPK_Real64<0x14, S_SETREG_IMM32_B32>,
1720                             Select_vi<S_SETREG_IMM32_B32.Mnemonic>;
1721
1722def S_CALL_B64_vi          : SOPK_Real_vi <0x15, S_CALL_B64>;
1723
1724//===----------------------------------------------------------------------===//
1725// SOP1 - GFX9.
1726//===----------------------------------------------------------------------===//
1727
1728def S_ANDN1_SAVEEXEC_B64_vi   : SOP1_Real_vi<0x33, S_ANDN1_SAVEEXEC_B64>;
1729def S_ORN1_SAVEEXEC_B64_vi    : SOP1_Real_vi<0x34, S_ORN1_SAVEEXEC_B64>;
1730def S_ANDN1_WREXEC_B64_vi     : SOP1_Real_vi<0x35, S_ANDN1_WREXEC_B64>;
1731def S_ANDN2_WREXEC_B64_vi     : SOP1_Real_vi<0x36, S_ANDN2_WREXEC_B64>;
1732def S_BITREPLICATE_B64_B32_vi : SOP1_Real_vi<0x37, S_BITREPLICATE_B64_B32>;
1733
1734//===----------------------------------------------------------------------===//
1735// SOP2 - GFX9.
1736//===----------------------------------------------------------------------===//
1737
1738def S_LSHL1_ADD_U32_vi   : SOP2_Real_vi<0x2e, S_LSHL1_ADD_U32>;
1739def S_LSHL2_ADD_U32_vi   : SOP2_Real_vi<0x2f, S_LSHL2_ADD_U32>;
1740def S_LSHL3_ADD_U32_vi   : SOP2_Real_vi<0x30, S_LSHL3_ADD_U32>;
1741def S_LSHL4_ADD_U32_vi   : SOP2_Real_vi<0x31, S_LSHL4_ADD_U32>;
1742def S_MUL_HI_U32_vi      : SOP2_Real_vi<0x2c, S_MUL_HI_U32>;
1743def S_MUL_HI_I32_vi      : SOP2_Real_vi<0x2d, S_MUL_HI_I32>;
1744