• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1//===-- SOPInstructions.td - SOP Instruction Defintions -------------------===//
2//
3//                     The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10def GPRIdxModeMatchClass : AsmOperandClass {
11  let Name = "GPRIdxMode";
12  let PredicateMethod = "isGPRIdxMode";
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  let SubtargetPredicate = isGCN;
30
31  string Mnemonic = opName;
32  string AsmOperands = asmOps;
33
34  bits<1> has_sdst = 0;
35}
36
37//===----------------------------------------------------------------------===//
38// SOP1 Instructions
39//===----------------------------------------------------------------------===//
40
41class SOP1_Pseudo <string opName, dag outs, dag ins,
42                   string asmOps, list<dag> pattern=[]> :
43  SOP_Pseudo<opName, outs, ins, asmOps, pattern> {
44
45  let mayLoad = 0;
46  let mayStore = 0;
47  let hasSideEffects = 0;
48  let SALU = 1;
49  let SOP1 = 1;
50  let SchedRW = [WriteSALU];
51  let Size = 4;
52  let UseNamedOperandTable = 1;
53
54  bits<1> has_src0 = 1;
55  bits<1> has_sdst = 1;
56}
57
58class SOP1_Real<bits<8> op, SOP1_Pseudo ps> :
59  InstSI <ps.OutOperandList, ps.InOperandList,
60          ps.Mnemonic # " " # ps.AsmOperands, []>,
61  Enc32 {
62
63  let isPseudo = 0;
64  let isCodeGenOnly = 0;
65  let Size = 4;
66
67  // copy relevant pseudo op flags
68  let SubtargetPredicate = ps.SubtargetPredicate;
69  let AsmMatchConverter  = ps.AsmMatchConverter;
70
71  // encoding
72  bits<7> sdst;
73  bits<8> src0;
74
75  let Inst{7-0} = !if(ps.has_src0, src0, ?);
76  let Inst{15-8} = op;
77  let Inst{22-16} = !if(ps.has_sdst, sdst, ?);
78  let Inst{31-23} = 0x17d; //encoding;
79}
80
81class SOP1_32 <string opName, list<dag> pattern=[]> : SOP1_Pseudo <
82  opName, (outs SReg_32:$sdst), (ins SSrc_b32:$src0),
83  "$sdst, $src0", pattern
84>;
85
86// 32-bit input, no output.
87class SOP1_0_32 <string opName, list<dag> pattern = []> : SOP1_Pseudo <
88  opName, (outs), (ins SSrc_b32:$src0),
89  "$src0", pattern> {
90  let has_sdst = 0;
91}
92
93class SOP1_0_32R <string opName, list<dag> pattern = []> : SOP1_Pseudo <
94  opName, (outs), (ins SReg_32:$src0),
95  "$src0", pattern> {
96  let has_sdst = 0;
97}
98
99class SOP1_64 <string opName, list<dag> pattern=[]> : SOP1_Pseudo <
100  opName, (outs SReg_64:$sdst), (ins SSrc_b64:$src0),
101  "$sdst, $src0", pattern
102>;
103
104// 64-bit input, 32-bit output.
105class SOP1_32_64 <string opName, list<dag> pattern=[]> : SOP1_Pseudo <
106  opName, (outs SReg_32:$sdst), (ins SSrc_b64:$src0),
107  "$sdst, $src0", pattern
108>;
109
110// 32-bit input, 64-bit output.
111class SOP1_64_32 <string opName, list<dag> pattern=[]> : SOP1_Pseudo <
112  opName, (outs SReg_64:$sdst), (ins SSrc_b32:$src0),
113  "$sdst, $src0", pattern
114>;
115
116// no input, 64-bit output.
117class SOP1_64_0 <string opName, list<dag> pattern=[]> : SOP1_Pseudo <
118  opName, (outs SReg_64:$sdst), (ins), "$sdst", pattern> {
119  let has_src0 = 0;
120}
121
122// 64-bit input, no output
123class SOP1_1 <string opName, list<dag> pattern=[]> : SOP1_Pseudo <
124  opName, (outs), (ins SReg_64:$src0), "$src0", pattern> {
125  let has_sdst = 0;
126}
127
128
129let isMoveImm = 1 in {
130  let isReMaterializable = 1, isAsCheapAsAMove = 1 in {
131    def S_MOV_B32 : SOP1_32 <"s_mov_b32">;
132    def S_MOV_B64 : SOP1_64 <"s_mov_b64">;
133  } // End isRematerializeable = 1
134
135  let Uses = [SCC] in {
136    def S_CMOV_B32 : SOP1_32 <"s_cmov_b32">;
137    def S_CMOV_B64 : SOP1_64 <"s_cmov_b64">;
138  } // End Uses = [SCC]
139} // End isMoveImm = 1
140
141let Defs = [SCC] in {
142  def S_NOT_B32 : SOP1_32 <"s_not_b32",
143    [(set i32:$sdst, (not i32:$src0))]
144  >;
145
146  def S_NOT_B64 : SOP1_64 <"s_not_b64",
147    [(set i64:$sdst, (not i64:$src0))]
148  >;
149  def S_WQM_B32 : SOP1_32 <"s_wqm_b32">;
150  def S_WQM_B64 : SOP1_64 <"s_wqm_b64",
151    [(set i1:$sdst, (int_amdgcn_wqm_vote i1:$src0))]
152  >;
153} // End Defs = [SCC]
154
155
156def S_BREV_B32 : SOP1_32 <"s_brev_b32",
157  [(set i32:$sdst, (bitreverse i32:$src0))]
158>;
159def S_BREV_B64 : SOP1_64 <"s_brev_b64">;
160
161let Defs = [SCC] in {
162def S_BCNT0_I32_B32 : SOP1_32 <"s_bcnt0_i32_b32">;
163def S_BCNT0_I32_B64 : SOP1_32_64 <"s_bcnt0_i32_b64">;
164def S_BCNT1_I32_B32 : SOP1_32 <"s_bcnt1_i32_b32",
165  [(set i32:$sdst, (ctpop i32:$src0))]
166>;
167def S_BCNT1_I32_B64 : SOP1_32_64 <"s_bcnt1_i32_b64">;
168} // End Defs = [SCC]
169
170def S_FF0_I32_B32 : SOP1_32 <"s_ff0_i32_b32">;
171def S_FF0_I32_B64 : SOP1_32_64 <"s_ff0_i32_b64">;
172def S_FF1_I32_B64 : SOP1_32_64 <"s_ff1_i32_b64">;
173
174def S_FF1_I32_B32 : SOP1_32 <"s_ff1_i32_b32",
175  [(set i32:$sdst, (AMDGPUffbl_b32 i32:$src0))]
176>;
177
178def S_FLBIT_I32_B32 : SOP1_32 <"s_flbit_i32_b32",
179  [(set i32:$sdst, (AMDGPUffbh_u32 i32:$src0))]
180>;
181
182def S_FLBIT_I32_B64 : SOP1_32_64 <"s_flbit_i32_b64">;
183def S_FLBIT_I32 : SOP1_32 <"s_flbit_i32",
184  [(set i32:$sdst, (AMDGPUffbh_i32 i32:$src0))]
185>;
186def S_FLBIT_I32_I64 : SOP1_32_64 <"s_flbit_i32_i64">;
187def S_SEXT_I32_I8 : SOP1_32 <"s_sext_i32_i8",
188  [(set i32:$sdst, (sext_inreg i32:$src0, i8))]
189>;
190def S_SEXT_I32_I16 : SOP1_32 <"s_sext_i32_i16",
191  [(set i32:$sdst, (sext_inreg i32:$src0, i16))]
192>;
193
194def S_BITSET0_B32 : SOP1_32    <"s_bitset0_b32">;
195def S_BITSET0_B64 : SOP1_64_32 <"s_bitset0_b64">;
196def S_BITSET1_B32 : SOP1_32    <"s_bitset1_b32">;
197def S_BITSET1_B64 : SOP1_64_32 <"s_bitset1_b64">;
198def S_GETPC_B64 : SOP1_64_0  <"s_getpc_b64",
199  [(set i64:$sdst, (int_amdgcn_s_getpc))]
200>;
201
202let isTerminator = 1, isBarrier = 1, SchedRW = [WriteBranch] in {
203
204let isBranch = 1, isIndirectBranch = 1 in {
205def S_SETPC_B64 : SOP1_1  <"s_setpc_b64">;
206} // End isBranch = 1, isIndirectBranch = 1
207
208let isReturn = 1 in {
209// Define variant marked as return rather than branch.
210def S_SETPC_B64_return : SOP1_1<"", [(AMDGPUret_flag i64:$src0)]>;
211}
212} // End isTerminator = 1, isBarrier = 1
213
214let isCall = 1 in {
215def S_SWAPPC_B64 : SOP1_64 <"s_swappc_b64"
216>;
217}
218
219def S_RFE_B64 : SOP1_1  <"s_rfe_b64">;
220
221let hasSideEffects = 1, Uses = [EXEC], Defs = [EXEC, SCC] in {
222
223def S_AND_SAVEEXEC_B64 : SOP1_64 <"s_and_saveexec_b64">;
224def S_OR_SAVEEXEC_B64 : SOP1_64 <"s_or_saveexec_b64">;
225def S_XOR_SAVEEXEC_B64 : SOP1_64 <"s_xor_saveexec_b64">;
226def S_ANDN2_SAVEEXEC_B64 : SOP1_64 <"s_andn2_saveexec_b64">;
227def S_ORN2_SAVEEXEC_B64 : SOP1_64 <"s_orn2_saveexec_b64">;
228def S_NAND_SAVEEXEC_B64 : SOP1_64 <"s_nand_saveexec_b64">;
229def S_NOR_SAVEEXEC_B64 : SOP1_64 <"s_nor_saveexec_b64">;
230def S_XNOR_SAVEEXEC_B64 : SOP1_64 <"s_xnor_saveexec_b64">;
231
232} // End hasSideEffects = 1, Uses = [EXEC], Defs = [EXEC, SCC]
233
234def S_QUADMASK_B32 : SOP1_32 <"s_quadmask_b32">;
235def S_QUADMASK_B64 : SOP1_64 <"s_quadmask_b64">;
236
237let Uses = [M0] in {
238def S_MOVRELS_B32 : SOP1_32 <"s_movrels_b32">;
239def S_MOVRELS_B64 : SOP1_64 <"s_movrels_b64">;
240def S_MOVRELD_B32 : SOP1_32 <"s_movreld_b32">;
241def S_MOVRELD_B64 : SOP1_64 <"s_movreld_b64">;
242} // End Uses = [M0]
243
244def S_CBRANCH_JOIN : SOP1_0_32R <"s_cbranch_join">;
245def S_MOV_REGRD_B32 : SOP1_32 <"s_mov_regrd_b32">;
246let Defs = [SCC] in {
247def S_ABS_I32 : SOP1_32 <"s_abs_i32">;
248} // End Defs = [SCC]
249def S_MOV_FED_B32 : SOP1_32 <"s_mov_fed_b32">;
250
251let SubtargetPredicate = HasVGPRIndexMode in {
252def S_SET_GPR_IDX_IDX : SOP1_0_32<"s_set_gpr_idx_idx"> {
253  let Uses = [M0];
254  let Defs = [M0];
255}
256}
257
258let SubtargetPredicate = isGFX9 in {
259  let hasSideEffects = 1, Defs = [EXEC, SCC], Uses = [EXEC] in {
260    def S_ANDN1_SAVEEXEC_B64 : SOP1_64<"s_andn1_saveexec_b64">;
261    def S_ORN1_SAVEEXEC_B64  : SOP1_64<"s_orn1_saveexec_b64">;
262    def S_ANDN1_WREXEC_B64   : SOP1_64<"s_andn1_wrexec_b64">;
263    def S_ANDN2_WREXEC_B64   : SOP1_64<"s_andn2_wrexec_b64">;
264  } // End hasSideEffects = 1, Defs = [EXEC, SCC], Uses = [EXEC]
265
266  def S_BITREPLICATE_B64_B32 : SOP1_64_32<"s_bitreplicate_b64_b32">;
267} // End SubtargetPredicate = isGFX9
268
269//===----------------------------------------------------------------------===//
270// SOP2 Instructions
271//===----------------------------------------------------------------------===//
272
273class SOP2_Pseudo<string opName, dag outs, dag ins,
274                  string asmOps, list<dag> pattern=[]> :
275  SOP_Pseudo<opName, outs, ins, asmOps, pattern> {
276
277  let mayLoad = 0;
278  let mayStore = 0;
279  let hasSideEffects = 0;
280  let SALU = 1;
281  let SOP2 = 1;
282  let SchedRW = [WriteSALU];
283  let UseNamedOperandTable = 1;
284
285  let has_sdst = 1;
286
287  // Pseudo instructions have no encodings, but adding this field here allows
288  // us to do:
289  // let sdst = xxx in {
290  // for multiclasses that include both real and pseudo instructions.
291  // field bits<7> sdst = 0;
292  // let Size = 4; // Do we need size here?
293}
294
295class SOP2_Real<bits<7> op, SOP_Pseudo ps> :
296  InstSI <ps.OutOperandList, ps.InOperandList,
297          ps.Mnemonic # " " # ps.AsmOperands, []>,
298  Enc32 {
299  let isPseudo = 0;
300  let isCodeGenOnly = 0;
301
302  // copy relevant pseudo op flags
303  let SubtargetPredicate = ps.SubtargetPredicate;
304  let AsmMatchConverter  = ps.AsmMatchConverter;
305
306  // encoding
307  bits<7> sdst;
308  bits<8> src0;
309  bits<8> src1;
310
311  let Inst{7-0}   = src0;
312  let Inst{15-8}  = src1;
313  let Inst{22-16} = !if(ps.has_sdst, sdst, ?);
314  let Inst{29-23} = op;
315  let Inst{31-30} = 0x2; // encoding
316}
317
318
319class SOP2_32 <string opName, list<dag> pattern=[]> : SOP2_Pseudo <
320  opName, (outs SReg_32:$sdst), (ins SSrc_b32:$src0, SSrc_b32:$src1),
321  "$sdst, $src0, $src1", pattern
322>;
323
324class SOP2_64 <string opName, list<dag> pattern=[]> : SOP2_Pseudo <
325  opName, (outs SReg_64:$sdst), (ins SSrc_b64:$src0, SSrc_b64:$src1),
326  "$sdst, $src0, $src1", pattern
327>;
328
329class SOP2_64_32 <string opName, list<dag> pattern=[]> : SOP2_Pseudo <
330  opName, (outs SReg_64:$sdst), (ins SSrc_b64:$src0, SSrc_b32:$src1),
331  "$sdst, $src0, $src1", pattern
332>;
333
334class SOP2_64_32_32 <string opName, list<dag> pattern=[]> : SOP2_Pseudo <
335  opName, (outs SReg_64:$sdst), (ins SSrc_b32:$src0, SSrc_b32:$src1),
336  "$sdst, $src0, $src1", pattern
337>;
338
339let Defs = [SCC] in { // Carry out goes to SCC
340let isCommutable = 1 in {
341def S_ADD_U32 : SOP2_32 <"s_add_u32">;
342def S_ADD_I32 : SOP2_32 <"s_add_i32",
343  [(set i32:$sdst, (add SSrc_b32:$src0, SSrc_b32:$src1))]
344>;
345} // End isCommutable = 1
346
347def S_SUB_U32 : SOP2_32 <"s_sub_u32">;
348def S_SUB_I32 : SOP2_32 <"s_sub_i32",
349  [(set i32:$sdst, (sub SSrc_b32:$src0, SSrc_b32:$src1))]
350>;
351
352let Uses = [SCC] in { // Carry in comes from SCC
353let isCommutable = 1 in {
354def S_ADDC_U32 : SOP2_32 <"s_addc_u32",
355  [(set i32:$sdst, (adde (i32 SSrc_b32:$src0), (i32 SSrc_b32:$src1)))]>;
356} // End isCommutable = 1
357
358def S_SUBB_U32 : SOP2_32 <"s_subb_u32",
359  [(set i32:$sdst, (sube (i32 SSrc_b32:$src0), (i32 SSrc_b32:$src1)))]>;
360} // End Uses = [SCC]
361
362
363let isCommutable = 1 in {
364def S_MIN_I32 : SOP2_32 <"s_min_i32",
365  [(set i32:$sdst, (smin i32:$src0, i32:$src1))]
366>;
367def S_MIN_U32 : SOP2_32 <"s_min_u32",
368  [(set i32:$sdst, (umin i32:$src0, i32:$src1))]
369>;
370def S_MAX_I32 : SOP2_32 <"s_max_i32",
371  [(set i32:$sdst, (smax i32:$src0, i32:$src1))]
372>;
373def S_MAX_U32 : SOP2_32 <"s_max_u32",
374  [(set i32:$sdst, (umax i32:$src0, i32:$src1))]
375>;
376} // End isCommutable = 1
377} // End Defs = [SCC]
378
379
380let Uses = [SCC] in {
381  def S_CSELECT_B32 : SOP2_32 <"s_cselect_b32">;
382  def S_CSELECT_B64 : SOP2_64 <"s_cselect_b64">;
383} // End Uses = [SCC]
384
385let Defs = [SCC] in {
386let isCommutable = 1 in {
387def S_AND_B32 : SOP2_32 <"s_and_b32",
388  [(set i32:$sdst, (and i32:$src0, i32:$src1))]
389>;
390
391def S_AND_B64 : SOP2_64 <"s_and_b64",
392  [(set i64:$sdst, (and i64:$src0, i64:$src1))]
393>;
394
395def S_OR_B32 : SOP2_32 <"s_or_b32",
396  [(set i32:$sdst, (or i32:$src0, i32:$src1))]
397>;
398
399def S_OR_B64 : SOP2_64 <"s_or_b64",
400  [(set i64:$sdst, (or i64:$src0, i64:$src1))]
401>;
402
403def S_XOR_B32 : SOP2_32 <"s_xor_b32",
404  [(set i32:$sdst, (xor i32:$src0, i32:$src1))]
405>;
406
407def S_XOR_B64 : SOP2_64 <"s_xor_b64",
408  [(set i64:$sdst, (xor i64:$src0, i64:$src1))]
409>;
410
411def S_XNOR_B32 : SOP2_32 <"s_xnor_b32",
412  [(set i32:$sdst, (not (xor_oneuse i32:$src0, i32:$src1)))]
413>;
414
415def S_XNOR_B64 : SOP2_64 <"s_xnor_b64",
416  [(set i64:$sdst, (not (xor_oneuse i64:$src0, i64:$src1)))]
417>;
418} // End isCommutable = 1
419
420def S_ANDN2_B32 : SOP2_32 <"s_andn2_b32">;
421def S_ANDN2_B64 : SOP2_64 <"s_andn2_b64">;
422def S_ORN2_B32 : SOP2_32 <"s_orn2_b32">;
423def S_ORN2_B64 : SOP2_64 <"s_orn2_b64">;
424def S_NAND_B32 : SOP2_32 <"s_nand_b32">;
425def S_NAND_B64 : SOP2_64 <"s_nand_b64">;
426def S_NOR_B32 : SOP2_32 <"s_nor_b32">;
427def S_NOR_B64 : SOP2_64 <"s_nor_b64">;
428} // End Defs = [SCC]
429
430// Use added complexity so these patterns are preferred to the VALU patterns.
431let AddedComplexity = 1 in {
432
433let Defs = [SCC] in {
434def S_LSHL_B32 : SOP2_32 <"s_lshl_b32",
435  [(set i32:$sdst, (shl i32:$src0, i32:$src1))]
436>;
437def S_LSHL_B64 : SOP2_64_32 <"s_lshl_b64",
438  [(set i64:$sdst, (shl i64:$src0, i32:$src1))]
439>;
440def S_LSHR_B32 : SOP2_32 <"s_lshr_b32",
441  [(set i32:$sdst, (srl i32:$src0, i32:$src1))]
442>;
443def S_LSHR_B64 : SOP2_64_32 <"s_lshr_b64",
444  [(set i64:$sdst, (srl i64:$src0, i32:$src1))]
445>;
446def S_ASHR_I32 : SOP2_32 <"s_ashr_i32",
447  [(set i32:$sdst, (sra i32:$src0, i32:$src1))]
448>;
449def S_ASHR_I64 : SOP2_64_32 <"s_ashr_i64",
450  [(set i64:$sdst, (sra i64:$src0, i32:$src1))]
451>;
452} // End Defs = [SCC]
453
454def S_BFM_B32 : SOP2_32 <"s_bfm_b32",
455  [(set i32:$sdst, (AMDGPUbfm i32:$src0, i32:$src1))]>;
456def S_BFM_B64 : SOP2_64_32_32 <"s_bfm_b64">;
457def S_MUL_I32 : SOP2_32 <"s_mul_i32",
458  [(set i32:$sdst, (mul i32:$src0, i32:$src1))]> {
459  let isCommutable = 1;
460}
461
462} // End AddedComplexity = 1
463
464let Defs = [SCC] in {
465def S_BFE_U32 : SOP2_32 <"s_bfe_u32">;
466def S_BFE_I32 : SOP2_32 <"s_bfe_i32">;
467def S_BFE_U64 : SOP2_64_32 <"s_bfe_u64">;
468def S_BFE_I64 : SOP2_64_32 <"s_bfe_i64">;
469} // End Defs = [SCC]
470
471def S_CBRANCH_G_FORK : SOP2_Pseudo <
472  "s_cbranch_g_fork", (outs),
473  (ins SCSrc_b64:$src0, SCSrc_b64:$src1),
474  "$src0, $src1"
475> {
476  let has_sdst = 0;
477}
478
479let Defs = [SCC] in {
480def S_ABSDIFF_I32 : SOP2_32 <"s_absdiff_i32">;
481} // End Defs = [SCC]
482
483let SubtargetPredicate = isVI in {
484  def S_RFE_RESTORE_B64 : SOP2_Pseudo <
485    "s_rfe_restore_b64", (outs),
486    (ins SSrc_b64:$src0, SSrc_b32:$src1),
487    "$src0, $src1"
488  > {
489    let hasSideEffects = 1;
490    let has_sdst = 0;
491  }
492}
493
494let SubtargetPredicate = isGFX9 in {
495  def S_PACK_LL_B32_B16 : SOP2_32<"s_pack_ll_b32_b16">;
496  def S_PACK_LH_B32_B16 : SOP2_32<"s_pack_lh_b32_b16">;
497  def S_PACK_HH_B32_B16 : SOP2_32<"s_pack_hh_b32_b16">;
498
499  let Defs = [SCC] in {
500    def S_LSHL1_ADD_U32 : SOP2_32<"s_lshl1_add_u32">;
501    def S_LSHL2_ADD_U32 : SOP2_32<"s_lshl2_add_u32">;
502    def S_LSHL3_ADD_U32 : SOP2_32<"s_lshl3_add_u32">;
503    def S_LSHL4_ADD_U32 : SOP2_32<"s_lshl4_add_u32">;
504  } // End Defs = [SCC]
505
506  def S_MUL_HI_U32 : SOP2_32<"s_mul_hi_u32">;
507  def S_MUL_HI_I32 : SOP2_32<"s_mul_hi_i32">;
508}
509
510//===----------------------------------------------------------------------===//
511// SOPK Instructions
512//===----------------------------------------------------------------------===//
513
514class SOPK_Pseudo <string opName, dag outs, dag ins,
515                   string asmOps, list<dag> pattern=[]> :
516  InstSI <outs, ins, "", pattern>,
517  SIMCInstr<opName, SIEncodingFamily.NONE> {
518  let isPseudo = 1;
519  let isCodeGenOnly = 1;
520  let SubtargetPredicate = isGCN;
521  let mayLoad = 0;
522  let mayStore = 0;
523  let hasSideEffects = 0;
524  let SALU = 1;
525  let SOPK = 1;
526  let SchedRW = [WriteSALU];
527  let UseNamedOperandTable = 1;
528  string Mnemonic = opName;
529  string AsmOperands = asmOps;
530
531  bits<1> has_sdst = 1;
532}
533
534class SOPK_Real<bits<5> op, SOPK_Pseudo ps> :
535  InstSI <ps.OutOperandList, ps.InOperandList,
536          ps.Mnemonic # " " # ps.AsmOperands, []> {
537  let isPseudo = 0;
538  let isCodeGenOnly = 0;
539
540  // copy relevant pseudo op flags
541  let SubtargetPredicate = ps.SubtargetPredicate;
542  let AsmMatchConverter  = ps.AsmMatchConverter;
543  let DisableEncoding    = ps.DisableEncoding;
544  let Constraints        = ps.Constraints;
545
546  // encoding
547  bits<7>  sdst;
548  bits<16> simm16;
549  bits<32> imm;
550}
551
552class SOPK_Real32<bits<5> op, SOPK_Pseudo ps> :
553  SOPK_Real <op, ps>,
554  Enc32 {
555  let Inst{15-0}  = simm16;
556  let Inst{22-16} = !if(ps.has_sdst, sdst, ?);
557  let Inst{27-23} = op;
558  let Inst{31-28} = 0xb; //encoding
559}
560
561class SOPK_Real64<bits<5> op, SOPK_Pseudo ps> :
562  SOPK_Real<op, ps>,
563  Enc64 {
564  let Inst{15-0}  = simm16;
565  let Inst{22-16} = !if(ps.has_sdst, sdst, ?);
566  let Inst{27-23} = op;
567  let Inst{31-28} = 0xb; //encoding
568  let Inst{63-32} = imm;
569}
570
571class SOPKInstTable <bit is_sopk, string cmpOp = ""> {
572  bit IsSOPK = is_sopk;
573  string BaseCmpOp = cmpOp;
574}
575
576class SOPK_32 <string opName, list<dag> pattern=[]> : SOPK_Pseudo <
577  opName,
578  (outs SReg_32:$sdst),
579  (ins s16imm:$simm16),
580  "$sdst, $simm16",
581  pattern>;
582
583class SOPK_SCC <string opName, string base_op, bit isSignExt> : SOPK_Pseudo <
584  opName,
585  (outs),
586  !if(isSignExt,
587      (ins SReg_32:$sdst, s16imm:$simm16),
588      (ins SReg_32:$sdst, u16imm:$simm16)),
589  "$sdst, $simm16", []>,
590  SOPKInstTable<1, base_op>{
591  let Defs = [SCC];
592}
593
594class SOPK_32TIE <string opName, list<dag> pattern=[]> : SOPK_Pseudo <
595  opName,
596  (outs SReg_32:$sdst),
597  (ins SReg_32:$src0, s16imm:$simm16),
598  "$sdst, $simm16",
599  pattern
600>;
601
602let isReMaterializable = 1, isMoveImm = 1 in {
603def S_MOVK_I32 : SOPK_32 <"s_movk_i32">;
604} // End isReMaterializable = 1
605let Uses = [SCC] in {
606def S_CMOVK_I32 : SOPK_32 <"s_cmovk_i32">;
607}
608
609let isCompare = 1 in {
610
611// This instruction is disabled for now until we can figure out how to teach
612// the instruction selector to correctly use the  S_CMP* vs V_CMP*
613// instructions.
614//
615// When this instruction is enabled the code generator sometimes produces this
616// invalid sequence:
617//
618// SCC = S_CMPK_EQ_I32 SGPR0, imm
619// VCC = COPY SCC
620// VGPR0 = V_CNDMASK VCC, VGPR0, VGPR1
621//
622// def S_CMPK_EQ_I32 : SOPK_SCC <"s_cmpk_eq_i32",
623//   [(set i1:$dst, (setcc i32:$src0, imm:$src1, SETEQ))]
624// >;
625
626def S_CMPK_EQ_I32 : SOPK_SCC <"s_cmpk_eq_i32", "s_cmp_eq_i32", 1>;
627def S_CMPK_LG_I32 : SOPK_SCC <"s_cmpk_lg_i32", "s_cmp_lg_i32", 1>;
628def S_CMPK_GT_I32 : SOPK_SCC <"s_cmpk_gt_i32", "s_cmp_gt_i32", 1>;
629def S_CMPK_GE_I32 : SOPK_SCC <"s_cmpk_ge_i32", "s_cmp_ge_i32", 1>;
630def S_CMPK_LT_I32 : SOPK_SCC <"s_cmpk_lt_i32", "s_cmp_lt_i32", 1>;
631def S_CMPK_LE_I32 : SOPK_SCC <"s_cmpk_le_i32", "s_cmp_le_i32", 1>;
632
633let SOPKZext = 1 in {
634def S_CMPK_EQ_U32 : SOPK_SCC <"s_cmpk_eq_u32", "s_cmp_eq_u32", 0>;
635def S_CMPK_LG_U32 : SOPK_SCC <"s_cmpk_lg_u32", "s_cmp_lg_u32", 0>;
636def S_CMPK_GT_U32 : SOPK_SCC <"s_cmpk_gt_u32", "s_cmp_gt_u32", 0>;
637def S_CMPK_GE_U32 : SOPK_SCC <"s_cmpk_ge_u32", "s_cmp_ge_u32", 0>;
638def S_CMPK_LT_U32 : SOPK_SCC <"s_cmpk_lt_u32", "s_cmp_lt_u32", 0>;
639def S_CMPK_LE_U32 : SOPK_SCC <"s_cmpk_le_u32", "s_cmp_le_u32", 0>;
640} // End SOPKZext = 1
641} // End isCompare = 1
642
643let Defs = [SCC], isCommutable = 1, DisableEncoding = "$src0",
644    Constraints = "$sdst = $src0" in {
645  def S_ADDK_I32 : SOPK_32TIE <"s_addk_i32">;
646  def S_MULK_I32 : SOPK_32TIE <"s_mulk_i32">;
647}
648
649def S_CBRANCH_I_FORK : SOPK_Pseudo <
650  "s_cbranch_i_fork",
651  (outs), (ins SReg_64:$sdst, s16imm:$simm16),
652  "$sdst, $simm16"
653>;
654
655let mayLoad = 1 in {
656def S_GETREG_B32 : SOPK_Pseudo <
657  "s_getreg_b32",
658  (outs SReg_32:$sdst), (ins hwreg:$simm16),
659  "$sdst, $simm16"
660>;
661}
662
663let hasSideEffects = 1 in {
664
665def S_SETREG_B32 : SOPK_Pseudo <
666  "s_setreg_b32",
667  (outs), (ins SReg_32:$sdst, hwreg:$simm16),
668  "$simm16, $sdst",
669  [(AMDGPUsetreg i32:$sdst, (i16 timm:$simm16))]
670>;
671
672// FIXME: Not on SI?
673//def S_GETREG_REGRD_B32 : SOPK_32 <sopk<0x14, 0x13>, "s_getreg_regrd_b32">;
674
675def S_SETREG_IMM32_B32 : SOPK_Pseudo <
676  "s_setreg_imm32_b32",
677  (outs), (ins i32imm:$imm, hwreg:$simm16),
678  "$simm16, $imm"> {
679  let Size = 8; // Unlike every other SOPK instruction.
680  let has_sdst = 0;
681}
682
683} // End hasSideEffects = 1
684
685let SubtargetPredicate = isGFX9 in {
686  def S_CALL_B64 : SOPK_Pseudo<
687      "s_call_b64",
688      (outs SReg_64:$sdst),
689      (ins s16imm:$simm16),
690      "$sdst, $simm16"> {
691    let isCall = 1;
692  }
693}
694
695//===----------------------------------------------------------------------===//
696// SOPC Instructions
697//===----------------------------------------------------------------------===//
698
699class SOPCe <bits<7> op> : Enc32 {
700  bits<8> src0;
701  bits<8> src1;
702
703  let Inst{7-0} = src0;
704  let Inst{15-8} = src1;
705  let Inst{22-16} = op;
706  let Inst{31-23} = 0x17e;
707}
708
709class SOPC <bits<7> op, dag outs, dag ins, string asm,
710            list<dag> pattern = []> :
711  InstSI<outs, ins, asm, pattern>, SOPCe <op> {
712  let mayLoad = 0;
713  let mayStore = 0;
714  let hasSideEffects = 0;
715  let SALU = 1;
716  let SOPC = 1;
717  let isCodeGenOnly = 0;
718  let Defs = [SCC];
719  let SchedRW = [WriteSALU];
720  let UseNamedOperandTable = 1;
721  let SubtargetPredicate = isGCN;
722}
723
724class SOPC_Base <bits<7> op, RegisterOperand rc0, RegisterOperand rc1,
725                 string opName, list<dag> pattern = []> : SOPC <
726  op, (outs), (ins rc0:$src0, rc1:$src1),
727  opName#" $src0, $src1", pattern > {
728  let Defs = [SCC];
729}
730class SOPC_Helper <bits<7> op, RegisterOperand rc, ValueType vt,
731                    string opName, PatLeaf cond> : SOPC_Base <
732  op, rc, rc, opName,
733  [(set SCC, (si_setcc_uniform vt:$src0, vt:$src1, cond))] > {
734}
735
736class SOPC_CMP_32<bits<7> op, string opName,
737                  PatLeaf cond = COND_NULL, string revOp = opName>
738  : SOPC_Helper<op, SSrc_b32, i32, opName, cond>,
739    Commutable_REV<revOp, !eq(revOp, opName)>,
740    SOPKInstTable<0, opName> {
741  let isCompare = 1;
742  let isCommutable = 1;
743}
744
745class SOPC_CMP_64<bits<7> op, string opName,
746                  PatLeaf cond = COND_NULL, string revOp = opName>
747  : SOPC_Helper<op, SSrc_b64, i64, opName, cond>,
748    Commutable_REV<revOp, !eq(revOp, opName)> {
749  let isCompare = 1;
750  let isCommutable = 1;
751}
752
753class SOPC_32<bits<7> op, string opName, list<dag> pattern = []>
754  : SOPC_Base<op, SSrc_b32, SSrc_b32, opName, pattern>;
755
756class SOPC_64_32<bits<7> op, string opName, list<dag> pattern = []>
757  : SOPC_Base<op, SSrc_b64, SSrc_b32, opName, pattern>;
758
759def S_CMP_EQ_I32 : SOPC_CMP_32 <0x00, "s_cmp_eq_i32">;
760def S_CMP_LG_I32 : SOPC_CMP_32 <0x01, "s_cmp_lg_i32">;
761def S_CMP_GT_I32 : SOPC_CMP_32 <0x02, "s_cmp_gt_i32", COND_SGT>;
762def S_CMP_GE_I32 : SOPC_CMP_32 <0x03, "s_cmp_ge_i32", COND_SGE>;
763def S_CMP_LT_I32 : SOPC_CMP_32 <0x04, "s_cmp_lt_i32", COND_SLT, "s_cmp_gt_i32">;
764def S_CMP_LE_I32 : SOPC_CMP_32 <0x05, "s_cmp_le_i32", COND_SLE, "s_cmp_ge_i32">;
765def S_CMP_EQ_U32 : SOPC_CMP_32 <0x06, "s_cmp_eq_u32", COND_EQ>;
766def S_CMP_LG_U32 : SOPC_CMP_32 <0x07, "s_cmp_lg_u32", COND_NE>;
767def S_CMP_GT_U32 : SOPC_CMP_32 <0x08, "s_cmp_gt_u32", COND_UGT>;
768def S_CMP_GE_U32 : SOPC_CMP_32 <0x09, "s_cmp_ge_u32", COND_UGE>;
769def S_CMP_LT_U32 : SOPC_CMP_32 <0x0a, "s_cmp_lt_u32", COND_ULT, "s_cmp_gt_u32">;
770def S_CMP_LE_U32 : SOPC_CMP_32 <0x0b, "s_cmp_le_u32", COND_ULE, "s_cmp_ge_u32">;
771
772def S_BITCMP0_B32 : SOPC_32 <0x0c, "s_bitcmp0_b32">;
773def S_BITCMP1_B32 : SOPC_32 <0x0d, "s_bitcmp1_b32">;
774def S_BITCMP0_B64 : SOPC_64_32 <0x0e, "s_bitcmp0_b64">;
775def S_BITCMP1_B64 : SOPC_64_32 <0x0f, "s_bitcmp1_b64">;
776def S_SETVSKIP : SOPC_32 <0x10, "s_setvskip">;
777
778let SubtargetPredicate = isVI in {
779def S_CMP_EQ_U64 : SOPC_CMP_64 <0x12, "s_cmp_eq_u64", COND_EQ>;
780def S_CMP_LG_U64 : SOPC_CMP_64 <0x13, "s_cmp_lg_u64", COND_NE>;
781}
782
783let SubtargetPredicate = HasVGPRIndexMode in {
784def S_SET_GPR_IDX_ON : SOPC <0x11,
785  (outs),
786  (ins SSrc_b32:$src0, GPRIdxMode:$src1),
787  "s_set_gpr_idx_on $src0,$src1"> {
788  let Defs = [M0]; // No scc def
789  let Uses = [M0]; // Other bits of m0 unmodified.
790  let hasSideEffects = 1; // Sets mode.gpr_idx_en
791  let FixedSize = 1;
792}
793}
794
795//===----------------------------------------------------------------------===//
796// SOPP Instructions
797//===----------------------------------------------------------------------===//
798
799class SOPPe <bits<7> op> : Enc32 {
800  bits <16> simm16;
801
802  let Inst{15-0} = simm16;
803  let Inst{22-16} = op;
804  let Inst{31-23} = 0x17f; // encoding
805}
806
807class SOPP <bits<7> op, dag ins, string asm, list<dag> pattern = []> :
808  InstSI <(outs), ins, asm, pattern >, SOPPe <op> {
809
810  let mayLoad = 0;
811  let mayStore = 0;
812  let hasSideEffects = 0;
813  let SALU = 1;
814  let SOPP = 1;
815  let Size = 4;
816  let SchedRW = [WriteSALU];
817
818  let UseNamedOperandTable = 1;
819  let SubtargetPredicate = isGCN;
820}
821
822
823def S_NOP : SOPP <0x00000000, (ins i16imm:$simm16), "s_nop $simm16">;
824
825let isTerminator = 1 in {
826
827def S_ENDPGM : SOPP <0x00000001, (ins), "s_endpgm",
828  [(AMDGPUendpgm)]> {
829  let simm16 = 0;
830  let isBarrier = 1;
831  let isReturn = 1;
832}
833
834let SubtargetPredicate = isVI in {
835def S_ENDPGM_SAVED : SOPP <0x0000001B, (ins), "s_endpgm_saved"> {
836  let simm16 = 0;
837  let isBarrier = 1;
838  let isReturn = 1;
839}
840}
841
842let SubtargetPredicate = isGFX9 in {
843  let isBarrier = 1, isReturn = 1, simm16 = 0 in {
844    def S_ENDPGM_ORDERED_PS_DONE :
845      SOPP<0x01e, (ins), "s_endpgm_ordered_ps_done">;
846  } // End isBarrier = 1, isReturn = 1, simm16 = 0
847} // End SubtargetPredicate = isGFX9
848
849let isBranch = 1, SchedRW = [WriteBranch] in {
850def S_BRANCH : SOPP <
851  0x00000002, (ins sopp_brtarget:$simm16), "s_branch $simm16",
852  [(br bb:$simm16)]> {
853  let isBarrier = 1;
854}
855
856let Uses = [SCC] in {
857def S_CBRANCH_SCC0 : SOPP <
858  0x00000004, (ins sopp_brtarget:$simm16),
859  "s_cbranch_scc0 $simm16"
860>;
861def S_CBRANCH_SCC1 : SOPP <
862  0x00000005, (ins sopp_brtarget:$simm16),
863  "s_cbranch_scc1 $simm16"
864>;
865} // End Uses = [SCC]
866
867let Uses = [VCC] in {
868def S_CBRANCH_VCCZ : SOPP <
869  0x00000006, (ins sopp_brtarget:$simm16),
870  "s_cbranch_vccz $simm16"
871>;
872def S_CBRANCH_VCCNZ : SOPP <
873  0x00000007, (ins sopp_brtarget:$simm16),
874  "s_cbranch_vccnz $simm16"
875>;
876} // End Uses = [VCC]
877
878let Uses = [EXEC] in {
879def S_CBRANCH_EXECZ : SOPP <
880  0x00000008, (ins sopp_brtarget:$simm16),
881  "s_cbranch_execz $simm16"
882>;
883def S_CBRANCH_EXECNZ : SOPP <
884  0x00000009, (ins sopp_brtarget:$simm16),
885  "s_cbranch_execnz $simm16"
886>;
887} // End Uses = [EXEC]
888
889def S_CBRANCH_CDBGSYS : SOPP <
890  0x00000017, (ins sopp_brtarget:$simm16),
891  "s_cbranch_cdbgsys $simm16"
892>;
893
894def S_CBRANCH_CDBGSYS_AND_USER : SOPP <
895  0x0000001A, (ins sopp_brtarget:$simm16),
896  "s_cbranch_cdbgsys_and_user $simm16"
897>;
898
899def S_CBRANCH_CDBGSYS_OR_USER : SOPP <
900  0x00000019, (ins sopp_brtarget:$simm16),
901  "s_cbranch_cdbgsys_or_user $simm16"
902>;
903
904def S_CBRANCH_CDBGUSER : SOPP <
905  0x00000018, (ins sopp_brtarget:$simm16),
906  "s_cbranch_cdbguser $simm16"
907>;
908
909} // End isBranch = 1
910} // End isTerminator = 1
911
912let hasSideEffects = 1 in {
913def S_BARRIER : SOPP <0x0000000a, (ins), "s_barrier",
914  [(int_amdgcn_s_barrier)]> {
915  let SchedRW = [WriteBarrier];
916  let simm16 = 0;
917  let mayLoad = 1;
918  let mayStore = 1;
919  let isConvergent = 1;
920}
921
922let SubtargetPredicate = isVI in {
923def S_WAKEUP : SOPP <0x00000003, (ins), "s_wakeup"> {
924  let simm16 = 0;
925  let mayLoad = 1;
926  let mayStore = 1;
927}
928}
929
930let mayLoad = 1, mayStore = 1, hasSideEffects = 1 in
931def S_WAITCNT : SOPP <0x0000000c, (ins WAIT_FLAG:$simm16), "s_waitcnt $simm16">;
932def S_SETHALT : SOPP <0x0000000d, (ins i16imm:$simm16), "s_sethalt $simm16">;
933def S_SETKILL : SOPP <0x0000000b, (ins i16imm:$simm16), "s_setkill $simm16">;
934
935// On SI the documentation says sleep for approximately 64 * low 2
936// bits, consistent with the reported maximum of 448. On VI the
937// maximum reported is 960 cycles, so 960 / 64 = 15 max, so is the
938// maximum really 15 on VI?
939def S_SLEEP : SOPP <0x0000000e, (ins i32imm:$simm16),
940  "s_sleep $simm16", [(int_amdgcn_s_sleep SIMM16bit:$simm16)]> {
941  let hasSideEffects = 1;
942  let mayLoad = 1;
943  let mayStore = 1;
944}
945
946def S_SETPRIO : SOPP <0x0000000f, (ins i16imm:$simm16), "s_setprio $simm16">;
947
948let Uses = [EXEC, M0] in {
949// FIXME: Should this be mayLoad+mayStore?
950def S_SENDMSG : SOPP <0x00000010, (ins SendMsgImm:$simm16), "s_sendmsg $simm16",
951  [(AMDGPUsendmsg (i32 imm:$simm16))]
952>;
953
954def S_SENDMSGHALT : SOPP <0x00000011, (ins SendMsgImm:$simm16), "s_sendmsghalt $simm16",
955  [(AMDGPUsendmsghalt (i32 imm:$simm16))]
956>;
957} // End Uses = [EXEC, M0]
958
959def S_TRAP : SOPP <0x00000012, (ins i16imm:$simm16), "s_trap $simm16">;
960def S_ICACHE_INV : SOPP <0x00000013, (ins), "s_icache_inv"> {
961  let simm16 = 0;
962}
963def S_INCPERFLEVEL : SOPP <0x00000014, (ins i32imm:$simm16), "s_incperflevel $simm16",
964  [(int_amdgcn_s_incperflevel SIMM16bit:$simm16)]> {
965  let hasSideEffects = 1;
966  let mayLoad = 1;
967  let mayStore = 1;
968}
969def S_DECPERFLEVEL : SOPP <0x00000015, (ins i32imm:$simm16), "s_decperflevel $simm16",
970  [(int_amdgcn_s_decperflevel SIMM16bit:$simm16)]> {
971  let hasSideEffects = 1;
972  let mayLoad = 1;
973  let mayStore = 1;
974}
975def S_TTRACEDATA : SOPP <0x00000016, (ins), "s_ttracedata"> {
976  let simm16 = 0;
977}
978
979let SubtargetPredicate = HasVGPRIndexMode in {
980def S_SET_GPR_IDX_OFF : SOPP<0x1c, (ins), "s_set_gpr_idx_off"> {
981  let simm16 = 0;
982}
983}
984} // End hasSideEffects
985
986let SubtargetPredicate = HasVGPRIndexMode in {
987def S_SET_GPR_IDX_MODE : SOPP<0x1d, (ins GPRIdxMode:$simm16),
988  "s_set_gpr_idx_mode$simm16"> {
989  let Defs = [M0];
990}
991}
992
993//===----------------------------------------------------------------------===//
994// S_GETREG_B32 Intrinsic Pattern.
995//===----------------------------------------------------------------------===//
996def : GCNPat <
997  (int_amdgcn_s_getreg imm:$simm16),
998  (S_GETREG_B32 (as_i16imm $simm16))
999>;
1000
1001//===----------------------------------------------------------------------===//
1002// SOP1 Patterns
1003//===----------------------------------------------------------------------===//
1004
1005def : GCNPat <
1006  (i64 (ctpop i64:$src)),
1007    (i64 (REG_SEQUENCE SReg_64,
1008     (i32 (COPY_TO_REGCLASS (S_BCNT1_I32_B64 $src), SReg_32)), sub0,
1009     (S_MOV_B32 (i32 0)), sub1))
1010>;
1011
1012def : GCNPat <
1013  (i32 (smax i32:$x, (i32 (ineg i32:$x)))),
1014  (S_ABS_I32 $x)
1015>;
1016
1017def : GCNPat <
1018  (i16 imm:$imm),
1019  (S_MOV_B32 imm:$imm)
1020>;
1021
1022// Same as a 32-bit inreg
1023def : GCNPat<
1024  (i32 (sext i16:$src)),
1025  (S_SEXT_I32_I16 $src)
1026>;
1027
1028
1029//===----------------------------------------------------------------------===//
1030// SOP2 Patterns
1031//===----------------------------------------------------------------------===//
1032
1033// V_ADD_I32_e32/S_ADD_U32 produces carry in VCC/SCC. For the vector
1034// case, the sgpr-copies pass will fix this to use the vector version.
1035def : GCNPat <
1036  (i32 (addc i32:$src0, i32:$src1)),
1037  (S_ADD_U32 $src0, $src1)
1038>;
1039
1040// FIXME: We need to use COPY_TO_REGCLASS to work-around the fact that
1041// REG_SEQUENCE patterns don't support instructions with multiple
1042// outputs.
1043def : GCNPat<
1044  (i64 (zext i16:$src)),
1045    (REG_SEQUENCE SReg_64,
1046      (i32 (COPY_TO_REGCLASS (S_AND_B32 $src, (S_MOV_B32 (i32 0xffff))), SGPR_32)), sub0,
1047      (S_MOV_B32 (i32 0)), sub1)
1048>;
1049
1050def : GCNPat <
1051  (i64 (sext i16:$src)),
1052    (REG_SEQUENCE SReg_64, (i32 (S_SEXT_I32_I16 $src)), sub0,
1053    (i32 (COPY_TO_REGCLASS (S_ASHR_I32 (i32 (S_SEXT_I32_I16 $src)), (S_MOV_B32 (i32 31))), SGPR_32)), sub1)
1054>;
1055
1056def : GCNPat<
1057  (i32 (zext i16:$src)),
1058  (S_AND_B32 (S_MOV_B32 (i32 0xffff)), $src)
1059>;
1060
1061
1062
1063//===----------------------------------------------------------------------===//
1064// SOPP Patterns
1065//===----------------------------------------------------------------------===//
1066
1067def : GCNPat <
1068  (int_amdgcn_s_waitcnt i32:$simm16),
1069  (S_WAITCNT (as_i16imm $simm16))
1070>;
1071
1072
1073//===----------------------------------------------------------------------===//
1074// Real target instructions, move this to the appropriate subtarget TD file
1075//===----------------------------------------------------------------------===//
1076
1077class Select_si<string opName> :
1078  SIMCInstr<opName, SIEncodingFamily.SI> {
1079  list<Predicate> AssemblerPredicates = [isSICI];
1080  string DecoderNamespace = "SICI";
1081}
1082
1083class SOP1_Real_si<bits<8> op, SOP1_Pseudo ps> :
1084  SOP1_Real<op, ps>,
1085  Select_si<ps.Mnemonic>;
1086
1087class SOP2_Real_si<bits<7> op, SOP2_Pseudo ps> :
1088  SOP2_Real<op, ps>,
1089  Select_si<ps.Mnemonic>;
1090
1091class SOPK_Real_si<bits<5> op, SOPK_Pseudo ps> :
1092  SOPK_Real32<op, ps>,
1093  Select_si<ps.Mnemonic>;
1094
1095def S_MOV_B32_si           : SOP1_Real_si <0x03, S_MOV_B32>;
1096def S_MOV_B64_si           : SOP1_Real_si <0x04, S_MOV_B64>;
1097def S_CMOV_B32_si          : SOP1_Real_si <0x05, S_CMOV_B32>;
1098def S_CMOV_B64_si          : SOP1_Real_si <0x06, S_CMOV_B64>;
1099def S_NOT_B32_si           : SOP1_Real_si <0x07, S_NOT_B32>;
1100def S_NOT_B64_si           : SOP1_Real_si <0x08, S_NOT_B64>;
1101def S_WQM_B32_si           : SOP1_Real_si <0x09, S_WQM_B32>;
1102def S_WQM_B64_si           : SOP1_Real_si <0x0a, S_WQM_B64>;
1103def S_BREV_B32_si          : SOP1_Real_si <0x0b, S_BREV_B32>;
1104def S_BREV_B64_si          : SOP1_Real_si <0x0c, S_BREV_B64>;
1105def S_BCNT0_I32_B32_si     : SOP1_Real_si <0x0d, S_BCNT0_I32_B32>;
1106def S_BCNT0_I32_B64_si     : SOP1_Real_si <0x0e, S_BCNT0_I32_B64>;
1107def S_BCNT1_I32_B32_si     : SOP1_Real_si <0x0f, S_BCNT1_I32_B32>;
1108def S_BCNT1_I32_B64_si     : SOP1_Real_si <0x10, S_BCNT1_I32_B64>;
1109def S_FF0_I32_B32_si       : SOP1_Real_si <0x11, S_FF0_I32_B32>;
1110def S_FF0_I32_B64_si       : SOP1_Real_si <0x12, S_FF0_I32_B64>;
1111def S_FF1_I32_B32_si       : SOP1_Real_si <0x13, S_FF1_I32_B32>;
1112def S_FF1_I32_B64_si       : SOP1_Real_si <0x14, S_FF1_I32_B64>;
1113def S_FLBIT_I32_B32_si     : SOP1_Real_si <0x15, S_FLBIT_I32_B32>;
1114def S_FLBIT_I32_B64_si     : SOP1_Real_si <0x16, S_FLBIT_I32_B64>;
1115def S_FLBIT_I32_si         : SOP1_Real_si <0x17, S_FLBIT_I32>;
1116def S_FLBIT_I32_I64_si     : SOP1_Real_si <0x18, S_FLBIT_I32_I64>;
1117def S_SEXT_I32_I8_si       : SOP1_Real_si <0x19, S_SEXT_I32_I8>;
1118def S_SEXT_I32_I16_si      : SOP1_Real_si <0x1a, S_SEXT_I32_I16>;
1119def S_BITSET0_B32_si       : SOP1_Real_si <0x1b, S_BITSET0_B32>;
1120def S_BITSET0_B64_si       : SOP1_Real_si <0x1c, S_BITSET0_B64>;
1121def S_BITSET1_B32_si       : SOP1_Real_si <0x1d, S_BITSET1_B32>;
1122def S_BITSET1_B64_si       : SOP1_Real_si <0x1e, S_BITSET1_B64>;
1123def S_GETPC_B64_si         : SOP1_Real_si <0x1f, S_GETPC_B64>;
1124def S_SETPC_B64_si         : SOP1_Real_si <0x20, S_SETPC_B64>;
1125def S_SWAPPC_B64_si        : SOP1_Real_si <0x21, S_SWAPPC_B64>;
1126def S_RFE_B64_si           : SOP1_Real_si <0x22, S_RFE_B64>;
1127def S_AND_SAVEEXEC_B64_si  : SOP1_Real_si <0x24, S_AND_SAVEEXEC_B64>;
1128def S_OR_SAVEEXEC_B64_si   : SOP1_Real_si <0x25, S_OR_SAVEEXEC_B64>;
1129def S_XOR_SAVEEXEC_B64_si  : SOP1_Real_si <0x26, S_XOR_SAVEEXEC_B64>;
1130def S_ANDN2_SAVEEXEC_B64_si: SOP1_Real_si <0x27, S_ANDN2_SAVEEXEC_B64>;
1131def S_ORN2_SAVEEXEC_B64_si : SOP1_Real_si <0x28, S_ORN2_SAVEEXEC_B64>;
1132def S_NAND_SAVEEXEC_B64_si : SOP1_Real_si <0x29, S_NAND_SAVEEXEC_B64>;
1133def S_NOR_SAVEEXEC_B64_si  : SOP1_Real_si <0x2a, S_NOR_SAVEEXEC_B64>;
1134def S_XNOR_SAVEEXEC_B64_si : SOP1_Real_si <0x2b, S_XNOR_SAVEEXEC_B64>;
1135def S_QUADMASK_B32_si      : SOP1_Real_si <0x2c, S_QUADMASK_B32>;
1136def S_QUADMASK_B64_si      : SOP1_Real_si <0x2d, S_QUADMASK_B64>;
1137def S_MOVRELS_B32_si       : SOP1_Real_si <0x2e, S_MOVRELS_B32>;
1138def S_MOVRELS_B64_si       : SOP1_Real_si <0x2f, S_MOVRELS_B64>;
1139def S_MOVRELD_B32_si       : SOP1_Real_si <0x30, S_MOVRELD_B32>;
1140def S_MOVRELD_B64_si       : SOP1_Real_si <0x31, S_MOVRELD_B64>;
1141def S_CBRANCH_JOIN_si      : SOP1_Real_si <0x32, S_CBRANCH_JOIN>;
1142def S_MOV_REGRD_B32_si     : SOP1_Real_si <0x33, S_MOV_REGRD_B32>;
1143def S_ABS_I32_si           : SOP1_Real_si <0x34, S_ABS_I32>;
1144def S_MOV_FED_B32_si       : SOP1_Real_si <0x35, S_MOV_FED_B32>;
1145
1146def S_ADD_U32_si           : SOP2_Real_si <0x00, S_ADD_U32>;
1147def S_ADD_I32_si           : SOP2_Real_si <0x02, S_ADD_I32>;
1148def S_SUB_U32_si           : SOP2_Real_si <0x01, S_SUB_U32>;
1149def S_SUB_I32_si           : SOP2_Real_si <0x03, S_SUB_I32>;
1150def S_ADDC_U32_si          : SOP2_Real_si <0x04, S_ADDC_U32>;
1151def S_SUBB_U32_si          : SOP2_Real_si <0x05, S_SUBB_U32>;
1152def S_MIN_I32_si           : SOP2_Real_si <0x06, S_MIN_I32>;
1153def S_MIN_U32_si           : SOP2_Real_si <0x07, S_MIN_U32>;
1154def S_MAX_I32_si           : SOP2_Real_si <0x08, S_MAX_I32>;
1155def S_MAX_U32_si           : SOP2_Real_si <0x09, S_MAX_U32>;
1156def S_CSELECT_B32_si       : SOP2_Real_si <0x0a, S_CSELECT_B32>;
1157def S_CSELECT_B64_si       : SOP2_Real_si <0x0b, S_CSELECT_B64>;
1158def S_AND_B32_si           : SOP2_Real_si <0x0e, S_AND_B32>;
1159def S_AND_B64_si           : SOP2_Real_si <0x0f, S_AND_B64>;
1160def S_OR_B32_si            : SOP2_Real_si <0x10, S_OR_B32>;
1161def S_OR_B64_si            : SOP2_Real_si <0x11, S_OR_B64>;
1162def S_XOR_B32_si           : SOP2_Real_si <0x12, S_XOR_B32>;
1163def S_XOR_B64_si           : SOP2_Real_si <0x13, S_XOR_B64>;
1164def S_ANDN2_B32_si         : SOP2_Real_si <0x14, S_ANDN2_B32>;
1165def S_ANDN2_B64_si         : SOP2_Real_si <0x15, S_ANDN2_B64>;
1166def S_ORN2_B32_si          : SOP2_Real_si <0x16, S_ORN2_B32>;
1167def S_ORN2_B64_si          : SOP2_Real_si <0x17, S_ORN2_B64>;
1168def S_NAND_B32_si          : SOP2_Real_si <0x18, S_NAND_B32>;
1169def S_NAND_B64_si          : SOP2_Real_si <0x19, S_NAND_B64>;
1170def S_NOR_B32_si           : SOP2_Real_si <0x1a, S_NOR_B32>;
1171def S_NOR_B64_si           : SOP2_Real_si <0x1b, S_NOR_B64>;
1172def S_XNOR_B32_si          : SOP2_Real_si <0x1c, S_XNOR_B32>;
1173def S_XNOR_B64_si          : SOP2_Real_si <0x1d, S_XNOR_B64>;
1174def S_LSHL_B32_si          : SOP2_Real_si <0x1e, S_LSHL_B32>;
1175def S_LSHL_B64_si          : SOP2_Real_si <0x1f, S_LSHL_B64>;
1176def S_LSHR_B32_si          : SOP2_Real_si <0x20, S_LSHR_B32>;
1177def S_LSHR_B64_si          : SOP2_Real_si <0x21, S_LSHR_B64>;
1178def S_ASHR_I32_si          : SOP2_Real_si <0x22, S_ASHR_I32>;
1179def S_ASHR_I64_si          : SOP2_Real_si <0x23, S_ASHR_I64>;
1180def S_BFM_B32_si           : SOP2_Real_si <0x24, S_BFM_B32>;
1181def S_BFM_B64_si           : SOP2_Real_si <0x25, S_BFM_B64>;
1182def S_MUL_I32_si           : SOP2_Real_si <0x26, S_MUL_I32>;
1183def S_BFE_U32_si           : SOP2_Real_si <0x27, S_BFE_U32>;
1184def S_BFE_I32_si           : SOP2_Real_si <0x28, S_BFE_I32>;
1185def S_BFE_U64_si           : SOP2_Real_si <0x29, S_BFE_U64>;
1186def S_BFE_I64_si           : SOP2_Real_si <0x2a, S_BFE_I64>;
1187def S_CBRANCH_G_FORK_si    : SOP2_Real_si <0x2b, S_CBRANCH_G_FORK>;
1188def S_ABSDIFF_I32_si       : SOP2_Real_si <0x2c, S_ABSDIFF_I32>;
1189
1190def S_MOVK_I32_si          : SOPK_Real_si <0x00, S_MOVK_I32>;
1191def S_CMOVK_I32_si         : SOPK_Real_si <0x02, S_CMOVK_I32>;
1192def S_CMPK_EQ_I32_si       : SOPK_Real_si <0x03, S_CMPK_EQ_I32>;
1193def S_CMPK_LG_I32_si       : SOPK_Real_si <0x04, S_CMPK_LG_I32>;
1194def S_CMPK_GT_I32_si       : SOPK_Real_si <0x05, S_CMPK_GT_I32>;
1195def S_CMPK_GE_I32_si       : SOPK_Real_si <0x06, S_CMPK_GE_I32>;
1196def S_CMPK_LT_I32_si       : SOPK_Real_si <0x07, S_CMPK_LT_I32>;
1197def S_CMPK_LE_I32_si       : SOPK_Real_si <0x08, S_CMPK_LE_I32>;
1198def S_CMPK_EQ_U32_si       : SOPK_Real_si <0x09, S_CMPK_EQ_U32>;
1199def S_CMPK_LG_U32_si       : SOPK_Real_si <0x0a, S_CMPK_LG_U32>;
1200def S_CMPK_GT_U32_si       : SOPK_Real_si <0x0b, S_CMPK_GT_U32>;
1201def S_CMPK_GE_U32_si       : SOPK_Real_si <0x0c, S_CMPK_GE_U32>;
1202def S_CMPK_LT_U32_si       : SOPK_Real_si <0x0d, S_CMPK_LT_U32>;
1203def S_CMPK_LE_U32_si       : SOPK_Real_si <0x0e, S_CMPK_LE_U32>;
1204def S_ADDK_I32_si          : SOPK_Real_si <0x0f, S_ADDK_I32>;
1205def S_MULK_I32_si          : SOPK_Real_si <0x10, S_MULK_I32>;
1206def S_CBRANCH_I_FORK_si    : SOPK_Real_si <0x11, S_CBRANCH_I_FORK>;
1207def S_GETREG_B32_si        : SOPK_Real_si <0x12, S_GETREG_B32>;
1208def S_SETREG_B32_si        : SOPK_Real_si <0x13, S_SETREG_B32>;
1209//def S_GETREG_REGRD_B32_si  : SOPK_Real_si <0x14, S_GETREG_REGRD_B32>; // see pseudo for comments
1210def S_SETREG_IMM32_B32_si  : SOPK_Real64<0x15, S_SETREG_IMM32_B32>,
1211                             Select_si<S_SETREG_IMM32_B32.Mnemonic>;
1212
1213
1214class Select_vi<string opName> :
1215  SIMCInstr<opName, SIEncodingFamily.VI> {
1216  list<Predicate> AssemblerPredicates = [isVI];
1217  string DecoderNamespace = "VI";
1218}
1219
1220class SOP1_Real_vi<bits<8> op, SOP1_Pseudo ps> :
1221  SOP1_Real<op, ps>,
1222  Select_vi<ps.Mnemonic>;
1223
1224
1225class SOP2_Real_vi<bits<7> op, SOP2_Pseudo ps> :
1226  SOP2_Real<op, ps>,
1227  Select_vi<ps.Mnemonic>;
1228
1229class SOPK_Real_vi<bits<5> op, SOPK_Pseudo ps> :
1230  SOPK_Real32<op, ps>,
1231  Select_vi<ps.Mnemonic>;
1232
1233def S_MOV_B32_vi           : SOP1_Real_vi <0x00, S_MOV_B32>;
1234def S_MOV_B64_vi           : SOP1_Real_vi <0x01, S_MOV_B64>;
1235def S_CMOV_B32_vi          : SOP1_Real_vi <0x02, S_CMOV_B32>;
1236def S_CMOV_B64_vi          : SOP1_Real_vi <0x03, S_CMOV_B64>;
1237def S_NOT_B32_vi           : SOP1_Real_vi <0x04, S_NOT_B32>;
1238def S_NOT_B64_vi           : SOP1_Real_vi <0x05, S_NOT_B64>;
1239def S_WQM_B32_vi           : SOP1_Real_vi <0x06, S_WQM_B32>;
1240def S_WQM_B64_vi           : SOP1_Real_vi <0x07, S_WQM_B64>;
1241def S_BREV_B32_vi          : SOP1_Real_vi <0x08, S_BREV_B32>;
1242def S_BREV_B64_vi          : SOP1_Real_vi <0x09, S_BREV_B64>;
1243def S_BCNT0_I32_B32_vi     : SOP1_Real_vi <0x0a, S_BCNT0_I32_B32>;
1244def S_BCNT0_I32_B64_vi     : SOP1_Real_vi <0x0b, S_BCNT0_I32_B64>;
1245def S_BCNT1_I32_B32_vi     : SOP1_Real_vi <0x0c, S_BCNT1_I32_B32>;
1246def S_BCNT1_I32_B64_vi     : SOP1_Real_vi <0x0d, S_BCNT1_I32_B64>;
1247def S_FF0_I32_B32_vi       : SOP1_Real_vi <0x0e, S_FF0_I32_B32>;
1248def S_FF0_I32_B64_vi       : SOP1_Real_vi <0x0f, S_FF0_I32_B64>;
1249def S_FF1_I32_B32_vi       : SOP1_Real_vi <0x10, S_FF1_I32_B32>;
1250def S_FF1_I32_B64_vi       : SOP1_Real_vi <0x11, S_FF1_I32_B64>;
1251def S_FLBIT_I32_B32_vi     : SOP1_Real_vi <0x12, S_FLBIT_I32_B32>;
1252def S_FLBIT_I32_B64_vi     : SOP1_Real_vi <0x13, S_FLBIT_I32_B64>;
1253def S_FLBIT_I32_vi         : SOP1_Real_vi <0x14, S_FLBIT_I32>;
1254def S_FLBIT_I32_I64_vi     : SOP1_Real_vi <0x15, S_FLBIT_I32_I64>;
1255def S_SEXT_I32_I8_vi       : SOP1_Real_vi <0x16, S_SEXT_I32_I8>;
1256def S_SEXT_I32_I16_vi      : SOP1_Real_vi <0x17, S_SEXT_I32_I16>;
1257def S_BITSET0_B32_vi       : SOP1_Real_vi <0x18, S_BITSET0_B32>;
1258def S_BITSET0_B64_vi       : SOP1_Real_vi <0x19, S_BITSET0_B64>;
1259def S_BITSET1_B32_vi       : SOP1_Real_vi <0x1a, S_BITSET1_B32>;
1260def S_BITSET1_B64_vi       : SOP1_Real_vi <0x1b, S_BITSET1_B64>;
1261def S_GETPC_B64_vi         : SOP1_Real_vi <0x1c, S_GETPC_B64>;
1262def S_SETPC_B64_vi         : SOP1_Real_vi <0x1d, S_SETPC_B64>;
1263def S_SWAPPC_B64_vi        : SOP1_Real_vi <0x1e, S_SWAPPC_B64>;
1264def S_RFE_B64_vi           : SOP1_Real_vi <0x1f, S_RFE_B64>;
1265def S_AND_SAVEEXEC_B64_vi  : SOP1_Real_vi <0x20, S_AND_SAVEEXEC_B64>;
1266def S_OR_SAVEEXEC_B64_vi   : SOP1_Real_vi <0x21, S_OR_SAVEEXEC_B64>;
1267def S_XOR_SAVEEXEC_B64_vi  : SOP1_Real_vi <0x22, S_XOR_SAVEEXEC_B64>;
1268def S_ANDN2_SAVEEXEC_B64_vi: SOP1_Real_vi <0x23, S_ANDN2_SAVEEXEC_B64>;
1269def S_ORN2_SAVEEXEC_B64_vi : SOP1_Real_vi <0x24, S_ORN2_SAVEEXEC_B64>;
1270def S_NAND_SAVEEXEC_B64_vi : SOP1_Real_vi <0x25, S_NAND_SAVEEXEC_B64>;
1271def S_NOR_SAVEEXEC_B64_vi  : SOP1_Real_vi <0x26, S_NOR_SAVEEXEC_B64>;
1272def S_XNOR_SAVEEXEC_B64_vi : SOP1_Real_vi <0x27, S_XNOR_SAVEEXEC_B64>;
1273def S_QUADMASK_B32_vi      : SOP1_Real_vi <0x28, S_QUADMASK_B32>;
1274def S_QUADMASK_B64_vi      : SOP1_Real_vi <0x29, S_QUADMASK_B64>;
1275def S_MOVRELS_B32_vi       : SOP1_Real_vi <0x2a, S_MOVRELS_B32>;
1276def S_MOVRELS_B64_vi       : SOP1_Real_vi <0x2b, S_MOVRELS_B64>;
1277def S_MOVRELD_B32_vi       : SOP1_Real_vi <0x2c, S_MOVRELD_B32>;
1278def S_MOVRELD_B64_vi       : SOP1_Real_vi <0x2d, S_MOVRELD_B64>;
1279def S_CBRANCH_JOIN_vi      : SOP1_Real_vi <0x2e, S_CBRANCH_JOIN>;
1280def S_MOV_REGRD_B32_vi     : SOP1_Real_vi <0x2f, S_MOV_REGRD_B32>;
1281def S_ABS_I32_vi           : SOP1_Real_vi <0x30, S_ABS_I32>;
1282def S_MOV_FED_B32_vi       : SOP1_Real_vi <0x31, S_MOV_FED_B32>;
1283def S_SET_GPR_IDX_IDX_vi   : SOP1_Real_vi <0x32, S_SET_GPR_IDX_IDX>;
1284
1285def S_ADD_U32_vi           : SOP2_Real_vi <0x00, S_ADD_U32>;
1286def S_ADD_I32_vi           : SOP2_Real_vi <0x02, S_ADD_I32>;
1287def S_SUB_U32_vi           : SOP2_Real_vi <0x01, S_SUB_U32>;
1288def S_SUB_I32_vi           : SOP2_Real_vi <0x03, S_SUB_I32>;
1289def S_ADDC_U32_vi          : SOP2_Real_vi <0x04, S_ADDC_U32>;
1290def S_SUBB_U32_vi          : SOP2_Real_vi <0x05, S_SUBB_U32>;
1291def S_MIN_I32_vi           : SOP2_Real_vi <0x06, S_MIN_I32>;
1292def S_MIN_U32_vi           : SOP2_Real_vi <0x07, S_MIN_U32>;
1293def S_MAX_I32_vi           : SOP2_Real_vi <0x08, S_MAX_I32>;
1294def S_MAX_U32_vi           : SOP2_Real_vi <0x09, S_MAX_U32>;
1295def S_CSELECT_B32_vi       : SOP2_Real_vi <0x0a, S_CSELECT_B32>;
1296def S_CSELECT_B64_vi       : SOP2_Real_vi <0x0b, S_CSELECT_B64>;
1297def S_AND_B32_vi           : SOP2_Real_vi <0x0c, S_AND_B32>;
1298def S_AND_B64_vi           : SOP2_Real_vi <0x0d, S_AND_B64>;
1299def S_OR_B32_vi            : SOP2_Real_vi <0x0e, S_OR_B32>;
1300def S_OR_B64_vi            : SOP2_Real_vi <0x0f, S_OR_B64>;
1301def S_XOR_B32_vi           : SOP2_Real_vi <0x10, S_XOR_B32>;
1302def S_XOR_B64_vi           : SOP2_Real_vi <0x11, S_XOR_B64>;
1303def S_ANDN2_B32_vi         : SOP2_Real_vi <0x12, S_ANDN2_B32>;
1304def S_ANDN2_B64_vi         : SOP2_Real_vi <0x13, S_ANDN2_B64>;
1305def S_ORN2_B32_vi          : SOP2_Real_vi <0x14, S_ORN2_B32>;
1306def S_ORN2_B64_vi          : SOP2_Real_vi <0x15, S_ORN2_B64>;
1307def S_NAND_B32_vi          : SOP2_Real_vi <0x16, S_NAND_B32>;
1308def S_NAND_B64_vi          : SOP2_Real_vi <0x17, S_NAND_B64>;
1309def S_NOR_B32_vi           : SOP2_Real_vi <0x18, S_NOR_B32>;
1310def S_NOR_B64_vi           : SOP2_Real_vi <0x19, S_NOR_B64>;
1311def S_XNOR_B32_vi          : SOP2_Real_vi <0x1a, S_XNOR_B32>;
1312def S_XNOR_B64_vi          : SOP2_Real_vi <0x1b, S_XNOR_B64>;
1313def S_LSHL_B32_vi          : SOP2_Real_vi <0x1c, S_LSHL_B32>;
1314def S_LSHL_B64_vi          : SOP2_Real_vi <0x1d, S_LSHL_B64>;
1315def S_LSHR_B32_vi          : SOP2_Real_vi <0x1e, S_LSHR_B32>;
1316def S_LSHR_B64_vi          : SOP2_Real_vi <0x1f, S_LSHR_B64>;
1317def S_ASHR_I32_vi          : SOP2_Real_vi <0x20, S_ASHR_I32>;
1318def S_ASHR_I64_vi          : SOP2_Real_vi <0x21, S_ASHR_I64>;
1319def S_BFM_B32_vi           : SOP2_Real_vi <0x22, S_BFM_B32>;
1320def S_BFM_B64_vi           : SOP2_Real_vi <0x23, S_BFM_B64>;
1321def S_MUL_I32_vi           : SOP2_Real_vi <0x24, S_MUL_I32>;
1322def S_BFE_U32_vi           : SOP2_Real_vi <0x25, S_BFE_U32>;
1323def S_BFE_I32_vi           : SOP2_Real_vi <0x26, S_BFE_I32>;
1324def S_BFE_U64_vi           : SOP2_Real_vi <0x27, S_BFE_U64>;
1325def S_BFE_I64_vi           : SOP2_Real_vi <0x28, S_BFE_I64>;
1326def S_CBRANCH_G_FORK_vi    : SOP2_Real_vi <0x29, S_CBRANCH_G_FORK>;
1327def S_ABSDIFF_I32_vi       : SOP2_Real_vi <0x2a, S_ABSDIFF_I32>;
1328def S_PACK_LL_B32_B16_vi   : SOP2_Real_vi <0x32, S_PACK_LL_B32_B16>;
1329def S_PACK_LH_B32_B16_vi   : SOP2_Real_vi <0x33, S_PACK_LH_B32_B16>;
1330def S_PACK_HH_B32_B16_vi   : SOP2_Real_vi <0x34, S_PACK_HH_B32_B16>;
1331def S_RFE_RESTORE_B64_vi   : SOP2_Real_vi <0x2b, S_RFE_RESTORE_B64>;
1332
1333def S_MOVK_I32_vi          : SOPK_Real_vi <0x00, S_MOVK_I32>;
1334def S_CMOVK_I32_vi         : SOPK_Real_vi <0x01, S_CMOVK_I32>;
1335def S_CMPK_EQ_I32_vi       : SOPK_Real_vi <0x02, S_CMPK_EQ_I32>;
1336def S_CMPK_LG_I32_vi       : SOPK_Real_vi <0x03, S_CMPK_LG_I32>;
1337def S_CMPK_GT_I32_vi       : SOPK_Real_vi <0x04, S_CMPK_GT_I32>;
1338def S_CMPK_GE_I32_vi       : SOPK_Real_vi <0x05, S_CMPK_GE_I32>;
1339def S_CMPK_LT_I32_vi       : SOPK_Real_vi <0x06, S_CMPK_LT_I32>;
1340def S_CMPK_LE_I32_vi       : SOPK_Real_vi <0x07, S_CMPK_LE_I32>;
1341def S_CMPK_EQ_U32_vi       : SOPK_Real_vi <0x08, S_CMPK_EQ_U32>;
1342def S_CMPK_LG_U32_vi       : SOPK_Real_vi <0x09, S_CMPK_LG_U32>;
1343def S_CMPK_GT_U32_vi       : SOPK_Real_vi <0x0A, S_CMPK_GT_U32>;
1344def S_CMPK_GE_U32_vi       : SOPK_Real_vi <0x0B, S_CMPK_GE_U32>;
1345def S_CMPK_LT_U32_vi       : SOPK_Real_vi <0x0C, S_CMPK_LT_U32>;
1346def S_CMPK_LE_U32_vi       : SOPK_Real_vi <0x0D, S_CMPK_LE_U32>;
1347def S_ADDK_I32_vi          : SOPK_Real_vi <0x0E, S_ADDK_I32>;
1348def S_MULK_I32_vi          : SOPK_Real_vi <0x0F, S_MULK_I32>;
1349def S_CBRANCH_I_FORK_vi    : SOPK_Real_vi <0x10, S_CBRANCH_I_FORK>;
1350def S_GETREG_B32_vi        : SOPK_Real_vi <0x11, S_GETREG_B32>;
1351def S_SETREG_B32_vi        : SOPK_Real_vi <0x12, S_SETREG_B32>;
1352//def S_GETREG_REGRD_B32_vi  : SOPK_Real_vi <0x13, S_GETREG_REGRD_B32>; // see pseudo for comments
1353def S_SETREG_IMM32_B32_vi  : SOPK_Real64<0x14, S_SETREG_IMM32_B32>,
1354                             Select_vi<S_SETREG_IMM32_B32.Mnemonic>;
1355
1356def S_CALL_B64_vi          : SOPK_Real_vi <0x15, S_CALL_B64>;
1357
1358//===----------------------------------------------------------------------===//
1359// SOP1 - GFX9.
1360//===----------------------------------------------------------------------===//
1361
1362def S_ANDN1_SAVEEXEC_B64_vi   : SOP1_Real_vi<0x33, S_ANDN1_SAVEEXEC_B64>;
1363def S_ORN1_SAVEEXEC_B64_vi    : SOP1_Real_vi<0x34, S_ORN1_SAVEEXEC_B64>;
1364def S_ANDN1_WREXEC_B64_vi     : SOP1_Real_vi<0x35, S_ANDN1_WREXEC_B64>;
1365def S_ANDN2_WREXEC_B64_vi     : SOP1_Real_vi<0x36, S_ANDN2_WREXEC_B64>;
1366def S_BITREPLICATE_B64_B32_vi : SOP1_Real_vi<0x37, S_BITREPLICATE_B64_B32>;
1367
1368//===----------------------------------------------------------------------===//
1369// SOP2 - GFX9.
1370//===----------------------------------------------------------------------===//
1371
1372def S_LSHL1_ADD_U32_vi   : SOP2_Real_vi<0x2e, S_LSHL1_ADD_U32>;
1373def S_LSHL2_ADD_U32_vi   : SOP2_Real_vi<0x2f, S_LSHL2_ADD_U32>;
1374def S_LSHL3_ADD_U32_vi   : SOP2_Real_vi<0x30, S_LSHL3_ADD_U32>;
1375def S_LSHL4_ADD_U32_vi   : SOP2_Real_vi<0x31, S_LSHL4_ADD_U32>;
1376def S_MUL_HI_U32_vi      : SOP2_Real_vi<0x2c, S_MUL_HI_U32>;
1377def S_MUL_HI_I32_vi      : SOP2_Real_vi<0x2d, S_MUL_HI_I32>;
1378