[ARM] VQADD instructions
[llvm-complete.git] / lib / Target / AMDGPU / DSInstructions.td
blob86c2db92acb422f76cd12820b20e97e42bbef959
1 //===-- DSInstructions.td - DS Instruction Defintions ---------------------===//
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 //===----------------------------------------------------------------------===//
9 class DS_Pseudo <string opName, dag outs, dag ins, string asmOps, list<dag> pattern=[]> :
10   InstSI <outs, ins, "", pattern>,
11   SIMCInstr <opName, SIEncodingFamily.NONE> {
13   let LGKM_CNT = 1;
14   let DS = 1;
15   let Size = 8;
16   let UseNamedOperandTable = 1;
18   // Most instruction load and store data, so set this as the default.
19   let mayLoad = 1;
20   let mayStore = 1;
21   let maybeAtomic = 1;
23   let hasSideEffects = 0;
24   let SchedRW = [WriteLDS];
26   let isPseudo = 1;
27   let isCodeGenOnly = 1;
29   let AsmMatchConverter = "cvtDS";
31   string Mnemonic = opName;
32   string AsmOperands = asmOps;
34   // Well these bits a kind of hack because it would be more natural
35   // to test "outs" and "ins" dags for the presence of particular operands
36   bits<1> has_vdst = 1;
37   bits<1> has_addr = 1;
38   bits<1> has_data0 = 1;
39   bits<1> has_data1 = 1;
41   bits<1> has_gws_data0 = 0; // data0 is encoded as addr
43   bits<1> has_offset  = 1; // has "offset" that should be split to offset0,1
44   bits<1> has_offset0 = 1;
45   bits<1> has_offset1 = 1;
47   bits<1> has_gds = 1;
48   bits<1> gdsValue = 0; // if has_gds == 0 set gds to this value
50   bits<1> has_m0_read = 1;
52   let Uses = !if(has_m0_read, [M0, EXEC], [EXEC]);
55 class DS_Real <DS_Pseudo ds> :
56   InstSI <ds.OutOperandList, ds.InOperandList, ds.Mnemonic # " " # ds.AsmOperands, []>,
57   Enc64 {
59   let isPseudo = 0;
60   let isCodeGenOnly = 0;
62   // copy relevant pseudo op flags
63   let SubtargetPredicate = ds.SubtargetPredicate;
64   let OtherPredicates = ds.OtherPredicates;
65   let AsmMatchConverter  = ds.AsmMatchConverter;
67   // encoding fields
68   bits<8> vdst;
69   bits<1> gds;
70   bits<8> addr;
71   bits<8> data0;
72   bits<8> data1;
73   bits<8> offset0;
74   bits<8> offset1;
76   bits<16> offset;
77   let offset0 = !if(ds.has_offset, offset{7-0}, ?);
78   let offset1 = !if(ds.has_offset, offset{15-8}, ?);
82 // DS Pseudo instructions
84 class DS_1A1D_NORET<string opName, RegisterClass rc = VGPR_32>
85 : DS_Pseudo<opName,
86   (outs),
87   (ins VGPR_32:$addr, rc:$data0, offset:$offset, gds:$gds),
88   "$addr, $data0$offset$gds"> {
90   let has_data1 = 0;
91   let has_vdst = 0;
94 multiclass DS_1A1D_NORET_mc<string opName, RegisterClass rc = VGPR_32> {
95   def "" : DS_1A1D_NORET<opName, rc>,
96            AtomicNoRet<opName, 0>;
98   let has_m0_read = 0 in {
99     def _gfx9 : DS_1A1D_NORET<opName, rc>,
100                 AtomicNoRet<opName#"_gfx9", 0>;
101   }
104 class DS_1A2D_NORET<string opName, RegisterClass rc = VGPR_32>
105 : DS_Pseudo<opName,
106   (outs),
107   (ins VGPR_32:$addr, rc:$data0, rc:$data1, offset:$offset, gds:$gds),
108   "$addr, $data0, $data1"#"$offset"#"$gds"> {
110   let has_vdst = 0;
113 multiclass DS_1A2D_NORET_mc<string opName, RegisterClass rc = VGPR_32> {
114   def "" : DS_1A2D_NORET<opName, rc>,
115            AtomicNoRet<opName, 0>;
117   let has_m0_read = 0 in {
118     def _gfx9 : DS_1A2D_NORET<opName, rc>,
119                 AtomicNoRet<opName#"_gfx9", 0>;
120   }
123 class DS_1A2D_Off8_NORET <string opName, RegisterClass rc = VGPR_32>
124 : DS_Pseudo<opName,
125   (outs),
126   (ins VGPR_32:$addr, rc:$data0, rc:$data1,
127        offset0:$offset0, offset1:$offset1, gds:$gds),
128   "$addr, $data0, $data1$offset0$offset1$gds"> {
130   let has_vdst = 0;
131   let has_offset = 0;
132   let AsmMatchConverter = "cvtDSOffset01";
135 multiclass DS_1A2D_Off8_NORET_mc <string opName, RegisterClass rc = VGPR_32> {
136   def "" : DS_1A2D_Off8_NORET<opName, rc>;
138   let has_m0_read = 0 in {
139     def _gfx9 : DS_1A2D_Off8_NORET<opName, rc>;
140   }
143 class DS_1A1D_RET <string opName, RegisterClass rc = VGPR_32>
144 : DS_Pseudo<opName,
145   (outs rc:$vdst),
146   (ins VGPR_32:$addr, rc:$data0, offset:$offset, gds:$gds),
147   "$vdst, $addr, $data0$offset$gds"> {
149   let hasPostISelHook = 1;
150   let has_data1 = 0;
153 multiclass DS_1A1D_RET_mc <string opName, RegisterClass rc = VGPR_32,
154                            string NoRetOp = ""> {
155   def "" : DS_1A1D_RET<opName, rc>,
156     AtomicNoRet<NoRetOp, !if(!eq(NoRetOp, ""), 0, 1)>;
158   let has_m0_read = 0 in {
159     def _gfx9 : DS_1A1D_RET<opName, rc>,
160       AtomicNoRet<!if(!eq(NoRetOp, ""), "", NoRetOp#"_gfx9"),
161                   !if(!eq(NoRetOp, ""), 0, 1)>;
162   }
165 class DS_1A2D_RET<string opName,
166                   RegisterClass rc = VGPR_32,
167                   RegisterClass src = rc>
168 : DS_Pseudo<opName,
169   (outs rc:$vdst),
170   (ins VGPR_32:$addr, src:$data0, src:$data1, offset:$offset, gds:$gds),
171   "$vdst, $addr, $data0, $data1$offset$gds"> {
173   let hasPostISelHook = 1;
176 multiclass DS_1A2D_RET_mc<string opName,
177                           RegisterClass rc = VGPR_32,
178                           string NoRetOp = "",
179                           RegisterClass src = rc> {
180   def "" : DS_1A2D_RET<opName, rc, src>,
181     AtomicNoRet<NoRetOp, !if(!eq(NoRetOp, ""), 0, 1)>;
183   let has_m0_read = 0 in {
184     def _gfx9 : DS_1A2D_RET<opName, rc, src>,
185       AtomicNoRet<NoRetOp#"_gfx9", !if(!eq(NoRetOp, ""), 0, 1)>;
186   }
189 class DS_1A2D_Off8_RET<string opName,
190                        RegisterClass rc = VGPR_32,
191                        RegisterClass src = rc>
192 : DS_Pseudo<opName,
193   (outs rc:$vdst),
194   (ins VGPR_32:$addr, src:$data0, src:$data1, offset0:$offset0, offset1:$offset1, gds:$gds),
195   "$vdst, $addr, $data0, $data1$offset0$offset1$gds"> {
197   let has_offset = 0;
198   let AsmMatchConverter = "cvtDSOffset01";
200   let hasPostISelHook = 1;
203 multiclass DS_1A2D_Off8_RET_mc<string opName,
204                                RegisterClass rc = VGPR_32,
205                                RegisterClass src = rc> {
206   def "" : DS_1A2D_Off8_RET<opName, rc, src>;
208   let has_m0_read = 0 in {
209     def _gfx9 : DS_1A2D_Off8_RET<opName, rc, src>;
210   }
214 class DS_1A_RET<string opName, RegisterClass rc = VGPR_32, bit HasTiedOutput = 0, Operand ofs = offset>
215 : DS_Pseudo<opName,
216   (outs rc:$vdst),
217   !if(HasTiedOutput,
218     (ins VGPR_32:$addr, ofs:$offset, gds:$gds, rc:$vdst_in),
219     (ins VGPR_32:$addr, ofs:$offset, gds:$gds)),
220   "$vdst, $addr$offset$gds"> {
221   let Constraints = !if(HasTiedOutput, "$vdst = $vdst_in", "");
222   let DisableEncoding = !if(HasTiedOutput, "$vdst_in", "");
223   let has_data0 = 0;
224   let has_data1 = 0;
227 multiclass DS_1A_RET_mc<string opName, RegisterClass rc = VGPR_32, bit HasTiedOutput = 0, Operand ofs = offset> {
228   def "" : DS_1A_RET<opName, rc, HasTiedOutput, ofs>;
230   let has_m0_read = 0 in {
231     def _gfx9 : DS_1A_RET<opName, rc, HasTiedOutput, ofs>;
232   }
235 class DS_1A_RET_Tied<string opName, RegisterClass rc = VGPR_32> :
236   DS_1A_RET<opName, rc, 1>;
238 class DS_1A_Off8_RET <string opName, RegisterClass rc = VGPR_32>
239 : DS_Pseudo<opName,
240   (outs rc:$vdst),
241   (ins VGPR_32:$addr, offset0:$offset0, offset1:$offset1, gds:$gds),
242   "$vdst, $addr$offset0$offset1$gds"> {
244   let has_offset = 0;
245   let has_data0 = 0;
246   let has_data1 = 0;
247   let AsmMatchConverter = "cvtDSOffset01";
250 multiclass DS_1A_Off8_RET_mc <string opName, RegisterClass rc = VGPR_32> {
251   def "" : DS_1A_Off8_RET<opName, rc>;
253   let has_m0_read = 0 in {
254     def _gfx9 : DS_1A_Off8_RET<opName, rc>;
255   }
258 class DS_1A_RET_GDS <string opName> : DS_Pseudo<opName,
259   (outs VGPR_32:$vdst),
260   (ins VGPR_32:$addr, offset:$offset),
261   "$vdst, $addr$offset gds"> {
263   let has_data0 = 0;
264   let has_data1 = 0;
265   let has_gds = 0;
266   let gdsValue = 1;
267   let AsmMatchConverter = "cvtDSGds";
270 class DS_0A_RET <string opName> : DS_Pseudo<opName,
271   (outs VGPR_32:$vdst),
272   (ins offset:$offset, gds:$gds),
273   "$vdst$offset$gds"> {
275   let mayLoad = 1;
276   let mayStore = 1;
278   let has_addr = 0;
279   let has_data0 = 0;
280   let has_data1 = 0;
283 class DS_1A <string opName> : DS_Pseudo<opName,
284   (outs),
285   (ins VGPR_32:$addr, offset:$offset, gds:$gds),
286   "$addr$offset$gds"> {
288   let mayLoad = 1;
289   let mayStore = 1;
291   let has_vdst = 0;
292   let has_data0 = 0;
293   let has_data1 = 0;
296 multiclass DS_1A_mc <string opName> {
297   def "" : DS_1A<opName>;
299   let has_m0_read = 0 in {
300     def _gfx9 : DS_1A<opName>;
301   }
305 class DS_GWS <string opName, dag ins, string asmOps>
306 : DS_Pseudo<opName, (outs), ins, asmOps> {
308   let has_vdst  = 0;
309   let has_addr  = 0;
310   let has_data0 = 0;
311   let has_data1 = 0;
313   let has_gds   = 0;
314   let gdsValue  = 1;
315   let AsmMatchConverter = "cvtDSGds";
318 class DS_GWS_0D <string opName>
319 : DS_GWS<opName,
320   (ins offset:$offset, gds:$gds), "$offset gds"> {
321   let hasSideEffects = 1;
324 class DS_GWS_1D <string opName>
325 : DS_GWS<opName,
326   (ins VGPR_32:$data0, offset:$offset, gds:$gds), "$data0$offset gds"> {
328   let has_gws_data0 = 1;
329   let hasSideEffects = 1;
332 class DS_VOID <string opName> : DS_Pseudo<opName,
333   (outs), (ins), ""> {
334   let mayLoad = 0;
335   let mayStore = 0;
336   let hasSideEffects = 1;
337   let UseNamedOperandTable = 0;
338   let AsmMatchConverter = "";
340   let has_vdst = 0;
341   let has_addr = 0;
342   let has_data0 = 0;
343   let has_data1 = 0;
344   let has_offset = 0;
345   let has_offset0 = 0;
346   let has_offset1 = 0;
347   let has_gds = 0;
350 class DS_1A1D_PERMUTE <string opName, SDPatternOperator node = null_frag>
351 : DS_Pseudo<opName,
352   (outs VGPR_32:$vdst),
353   (ins VGPR_32:$addr, VGPR_32:$data0, offset:$offset),
354   "$vdst, $addr, $data0$offset",
355   [(set i32:$vdst,
356    (node (DS1Addr1Offset i32:$addr, i16:$offset), i32:$data0))] > {
358   let mayLoad = 0;
359   let mayStore = 0;
360   let isConvergent = 1;
362   let has_data1 = 0;
363   let has_gds = 0;
366 defm DS_ADD_U32       : DS_1A1D_NORET_mc<"ds_add_u32">;
367 defm DS_SUB_U32       : DS_1A1D_NORET_mc<"ds_sub_u32">;
368 defm DS_RSUB_U32      : DS_1A1D_NORET_mc<"ds_rsub_u32">;
369 defm DS_INC_U32       : DS_1A1D_NORET_mc<"ds_inc_u32">;
370 defm DS_DEC_U32       : DS_1A1D_NORET_mc<"ds_dec_u32">;
371 defm DS_MIN_I32       : DS_1A1D_NORET_mc<"ds_min_i32">;
372 defm DS_MAX_I32       : DS_1A1D_NORET_mc<"ds_max_i32">;
373 defm DS_MIN_U32       : DS_1A1D_NORET_mc<"ds_min_u32">;
374 defm DS_MAX_U32       : DS_1A1D_NORET_mc<"ds_max_u32">;
375 defm DS_AND_B32       : DS_1A1D_NORET_mc<"ds_and_b32">;
376 defm DS_OR_B32        : DS_1A1D_NORET_mc<"ds_or_b32">;
377 defm DS_XOR_B32       : DS_1A1D_NORET_mc<"ds_xor_b32">;
378 defm DS_ADD_F32       : DS_1A1D_NORET_mc<"ds_add_f32">;
379 defm DS_MIN_F32       : DS_1A1D_NORET_mc<"ds_min_f32">;
380 defm DS_MAX_F32       : DS_1A1D_NORET_mc<"ds_max_f32">;
382 let mayLoad = 0 in {
383 defm DS_WRITE_B8      : DS_1A1D_NORET_mc<"ds_write_b8">;
384 defm DS_WRITE_B16     : DS_1A1D_NORET_mc<"ds_write_b16">;
385 defm DS_WRITE_B32     : DS_1A1D_NORET_mc<"ds_write_b32">;
386 defm DS_WRITE2_B32    : DS_1A2D_Off8_NORET_mc<"ds_write2_b32">;
387 defm DS_WRITE2ST64_B32: DS_1A2D_Off8_NORET_mc<"ds_write2st64_b32">;
390 let has_m0_read = 0 in {
392 let SubtargetPredicate = HasD16LoadStore in {
393 def DS_WRITE_B8_D16_HI  : DS_1A1D_NORET<"ds_write_b8_d16_hi">;
394 def DS_WRITE_B16_D16_HI : DS_1A1D_NORET<"ds_write_b16_d16_hi">;
397 let SubtargetPredicate = HasDSAddTid in {
398 def DS_WRITE_ADDTID_B32 : DS_1A1D_NORET<"ds_write_addtid_b32">;
401 } // End has_m0_read = 0
402 } // End mayLoad = 0
404 defm DS_MSKOR_B32     : DS_1A2D_NORET_mc<"ds_mskor_b32">;
405 defm DS_CMPST_B32     : DS_1A2D_NORET_mc<"ds_cmpst_b32">;
406 defm DS_CMPST_F32     : DS_1A2D_NORET_mc<"ds_cmpst_f32">;
408 defm DS_ADD_U64       : DS_1A1D_NORET_mc<"ds_add_u64", VReg_64>;
409 defm DS_SUB_U64       : DS_1A1D_NORET_mc<"ds_sub_u64", VReg_64>;
410 defm DS_RSUB_U64      : DS_1A1D_NORET_mc<"ds_rsub_u64", VReg_64>;
411 defm DS_INC_U64       : DS_1A1D_NORET_mc<"ds_inc_u64", VReg_64>;
412 defm DS_DEC_U64       : DS_1A1D_NORET_mc<"ds_dec_u64", VReg_64>;
413 defm DS_MIN_I64       : DS_1A1D_NORET_mc<"ds_min_i64", VReg_64>;
414 defm DS_MAX_I64       : DS_1A1D_NORET_mc<"ds_max_i64", VReg_64>;
415 defm DS_MIN_U64       : DS_1A1D_NORET_mc<"ds_min_u64", VReg_64>;
416 defm DS_MAX_U64       : DS_1A1D_NORET_mc<"ds_max_u64", VReg_64>;
417 defm DS_AND_B64       : DS_1A1D_NORET_mc<"ds_and_b64", VReg_64>;
418 defm DS_OR_B64        : DS_1A1D_NORET_mc<"ds_or_b64", VReg_64>;
419 defm DS_XOR_B64       : DS_1A1D_NORET_mc<"ds_xor_b64", VReg_64>;
420 defm DS_MSKOR_B64     : DS_1A2D_NORET_mc<"ds_mskor_b64", VReg_64>;
421 let mayLoad = 0 in {
422 defm DS_WRITE_B64     : DS_1A1D_NORET_mc<"ds_write_b64", VReg_64>;
423 defm DS_WRITE2_B64    : DS_1A2D_Off8_NORET_mc<"ds_write2_b64", VReg_64>;
424 defm DS_WRITE2ST64_B64: DS_1A2D_Off8_NORET_mc<"ds_write2st64_b64", VReg_64>;
426 defm DS_CMPST_B64     : DS_1A2D_NORET_mc<"ds_cmpst_b64", VReg_64>;
427 defm DS_CMPST_F64     : DS_1A2D_NORET_mc<"ds_cmpst_f64", VReg_64>;
428 defm DS_MIN_F64       : DS_1A1D_NORET_mc<"ds_min_f64", VReg_64>;
429 defm DS_MAX_F64       : DS_1A1D_NORET_mc<"ds_max_f64", VReg_64>;
431 defm DS_ADD_RTN_U32   : DS_1A1D_RET_mc<"ds_add_rtn_u32", VGPR_32, "ds_add_u32">;
432 defm DS_ADD_RTN_F32   : DS_1A1D_RET_mc<"ds_add_rtn_f32", VGPR_32, "ds_add_f32">;
433 defm DS_SUB_RTN_U32   : DS_1A1D_RET_mc<"ds_sub_rtn_u32", VGPR_32, "ds_sub_u32">;
434 defm DS_RSUB_RTN_U32  : DS_1A1D_RET_mc<"ds_rsub_rtn_u32", VGPR_32, "ds_rsub_u32">;
435 defm DS_INC_RTN_U32   : DS_1A1D_RET_mc<"ds_inc_rtn_u32", VGPR_32, "ds_inc_u32">;
436 defm DS_DEC_RTN_U32   : DS_1A1D_RET_mc<"ds_dec_rtn_u32", VGPR_32, "ds_dec_u32">;
437 defm DS_MIN_RTN_I32   : DS_1A1D_RET_mc<"ds_min_rtn_i32", VGPR_32, "ds_min_i32">;
438 defm DS_MAX_RTN_I32   : DS_1A1D_RET_mc<"ds_max_rtn_i32", VGPR_32, "ds_max_i32">;
439 defm DS_MIN_RTN_U32   : DS_1A1D_RET_mc<"ds_min_rtn_u32", VGPR_32, "ds_min_u32">;
440 defm DS_MAX_RTN_U32   : DS_1A1D_RET_mc<"ds_max_rtn_u32", VGPR_32, "ds_max_u32">;
441 defm DS_AND_RTN_B32   : DS_1A1D_RET_mc<"ds_and_rtn_b32", VGPR_32, "ds_and_b32">;
442 defm DS_OR_RTN_B32    : DS_1A1D_RET_mc<"ds_or_rtn_b32", VGPR_32, "ds_or_b32">;
443 defm DS_XOR_RTN_B32   : DS_1A1D_RET_mc<"ds_xor_rtn_b32", VGPR_32, "ds_xor_b32">;
444 defm DS_MSKOR_RTN_B32 : DS_1A2D_RET_mc<"ds_mskor_rtn_b32", VGPR_32, "ds_mskor_b32">;
445 defm DS_CMPST_RTN_B32 : DS_1A2D_RET_mc<"ds_cmpst_rtn_b32", VGPR_32, "ds_cmpst_b32">;
446 defm DS_CMPST_RTN_F32 : DS_1A2D_RET_mc<"ds_cmpst_rtn_f32", VGPR_32, "ds_cmpst_f32">;
447 defm DS_MIN_RTN_F32   : DS_1A1D_RET_mc<"ds_min_rtn_f32", VGPR_32, "ds_min_f32">;
448 defm DS_MAX_RTN_F32   : DS_1A1D_RET_mc<"ds_max_rtn_f32", VGPR_32, "ds_max_f32">;
450 defm DS_WRXCHG_RTN_B32 : DS_1A1D_RET_mc<"ds_wrxchg_rtn_b32">;
451 defm DS_WRXCHG2_RTN_B32 : DS_1A2D_Off8_RET_mc<"ds_wrxchg2_rtn_b32", VReg_64, VGPR_32>;
452 defm DS_WRXCHG2ST64_RTN_B32 : DS_1A2D_Off8_RET_mc<"ds_wrxchg2st64_rtn_b32", VReg_64, VGPR_32>;
454 defm DS_ADD_RTN_U64  : DS_1A1D_RET_mc<"ds_add_rtn_u64", VReg_64, "ds_add_u64">;
455 defm DS_SUB_RTN_U64  : DS_1A1D_RET_mc<"ds_sub_rtn_u64", VReg_64, "ds_sub_u64">;
456 defm DS_RSUB_RTN_U64  : DS_1A1D_RET_mc<"ds_rsub_rtn_u64", VReg_64, "ds_rsub_u64">;
457 defm DS_INC_RTN_U64   : DS_1A1D_RET_mc<"ds_inc_rtn_u64", VReg_64, "ds_inc_u64">;
458 defm DS_DEC_RTN_U64   : DS_1A1D_RET_mc<"ds_dec_rtn_u64", VReg_64, "ds_dec_u64">;
459 defm DS_MIN_RTN_I64    : DS_1A1D_RET_mc<"ds_min_rtn_i64", VReg_64, "ds_min_i64">;
460 defm DS_MAX_RTN_I64    : DS_1A1D_RET_mc<"ds_max_rtn_i64", VReg_64, "ds_max_i64">;
461 defm DS_MIN_RTN_U64   : DS_1A1D_RET_mc<"ds_min_rtn_u64", VReg_64, "ds_min_u64">;
462 defm DS_MAX_RTN_U64   : DS_1A1D_RET_mc<"ds_max_rtn_u64", VReg_64, "ds_max_u64">;
463 defm DS_AND_RTN_B64    : DS_1A1D_RET_mc<"ds_and_rtn_b64", VReg_64, "ds_and_b64">;
464 defm DS_OR_RTN_B64     : DS_1A1D_RET_mc<"ds_or_rtn_b64", VReg_64, "ds_or_b64">;
465 defm DS_XOR_RTN_B64    : DS_1A1D_RET_mc<"ds_xor_rtn_b64", VReg_64, "ds_xor_b64">;
466 defm DS_MSKOR_RTN_B64  : DS_1A2D_RET_mc<"ds_mskor_rtn_b64", VReg_64, "ds_mskor_b64">;
467 defm DS_CMPST_RTN_B64  : DS_1A2D_RET_mc<"ds_cmpst_rtn_b64", VReg_64, "ds_cmpst_b64">;
468 defm DS_CMPST_RTN_F64  : DS_1A2D_RET_mc<"ds_cmpst_rtn_f64", VReg_64, "ds_cmpst_f64">;
469 defm DS_MIN_RTN_F64    : DS_1A1D_RET_mc<"ds_min_rtn_f64", VReg_64, "ds_min_f64">;
470 defm DS_MAX_RTN_F64    : DS_1A1D_RET_mc<"ds_max_rtn_f64", VReg_64, "ds_max_f64">;
472 defm DS_WRXCHG_RTN_B64 : DS_1A1D_RET_mc<"ds_wrxchg_rtn_b64", VReg_64>;
473 defm DS_WRXCHG2_RTN_B64 : DS_1A2D_Off8_RET_mc<"ds_wrxchg2_rtn_b64", VReg_128, VReg_64>;
474 defm DS_WRXCHG2ST64_RTN_B64 : DS_1A2D_Off8_RET_mc<"ds_wrxchg2st64_rtn_b64", VReg_128, VReg_64>;
476 let isConvergent = 1, usesCustomInserter = 1 in {
477 def DS_GWS_INIT       : DS_GWS_1D<"ds_gws_init"> {
478   let mayLoad = 0;
480 def DS_GWS_SEMA_V     : DS_GWS_0D<"ds_gws_sema_v">;
481 def DS_GWS_SEMA_BR    : DS_GWS_1D<"ds_gws_sema_br">;
482 def DS_GWS_SEMA_P     : DS_GWS_0D<"ds_gws_sema_p">;
483 def DS_GWS_BARRIER    : DS_GWS_1D<"ds_gws_barrier">;
486 def DS_ADD_SRC2_U32   : DS_1A<"ds_add_src2_u32">;
487 def DS_SUB_SRC2_U32   : DS_1A<"ds_sub_src2_u32">;
488 def DS_RSUB_SRC2_U32  : DS_1A<"ds_rsub_src2_u32">;
489 def DS_INC_SRC2_U32   : DS_1A<"ds_inc_src2_u32">;
490 def DS_DEC_SRC2_U32   : DS_1A<"ds_dec_src2_u32">;
491 def DS_MIN_SRC2_I32   : DS_1A<"ds_min_src2_i32">;
492 def DS_MAX_SRC2_I32   : DS_1A<"ds_max_src2_i32">;
493 def DS_MIN_SRC2_U32   : DS_1A<"ds_min_src2_u32">;
494 def DS_MAX_SRC2_U32   : DS_1A<"ds_max_src2_u32">;
495 def DS_AND_SRC2_B32   : DS_1A<"ds_and_src2_b32">;
496 def DS_OR_SRC2_B32    : DS_1A<"ds_or_src2_b32">;
497 def DS_XOR_SRC2_B32   : DS_1A<"ds_xor_src2_b32">;
498 def DS_MIN_SRC2_F32   : DS_1A<"ds_min_src2_f32">;
499 def DS_MAX_SRC2_F32   : DS_1A<"ds_max_src2_f32">;
501 def DS_ADD_SRC2_U64   : DS_1A<"ds_add_src2_u64">;
502 def DS_SUB_SRC2_U64   : DS_1A<"ds_sub_src2_u64">;
503 def DS_RSUB_SRC2_U64  : DS_1A<"ds_rsub_src2_u64">;
504 def DS_INC_SRC2_U64   : DS_1A<"ds_inc_src2_u64">;
505 def DS_DEC_SRC2_U64   : DS_1A<"ds_dec_src2_u64">;
506 def DS_MIN_SRC2_I64   : DS_1A<"ds_min_src2_i64">;
507 def DS_MAX_SRC2_I64   : DS_1A<"ds_max_src2_i64">;
508 def DS_MIN_SRC2_U64   : DS_1A<"ds_min_src2_u64">;
509 def DS_MAX_SRC2_U64   : DS_1A<"ds_max_src2_u64">;
510 def DS_AND_SRC2_B64   : DS_1A<"ds_and_src2_b64">;
511 def DS_OR_SRC2_B64    : DS_1A<"ds_or_src2_b64">;
512 def DS_XOR_SRC2_B64   : DS_1A<"ds_xor_src2_b64">;
513 def DS_MIN_SRC2_F64   : DS_1A<"ds_min_src2_f64">;
514 def DS_MAX_SRC2_F64   : DS_1A<"ds_max_src2_f64">;
516 def DS_WRITE_SRC2_B32 : DS_1A<"ds_write_src2_b32">;
517 def DS_WRITE_SRC2_B64 : DS_1A<"ds_write_src2_b64">;
519 let Uses = [EXEC], mayLoad = 0, mayStore = 0, isConvergent = 1 in {
520 def DS_SWIZZLE_B32 : DS_1A_RET <"ds_swizzle_b32", VGPR_32, 0, SwizzleImm>;
523 let mayStore = 0 in {
524 defm DS_READ_I8      : DS_1A_RET_mc<"ds_read_i8">;
525 defm DS_READ_U8      : DS_1A_RET_mc<"ds_read_u8">;
526 defm DS_READ_I16     : DS_1A_RET_mc<"ds_read_i16">;
527 defm DS_READ_U16     : DS_1A_RET_mc<"ds_read_u16">;
528 defm DS_READ_B32     : DS_1A_RET_mc<"ds_read_b32">;
529 defm DS_READ_B64     : DS_1A_RET_mc<"ds_read_b64", VReg_64>;
531 defm DS_READ2_B32    : DS_1A_Off8_RET_mc<"ds_read2_b32", VReg_64>;
532 defm DS_READ2ST64_B32: DS_1A_Off8_RET_mc<"ds_read2st64_b32", VReg_64>;
534 defm DS_READ2_B64    : DS_1A_Off8_RET_mc<"ds_read2_b64", VReg_128>;
535 defm DS_READ2ST64_B64: DS_1A_Off8_RET_mc<"ds_read2st64_b64", VReg_128>;
537 let has_m0_read = 0 in {
538 let SubtargetPredicate = HasD16LoadStore in {
539 def DS_READ_U8_D16     : DS_1A_RET_Tied<"ds_read_u8_d16">;
540 def DS_READ_U8_D16_HI  : DS_1A_RET_Tied<"ds_read_u8_d16_hi">;
541 def DS_READ_I8_D16     : DS_1A_RET_Tied<"ds_read_i8_d16">;
542 def DS_READ_I8_D16_HI  : DS_1A_RET_Tied<"ds_read_i8_d16_hi">;
543 def DS_READ_U16_D16    : DS_1A_RET_Tied<"ds_read_u16_d16">;
544 def DS_READ_U16_D16_HI : DS_1A_RET_Tied<"ds_read_u16_d16_hi">;
547 let SubtargetPredicate = HasDSAddTid in {
548 def DS_READ_ADDTID_B32 : DS_1A_RET<"ds_read_addtid_b32">;
550 } // End has_m0_read = 0
553 def DS_CONSUME       : DS_0A_RET<"ds_consume">;
554 def DS_APPEND        : DS_0A_RET<"ds_append">;
555 def DS_ORDERED_COUNT : DS_1A_RET_GDS<"ds_ordered_count">;
557 //===----------------------------------------------------------------------===//
558 // Instruction definitions for CI and newer.
559 //===----------------------------------------------------------------------===//
561 let SubtargetPredicate = isGFX7Plus in {
563 defm DS_WRAP_RTN_B32 : DS_1A2D_RET_mc<"ds_wrap_rtn_b32", VGPR_32>;
564 defm DS_CONDXCHG32_RTN_B64 : DS_1A1D_RET_mc<"ds_condxchg32_rtn_b64", VReg_64>;
566 let isConvergent = 1, usesCustomInserter = 1 in {
567 def DS_GWS_SEMA_RELEASE_ALL : DS_GWS_0D<"ds_gws_sema_release_all">;
570 let mayStore = 0 in {
571 defm DS_READ_B96 : DS_1A_RET_mc<"ds_read_b96", VReg_96>;
572 defm DS_READ_B128: DS_1A_RET_mc<"ds_read_b128", VReg_128>;
573 } // End mayStore = 0
575 let mayLoad = 0 in {
576 defm DS_WRITE_B96 : DS_1A1D_NORET_mc<"ds_write_b96", VReg_96>;
577 defm DS_WRITE_B128 : DS_1A1D_NORET_mc<"ds_write_b128", VReg_128>;
578 } // End mayLoad = 0
580 def DS_NOP : DS_VOID<"ds_nop">;
582 } // let SubtargetPredicate = isGFX7Plus
584 //===----------------------------------------------------------------------===//
585 // Instruction definitions for VI and newer.
586 //===----------------------------------------------------------------------===//
588 let SubtargetPredicate = isGFX8Plus in {
590 let Uses = [EXEC] in {
591 def DS_PERMUTE_B32  : DS_1A1D_PERMUTE <"ds_permute_b32",
592                                        int_amdgcn_ds_permute>;
593 def DS_BPERMUTE_B32 : DS_1A1D_PERMUTE <"ds_bpermute_b32",
594                                        int_amdgcn_ds_bpermute>;
597 def DS_ADD_SRC2_F32 : DS_1A<"ds_add_src2_f32">;
599 } // let SubtargetPredicate = isGFX8Plus
601 //===----------------------------------------------------------------------===//
602 // DS Patterns
603 //===----------------------------------------------------------------------===//
605 def : GCNPat <
606   (int_amdgcn_ds_swizzle i32:$src, timm:$offset16),
607   (DS_SWIZZLE_B32 $src, (as_i16imm $offset16), (i1 0))
610 class DSReadPat <DS_Pseudo inst, ValueType vt, PatFrag frag, int gds=0> : GCNPat <
611   (vt (frag (DS1Addr1Offset i32:$ptr, i16:$offset))),
612   (inst $ptr, offset:$offset, (i1 gds))
615 multiclass DSReadPat_mc<DS_Pseudo inst, ValueType vt, string frag> {
617   let OtherPredicates = [LDSRequiresM0Init] in {
618     def : DSReadPat<inst, vt, !cast<PatFrag>(frag#"_m0")>;
619   }
621   let OtherPredicates = [NotLDSRequiresM0Init] in {
622     def : DSReadPat<!cast<DS_Pseudo>(!cast<string>(inst)#"_gfx9"), vt, !cast<PatFrag>(frag)>;
623   }
626 class DSReadPat_D16 <DS_Pseudo inst, PatFrag frag, ValueType vt> : GCNPat <
627   (frag (DS1Addr1Offset i32:$ptr, i16:$offset), vt:$in),
628   (inst $ptr, offset:$offset, (i1 0), $in)
631 defm : DSReadPat_mc <DS_READ_I8, i32, "sextloadi8_local">;
632 defm : DSReadPat_mc <DS_READ_I8,  i16, "sextloadi8_local">;
633 defm : DSReadPat_mc <DS_READ_U8,  i32, "extloadi8_local">;
634 defm : DSReadPat_mc <DS_READ_U8,  i32, "zextloadi8_local">;
635 defm : DSReadPat_mc <DS_READ_U8,  i16, "extloadi8_local">;
636 defm : DSReadPat_mc <DS_READ_U8,  i16, "zextloadi8_local">;
637 defm : DSReadPat_mc <DS_READ_I16, i32, "sextloadi16_local">;
638 defm : DSReadPat_mc <DS_READ_I16, i32, "sextloadi16_local">;
639 defm : DSReadPat_mc <DS_READ_U16, i32, "extloadi16_local">;
640 defm : DSReadPat_mc <DS_READ_U16, i32, "zextloadi16_local">;
641 defm : DSReadPat_mc <DS_READ_U16, i16, "load_local">;
643 foreach vt = Reg32Types.types in {
644 defm : DSReadPat_mc <DS_READ_B32, vt, "load_local">;
647 defm : DSReadPat_mc <DS_READ_B32, i32, "atomic_load_32_local">;
648 defm : DSReadPat_mc <DS_READ_B64, i64, "atomic_load_64_local">;
650 let AddedComplexity = 100 in {
652 foreach vt = VReg_64.RegTypes in {
653 defm : DSReadPat_mc <DS_READ_B64, vt, "load_align8_local">;
656 defm : DSReadPat_mc <DS_READ_B128, v4i32, "load_align16_local">;
658 } // End AddedComplexity = 100
660 let OtherPredicates = [D16PreservesUnusedBits] in {
661 def : DSReadPat_D16<DS_READ_U16_D16_HI, load_d16_hi_local, v2i16>;
662 def : DSReadPat_D16<DS_READ_U16_D16_HI, load_d16_hi_local, v2f16>;
663 def : DSReadPat_D16<DS_READ_U8_D16_HI, az_extloadi8_d16_hi_local, v2i16>;
664 def : DSReadPat_D16<DS_READ_U8_D16_HI, az_extloadi8_d16_hi_local, v2f16>;
665 def : DSReadPat_D16<DS_READ_I8_D16_HI, sextloadi8_d16_hi_local, v2i16>;
666 def : DSReadPat_D16<DS_READ_I8_D16_HI, sextloadi8_d16_hi_local, v2f16>;
668 def : DSReadPat_D16<DS_READ_U16_D16, load_d16_lo_local, v2i16>;
669 def : DSReadPat_D16<DS_READ_U16_D16, load_d16_lo_local, v2f16>;
670 def : DSReadPat_D16<DS_READ_U8_D16, az_extloadi8_d16_lo_local, v2i16>;
671 def : DSReadPat_D16<DS_READ_U8_D16, az_extloadi8_d16_lo_local, v2f16>;
672 def : DSReadPat_D16<DS_READ_I8_D16, sextloadi8_d16_lo_local, v2i16>;
673 def : DSReadPat_D16<DS_READ_I8_D16, sextloadi8_d16_lo_local, v2f16>;
676 class DSWritePat <DS_Pseudo inst, ValueType vt, PatFrag frag, int gds=0> : GCNPat <
677   (frag vt:$value, (DS1Addr1Offset i32:$ptr, i16:$offset)),
678   (inst $ptr, getVregSrcForVT<vt>.ret:$value, offset:$offset, (i1 gds))
681 multiclass DSWritePat_mc <DS_Pseudo inst, ValueType vt, string frag> {
682   let OtherPredicates = [LDSRequiresM0Init] in {
683     def : DSWritePat<inst, vt, !cast<PatFrag>(frag#"_m0")>;
684   }
686   let OtherPredicates = [NotLDSRequiresM0Init] in {
687     def : DSWritePat<!cast<DS_Pseudo>(!cast<string>(inst)#"_gfx9"), vt, !cast<PatFrag>(frag)>;
688   }
691 // Irritatingly, atomic_store reverses the order of operands from a
692 // normal store.
693 class DSAtomicWritePat <DS_Pseudo inst, ValueType vt, PatFrag frag> : GCNPat <
694   (frag (DS1Addr1Offset i32:$ptr, i16:$offset), vt:$value),
695   (inst $ptr, $value, offset:$offset, (i1 0))
698 multiclass DSAtomicWritePat_mc <DS_Pseudo inst, ValueType vt, string frag> {
699   let OtherPredicates = [LDSRequiresM0Init] in {
700     def : DSAtomicWritePat<inst, vt, !cast<PatFrag>(frag#"_m0")>;
701   }
703   let OtherPredicates = [NotLDSRequiresM0Init] in {
704     def : DSAtomicWritePat<!cast<DS_Pseudo>(!cast<string>(inst)#"_gfx9"), vt, !cast<PatFrag>(frag)>;
705   }
708 defm : DSWritePat_mc <DS_WRITE_B8, i32, "truncstorei8_local">;
709 defm : DSWritePat_mc <DS_WRITE_B16, i32, "truncstorei16_local">;
710 defm : DSWritePat_mc <DS_WRITE_B8, i16, "truncstorei8_local">;
711 defm : DSWritePat_mc <DS_WRITE_B16, i16, "store_local">;
713 foreach vt = VGPR_32.RegTypes in {
714 defm : DSWritePat_mc <DS_WRITE_B32, vt, "store_local">;
717 defm : DSAtomicWritePat_mc <DS_WRITE_B32, i32, "atomic_store_local_32">;
718 defm : DSAtomicWritePat_mc <DS_WRITE_B64, i64, "atomic_store_local_64">;
720 let OtherPredicates = [D16PreservesUnusedBits] in {
721 def : DSWritePat <DS_WRITE_B16_D16_HI, i32, store_local_hi16>;
722 def : DSWritePat <DS_WRITE_B8_D16_HI, i32, truncstorei8_local_hi16>;
726 class DS64Bit4ByteAlignedReadPat<DS_Pseudo inst, PatFrag frag> : GCNPat <
727   (v2i32 (frag (DS64Bit4ByteAligned i32:$ptr, i8:$offset0, i8:$offset1))),
728   (inst $ptr, $offset0, $offset1, (i1 0))
731 class DS64Bit4ByteAlignedWritePat<DS_Pseudo inst, PatFrag frag> : GCNPat<
732   (frag v2i32:$value, (DS64Bit4ByteAligned i32:$ptr, i8:$offset0, i8:$offset1)),
733   (inst $ptr, (i32 (EXTRACT_SUBREG $value, sub0)),
734               (i32 (EXTRACT_SUBREG $value, sub1)), $offset0, $offset1,
735               (i1 0))
738 // v2i32 loads are split into i32 loads on SI during lowering, due to a bug
739 // related to bounds checking.
740 let OtherPredicates = [LDSRequiresM0Init, isGFX7Plus] in {
741 def : DS64Bit4ByteAlignedReadPat<DS_READ2_B32, load_local_m0>;
742 def : DS64Bit4ByteAlignedWritePat<DS_WRITE2_B32, store_local_m0>;
745 let OtherPredicates = [NotLDSRequiresM0Init] in {
746 def : DS64Bit4ByteAlignedReadPat<DS_READ2_B32_gfx9, load_local>;
747 def : DS64Bit4ByteAlignedWritePat<DS_WRITE2_B32_gfx9, store_local>;
751 let AddedComplexity = 100 in {
753 foreach vt = VReg_64.RegTypes in {
754 defm : DSWritePat_mc <DS_WRITE_B64, vt, "store_align8_local">;
757 defm : DSWritePat_mc <DS_WRITE_B128, v4i32, "store_align16_local">;
759 } // End AddedComplexity = 100
760 class DSAtomicRetPat<DS_Pseudo inst, ValueType vt, PatFrag frag, bit gds=0> : GCNPat <
761   (frag (DS1Addr1Offset i32:$ptr, i16:$offset), vt:$value),
762   (inst $ptr, getVregSrcForVT<vt>.ret:$value, offset:$offset, (i1 gds))
765 multiclass DSAtomicRetPat_mc<DS_Pseudo inst, ValueType vt, string frag> {
766   let OtherPredicates = [LDSRequiresM0Init] in {
767     def : DSAtomicRetPat<inst, vt, !cast<PatFrag>(frag#"_local_m0_"#vt.Size)>;
768   }
770   let OtherPredicates = [NotLDSRequiresM0Init] in {
771     def : DSAtomicRetPat<!cast<DS_Pseudo>(!cast<string>(inst)#"_gfx9"), vt,
772                          !cast<PatFrag>(frag#"_local_"#vt.Size)>;
773   }
775   def : DSAtomicRetPat<inst, vt, !cast<PatFrag>(frag#"_region_m0_"#vt.Size), 1>;
780 class DSAtomicCmpXChg<DS_Pseudo inst, ValueType vt, PatFrag frag, bit gds=0> : GCNPat <
781   (frag (DS1Addr1Offset i32:$ptr, i16:$offset), vt:$cmp, vt:$swap),
782   (inst $ptr, getVregSrcForVT<vt>.ret:$cmp, getVregSrcForVT<vt>.ret:$swap, offset:$offset, (i1 gds))
785 multiclass DSAtomicCmpXChg_mc<DS_Pseudo inst, ValueType vt, string frag> {
786   let OtherPredicates = [LDSRequiresM0Init] in {
787     def : DSAtomicCmpXChg<inst, vt, !cast<PatFrag>(frag#"_local_m0_"#vt.Size)>;
788   }
790   let OtherPredicates = [NotLDSRequiresM0Init] in {
791     def : DSAtomicCmpXChg<!cast<DS_Pseudo>(!cast<string>(inst)#"_gfx9"), vt,
792                           !cast<PatFrag>(frag#"_local_"#vt.Size)>;
793   }
795   def : DSAtomicCmpXChg<inst, vt, !cast<PatFrag>(frag#"_region_m0_"#vt.Size), 1>;
800 // 32-bit atomics.
801 defm : DSAtomicRetPat_mc<DS_WRXCHG_RTN_B32, i32, "atomic_swap">;
802 defm : DSAtomicRetPat_mc<DS_ADD_RTN_U32, i32, "atomic_load_add">;
803 defm : DSAtomicRetPat_mc<DS_SUB_RTN_U32, i32, "atomic_load_sub">;
804 defm : DSAtomicRetPat_mc<DS_INC_RTN_U32, i32, "atomic_inc">;
805 defm : DSAtomicRetPat_mc<DS_DEC_RTN_U32, i32, "atomic_dec">;
806 defm : DSAtomicRetPat_mc<DS_AND_RTN_B32, i32, "atomic_load_and">;
807 defm : DSAtomicRetPat_mc<DS_OR_RTN_B32, i32, "atomic_load_or">;
808 defm : DSAtomicRetPat_mc<DS_XOR_RTN_B32, i32, "atomic_load_xor">;
809 defm : DSAtomicRetPat_mc<DS_MIN_RTN_I32, i32, "atomic_load_min">;
810 defm : DSAtomicRetPat_mc<DS_MAX_RTN_I32, i32, "atomic_load_max">;
811 defm : DSAtomicRetPat_mc<DS_MIN_RTN_U32, i32, "atomic_load_umin">;
812 defm : DSAtomicRetPat_mc<DS_MAX_RTN_U32, i32, "atomic_load_umax">;
813 defm : DSAtomicCmpXChg_mc<DS_CMPST_RTN_B32, i32, "atomic_cmp_swap">;
814 defm : DSAtomicRetPat_mc<DS_MIN_RTN_F32, f32, "atomic_load_fmin">;
815 defm : DSAtomicRetPat_mc<DS_MAX_RTN_F32, f32, "atomic_load_fmax">;
816 defm : DSAtomicRetPat_mc<DS_ADD_RTN_F32, f32, "atomic_load_fadd">;
818 // 64-bit atomics.
819 defm : DSAtomicRetPat_mc<DS_WRXCHG_RTN_B64, i64, "atomic_swap">;
820 defm : DSAtomicRetPat_mc<DS_ADD_RTN_U64, i64, "atomic_load_add">;
821 defm : DSAtomicRetPat_mc<DS_SUB_RTN_U64, i64, "atomic_load_sub">;
822 defm : DSAtomicRetPat_mc<DS_INC_RTN_U64, i64, "atomic_inc">;
823 defm : DSAtomicRetPat_mc<DS_DEC_RTN_U64, i64, "atomic_dec">;
824 defm : DSAtomicRetPat_mc<DS_AND_RTN_B64, i64, "atomic_load_and">;
825 defm : DSAtomicRetPat_mc<DS_OR_RTN_B64, i64, "atomic_load_or">;
826 defm : DSAtomicRetPat_mc<DS_XOR_RTN_B64, i64, "atomic_load_xor">;
827 defm : DSAtomicRetPat_mc<DS_MIN_RTN_I64, i64, "atomic_load_min">;
828 defm : DSAtomicRetPat_mc<DS_MAX_RTN_I64, i64, "atomic_load_max">;
829 defm : DSAtomicRetPat_mc<DS_MIN_RTN_U64, i64, "atomic_load_umin">;
830 defm : DSAtomicRetPat_mc<DS_MAX_RTN_U64, i64, "atomic_load_umax">;
832 defm : DSAtomicCmpXChg_mc<DS_CMPST_RTN_B64, i64, "atomic_cmp_swap">;
834 def : Pat <
835   (SIds_ordered_count i32:$value, i16:$offset),
836   (DS_ORDERED_COUNT $value, (as_i16imm $offset))
839 //===----------------------------------------------------------------------===//
840 // Target-specific instruction encodings.
841 //===----------------------------------------------------------------------===//
843 //===----------------------------------------------------------------------===//
844 // Base ENC_DS for GFX6, GFX7, GFX10.
845 //===----------------------------------------------------------------------===//
847 class Base_DS_Real_gfx6_gfx7_gfx10<bits<8> op, DS_Pseudo ps, int ef> :
848     DS_Real<ps>, SIMCInstr <ps.Mnemonic, ef> {
850   let Inst{7-0}   = !if(ps.has_offset0, offset0, 0);
851   let Inst{15-8}  = !if(ps.has_offset1, offset1, 0);
852   let Inst{17}    = !if(ps.has_gds, gds, ps.gdsValue);
853   let Inst{25-18} = op;
854   let Inst{31-26} = 0x36;
855   let Inst{39-32} = !if(ps.has_addr, addr, !if(ps.has_gws_data0, data0, 0));
856   let Inst{47-40} = !if(ps.has_data0, data0, 0);
857   let Inst{55-48} = !if(ps.has_data1, data1, 0);
858   let Inst{63-56} = !if(ps.has_vdst, vdst, 0);
861 //===----------------------------------------------------------------------===//
862 // GFX10.
863 //===----------------------------------------------------------------------===//
865 let AssemblerPredicate = isGFX10Plus, DecoderNamespace = "GFX10" in {
866   multiclass DS_Real_gfx10<bits<8> op>  {
867     def _gfx10 : Base_DS_Real_gfx6_gfx7_gfx10<op, !cast<DS_Pseudo>(NAME),
868                                               SIEncodingFamily.GFX10>;
869   }
870 } // End AssemblerPredicate = isGFX10Plus, DecoderNamespace = "GFX10"
872 defm DS_ADD_F32          : DS_Real_gfx10<0x015>;
873 defm DS_ADD_RTN_F32      : DS_Real_gfx10<0x055>;
874 defm DS_ADD_SRC2_F32     : DS_Real_gfx10<0x095>;
875 defm DS_WRITE_B8_D16_HI  : DS_Real_gfx10<0x0a0>;
876 defm DS_WRITE_B16_D16_HI : DS_Real_gfx10<0x0a1>;
877 defm DS_READ_U8_D16      : DS_Real_gfx10<0x0a2>;
878 defm DS_READ_U8_D16_HI   : DS_Real_gfx10<0x0a3>;
879 defm DS_READ_I8_D16      : DS_Real_gfx10<0x0a4>;
880 defm DS_READ_I8_D16_HI   : DS_Real_gfx10<0x0a5>;
881 defm DS_READ_U16_D16     : DS_Real_gfx10<0x0a6>;
882 defm DS_READ_U16_D16_HI  : DS_Real_gfx10<0x0a7>;
883 defm DS_WRITE_ADDTID_B32 : DS_Real_gfx10<0x0b0>;
884 defm DS_READ_ADDTID_B32  : DS_Real_gfx10<0x0b1>;
885 defm DS_PERMUTE_B32      : DS_Real_gfx10<0x0b2>;
886 defm DS_BPERMUTE_B32     : DS_Real_gfx10<0x0b3>;
888 //===----------------------------------------------------------------------===//
889 // GFX7, GFX10.
890 //===----------------------------------------------------------------------===//
892 let AssemblerPredicate = isGFX7Only, DecoderNamespace = "GFX7" in {
893   multiclass DS_Real_gfx7<bits<8> op> {
894     def _gfx7 : Base_DS_Real_gfx6_gfx7_gfx10<op, !cast<DS_Pseudo>(NAME),
895                                              SIEncodingFamily.SI>;
896   }
897 } // End AssemblerPredicate = isGFX7Only, DecoderNamespace = "GFX7"
899 multiclass DS_Real_gfx7_gfx10<bits<8> op> :
900   DS_Real_gfx7<op>, DS_Real_gfx10<op>;
902 // FIXME-GFX7: Add tests when upstreaming this part.
903 defm DS_GWS_SEMA_RELEASE_ALL : DS_Real_gfx7_gfx10<0x018>;
904 defm DS_WRAP_RTN_B32         : DS_Real_gfx7_gfx10<0x034>;
905 defm DS_CONDXCHG32_RTN_B64   : DS_Real_gfx7_gfx10<0x07e>;
906 defm DS_WRITE_B96            : DS_Real_gfx7_gfx10<0x0de>;
907 defm DS_WRITE_B128           : DS_Real_gfx7_gfx10<0x0df>;
908 defm DS_READ_B96             : DS_Real_gfx7_gfx10<0x0fe>;
909 defm DS_READ_B128            : DS_Real_gfx7_gfx10<0x0ff>;
911 //===----------------------------------------------------------------------===//
912 // GFX6, GFX7, GFX10.
913 //===----------------------------------------------------------------------===//
915 let AssemblerPredicate = isGFX6GFX7, DecoderNamespace = "GFX6GFX7" in {
916   multiclass DS_Real_gfx6_gfx7<bits<8> op> {
917     def _gfx6_gfx7 : Base_DS_Real_gfx6_gfx7_gfx10<op, !cast<DS_Pseudo>(NAME),
918                                                   SIEncodingFamily.SI>;
919   }
920 } // End AssemblerPredicate = isGFX6GFX7, DecoderNamespace = "GFX6GFX7"
922 multiclass DS_Real_gfx6_gfx7_gfx10<bits<8> op> :
923   DS_Real_gfx6_gfx7<op>, DS_Real_gfx10<op>;
925 defm DS_ADD_U32             : DS_Real_gfx6_gfx7_gfx10<0x000>;
926 defm DS_SUB_U32             : DS_Real_gfx6_gfx7_gfx10<0x001>;
927 defm DS_RSUB_U32            : DS_Real_gfx6_gfx7_gfx10<0x002>;
928 defm DS_INC_U32             : DS_Real_gfx6_gfx7_gfx10<0x003>;
929 defm DS_DEC_U32             : DS_Real_gfx6_gfx7_gfx10<0x004>;
930 defm DS_MIN_I32             : DS_Real_gfx6_gfx7_gfx10<0x005>;
931 defm DS_MAX_I32             : DS_Real_gfx6_gfx7_gfx10<0x006>;
932 defm DS_MIN_U32             : DS_Real_gfx6_gfx7_gfx10<0x007>;
933 defm DS_MAX_U32             : DS_Real_gfx6_gfx7_gfx10<0x008>;
934 defm DS_AND_B32             : DS_Real_gfx6_gfx7_gfx10<0x009>;
935 defm DS_OR_B32              : DS_Real_gfx6_gfx7_gfx10<0x00a>;
936 defm DS_XOR_B32             : DS_Real_gfx6_gfx7_gfx10<0x00b>;
937 defm DS_MSKOR_B32           : DS_Real_gfx6_gfx7_gfx10<0x00c>;
938 defm DS_WRITE_B32           : DS_Real_gfx6_gfx7_gfx10<0x00d>;
939 defm DS_WRITE2_B32          : DS_Real_gfx6_gfx7_gfx10<0x00e>;
940 defm DS_WRITE2ST64_B32      : DS_Real_gfx6_gfx7_gfx10<0x00f>;
941 defm DS_CMPST_B32           : DS_Real_gfx6_gfx7_gfx10<0x010>;
942 defm DS_CMPST_F32           : DS_Real_gfx6_gfx7_gfx10<0x011>;
943 defm DS_MIN_F32             : DS_Real_gfx6_gfx7_gfx10<0x012>;
944 defm DS_MAX_F32             : DS_Real_gfx6_gfx7_gfx10<0x013>;
945 defm DS_NOP                 : DS_Real_gfx6_gfx7_gfx10<0x014>;
946 defm DS_GWS_INIT            : DS_Real_gfx6_gfx7_gfx10<0x019>;
947 defm DS_GWS_SEMA_V          : DS_Real_gfx6_gfx7_gfx10<0x01a>;
948 defm DS_GWS_SEMA_BR         : DS_Real_gfx6_gfx7_gfx10<0x01b>;
949 defm DS_GWS_SEMA_P          : DS_Real_gfx6_gfx7_gfx10<0x01c>;
950 defm DS_GWS_BARRIER         : DS_Real_gfx6_gfx7_gfx10<0x01d>;
951 defm DS_WRITE_B8            : DS_Real_gfx6_gfx7_gfx10<0x01e>;
952 defm DS_WRITE_B16           : DS_Real_gfx6_gfx7_gfx10<0x01f>;
953 defm DS_ADD_RTN_U32         : DS_Real_gfx6_gfx7_gfx10<0x020>;
954 defm DS_SUB_RTN_U32         : DS_Real_gfx6_gfx7_gfx10<0x021>;
955 defm DS_RSUB_RTN_U32        : DS_Real_gfx6_gfx7_gfx10<0x022>;
956 defm DS_INC_RTN_U32         : DS_Real_gfx6_gfx7_gfx10<0x023>;
957 defm DS_DEC_RTN_U32         : DS_Real_gfx6_gfx7_gfx10<0x024>;
958 defm DS_MIN_RTN_I32         : DS_Real_gfx6_gfx7_gfx10<0x025>;
959 defm DS_MAX_RTN_I32         : DS_Real_gfx6_gfx7_gfx10<0x026>;
960 defm DS_MIN_RTN_U32         : DS_Real_gfx6_gfx7_gfx10<0x027>;
961 defm DS_MAX_RTN_U32         : DS_Real_gfx6_gfx7_gfx10<0x028>;
962 defm DS_AND_RTN_B32         : DS_Real_gfx6_gfx7_gfx10<0x029>;
963 defm DS_OR_RTN_B32          : DS_Real_gfx6_gfx7_gfx10<0x02a>;
964 defm DS_XOR_RTN_B32         : DS_Real_gfx6_gfx7_gfx10<0x02b>;
965 defm DS_MSKOR_RTN_B32       : DS_Real_gfx6_gfx7_gfx10<0x02c>;
966 defm DS_WRXCHG_RTN_B32      : DS_Real_gfx6_gfx7_gfx10<0x02d>;
967 defm DS_WRXCHG2_RTN_B32     : DS_Real_gfx6_gfx7_gfx10<0x02e>;
968 defm DS_WRXCHG2ST64_RTN_B32 : DS_Real_gfx6_gfx7_gfx10<0x02f>;
969 defm DS_CMPST_RTN_B32       : DS_Real_gfx6_gfx7_gfx10<0x030>;
970 defm DS_CMPST_RTN_F32       : DS_Real_gfx6_gfx7_gfx10<0x031>;
971 defm DS_MIN_RTN_F32         : DS_Real_gfx6_gfx7_gfx10<0x032>;
972 defm DS_MAX_RTN_F32         : DS_Real_gfx6_gfx7_gfx10<0x033>;
973 defm DS_SWIZZLE_B32         : DS_Real_gfx6_gfx7_gfx10<0x035>;
974 defm DS_READ_B32            : DS_Real_gfx6_gfx7_gfx10<0x036>;
975 defm DS_READ2_B32           : DS_Real_gfx6_gfx7_gfx10<0x037>;
976 defm DS_READ2ST64_B32       : DS_Real_gfx6_gfx7_gfx10<0x038>;
977 defm DS_READ_I8             : DS_Real_gfx6_gfx7_gfx10<0x039>;
978 defm DS_READ_U8             : DS_Real_gfx6_gfx7_gfx10<0x03a>;
979 defm DS_READ_I16            : DS_Real_gfx6_gfx7_gfx10<0x03b>;
980 defm DS_READ_U16            : DS_Real_gfx6_gfx7_gfx10<0x03c>;
981 defm DS_CONSUME             : DS_Real_gfx6_gfx7_gfx10<0x03d>;
982 defm DS_APPEND              : DS_Real_gfx6_gfx7_gfx10<0x03e>;
983 defm DS_ORDERED_COUNT       : DS_Real_gfx6_gfx7_gfx10<0x03f>;
984 defm DS_ADD_U64             : DS_Real_gfx6_gfx7_gfx10<0x040>;
985 defm DS_SUB_U64             : DS_Real_gfx6_gfx7_gfx10<0x041>;
986 defm DS_RSUB_U64            : DS_Real_gfx6_gfx7_gfx10<0x042>;
987 defm DS_INC_U64             : DS_Real_gfx6_gfx7_gfx10<0x043>;
988 defm DS_DEC_U64             : DS_Real_gfx6_gfx7_gfx10<0x044>;
989 defm DS_MIN_I64             : DS_Real_gfx6_gfx7_gfx10<0x045>;
990 defm DS_MAX_I64             : DS_Real_gfx6_gfx7_gfx10<0x046>;
991 defm DS_MIN_U64             : DS_Real_gfx6_gfx7_gfx10<0x047>;
992 defm DS_MAX_U64             : DS_Real_gfx6_gfx7_gfx10<0x048>;
993 defm DS_AND_B64             : DS_Real_gfx6_gfx7_gfx10<0x049>;
994 defm DS_OR_B64              : DS_Real_gfx6_gfx7_gfx10<0x04a>;
995 defm DS_XOR_B64             : DS_Real_gfx6_gfx7_gfx10<0x04b>;
996 defm DS_MSKOR_B64           : DS_Real_gfx6_gfx7_gfx10<0x04c>;
997 defm DS_WRITE_B64           : DS_Real_gfx6_gfx7_gfx10<0x04d>;
998 defm DS_WRITE2_B64          : DS_Real_gfx6_gfx7_gfx10<0x04e>;
999 defm DS_WRITE2ST64_B64      : DS_Real_gfx6_gfx7_gfx10<0x04f>;
1000 defm DS_CMPST_B64           : DS_Real_gfx6_gfx7_gfx10<0x050>;
1001 defm DS_CMPST_F64           : DS_Real_gfx6_gfx7_gfx10<0x051>;
1002 defm DS_MIN_F64             : DS_Real_gfx6_gfx7_gfx10<0x052>;
1003 defm DS_MAX_F64             : DS_Real_gfx6_gfx7_gfx10<0x053>;
1004 defm DS_ADD_RTN_U64         : DS_Real_gfx6_gfx7_gfx10<0x060>;
1005 defm DS_SUB_RTN_U64         : DS_Real_gfx6_gfx7_gfx10<0x061>;
1006 defm DS_RSUB_RTN_U64        : DS_Real_gfx6_gfx7_gfx10<0x062>;
1007 defm DS_INC_RTN_U64         : DS_Real_gfx6_gfx7_gfx10<0x063>;
1008 defm DS_DEC_RTN_U64         : DS_Real_gfx6_gfx7_gfx10<0x064>;
1009 defm DS_MIN_RTN_I64         : DS_Real_gfx6_gfx7_gfx10<0x065>;
1010 defm DS_MAX_RTN_I64         : DS_Real_gfx6_gfx7_gfx10<0x066>;
1011 defm DS_MIN_RTN_U64         : DS_Real_gfx6_gfx7_gfx10<0x067>;
1012 defm DS_MAX_RTN_U64         : DS_Real_gfx6_gfx7_gfx10<0x068>;
1013 defm DS_AND_RTN_B64         : DS_Real_gfx6_gfx7_gfx10<0x069>;
1014 defm DS_OR_RTN_B64          : DS_Real_gfx6_gfx7_gfx10<0x06a>;
1015 defm DS_XOR_RTN_B64         : DS_Real_gfx6_gfx7_gfx10<0x06b>;
1016 defm DS_MSKOR_RTN_B64       : DS_Real_gfx6_gfx7_gfx10<0x06c>;
1017 defm DS_WRXCHG_RTN_B64      : DS_Real_gfx6_gfx7_gfx10<0x06d>;
1018 defm DS_WRXCHG2_RTN_B64     : DS_Real_gfx6_gfx7_gfx10<0x06e>;
1019 defm DS_WRXCHG2ST64_RTN_B64 : DS_Real_gfx6_gfx7_gfx10<0x06f>;
1020 defm DS_CMPST_RTN_B64       : DS_Real_gfx6_gfx7_gfx10<0x070>;
1021 defm DS_CMPST_RTN_F64       : DS_Real_gfx6_gfx7_gfx10<0x071>;
1022 defm DS_MIN_RTN_F64         : DS_Real_gfx6_gfx7_gfx10<0x072>;
1023 defm DS_MAX_RTN_F64         : DS_Real_gfx6_gfx7_gfx10<0x073>;
1024 defm DS_READ_B64            : DS_Real_gfx6_gfx7_gfx10<0x076>;
1025 defm DS_READ2_B64           : DS_Real_gfx6_gfx7_gfx10<0x077>;
1026 defm DS_READ2ST64_B64       : DS_Real_gfx6_gfx7_gfx10<0x078>;
1027 defm DS_ADD_SRC2_U32        : DS_Real_gfx6_gfx7_gfx10<0x080>;
1028 defm DS_SUB_SRC2_U32        : DS_Real_gfx6_gfx7_gfx10<0x081>;
1029 defm DS_RSUB_SRC2_U32       : DS_Real_gfx6_gfx7_gfx10<0x082>;
1030 defm DS_INC_SRC2_U32        : DS_Real_gfx6_gfx7_gfx10<0x083>;
1031 defm DS_DEC_SRC2_U32        : DS_Real_gfx6_gfx7_gfx10<0x084>;
1032 defm DS_MIN_SRC2_I32        : DS_Real_gfx6_gfx7_gfx10<0x085>;
1033 defm DS_MAX_SRC2_I32        : DS_Real_gfx6_gfx7_gfx10<0x086>;
1034 defm DS_MIN_SRC2_U32        : DS_Real_gfx6_gfx7_gfx10<0x087>;
1035 defm DS_MAX_SRC2_U32        : DS_Real_gfx6_gfx7_gfx10<0x088>;
1036 defm DS_AND_SRC2_B32        : DS_Real_gfx6_gfx7_gfx10<0x089>;
1037 defm DS_OR_SRC2_B32         : DS_Real_gfx6_gfx7_gfx10<0x08a>;
1038 defm DS_XOR_SRC2_B32        : DS_Real_gfx6_gfx7_gfx10<0x08b>;
1039 defm DS_WRITE_SRC2_B32      : DS_Real_gfx6_gfx7_gfx10<0x08d>;
1040 defm DS_MIN_SRC2_F32        : DS_Real_gfx6_gfx7_gfx10<0x092>;
1041 defm DS_MAX_SRC2_F32        : DS_Real_gfx6_gfx7_gfx10<0x093>;
1042 defm DS_ADD_SRC2_U64        : DS_Real_gfx6_gfx7_gfx10<0x0c0>;
1043 defm DS_SUB_SRC2_U64        : DS_Real_gfx6_gfx7_gfx10<0x0c1>;
1044 defm DS_RSUB_SRC2_U64       : DS_Real_gfx6_gfx7_gfx10<0x0c2>;
1045 defm DS_INC_SRC2_U64        : DS_Real_gfx6_gfx7_gfx10<0x0c3>;
1046 defm DS_DEC_SRC2_U64        : DS_Real_gfx6_gfx7_gfx10<0x0c4>;
1047 defm DS_MIN_SRC2_I64        : DS_Real_gfx6_gfx7_gfx10<0x0c5>;
1048 defm DS_MAX_SRC2_I64        : DS_Real_gfx6_gfx7_gfx10<0x0c6>;
1049 defm DS_MIN_SRC2_U64        : DS_Real_gfx6_gfx7_gfx10<0x0c7>;
1050 defm DS_MAX_SRC2_U64        : DS_Real_gfx6_gfx7_gfx10<0x0c8>;
1051 defm DS_AND_SRC2_B64        : DS_Real_gfx6_gfx7_gfx10<0x0c9>;
1052 defm DS_OR_SRC2_B64         : DS_Real_gfx6_gfx7_gfx10<0x0ca>;
1053 defm DS_XOR_SRC2_B64        : DS_Real_gfx6_gfx7_gfx10<0x0cb>;
1054 defm DS_WRITE_SRC2_B64      : DS_Real_gfx6_gfx7_gfx10<0x0cd>;
1055 defm DS_MIN_SRC2_F64        : DS_Real_gfx6_gfx7_gfx10<0x0d2>;
1056 defm DS_MAX_SRC2_F64        : DS_Real_gfx6_gfx7_gfx10<0x0d3>;
1058 //===----------------------------------------------------------------------===//
1059 // GFX8, GFX9 (VI).
1060 //===----------------------------------------------------------------------===//
1062 class DS_Real_vi <bits<8> op, DS_Pseudo ds> :
1063   DS_Real <ds>,
1064   SIMCInstr <ds.Mnemonic, SIEncodingFamily.VI> {
1065   let AssemblerPredicates = [isGFX8GFX9];
1066   let DecoderNamespace = "GFX8";
1068   // encoding
1069   let Inst{7-0}   = !if(ds.has_offset0, offset0, 0);
1070   let Inst{15-8}  = !if(ds.has_offset1, offset1, 0);
1071   let Inst{16}    = !if(ds.has_gds, gds, ds.gdsValue);
1072   let Inst{24-17} = op;
1073   let Inst{31-26} = 0x36; // ds prefix
1074   let Inst{39-32} = !if(ds.has_addr, addr, !if(ds.has_gws_data0, data0, 0));
1075   let Inst{47-40} = !if(ds.has_data0, data0, 0);
1076   let Inst{55-48} = !if(ds.has_data1, data1, 0);
1077   let Inst{63-56} = !if(ds.has_vdst, vdst, 0);
1080 def DS_ADD_U32_vi         : DS_Real_vi<0x0,  DS_ADD_U32>;
1081 def DS_SUB_U32_vi         : DS_Real_vi<0x1,  DS_SUB_U32>;
1082 def DS_RSUB_U32_vi        : DS_Real_vi<0x2,  DS_RSUB_U32>;
1083 def DS_INC_U32_vi         : DS_Real_vi<0x3,  DS_INC_U32>;
1084 def DS_DEC_U32_vi         : DS_Real_vi<0x4,  DS_DEC_U32>;
1085 def DS_MIN_I32_vi         : DS_Real_vi<0x5,  DS_MIN_I32>;
1086 def DS_MAX_I32_vi         : DS_Real_vi<0x6,  DS_MAX_I32>;
1087 def DS_MIN_U32_vi         : DS_Real_vi<0x7,  DS_MIN_U32>;
1088 def DS_MAX_U32_vi         : DS_Real_vi<0x8,  DS_MAX_U32>;
1089 def DS_AND_B32_vi         : DS_Real_vi<0x9,  DS_AND_B32>;
1090 def DS_OR_B32_vi          : DS_Real_vi<0xa,  DS_OR_B32>;
1091 def DS_XOR_B32_vi         : DS_Real_vi<0xb,  DS_XOR_B32>;
1092 def DS_MSKOR_B32_vi       : DS_Real_vi<0xc,  DS_MSKOR_B32>;
1093 def DS_WRITE_B32_vi       : DS_Real_vi<0xd,  DS_WRITE_B32>;
1094 def DS_WRITE2_B32_vi      : DS_Real_vi<0xe,  DS_WRITE2_B32>;
1095 def DS_WRITE2ST64_B32_vi  : DS_Real_vi<0xf,  DS_WRITE2ST64_B32>;
1096 def DS_CMPST_B32_vi       : DS_Real_vi<0x10, DS_CMPST_B32>;
1097 def DS_CMPST_F32_vi       : DS_Real_vi<0x11, DS_CMPST_F32>;
1098 def DS_MIN_F32_vi         : DS_Real_vi<0x12, DS_MIN_F32>;
1099 def DS_MAX_F32_vi         : DS_Real_vi<0x13, DS_MAX_F32>;
1100 def DS_NOP_vi             : DS_Real_vi<0x14, DS_NOP>;
1101 def DS_ADD_F32_vi         : DS_Real_vi<0x15, DS_ADD_F32>;
1102 def DS_GWS_INIT_vi        : DS_Real_vi<0x99, DS_GWS_INIT>;
1103 def DS_GWS_SEMA_V_vi      : DS_Real_vi<0x9a, DS_GWS_SEMA_V>;
1104 def DS_GWS_SEMA_BR_vi     : DS_Real_vi<0x9b, DS_GWS_SEMA_BR>;
1105 def DS_GWS_SEMA_P_vi      : DS_Real_vi<0x9c, DS_GWS_SEMA_P>;
1106 def DS_GWS_BARRIER_vi     : DS_Real_vi<0x9d, DS_GWS_BARRIER>;
1107 def DS_WRITE_ADDTID_B32_vi : DS_Real_vi<0x1d, DS_WRITE_ADDTID_B32>;
1108 def DS_WRITE_B8_vi        : DS_Real_vi<0x1e, DS_WRITE_B8>;
1109 def DS_WRITE_B16_vi       : DS_Real_vi<0x1f, DS_WRITE_B16>;
1110 def DS_ADD_RTN_U32_vi     : DS_Real_vi<0x20, DS_ADD_RTN_U32>;
1111 def DS_SUB_RTN_U32_vi     : DS_Real_vi<0x21, DS_SUB_RTN_U32>;
1112 def DS_RSUB_RTN_U32_vi    : DS_Real_vi<0x22, DS_RSUB_RTN_U32>;
1113 def DS_INC_RTN_U32_vi     : DS_Real_vi<0x23, DS_INC_RTN_U32>;
1114 def DS_DEC_RTN_U32_vi     : DS_Real_vi<0x24, DS_DEC_RTN_U32>;
1115 def DS_MIN_RTN_I32_vi     : DS_Real_vi<0x25, DS_MIN_RTN_I32>;
1116 def DS_MAX_RTN_I32_vi     : DS_Real_vi<0x26, DS_MAX_RTN_I32>;
1117 def DS_MIN_RTN_U32_vi     : DS_Real_vi<0x27, DS_MIN_RTN_U32>;
1118 def DS_MAX_RTN_U32_vi     : DS_Real_vi<0x28, DS_MAX_RTN_U32>;
1119 def DS_AND_RTN_B32_vi     : DS_Real_vi<0x29, DS_AND_RTN_B32>;
1120 def DS_OR_RTN_B32_vi      : DS_Real_vi<0x2a, DS_OR_RTN_B32>;
1121 def DS_XOR_RTN_B32_vi     : DS_Real_vi<0x2b, DS_XOR_RTN_B32>;
1122 def DS_MSKOR_RTN_B32_vi   : DS_Real_vi<0x2c, DS_MSKOR_RTN_B32>;
1123 def DS_WRXCHG_RTN_B32_vi  : DS_Real_vi<0x2d, DS_WRXCHG_RTN_B32>;
1124 def DS_WRXCHG2_RTN_B32_vi : DS_Real_vi<0x2e, DS_WRXCHG2_RTN_B32>;
1125 def DS_WRXCHG2ST64_RTN_B32_vi : DS_Real_vi<0x2f, DS_WRXCHG2ST64_RTN_B32>;
1126 def DS_CMPST_RTN_B32_vi   : DS_Real_vi<0x30, DS_CMPST_RTN_B32>;
1127 def DS_CMPST_RTN_F32_vi   : DS_Real_vi<0x31, DS_CMPST_RTN_F32>;
1128 def DS_MIN_RTN_F32_vi     : DS_Real_vi<0x32, DS_MIN_RTN_F32>;
1129 def DS_MAX_RTN_F32_vi     : DS_Real_vi<0x33, DS_MAX_RTN_F32>;
1130 def DS_WRAP_RTN_B32_vi    : DS_Real_vi<0x34, DS_WRAP_RTN_B32>;
1131 def DS_ADD_RTN_F32_vi     : DS_Real_vi<0x35, DS_ADD_RTN_F32>;
1132 def DS_READ_B32_vi        : DS_Real_vi<0x36, DS_READ_B32>;
1133 def DS_READ2_B32_vi       : DS_Real_vi<0x37, DS_READ2_B32>;
1134 def DS_READ2ST64_B32_vi   : DS_Real_vi<0x38, DS_READ2ST64_B32>;
1135 def DS_READ_I8_vi         : DS_Real_vi<0x39, DS_READ_I8>;
1136 def DS_READ_U8_vi         : DS_Real_vi<0x3a, DS_READ_U8>;
1137 def DS_READ_I16_vi        : DS_Real_vi<0x3b, DS_READ_I16>;
1138 def DS_READ_U16_vi        : DS_Real_vi<0x3c, DS_READ_U16>;
1139 def DS_READ_ADDTID_B32_vi : DS_Real_vi<0xb6, DS_READ_ADDTID_B32>;
1140 def DS_CONSUME_vi         : DS_Real_vi<0xbd, DS_CONSUME>;
1141 def DS_APPEND_vi          : DS_Real_vi<0xbe, DS_APPEND>;
1142 def DS_ORDERED_COUNT_vi   : DS_Real_vi<0xbf, DS_ORDERED_COUNT>;
1143 def DS_SWIZZLE_B32_vi     : DS_Real_vi<0x3d, DS_SWIZZLE_B32>;
1144 def DS_PERMUTE_B32_vi     : DS_Real_vi<0x3e, DS_PERMUTE_B32>;
1145 def DS_BPERMUTE_B32_vi    : DS_Real_vi<0x3f, DS_BPERMUTE_B32>;
1147 def DS_ADD_U64_vi         : DS_Real_vi<0x40, DS_ADD_U64>;
1148 def DS_SUB_U64_vi         : DS_Real_vi<0x41, DS_SUB_U64>;
1149 def DS_RSUB_U64_vi        : DS_Real_vi<0x42, DS_RSUB_U64>;
1150 def DS_INC_U64_vi         : DS_Real_vi<0x43, DS_INC_U64>;
1151 def DS_DEC_U64_vi         : DS_Real_vi<0x44, DS_DEC_U64>;
1152 def DS_MIN_I64_vi         : DS_Real_vi<0x45, DS_MIN_I64>;
1153 def DS_MAX_I64_vi         : DS_Real_vi<0x46, DS_MAX_I64>;
1154 def DS_MIN_U64_vi         : DS_Real_vi<0x47, DS_MIN_U64>;
1155 def DS_MAX_U64_vi         : DS_Real_vi<0x48, DS_MAX_U64>;
1156 def DS_AND_B64_vi         : DS_Real_vi<0x49, DS_AND_B64>;
1157 def DS_OR_B64_vi          : DS_Real_vi<0x4a, DS_OR_B64>;
1158 def DS_XOR_B64_vi         : DS_Real_vi<0x4b, DS_XOR_B64>;
1159 def DS_MSKOR_B64_vi       : DS_Real_vi<0x4c, DS_MSKOR_B64>;
1160 def DS_WRITE_B64_vi       : DS_Real_vi<0x4d, DS_WRITE_B64>;
1161 def DS_WRITE2_B64_vi      : DS_Real_vi<0x4E, DS_WRITE2_B64>;
1162 def DS_WRITE2ST64_B64_vi  : DS_Real_vi<0x4f, DS_WRITE2ST64_B64>;
1163 def DS_CMPST_B64_vi       : DS_Real_vi<0x50, DS_CMPST_B64>;
1164 def DS_CMPST_F64_vi       : DS_Real_vi<0x51, DS_CMPST_F64>;
1165 def DS_MIN_F64_vi         : DS_Real_vi<0x52, DS_MIN_F64>;
1166 def DS_MAX_F64_vi         : DS_Real_vi<0x53, DS_MAX_F64>;
1168 def DS_WRITE_B8_D16_HI_vi  : DS_Real_vi<0x54, DS_WRITE_B8_D16_HI>;
1169 def DS_WRITE_B16_D16_HI_vi : DS_Real_vi<0x55, DS_WRITE_B16_D16_HI>;
1171 def DS_READ_U8_D16_vi     : DS_Real_vi<0x56, DS_READ_U8_D16>;
1172 def DS_READ_U8_D16_HI_vi  : DS_Real_vi<0x57, DS_READ_U8_D16_HI>;
1173 def DS_READ_I8_D16_vi     : DS_Real_vi<0x58, DS_READ_I8_D16>;
1174 def DS_READ_I8_D16_HI_vi  : DS_Real_vi<0x59, DS_READ_I8_D16_HI>;
1175 def DS_READ_U16_D16_vi    : DS_Real_vi<0x5a, DS_READ_U16_D16>;
1176 def DS_READ_U16_D16_HI_vi : DS_Real_vi<0x5b, DS_READ_U16_D16_HI>;
1178 def DS_ADD_RTN_U64_vi     : DS_Real_vi<0x60, DS_ADD_RTN_U64>;
1179 def DS_SUB_RTN_U64_vi     : DS_Real_vi<0x61, DS_SUB_RTN_U64>;
1180 def DS_RSUB_RTN_U64_vi    : DS_Real_vi<0x62, DS_RSUB_RTN_U64>;
1181 def DS_INC_RTN_U64_vi     : DS_Real_vi<0x63, DS_INC_RTN_U64>;
1182 def DS_DEC_RTN_U64_vi     : DS_Real_vi<0x64, DS_DEC_RTN_U64>;
1183 def DS_MIN_RTN_I64_vi     : DS_Real_vi<0x65, DS_MIN_RTN_I64>;
1184 def DS_MAX_RTN_I64_vi     : DS_Real_vi<0x66, DS_MAX_RTN_I64>;
1185 def DS_MIN_RTN_U64_vi     : DS_Real_vi<0x67, DS_MIN_RTN_U64>;
1186 def DS_MAX_RTN_U64_vi     : DS_Real_vi<0x68, DS_MAX_RTN_U64>;
1187 def DS_AND_RTN_B64_vi     : DS_Real_vi<0x69, DS_AND_RTN_B64>;
1188 def DS_OR_RTN_B64_vi      : DS_Real_vi<0x6a, DS_OR_RTN_B64>;
1189 def DS_XOR_RTN_B64_vi     : DS_Real_vi<0x6b, DS_XOR_RTN_B64>;
1190 def DS_MSKOR_RTN_B64_vi   : DS_Real_vi<0x6c, DS_MSKOR_RTN_B64>;
1191 def DS_WRXCHG_RTN_B64_vi  : DS_Real_vi<0x6d, DS_WRXCHG_RTN_B64>;
1192 def DS_WRXCHG2_RTN_B64_vi : DS_Real_vi<0x6e, DS_WRXCHG2_RTN_B64>;
1193 def DS_WRXCHG2ST64_RTN_B64_vi : DS_Real_vi<0x6f, DS_WRXCHG2ST64_RTN_B64>;
1194 def DS_CONDXCHG32_RTN_B64_vi   : DS_Real_vi<0x7e, DS_CONDXCHG32_RTN_B64>;
1195 def DS_GWS_SEMA_RELEASE_ALL_vi : DS_Real_vi<0x98, DS_GWS_SEMA_RELEASE_ALL>;
1196 def DS_CMPST_RTN_B64_vi   : DS_Real_vi<0x70, DS_CMPST_RTN_B64>;
1197 def DS_CMPST_RTN_F64_vi   : DS_Real_vi<0x71, DS_CMPST_RTN_F64>;
1198 def DS_MIN_RTN_F64_vi     : DS_Real_vi<0x72, DS_MIN_RTN_F64>;
1199 def DS_MAX_RTN_F64_vi     : DS_Real_vi<0x73, DS_MAX_RTN_F64>;
1201 def DS_READ_B64_vi        : DS_Real_vi<0x76, DS_READ_B64>;
1202 def DS_READ2_B64_vi       : DS_Real_vi<0x77, DS_READ2_B64>;
1203 def DS_READ2ST64_B64_vi   : DS_Real_vi<0x78, DS_READ2ST64_B64>;
1205 def DS_ADD_SRC2_U32_vi    : DS_Real_vi<0x80, DS_ADD_SRC2_U32>;
1206 def DS_SUB_SRC2_U32_vi    : DS_Real_vi<0x81, DS_SUB_SRC2_U32>;
1207 def DS_RSUB_SRC2_U32_vi   : DS_Real_vi<0x82, DS_RSUB_SRC2_U32>;
1208 def DS_INC_SRC2_U32_vi    : DS_Real_vi<0x83, DS_INC_SRC2_U32>;
1209 def DS_DEC_SRC2_U32_vi    : DS_Real_vi<0x84, DS_DEC_SRC2_U32>;
1210 def DS_MIN_SRC2_I32_vi    : DS_Real_vi<0x85, DS_MIN_SRC2_I32>;
1211 def DS_MAX_SRC2_I32_vi    : DS_Real_vi<0x86, DS_MAX_SRC2_I32>;
1212 def DS_MIN_SRC2_U32_vi    : DS_Real_vi<0x87, DS_MIN_SRC2_U32>;
1213 def DS_MAX_SRC2_U32_vi    : DS_Real_vi<0x88, DS_MAX_SRC2_U32>;
1214 def DS_AND_SRC2_B32_vi    : DS_Real_vi<0x89, DS_AND_SRC2_B32>;
1215 def DS_OR_SRC2_B32_vi     : DS_Real_vi<0x8a, DS_OR_SRC2_B32>;
1216 def DS_XOR_SRC2_B32_vi    : DS_Real_vi<0x8b, DS_XOR_SRC2_B32>;
1217 def DS_WRITE_SRC2_B32_vi  : DS_Real_vi<0x8d, DS_WRITE_SRC2_B32>;
1218 def DS_MIN_SRC2_F32_vi    : DS_Real_vi<0x92, DS_MIN_SRC2_F32>;
1219 def DS_MAX_SRC2_F32_vi    : DS_Real_vi<0x93, DS_MAX_SRC2_F32>;
1220 def DS_ADD_SRC2_F32_vi    : DS_Real_vi<0x95, DS_ADD_SRC2_F32>;
1221 def DS_ADD_SRC2_U64_vi    : DS_Real_vi<0xc0, DS_ADD_SRC2_U64>;
1222 def DS_SUB_SRC2_U64_vi    : DS_Real_vi<0xc1, DS_SUB_SRC2_U64>;
1223 def DS_RSUB_SRC2_U64_vi   : DS_Real_vi<0xc2, DS_RSUB_SRC2_U64>;
1224 def DS_INC_SRC2_U64_vi    : DS_Real_vi<0xc3, DS_INC_SRC2_U64>;
1225 def DS_DEC_SRC2_U64_vi    : DS_Real_vi<0xc4, DS_DEC_SRC2_U64>;
1226 def DS_MIN_SRC2_I64_vi    : DS_Real_vi<0xc5, DS_MIN_SRC2_I64>;
1227 def DS_MAX_SRC2_I64_vi    : DS_Real_vi<0xc6, DS_MAX_SRC2_I64>;
1228 def DS_MIN_SRC2_U64_vi    : DS_Real_vi<0xc7, DS_MIN_SRC2_U64>;
1229 def DS_MAX_SRC2_U64_vi    : DS_Real_vi<0xc8, DS_MAX_SRC2_U64>;
1230 def DS_AND_SRC2_B64_vi    : DS_Real_vi<0xc9, DS_AND_SRC2_B64>;
1231 def DS_OR_SRC2_B64_vi     : DS_Real_vi<0xca, DS_OR_SRC2_B64>;
1232 def DS_XOR_SRC2_B64_vi    : DS_Real_vi<0xcb, DS_XOR_SRC2_B64>;
1233 def DS_WRITE_SRC2_B64_vi  : DS_Real_vi<0xcd, DS_WRITE_SRC2_B64>;
1234 def DS_MIN_SRC2_F64_vi    : DS_Real_vi<0xd2, DS_MIN_SRC2_F64>;
1235 def DS_MAX_SRC2_F64_vi    : DS_Real_vi<0xd3, DS_MAX_SRC2_F64>;
1236 def DS_WRITE_B96_vi       : DS_Real_vi<0xde, DS_WRITE_B96>;
1237 def DS_WRITE_B128_vi      : DS_Real_vi<0xdf, DS_WRITE_B128>;
1238 def DS_READ_B96_vi        : DS_Real_vi<0xfe, DS_READ_B96>;
1239 def DS_READ_B128_vi       : DS_Real_vi<0xff, DS_READ_B128>;