1 //===-- DSInstructions.td - DS Instruction Definitions --------------------===//
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
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> {
16 let UseNamedOperandTable = 1;
18 // Most instruction load and store data, so set this as the default.
23 let hasSideEffects = 0;
24 let SchedRW = [WriteLDS];
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
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;
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 ps> :
56 InstSI <ps.OutOperandList, ps.InOperandList, ps.Mnemonic # ps.AsmOperands, []>,
60 let isCodeGenOnly = 0;
63 let UseNamedOperandTable = 1;
65 // copy relevant pseudo op flags
66 let SubtargetPredicate = ps.SubtargetPredicate;
67 let OtherPredicates = ps.OtherPredicates;
68 let AsmMatchConverter = ps.AsmMatchConverter;
69 let SchedRW = ps.SchedRW;
70 let mayLoad = ps.mayLoad;
71 let mayStore = ps.mayStore;
72 let IsAtomicRet = ps.IsAtomicRet;
73 let IsAtomicNoRet = ps.IsAtomicNoRet;
85 let offset0 = !if(ps.has_offset, offset{7-0}, ?);
86 let offset1 = !if(ps.has_offset, offset{15-8}, ?);
88 bits<1> acc = !if(ps.has_vdst, vdst{9},
89 !if(!or(ps.has_data0, ps.has_gws_data0), data0{9}, 0));
93 // DS Pseudo instructions
95 class DS_0A1D_NORET<string opName, RegisterClass rc = VGPR_32>
98 (ins getLdStRegisterOperand<rc>.ret:$data0, offset:$offset, gds:$gds),
99 " $data0$offset$gds"> {
106 class DS_1A1D_NORET<string opName, RegisterClass rc = VGPR_32>
109 (ins VGPR_32:$addr, getLdStRegisterOperand<rc>.ret:$data0, offset:$offset, gds:$gds),
110 " $addr, $data0$offset$gds"> {
114 let IsAtomicNoRet = 1;
117 multiclass DS_1A1D_NORET_mc<string opName, RegisterClass rc = VGPR_32> {
118 def "" : DS_1A1D_NORET<opName, rc>,
119 AtomicNoRet<opName, 0>;
121 let has_m0_read = 0 in {
122 def _gfx9 : DS_1A1D_NORET<opName, rc>,
123 AtomicNoRet<opName#"_gfx9", 0>;
127 multiclass DS_1A1D_NORET_mc_gfx9<string opName, RegisterClass rc = VGPR_32> {
128 let has_m0_read = 0 in {
129 def "" : DS_1A1D_NORET<opName, rc>,
130 AtomicNoRet<opName, 0>;
134 class DS_1A2D_NORET<string opName, RegisterClass rc = VGPR_32,
135 RegisterOperand data_op = getLdStRegisterOperand<rc>.ret>
138 (ins VGPR_32:$addr, data_op:$data0, data_op:$data1, offset:$offset, gds:$gds),
139 " $addr, $data0, $data1$offset$gds"> {
142 let IsAtomicNoRet = 1;
145 multiclass DS_1A2D_NORET_mc<string opName, RegisterClass rc = VGPR_32> {
146 def "" : DS_1A2D_NORET<opName, rc>,
147 AtomicNoRet<opName, 0>;
149 let has_m0_read = 0 in {
150 def _gfx9 : DS_1A2D_NORET<opName, rc>,
151 AtomicNoRet<opName#"_gfx9", 0>;
155 class DS_1A2D_Off8_NORET <string opName, RegisterClass rc = VGPR_32,
156 RegisterOperand data_op = getLdStRegisterOperand<rc>.ret>
159 (ins VGPR_32:$addr, data_op:$data0, data_op:$data1,
160 offset0:$offset0, offset1:$offset1, gds:$gds),
161 " $addr, $data0, $data1$offset0$offset1$gds"> {
165 let AsmMatchConverter = "cvtDSOffset01";
168 multiclass DS_1A2D_Off8_NORET_mc <string opName, RegisterClass rc = VGPR_32> {
169 def "" : DS_1A2D_Off8_NORET<opName, rc>;
171 let has_m0_read = 0 in {
172 def _gfx9 : DS_1A2D_Off8_NORET<opName, rc>;
176 class DS_1A1D_RET <string opName, RegisterClass rc = VGPR_32,
177 RegisterOperand data_op = getLdStRegisterOperand<rc>.ret>
179 (outs data_op:$vdst),
180 (ins VGPR_32:$addr, data_op:$data0, offset:$offset, gds:$gds),
181 " $vdst, $addr, $data0$offset$gds"> {
183 let hasPostISelHook = 1;
188 multiclass DS_1A1D_RET_mc <string opName, RegisterClass rc = VGPR_32,
189 string NoRetOp = ""> {
190 def "" : DS_1A1D_RET<opName, rc>,
191 AtomicNoRet<NoRetOp, !ne(NoRetOp, "")>;
193 let has_m0_read = 0 in {
194 def _gfx9 : DS_1A1D_RET<opName, rc>,
195 AtomicNoRet<!if(!eq(NoRetOp, ""), "", NoRetOp#"_gfx9"),
200 multiclass DS_1A1D_RET_mc_gfx9 <string opName, RegisterClass rc = VGPR_32,
201 string NoRetOp = ""> {
202 let has_m0_read = 0 in {
203 def "" : DS_1A1D_RET<opName, rc>,
204 AtomicNoRet<!if(!eq(NoRetOp, ""), "", NoRetOp),
205 !if(!eq(NoRetOp, ""), 0, 1)>;
209 class DS_1A2D_RET<string opName,
210 RegisterClass rc = VGPR_32,
211 RegisterClass src = rc,
212 RegisterOperand dst_op = getLdStRegisterOperand<rc>.ret,
213 RegisterOperand src_op = getLdStRegisterOperand<src>.ret>
216 (ins VGPR_32:$addr, src_op:$data0, src_op:$data1, offset:$offset, gds:$gds),
217 " $vdst, $addr, $data0, $data1$offset$gds"> {
219 let hasPostISelHook = 1;
223 multiclass DS_1A2D_RET_mc<string opName,
224 RegisterClass rc = VGPR_32,
226 RegisterClass src = rc> {
227 def "" : DS_1A2D_RET<opName, rc, src>,
228 AtomicNoRet<NoRetOp, !ne(NoRetOp, "")>;
230 let has_m0_read = 0 in {
231 def _gfx9 : DS_1A2D_RET<opName, rc, src>,
232 AtomicNoRet<NoRetOp#"_gfx9", !ne(NoRetOp, "")>;
236 class DS_1A2D_Off8_RET<string opName,
237 RegisterClass rc = VGPR_32,
238 RegisterClass src = rc,
239 RegisterOperand dst_op = getLdStRegisterOperand<rc>.ret,
240 RegisterOperand src_op = getLdStRegisterOperand<src>.ret>
243 (ins VGPR_32:$addr, src_op:$data0, src_op:$data1, offset0:$offset0, offset1:$offset1, gds:$gds),
244 " $vdst, $addr, $data0, $data1$offset0$offset1$gds"> {
247 let AsmMatchConverter = "cvtDSOffset01";
249 let hasPostISelHook = 1;
252 multiclass DS_1A2D_Off8_RET_mc<string opName,
253 RegisterClass rc = VGPR_32,
254 RegisterClass src = rc> {
255 def "" : DS_1A2D_Off8_RET<opName, rc, src>;
257 let has_m0_read = 0 in {
258 def _gfx9 : DS_1A2D_Off8_RET<opName, rc, src>;
263 class DS_1A_RET<string opName, RegisterClass rc = VGPR_32, bit HasTiedOutput = 0, Operand ofs = offset,
264 RegisterOperand data_op = getLdStRegisterOperand<rc>.ret>
266 (outs data_op:$vdst),
268 (ins VGPR_32:$addr, ofs:$offset, gds:$gds, data_op:$vdst_in),
269 (ins VGPR_32:$addr, ofs:$offset, gds:$gds)),
270 " $vdst, $addr$offset$gds"> {
271 let Constraints = !if(HasTiedOutput, "$vdst = $vdst_in", "");
272 let DisableEncoding = !if(HasTiedOutput, "$vdst_in", "");
277 multiclass DS_1A_RET_mc<string opName, RegisterClass rc = VGPR_32, bit HasTiedOutput = 0, Operand ofs = offset> {
278 def "" : DS_1A_RET<opName, rc, HasTiedOutput, ofs>;
280 let has_m0_read = 0 in {
281 def _gfx9 : DS_1A_RET<opName, rc, HasTiedOutput, ofs>;
285 class DS_1A_RET_Tied<string opName, RegisterClass rc = VGPR_32> :
286 DS_1A_RET<opName, rc, 1>;
288 class DS_1A_Off8_RET <string opName, RegisterClass rc = VGPR_32>
290 (outs getLdStRegisterOperand<rc>.ret:$vdst),
291 (ins VGPR_32:$addr, offset0:$offset0, offset1:$offset1, gds:$gds),
292 " $vdst, $addr$offset0$offset1$gds"> {
297 let AsmMatchConverter = "cvtDSOffset01";
300 multiclass DS_1A_Off8_RET_mc <string opName, RegisterClass rc = VGPR_32> {
301 def "" : DS_1A_Off8_RET<opName, rc>;
303 let has_m0_read = 0 in {
304 def _gfx9 : DS_1A_Off8_RET<opName, rc>;
308 class DS_1A_RET_GDS <string opName> : DS_Pseudo<opName,
309 (outs getLdStRegisterOperand<VGPR_32>.ret:$vdst),
310 (ins VGPR_32:$addr, offset:$offset),
311 " $vdst, $addr$offset gds"> {
317 let AsmMatchConverter = "cvtDSGds";
320 class DS_0A_RET <string opName> : DS_Pseudo<opName,
321 (outs getLdStRegisterOperand<VGPR_32>.ret:$vdst),
322 (ins offset:$offset, gds:$gds),
323 " $vdst$offset$gds"> {
333 class DS_1A <string opName> : DS_Pseudo<opName,
335 (ins VGPR_32:$addr, offset:$offset, gds:$gds),
336 " $addr$offset$gds"> {
346 multiclass DS_1A_mc <string opName> {
347 def "" : DS_1A<opName>;
349 let has_m0_read = 0 in {
350 def _gfx9 : DS_1A<opName>;
355 class DS_GWS <string opName, dag ins, string asmOps>
356 : DS_Pseudo<opName, (outs), ins, asmOps> {
365 let AsmMatchConverter = "cvtDSGds";
368 class DS_GWS_0D <string opName>
370 (ins offset:$offset), "$offset gds"> {
371 let hasSideEffects = 1;
374 class DS_GWS_1D <string opName>
376 (ins getLdStRegisterOperand<VGPR_32>.ret:$data0, offset:$offset),
377 " $data0$offset gds"> {
379 let has_gws_data0 = 1;
380 let hasSideEffects = 1;
383 class DS_VOID <string opName> : DS_Pseudo<opName,
387 let hasSideEffects = 1;
388 let UseNamedOperandTable = 0;
389 let AsmMatchConverter = "";
401 class DS_1A1D_PERMUTE <string opName, SDPatternOperator node = null_frag,
402 RegisterOperand data_op = getLdStRegisterOperand<VGPR_32>.ret>
404 (outs data_op:$vdst),
405 (ins VGPR_32:$addr, data_op:$data0, offset:$offset),
406 " $vdst, $addr, $data0$offset",
408 (node (DS1Addr1Offset i32:$addr, i16:$offset), i32:$data0))] > {
412 let isConvergent = 1;
418 defm DS_ADD_U32 : DS_1A1D_NORET_mc<"ds_add_u32">;
419 defm DS_SUB_U32 : DS_1A1D_NORET_mc<"ds_sub_u32">;
420 defm DS_RSUB_U32 : DS_1A1D_NORET_mc<"ds_rsub_u32">;
421 defm DS_INC_U32 : DS_1A1D_NORET_mc<"ds_inc_u32">;
422 defm DS_DEC_U32 : DS_1A1D_NORET_mc<"ds_dec_u32">;
423 defm DS_MIN_I32 : DS_1A1D_NORET_mc<"ds_min_i32">;
424 defm DS_MAX_I32 : DS_1A1D_NORET_mc<"ds_max_i32">;
425 defm DS_MIN_U32 : DS_1A1D_NORET_mc<"ds_min_u32">;
426 defm DS_MAX_U32 : DS_1A1D_NORET_mc<"ds_max_u32">;
427 defm DS_AND_B32 : DS_1A1D_NORET_mc<"ds_and_b32">;
428 defm DS_OR_B32 : DS_1A1D_NORET_mc<"ds_or_b32">;
429 defm DS_XOR_B32 : DS_1A1D_NORET_mc<"ds_xor_b32">;
431 let SubtargetPredicate = HasLDSFPAtomics in {
432 defm DS_ADD_F32 : DS_1A1D_NORET_mc<"ds_add_f32">;
435 // FIXME: Are these really present pre-gfx8?
436 defm DS_MIN_F32 : DS_1A1D_NORET_mc<"ds_min_f32">;
437 defm DS_MAX_F32 : DS_1A1D_NORET_mc<"ds_max_f32">;
440 defm DS_WRITE_B8 : DS_1A1D_NORET_mc<"ds_write_b8">;
441 defm DS_WRITE_B16 : DS_1A1D_NORET_mc<"ds_write_b16">;
442 defm DS_WRITE_B32 : DS_1A1D_NORET_mc<"ds_write_b32">;
443 defm DS_WRITE2_B32 : DS_1A2D_Off8_NORET_mc<"ds_write2_b32">;
444 defm DS_WRITE2ST64_B32: DS_1A2D_Off8_NORET_mc<"ds_write2st64_b32">;
447 let has_m0_read = 0 in {
449 let SubtargetPredicate = HasD16LoadStore in {
450 def DS_WRITE_B8_D16_HI : DS_1A1D_NORET<"ds_write_b8_d16_hi">;
451 def DS_WRITE_B16_D16_HI : DS_1A1D_NORET<"ds_write_b16_d16_hi">;
454 } // End has_m0_read = 0
456 let SubtargetPredicate = HasDSAddTid in {
457 def DS_WRITE_ADDTID_B32 : DS_0A1D_NORET<"ds_write_addtid_b32">;
462 let SubtargetPredicate = isGFX90APlus in {
463 defm DS_ADD_F64 : DS_1A1D_NORET_mc_gfx9<"ds_add_f64", VReg_64>;
464 defm DS_ADD_RTN_F64 : DS_1A1D_RET_mc_gfx9<"ds_add_rtn_f64", VReg_64, "ds_add_f64">;
465 } // End SubtargetPredicate = isGFX90APlus
467 defm DS_MSKOR_B32 : DS_1A2D_NORET_mc<"ds_mskor_b32">;
468 defm DS_CMPST_B32 : DS_1A2D_NORET_mc<"ds_cmpst_b32">;
469 defm DS_CMPST_F32 : DS_1A2D_NORET_mc<"ds_cmpst_f32">;
471 defm DS_ADD_U64 : DS_1A1D_NORET_mc<"ds_add_u64", VReg_64>;
472 defm DS_SUB_U64 : DS_1A1D_NORET_mc<"ds_sub_u64", VReg_64>;
473 defm DS_RSUB_U64 : DS_1A1D_NORET_mc<"ds_rsub_u64", VReg_64>;
474 defm DS_INC_U64 : DS_1A1D_NORET_mc<"ds_inc_u64", VReg_64>;
475 defm DS_DEC_U64 : DS_1A1D_NORET_mc<"ds_dec_u64", VReg_64>;
476 defm DS_MIN_I64 : DS_1A1D_NORET_mc<"ds_min_i64", VReg_64>;
477 defm DS_MAX_I64 : DS_1A1D_NORET_mc<"ds_max_i64", VReg_64>;
478 defm DS_MIN_U64 : DS_1A1D_NORET_mc<"ds_min_u64", VReg_64>;
479 defm DS_MAX_U64 : DS_1A1D_NORET_mc<"ds_max_u64", VReg_64>;
480 defm DS_AND_B64 : DS_1A1D_NORET_mc<"ds_and_b64", VReg_64>;
481 defm DS_OR_B64 : DS_1A1D_NORET_mc<"ds_or_b64", VReg_64>;
482 defm DS_XOR_B64 : DS_1A1D_NORET_mc<"ds_xor_b64", VReg_64>;
483 defm DS_MSKOR_B64 : DS_1A2D_NORET_mc<"ds_mskor_b64", VReg_64>;
485 defm DS_WRITE_B64 : DS_1A1D_NORET_mc<"ds_write_b64", VReg_64>;
486 defm DS_WRITE2_B64 : DS_1A2D_Off8_NORET_mc<"ds_write2_b64", VReg_64>;
487 defm DS_WRITE2ST64_B64: DS_1A2D_Off8_NORET_mc<"ds_write2st64_b64", VReg_64>;
489 defm DS_CMPST_B64 : DS_1A2D_NORET_mc<"ds_cmpst_b64", VReg_64>;
490 defm DS_CMPST_F64 : DS_1A2D_NORET_mc<"ds_cmpst_f64", VReg_64>;
491 defm DS_MIN_F64 : DS_1A1D_NORET_mc<"ds_min_f64", VReg_64>;
492 defm DS_MAX_F64 : DS_1A1D_NORET_mc<"ds_max_f64", VReg_64>;
494 defm DS_ADD_RTN_U32 : DS_1A1D_RET_mc<"ds_add_rtn_u32", VGPR_32, "ds_add_u32">;
496 let SubtargetPredicate = HasLDSFPAtomics in {
497 defm DS_ADD_RTN_F32 : DS_1A1D_RET_mc<"ds_add_rtn_f32", VGPR_32, "ds_add_f32">;
499 defm DS_SUB_RTN_U32 : DS_1A1D_RET_mc<"ds_sub_rtn_u32", VGPR_32, "ds_sub_u32">;
500 defm DS_RSUB_RTN_U32 : DS_1A1D_RET_mc<"ds_rsub_rtn_u32", VGPR_32, "ds_rsub_u32">;
501 defm DS_INC_RTN_U32 : DS_1A1D_RET_mc<"ds_inc_rtn_u32", VGPR_32, "ds_inc_u32">;
502 defm DS_DEC_RTN_U32 : DS_1A1D_RET_mc<"ds_dec_rtn_u32", VGPR_32, "ds_dec_u32">;
503 defm DS_MIN_RTN_I32 : DS_1A1D_RET_mc<"ds_min_rtn_i32", VGPR_32, "ds_min_i32">;
504 defm DS_MAX_RTN_I32 : DS_1A1D_RET_mc<"ds_max_rtn_i32", VGPR_32, "ds_max_i32">;
505 defm DS_MIN_RTN_U32 : DS_1A1D_RET_mc<"ds_min_rtn_u32", VGPR_32, "ds_min_u32">;
506 defm DS_MAX_RTN_U32 : DS_1A1D_RET_mc<"ds_max_rtn_u32", VGPR_32, "ds_max_u32">;
507 defm DS_AND_RTN_B32 : DS_1A1D_RET_mc<"ds_and_rtn_b32", VGPR_32, "ds_and_b32">;
508 defm DS_OR_RTN_B32 : DS_1A1D_RET_mc<"ds_or_rtn_b32", VGPR_32, "ds_or_b32">;
509 defm DS_XOR_RTN_B32 : DS_1A1D_RET_mc<"ds_xor_rtn_b32", VGPR_32, "ds_xor_b32">;
510 defm DS_MSKOR_RTN_B32 : DS_1A2D_RET_mc<"ds_mskor_rtn_b32", VGPR_32, "ds_mskor_b32">;
511 defm DS_CMPST_RTN_B32 : DS_1A2D_RET_mc<"ds_cmpst_rtn_b32", VGPR_32, "ds_cmpst_b32">;
512 defm DS_CMPST_RTN_F32 : DS_1A2D_RET_mc<"ds_cmpst_rtn_f32", VGPR_32, "ds_cmpst_f32">;
513 defm DS_MIN_RTN_F32 : DS_1A1D_RET_mc<"ds_min_rtn_f32", VGPR_32, "ds_min_f32">;
514 defm DS_MAX_RTN_F32 : DS_1A1D_RET_mc<"ds_max_rtn_f32", VGPR_32, "ds_max_f32">;
516 defm DS_WRXCHG_RTN_B32 : DS_1A1D_RET_mc<"ds_wrxchg_rtn_b32">;
517 defm DS_WRXCHG2_RTN_B32 : DS_1A2D_Off8_RET_mc<"ds_wrxchg2_rtn_b32", VReg_64, VGPR_32>;
518 defm DS_WRXCHG2ST64_RTN_B32 : DS_1A2D_Off8_RET_mc<"ds_wrxchg2st64_rtn_b32", VReg_64, VGPR_32>;
520 defm DS_ADD_RTN_U64 : DS_1A1D_RET_mc<"ds_add_rtn_u64", VReg_64, "ds_add_u64">;
521 defm DS_SUB_RTN_U64 : DS_1A1D_RET_mc<"ds_sub_rtn_u64", VReg_64, "ds_sub_u64">;
522 defm DS_RSUB_RTN_U64 : DS_1A1D_RET_mc<"ds_rsub_rtn_u64", VReg_64, "ds_rsub_u64">;
523 defm DS_INC_RTN_U64 : DS_1A1D_RET_mc<"ds_inc_rtn_u64", VReg_64, "ds_inc_u64">;
524 defm DS_DEC_RTN_U64 : DS_1A1D_RET_mc<"ds_dec_rtn_u64", VReg_64, "ds_dec_u64">;
525 defm DS_MIN_RTN_I64 : DS_1A1D_RET_mc<"ds_min_rtn_i64", VReg_64, "ds_min_i64">;
526 defm DS_MAX_RTN_I64 : DS_1A1D_RET_mc<"ds_max_rtn_i64", VReg_64, "ds_max_i64">;
527 defm DS_MIN_RTN_U64 : DS_1A1D_RET_mc<"ds_min_rtn_u64", VReg_64, "ds_min_u64">;
528 defm DS_MAX_RTN_U64 : DS_1A1D_RET_mc<"ds_max_rtn_u64", VReg_64, "ds_max_u64">;
529 defm DS_AND_RTN_B64 : DS_1A1D_RET_mc<"ds_and_rtn_b64", VReg_64, "ds_and_b64">;
530 defm DS_OR_RTN_B64 : DS_1A1D_RET_mc<"ds_or_rtn_b64", VReg_64, "ds_or_b64">;
531 defm DS_XOR_RTN_B64 : DS_1A1D_RET_mc<"ds_xor_rtn_b64", VReg_64, "ds_xor_b64">;
532 defm DS_MSKOR_RTN_B64 : DS_1A2D_RET_mc<"ds_mskor_rtn_b64", VReg_64, "ds_mskor_b64">;
533 defm DS_CMPST_RTN_B64 : DS_1A2D_RET_mc<"ds_cmpst_rtn_b64", VReg_64, "ds_cmpst_b64">;
534 defm DS_CMPST_RTN_F64 : DS_1A2D_RET_mc<"ds_cmpst_rtn_f64", VReg_64, "ds_cmpst_f64">;
535 defm DS_MIN_RTN_F64 : DS_1A1D_RET_mc<"ds_min_rtn_f64", VReg_64, "ds_min_f64">;
536 defm DS_MAX_RTN_F64 : DS_1A1D_RET_mc<"ds_max_rtn_f64", VReg_64, "ds_max_f64">;
538 defm DS_WRXCHG_RTN_B64 : DS_1A1D_RET_mc<"ds_wrxchg_rtn_b64", VReg_64>;
539 defm DS_WRXCHG2_RTN_B64 : DS_1A2D_Off8_RET_mc<"ds_wrxchg2_rtn_b64", VReg_128, VReg_64>;
540 defm DS_WRXCHG2ST64_RTN_B64 : DS_1A2D_Off8_RET_mc<"ds_wrxchg2st64_rtn_b64", VReg_128, VReg_64>;
542 let isConvergent = 1, usesCustomInserter = 1 in {
543 def DS_GWS_INIT : DS_GWS_1D<"ds_gws_init"> {
546 def DS_GWS_SEMA_V : DS_GWS_0D<"ds_gws_sema_v">;
547 def DS_GWS_SEMA_BR : DS_GWS_1D<"ds_gws_sema_br">;
548 def DS_GWS_SEMA_P : DS_GWS_0D<"ds_gws_sema_p">;
549 def DS_GWS_BARRIER : DS_GWS_1D<"ds_gws_barrier">;
552 let SubtargetPredicate = HasDsSrc2Insts in {
553 def DS_ADD_SRC2_U32 : DS_1A<"ds_add_src2_u32">;
554 def DS_SUB_SRC2_U32 : DS_1A<"ds_sub_src2_u32">;
555 def DS_RSUB_SRC2_U32 : DS_1A<"ds_rsub_src2_u32">;
556 def DS_INC_SRC2_U32 : DS_1A<"ds_inc_src2_u32">;
557 def DS_DEC_SRC2_U32 : DS_1A<"ds_dec_src2_u32">;
558 def DS_MIN_SRC2_I32 : DS_1A<"ds_min_src2_i32">;
559 def DS_MAX_SRC2_I32 : DS_1A<"ds_max_src2_i32">;
560 def DS_MIN_SRC2_U32 : DS_1A<"ds_min_src2_u32">;
561 def DS_MAX_SRC2_U32 : DS_1A<"ds_max_src2_u32">;
562 def DS_AND_SRC2_B32 : DS_1A<"ds_and_src2_b32">;
563 def DS_OR_SRC2_B32 : DS_1A<"ds_or_src2_b32">;
564 def DS_XOR_SRC2_B32 : DS_1A<"ds_xor_src2_b32">;
565 def DS_MIN_SRC2_F32 : DS_1A<"ds_min_src2_f32">;
566 def DS_MAX_SRC2_F32 : DS_1A<"ds_max_src2_f32">;
568 def DS_ADD_SRC2_U64 : DS_1A<"ds_add_src2_u64">;
569 def DS_SUB_SRC2_U64 : DS_1A<"ds_sub_src2_u64">;
570 def DS_RSUB_SRC2_U64 : DS_1A<"ds_rsub_src2_u64">;
571 def DS_INC_SRC2_U64 : DS_1A<"ds_inc_src2_u64">;
572 def DS_DEC_SRC2_U64 : DS_1A<"ds_dec_src2_u64">;
573 def DS_MIN_SRC2_I64 : DS_1A<"ds_min_src2_i64">;
574 def DS_MAX_SRC2_I64 : DS_1A<"ds_max_src2_i64">;
575 def DS_MIN_SRC2_U64 : DS_1A<"ds_min_src2_u64">;
576 def DS_MAX_SRC2_U64 : DS_1A<"ds_max_src2_u64">;
577 def DS_AND_SRC2_B64 : DS_1A<"ds_and_src2_b64">;
578 def DS_OR_SRC2_B64 : DS_1A<"ds_or_src2_b64">;
579 def DS_XOR_SRC2_B64 : DS_1A<"ds_xor_src2_b64">;
580 def DS_MIN_SRC2_F64 : DS_1A<"ds_min_src2_f64">;
581 def DS_MAX_SRC2_F64 : DS_1A<"ds_max_src2_f64">;
583 def DS_WRITE_SRC2_B32 : DS_1A<"ds_write_src2_b32">;
584 def DS_WRITE_SRC2_B64 : DS_1A<"ds_write_src2_b64">;
585 } // End SubtargetPredicate = HasDsSrc2Insts
587 let Uses = [EXEC], mayLoad = 0, mayStore = 0, isConvergent = 1 in {
588 def DS_SWIZZLE_B32 : DS_1A_RET <"ds_swizzle_b32", VGPR_32, 0, SwizzleImm>;
591 let mayStore = 0 in {
592 defm DS_READ_I8 : DS_1A_RET_mc<"ds_read_i8">;
593 defm DS_READ_U8 : DS_1A_RET_mc<"ds_read_u8">;
594 defm DS_READ_I16 : DS_1A_RET_mc<"ds_read_i16">;
595 defm DS_READ_U16 : DS_1A_RET_mc<"ds_read_u16">;
596 defm DS_READ_B32 : DS_1A_RET_mc<"ds_read_b32">;
597 defm DS_READ_B64 : DS_1A_RET_mc<"ds_read_b64", VReg_64>;
599 defm DS_READ2_B32 : DS_1A_Off8_RET_mc<"ds_read2_b32", VReg_64>;
600 defm DS_READ2ST64_B32: DS_1A_Off8_RET_mc<"ds_read2st64_b32", VReg_64>;
602 defm DS_READ2_B64 : DS_1A_Off8_RET_mc<"ds_read2_b64", VReg_128>;
603 defm DS_READ2ST64_B64: DS_1A_Off8_RET_mc<"ds_read2st64_b64", VReg_128>;
605 let has_m0_read = 0 in {
606 let SubtargetPredicate = HasD16LoadStore in {
607 def DS_READ_U8_D16 : DS_1A_RET_Tied<"ds_read_u8_d16">;
608 def DS_READ_U8_D16_HI : DS_1A_RET_Tied<"ds_read_u8_d16_hi">;
609 def DS_READ_I8_D16 : DS_1A_RET_Tied<"ds_read_i8_d16">;
610 def DS_READ_I8_D16_HI : DS_1A_RET_Tied<"ds_read_i8_d16_hi">;
611 def DS_READ_U16_D16 : DS_1A_RET_Tied<"ds_read_u16_d16">;
612 def DS_READ_U16_D16_HI : DS_1A_RET_Tied<"ds_read_u16_d16_hi">;
614 } // End has_m0_read = 0
616 let SubtargetPredicate = HasDSAddTid in {
617 def DS_READ_ADDTID_B32 : DS_0A_RET<"ds_read_addtid_b32">;
620 } // End mayStore = 0
622 def DS_CONSUME : DS_0A_RET<"ds_consume">;
623 def DS_APPEND : DS_0A_RET<"ds_append">;
624 def DS_ORDERED_COUNT : DS_1A_RET_GDS<"ds_ordered_count">;
626 //===----------------------------------------------------------------------===//
627 // Instruction definitions for CI and newer.
628 //===----------------------------------------------------------------------===//
630 let SubtargetPredicate = isGFX7Plus in {
632 defm DS_WRAP_RTN_B32 : DS_1A2D_RET_mc<"ds_wrap_rtn_b32", VGPR_32>;
633 defm DS_CONDXCHG32_RTN_B64 : DS_1A1D_RET_mc<"ds_condxchg32_rtn_b64", VReg_64>;
635 let isConvergent = 1, usesCustomInserter = 1 in {
636 def DS_GWS_SEMA_RELEASE_ALL : DS_GWS_0D<"ds_gws_sema_release_all">;
639 let mayStore = 0 in {
640 defm DS_READ_B96 : DS_1A_RET_mc<"ds_read_b96", VReg_96>;
641 defm DS_READ_B128: DS_1A_RET_mc<"ds_read_b128", VReg_128>;
642 } // End mayStore = 0
645 defm DS_WRITE_B96 : DS_1A1D_NORET_mc<"ds_write_b96", VReg_96>;
646 defm DS_WRITE_B128 : DS_1A1D_NORET_mc<"ds_write_b128", VReg_128>;
649 def DS_NOP : DS_VOID<"ds_nop">;
651 } // let SubtargetPredicate = isGFX7Plus
653 //===----------------------------------------------------------------------===//
654 // Instruction definitions for VI and newer.
655 //===----------------------------------------------------------------------===//
657 let SubtargetPredicate = isGFX8Plus in {
659 let Uses = [EXEC] in {
660 def DS_PERMUTE_B32 : DS_1A1D_PERMUTE <"ds_permute_b32",
661 int_amdgcn_ds_permute>;
662 def DS_BPERMUTE_B32 : DS_1A1D_PERMUTE <"ds_bpermute_b32",
663 int_amdgcn_ds_bpermute>;
666 } // let SubtargetPredicate = isGFX8Plus
668 let SubtargetPredicate = HasLDSFPAtomics, OtherPredicates = [HasDsSrc2Insts] in {
669 def DS_ADD_SRC2_F32 : DS_1A<"ds_add_src2_f32">;
672 //===----------------------------------------------------------------------===//
674 //===----------------------------------------------------------------------===//
677 (int_amdgcn_ds_swizzle i32:$src, timm:$offset16),
678 (DS_SWIZZLE_B32 VGPR_32:$src, (as_i16timm $offset16), (i1 0))
681 class DSReadPat <DS_Pseudo inst, ValueType vt, PatFrag frag, int gds=0> : GCNPat <
682 (vt (frag (DS1Addr1Offset i32:$ptr, i16:$offset))),
683 (inst $ptr, offset:$offset, (i1 gds))
686 multiclass DSReadPat_mc<DS_Pseudo inst, ValueType vt, string frag> {
688 let OtherPredicates = [LDSRequiresM0Init] in {
689 def : DSReadPat<inst, vt, !cast<PatFrag>(frag#"_m0")>;
692 let OtherPredicates = [NotLDSRequiresM0Init] in {
693 def : DSReadPat<!cast<DS_Pseudo>(!cast<string>(inst)#"_gfx9"), vt, !cast<PatFrag>(frag)>;
697 class DSReadPat_D16 <DS_Pseudo inst, PatFrag frag, ValueType vt> : GCNPat <
698 (frag (DS1Addr1Offset i32:$ptr, i16:$offset), vt:$in),
699 (inst $ptr, offset:$offset, (i1 0), $in)
702 defm : DSReadPat_mc <DS_READ_I8, i32, "sextloadi8_local">;
703 defm : DSReadPat_mc <DS_READ_I8, i16, "sextloadi8_local">;
704 defm : DSReadPat_mc <DS_READ_U8, i32, "extloadi8_local">;
705 defm : DSReadPat_mc <DS_READ_U8, i32, "zextloadi8_local">;
706 defm : DSReadPat_mc <DS_READ_U8, i16, "extloadi8_local">;
707 defm : DSReadPat_mc <DS_READ_U8, i16, "zextloadi8_local">;
708 defm : DSReadPat_mc <DS_READ_I16, i32, "sextloadi16_local">;
709 defm : DSReadPat_mc <DS_READ_I16, i32, "sextloadi16_local">;
710 defm : DSReadPat_mc <DS_READ_U16, i32, "extloadi16_local">;
711 defm : DSReadPat_mc <DS_READ_U16, i32, "zextloadi16_local">;
712 defm : DSReadPat_mc <DS_READ_U16, i16, "load_local">;
714 foreach vt = Reg32Types.types in {
715 defm : DSReadPat_mc <DS_READ_B32, vt, "load_local">;
718 defm : DSReadPat_mc <DS_READ_B32, i32, "atomic_load_32_local">;
719 defm : DSReadPat_mc <DS_READ_B64, i64, "atomic_load_64_local">;
721 let OtherPredicates = [D16PreservesUnusedBits] in {
722 def : DSReadPat_D16<DS_READ_U16_D16_HI, load_d16_hi_local, v2i16>;
723 def : DSReadPat_D16<DS_READ_U16_D16_HI, load_d16_hi_local, v2f16>;
724 def : DSReadPat_D16<DS_READ_U8_D16_HI, az_extloadi8_d16_hi_local, v2i16>;
725 def : DSReadPat_D16<DS_READ_U8_D16_HI, az_extloadi8_d16_hi_local, v2f16>;
726 def : DSReadPat_D16<DS_READ_I8_D16_HI, sextloadi8_d16_hi_local, v2i16>;
727 def : DSReadPat_D16<DS_READ_I8_D16_HI, sextloadi8_d16_hi_local, v2f16>;
729 def : DSReadPat_D16<DS_READ_U16_D16, load_d16_lo_local, v2i16>;
730 def : DSReadPat_D16<DS_READ_U16_D16, load_d16_lo_local, v2f16>;
731 def : DSReadPat_D16<DS_READ_U8_D16, az_extloadi8_d16_lo_local, v2i16>;
732 def : DSReadPat_D16<DS_READ_U8_D16, az_extloadi8_d16_lo_local, v2f16>;
733 def : DSReadPat_D16<DS_READ_I8_D16, sextloadi8_d16_lo_local, v2i16>;
734 def : DSReadPat_D16<DS_READ_I8_D16, sextloadi8_d16_lo_local, v2f16>;
737 class DSWritePat <DS_Pseudo inst, ValueType vt, PatFrag frag, int gds=0> : GCNPat <
738 (frag vt:$value, (DS1Addr1Offset i32:$ptr, i16:$offset)),
739 (inst $ptr, getVregSrcForVT<vt>.ret:$value, offset:$offset, (i1 gds))
742 multiclass DSWritePat_mc <DS_Pseudo inst, ValueType vt, string frag> {
743 let OtherPredicates = [LDSRequiresM0Init] in {
744 def : DSWritePat<inst, vt, !cast<PatFrag>(frag#"_m0")>;
747 let OtherPredicates = [NotLDSRequiresM0Init] in {
748 def : DSWritePat<!cast<DS_Pseudo>(!cast<string>(inst)#"_gfx9"), vt, !cast<PatFrag>(frag)>;
752 // Irritatingly, atomic_store reverses the order of operands from a
754 class DSAtomicWritePat <DS_Pseudo inst, ValueType vt, PatFrag frag> : GCNPat <
755 (frag (DS1Addr1Offset i32:$ptr, i16:$offset), vt:$value),
756 (inst $ptr, getVregSrcForVT<vt>.ret:$value, offset:$offset, (i1 0))
759 multiclass DSAtomicWritePat_mc <DS_Pseudo inst, ValueType vt, string frag> {
760 let OtherPredicates = [LDSRequiresM0Init] in {
761 def : DSAtomicWritePat<inst, vt, !cast<PatFrag>(frag#"_m0")>;
764 let OtherPredicates = [NotLDSRequiresM0Init] in {
765 def : DSAtomicWritePat<!cast<DS_Pseudo>(!cast<string>(inst)#"_gfx9"), vt, !cast<PatFrag>(frag)>;
769 defm : DSWritePat_mc <DS_WRITE_B8, i32, "truncstorei8_local">;
770 defm : DSWritePat_mc <DS_WRITE_B16, i32, "truncstorei16_local">;
771 defm : DSWritePat_mc <DS_WRITE_B8, i16, "truncstorei8_local">;
772 defm : DSWritePat_mc <DS_WRITE_B16, i16, "store_local">;
774 foreach vt = Reg32Types.types in {
775 defm : DSWritePat_mc <DS_WRITE_B32, vt, "store_local">;
778 defm : DSAtomicWritePat_mc <DS_WRITE_B32, i32, "atomic_store_local_32">;
779 defm : DSAtomicWritePat_mc <DS_WRITE_B64, i64, "atomic_store_local_64">;
781 let OtherPredicates = [D16PreservesUnusedBits] in {
782 def : DSWritePat <DS_WRITE_B16_D16_HI, i32, store_hi16_local>;
783 def : DSWritePat <DS_WRITE_B8_D16_HI, i32, truncstorei8_hi16_local>;
786 class DS64Bit4ByteAlignedReadPat<DS_Pseudo inst, ValueType vt, PatFrag frag> : GCNPat <
787 (vt:$value (frag (DS64Bit4ByteAligned i32:$ptr, i8:$offset0, i8:$offset1))),
788 (inst $ptr, $offset0, $offset1, (i1 0))
791 class DS64Bit4ByteAlignedWritePat<DS_Pseudo inst, ValueType vt, PatFrag frag> : GCNPat<
792 (frag vt:$value, (DS64Bit4ByteAligned i32:$ptr, i8:$offset0, i8:$offset1)),
793 (inst $ptr, (i32 (EXTRACT_SUBREG VReg_64:$value, sub0)),
794 (i32 (EXTRACT_SUBREG VReg_64:$value, sub1)), $offset0, $offset1,
798 class DS128Bit8ByteAlignedReadPat<DS_Pseudo inst, ValueType vt, PatFrag frag> : GCNPat <
799 (vt:$value (frag (DS128Bit8ByteAligned i32:$ptr, i8:$offset0, i8:$offset1))),
800 (inst $ptr, $offset0, $offset1, (i1 0))
803 class DS128Bit8ByteAlignedWritePat<DS_Pseudo inst, ValueType vt, PatFrag frag> : GCNPat<
804 (frag vt:$value, (DS128Bit8ByteAligned i32:$ptr, i8:$offset0, i8:$offset1)),
805 (inst $ptr, (i64 (EXTRACT_SUBREG VReg_128:$value, sub0_sub1)),
806 (i64 (EXTRACT_SUBREG VReg_128:$value, sub2_sub3)), $offset0, $offset1,
810 multiclass DS64Bit4ByteAlignedPat_mc<ValueType vt> {
811 let OtherPredicates = [LDSRequiresM0Init, isGFX7Plus] in {
812 def : DS64Bit4ByteAlignedReadPat<DS_READ2_B32, vt, load_local_m0>;
813 def : DS64Bit4ByteAlignedWritePat<DS_WRITE2_B32, vt, store_local_m0>;
816 let OtherPredicates = [NotLDSRequiresM0Init] in {
817 def : DS64Bit4ByteAlignedReadPat<DS_READ2_B32_gfx9, vt, load_local>;
818 def : DS64Bit4ByteAlignedWritePat<DS_WRITE2_B32_gfx9, vt, store_local>;
822 multiclass DS128Bit8ByteAlignedPat_mc<ValueType vt> {
823 let OtherPredicates = [LDSRequiresM0Init, isGFX7Plus] in {
824 def : DS128Bit8ByteAlignedReadPat<DS_READ2_B64, vt, load_local_m0>;
825 def : DS128Bit8ByteAlignedWritePat<DS_WRITE2_B64, vt, store_local_m0>;
828 let OtherPredicates = [NotLDSRequiresM0Init] in {
829 def : DS128Bit8ByteAlignedReadPat<DS_READ2_B64_gfx9, vt, load_local>;
830 def : DS128Bit8ByteAlignedWritePat<DS_WRITE2_B64_gfx9, vt, store_local>;
834 // v2i32 loads are split into i32 loads on SI during lowering, due to a bug
835 // related to bounds checking.
836 foreach vt = VReg_64.RegTypes in {
837 defm : DS64Bit4ByteAlignedPat_mc<vt>;
840 foreach vt = VReg_128.RegTypes in {
841 defm : DS128Bit8ByteAlignedPat_mc<vt>;
844 // Prefer ds_read over ds_read2 and ds_write over ds_write2, all other things
845 // being equal, because it has a larger immediate offset range.
846 let AddedComplexity = 100 in {
848 foreach vt = VReg_64.RegTypes in {
849 defm : DSReadPat_mc <DS_READ_B64, vt, "load_align8_local">;
850 defm : DSWritePat_mc <DS_WRITE_B64, vt, "store_align8_local">;
853 let SubtargetPredicate = isGFX7Plus in {
855 foreach vt = VReg_96.RegTypes in {
856 defm : DSReadPat_mc <DS_READ_B96, vt, "load_align16_local">;
857 defm : DSWritePat_mc <DS_WRITE_B96, vt, "store_align16_local">;
860 foreach vt = VReg_128.RegTypes in {
861 defm : DSReadPat_mc <DS_READ_B128, vt, "load_align16_local">;
862 defm : DSWritePat_mc <DS_WRITE_B128, vt, "store_align16_local">;
865 let SubtargetPredicate = HasUnalignedAccessMode in {
867 // FIXME: From performance point of view, is ds_read_b96/ds_write_b96 better choice
868 // for unaligned accesses?
869 foreach vt = VReg_96.RegTypes in {
870 defm : DSReadPat_mc <DS_READ_B96, vt, "load_local">;
871 defm : DSWritePat_mc <DS_WRITE_B96, vt, "store_local">;
874 // For performance reasons, *do not* select ds_read_b128/ds_write_b128 for unaligned
877 } // End SubtargetPredicate = HasUnalignedAccessMode
879 } // End SubtargetPredicate = isGFX7Plus
881 } // End AddedComplexity = 100
883 class DSAtomicRetPat<DS_Pseudo inst, ValueType vt, PatFrag frag, bit gds=0> : GCNPat <
884 (frag (DS1Addr1Offset i32:$ptr, i16:$offset), vt:$value),
885 (inst $ptr, getVregSrcForVT<vt>.ret:$value, offset:$offset, (i1 gds))
888 multiclass DSAtomicRetPat_mc<DS_Pseudo inst, ValueType vt, string frag> {
889 let OtherPredicates = [LDSRequiresM0Init] in {
890 def : DSAtomicRetPat<inst, vt, !cast<PatFrag>(frag#"_local_m0_"#vt.Size)>;
893 let OtherPredicates = [NotLDSRequiresM0Init] in {
894 def : DSAtomicRetPat<!cast<DS_Pseudo>(!cast<string>(inst)#"_gfx9"), vt,
895 !cast<PatFrag>(frag#"_local_"#vt.Size)>;
898 def : DSAtomicRetPat<inst, vt, !cast<PatFrag>(frag#"_region_m0_"#vt.Size), 1>;
903 class DSAtomicCmpXChg<DS_Pseudo inst, ValueType vt, PatFrag frag, bit gds=0> : GCNPat <
904 (frag (DS1Addr1Offset i32:$ptr, i16:$offset), vt:$cmp, vt:$swap),
905 (inst $ptr, getVregSrcForVT<vt>.ret:$cmp, getVregSrcForVT<vt>.ret:$swap, offset:$offset, (i1 gds))
908 multiclass DSAtomicCmpXChg_mc<DS_Pseudo inst, ValueType vt, string frag> {
909 let OtherPredicates = [LDSRequiresM0Init] in {
910 def : DSAtomicCmpXChg<inst, vt, !cast<PatFrag>(frag#"_local_m0_"#vt.Size)>;
913 let OtherPredicates = [NotLDSRequiresM0Init] in {
914 def : DSAtomicCmpXChg<!cast<DS_Pseudo>(!cast<string>(inst)#"_gfx9"), vt,
915 !cast<PatFrag>(frag#"_local_"#vt.Size)>;
918 def : DSAtomicCmpXChg<inst, vt, !cast<PatFrag>(frag#"_region_m0_"#vt.Size), 1>;
924 defm : DSAtomicRetPat_mc<DS_WRXCHG_RTN_B32, i32, "atomic_swap">;
925 defm : DSAtomicRetPat_mc<DS_ADD_RTN_U32, i32, "atomic_load_add">;
926 defm : DSAtomicRetPat_mc<DS_SUB_RTN_U32, i32, "atomic_load_sub">;
927 defm : DSAtomicRetPat_mc<DS_INC_RTN_U32, i32, "atomic_inc">;
928 defm : DSAtomicRetPat_mc<DS_DEC_RTN_U32, i32, "atomic_dec">;
929 defm : DSAtomicRetPat_mc<DS_AND_RTN_B32, i32, "atomic_load_and">;
930 defm : DSAtomicRetPat_mc<DS_OR_RTN_B32, i32, "atomic_load_or">;
931 defm : DSAtomicRetPat_mc<DS_XOR_RTN_B32, i32, "atomic_load_xor">;
932 defm : DSAtomicRetPat_mc<DS_MIN_RTN_I32, i32, "atomic_load_min">;
933 defm : DSAtomicRetPat_mc<DS_MAX_RTN_I32, i32, "atomic_load_max">;
934 defm : DSAtomicRetPat_mc<DS_MIN_RTN_U32, i32, "atomic_load_umin">;
935 defm : DSAtomicRetPat_mc<DS_MAX_RTN_U32, i32, "atomic_load_umax">;
936 defm : DSAtomicCmpXChg_mc<DS_CMPST_RTN_B32, i32, "atomic_cmp_swap">;
938 let SubtargetPredicate = HasLDSFPAtomics in {
939 defm : DSAtomicRetPat_mc<DS_MIN_RTN_F32, f32, "atomic_load_fmin">;
940 defm : DSAtomicRetPat_mc<DS_MAX_RTN_F32, f32, "atomic_load_fmax">;
941 defm : DSAtomicRetPat_mc<DS_ADD_RTN_F32, f32, "atomic_load_fadd">;
945 defm : DSAtomicRetPat_mc<DS_WRXCHG_RTN_B64, i64, "atomic_swap">;
946 defm : DSAtomicRetPat_mc<DS_ADD_RTN_U64, i64, "atomic_load_add">;
947 defm : DSAtomicRetPat_mc<DS_SUB_RTN_U64, i64, "atomic_load_sub">;
948 defm : DSAtomicRetPat_mc<DS_INC_RTN_U64, i64, "atomic_inc">;
949 defm : DSAtomicRetPat_mc<DS_DEC_RTN_U64, i64, "atomic_dec">;
950 defm : DSAtomicRetPat_mc<DS_AND_RTN_B64, i64, "atomic_load_and">;
951 defm : DSAtomicRetPat_mc<DS_OR_RTN_B64, i64, "atomic_load_or">;
952 defm : DSAtomicRetPat_mc<DS_XOR_RTN_B64, i64, "atomic_load_xor">;
953 defm : DSAtomicRetPat_mc<DS_MIN_RTN_I64, i64, "atomic_load_min">;
954 defm : DSAtomicRetPat_mc<DS_MAX_RTN_I64, i64, "atomic_load_max">;
955 defm : DSAtomicRetPat_mc<DS_MIN_RTN_U64, i64, "atomic_load_umin">;
956 defm : DSAtomicRetPat_mc<DS_MAX_RTN_U64, i64, "atomic_load_umax">;
958 defm : DSAtomicCmpXChg_mc<DS_CMPST_RTN_B64, i64, "atomic_cmp_swap">;
960 let SubtargetPredicate = isGFX90APlus in {
961 def : DSAtomicRetPat<DS_ADD_RTN_F64, f64, atomic_load_fadd_local_64>;
965 (SIds_ordered_count i32:$value, i16:$offset),
966 (DS_ORDERED_COUNT $value, (as_i16imm $offset))
969 //===----------------------------------------------------------------------===//
970 // Target-specific instruction encodings.
971 //===----------------------------------------------------------------------===//
973 //===----------------------------------------------------------------------===//
974 // Base ENC_DS for GFX6, GFX7, GFX10.
975 //===----------------------------------------------------------------------===//
977 class Base_DS_Real_gfx6_gfx7_gfx10<bits<8> op, DS_Pseudo ps, int ef> :
978 DS_Real<ps>, SIMCInstr <ps.Mnemonic, ef> {
980 let Inst{7-0} = !if(ps.has_offset0, offset0, 0);
981 let Inst{15-8} = !if(ps.has_offset1, offset1, 0);
982 let Inst{17} = !if(ps.has_gds, gds, ps.gdsValue);
983 let Inst{25-18} = op;
984 let Inst{31-26} = 0x36;
985 let Inst{39-32} = !if(ps.has_addr, addr, !if(ps.has_gws_data0, data0{7-0}, 0));
986 let Inst{47-40} = !if(ps.has_data0, data0{7-0}, 0);
987 let Inst{55-48} = !if(ps.has_data1, data1{7-0}, 0);
988 let Inst{63-56} = !if(ps.has_vdst, vdst{7-0}, 0);
991 //===----------------------------------------------------------------------===//
993 //===----------------------------------------------------------------------===//
995 let AssemblerPredicate = isGFX10Plus, DecoderNamespace = "GFX10" in {
996 multiclass DS_Real_gfx10<bits<8> op> {
997 def _gfx10 : Base_DS_Real_gfx6_gfx7_gfx10<op, !cast<DS_Pseudo>(NAME),
998 SIEncodingFamily.GFX10>;
1000 } // End AssemblerPredicate = isGFX10Plus, DecoderNamespace = "GFX10"
1002 defm DS_ADD_F32 : DS_Real_gfx10<0x015>;
1003 defm DS_ADD_RTN_F32 : DS_Real_gfx10<0x055>;
1004 defm DS_ADD_SRC2_F32 : DS_Real_gfx10<0x095>;
1005 defm DS_WRITE_B8_D16_HI : DS_Real_gfx10<0x0a0>;
1006 defm DS_WRITE_B16_D16_HI : DS_Real_gfx10<0x0a1>;
1007 defm DS_READ_U8_D16 : DS_Real_gfx10<0x0a2>;
1008 defm DS_READ_U8_D16_HI : DS_Real_gfx10<0x0a3>;
1009 defm DS_READ_I8_D16 : DS_Real_gfx10<0x0a4>;
1010 defm DS_READ_I8_D16_HI : DS_Real_gfx10<0x0a5>;
1011 defm DS_READ_U16_D16 : DS_Real_gfx10<0x0a6>;
1012 defm DS_READ_U16_D16_HI : DS_Real_gfx10<0x0a7>;
1013 defm DS_WRITE_ADDTID_B32 : DS_Real_gfx10<0x0b0>;
1014 defm DS_READ_ADDTID_B32 : DS_Real_gfx10<0x0b1>;
1015 defm DS_PERMUTE_B32 : DS_Real_gfx10<0x0b2>;
1016 defm DS_BPERMUTE_B32 : DS_Real_gfx10<0x0b3>;
1018 //===----------------------------------------------------------------------===//
1020 //===----------------------------------------------------------------------===//
1022 let AssemblerPredicate = isGFX7Only, DecoderNamespace = "GFX7" in {
1023 multiclass DS_Real_gfx7<bits<8> op> {
1024 def _gfx7 : Base_DS_Real_gfx6_gfx7_gfx10<op, !cast<DS_Pseudo>(NAME),
1025 SIEncodingFamily.SI>;
1027 } // End AssemblerPredicate = isGFX7Only, DecoderNamespace = "GFX7"
1029 multiclass DS_Real_gfx7_gfx10<bits<8> op> :
1030 DS_Real_gfx7<op>, DS_Real_gfx10<op>;
1032 // FIXME-GFX7: Add tests when upstreaming this part.
1033 defm DS_GWS_SEMA_RELEASE_ALL : DS_Real_gfx7_gfx10<0x018>;
1034 defm DS_WRAP_RTN_B32 : DS_Real_gfx7_gfx10<0x034>;
1035 defm DS_CONDXCHG32_RTN_B64 : DS_Real_gfx7_gfx10<0x07e>;
1036 defm DS_WRITE_B96 : DS_Real_gfx7_gfx10<0x0de>;
1037 defm DS_WRITE_B128 : DS_Real_gfx7_gfx10<0x0df>;
1038 defm DS_READ_B96 : DS_Real_gfx7_gfx10<0x0fe>;
1039 defm DS_READ_B128 : DS_Real_gfx7_gfx10<0x0ff>;
1041 //===----------------------------------------------------------------------===//
1042 // GFX6, GFX7, GFX10.
1043 //===----------------------------------------------------------------------===//
1045 let AssemblerPredicate = isGFX6GFX7, DecoderNamespace = "GFX6GFX7" in {
1046 multiclass DS_Real_gfx6_gfx7<bits<8> op> {
1047 def _gfx6_gfx7 : Base_DS_Real_gfx6_gfx7_gfx10<op, !cast<DS_Pseudo>(NAME),
1048 SIEncodingFamily.SI>;
1050 } // End AssemblerPredicate = isGFX6GFX7, DecoderNamespace = "GFX6GFX7"
1052 multiclass DS_Real_gfx6_gfx7_gfx10<bits<8> op> :
1053 DS_Real_gfx6_gfx7<op>, DS_Real_gfx10<op>;
1055 defm DS_ADD_U32 : DS_Real_gfx6_gfx7_gfx10<0x000>;
1056 defm DS_SUB_U32 : DS_Real_gfx6_gfx7_gfx10<0x001>;
1057 defm DS_RSUB_U32 : DS_Real_gfx6_gfx7_gfx10<0x002>;
1058 defm DS_INC_U32 : DS_Real_gfx6_gfx7_gfx10<0x003>;
1059 defm DS_DEC_U32 : DS_Real_gfx6_gfx7_gfx10<0x004>;
1060 defm DS_MIN_I32 : DS_Real_gfx6_gfx7_gfx10<0x005>;
1061 defm DS_MAX_I32 : DS_Real_gfx6_gfx7_gfx10<0x006>;
1062 defm DS_MIN_U32 : DS_Real_gfx6_gfx7_gfx10<0x007>;
1063 defm DS_MAX_U32 : DS_Real_gfx6_gfx7_gfx10<0x008>;
1064 defm DS_AND_B32 : DS_Real_gfx6_gfx7_gfx10<0x009>;
1065 defm DS_OR_B32 : DS_Real_gfx6_gfx7_gfx10<0x00a>;
1066 defm DS_XOR_B32 : DS_Real_gfx6_gfx7_gfx10<0x00b>;
1067 defm DS_MSKOR_B32 : DS_Real_gfx6_gfx7_gfx10<0x00c>;
1068 defm DS_WRITE_B32 : DS_Real_gfx6_gfx7_gfx10<0x00d>;
1069 defm DS_WRITE2_B32 : DS_Real_gfx6_gfx7_gfx10<0x00e>;
1070 defm DS_WRITE2ST64_B32 : DS_Real_gfx6_gfx7_gfx10<0x00f>;
1071 defm DS_CMPST_B32 : DS_Real_gfx6_gfx7_gfx10<0x010>;
1072 defm DS_CMPST_F32 : DS_Real_gfx6_gfx7_gfx10<0x011>;
1073 defm DS_MIN_F32 : DS_Real_gfx6_gfx7_gfx10<0x012>;
1074 defm DS_MAX_F32 : DS_Real_gfx6_gfx7_gfx10<0x013>;
1075 defm DS_NOP : DS_Real_gfx6_gfx7_gfx10<0x014>;
1076 defm DS_GWS_INIT : DS_Real_gfx6_gfx7_gfx10<0x019>;
1077 defm DS_GWS_SEMA_V : DS_Real_gfx6_gfx7_gfx10<0x01a>;
1078 defm DS_GWS_SEMA_BR : DS_Real_gfx6_gfx7_gfx10<0x01b>;
1079 defm DS_GWS_SEMA_P : DS_Real_gfx6_gfx7_gfx10<0x01c>;
1080 defm DS_GWS_BARRIER : DS_Real_gfx6_gfx7_gfx10<0x01d>;
1081 defm DS_WRITE_B8 : DS_Real_gfx6_gfx7_gfx10<0x01e>;
1082 defm DS_WRITE_B16 : DS_Real_gfx6_gfx7_gfx10<0x01f>;
1083 defm DS_ADD_RTN_U32 : DS_Real_gfx6_gfx7_gfx10<0x020>;
1084 defm DS_SUB_RTN_U32 : DS_Real_gfx6_gfx7_gfx10<0x021>;
1085 defm DS_RSUB_RTN_U32 : DS_Real_gfx6_gfx7_gfx10<0x022>;
1086 defm DS_INC_RTN_U32 : DS_Real_gfx6_gfx7_gfx10<0x023>;
1087 defm DS_DEC_RTN_U32 : DS_Real_gfx6_gfx7_gfx10<0x024>;
1088 defm DS_MIN_RTN_I32 : DS_Real_gfx6_gfx7_gfx10<0x025>;
1089 defm DS_MAX_RTN_I32 : DS_Real_gfx6_gfx7_gfx10<0x026>;
1090 defm DS_MIN_RTN_U32 : DS_Real_gfx6_gfx7_gfx10<0x027>;
1091 defm DS_MAX_RTN_U32 : DS_Real_gfx6_gfx7_gfx10<0x028>;
1092 defm DS_AND_RTN_B32 : DS_Real_gfx6_gfx7_gfx10<0x029>;
1093 defm DS_OR_RTN_B32 : DS_Real_gfx6_gfx7_gfx10<0x02a>;
1094 defm DS_XOR_RTN_B32 : DS_Real_gfx6_gfx7_gfx10<0x02b>;
1095 defm DS_MSKOR_RTN_B32 : DS_Real_gfx6_gfx7_gfx10<0x02c>;
1096 defm DS_WRXCHG_RTN_B32 : DS_Real_gfx6_gfx7_gfx10<0x02d>;
1097 defm DS_WRXCHG2_RTN_B32 : DS_Real_gfx6_gfx7_gfx10<0x02e>;
1098 defm DS_WRXCHG2ST64_RTN_B32 : DS_Real_gfx6_gfx7_gfx10<0x02f>;
1099 defm DS_CMPST_RTN_B32 : DS_Real_gfx6_gfx7_gfx10<0x030>;
1100 defm DS_CMPST_RTN_F32 : DS_Real_gfx6_gfx7_gfx10<0x031>;
1101 defm DS_MIN_RTN_F32 : DS_Real_gfx6_gfx7_gfx10<0x032>;
1102 defm DS_MAX_RTN_F32 : DS_Real_gfx6_gfx7_gfx10<0x033>;
1103 defm DS_SWIZZLE_B32 : DS_Real_gfx6_gfx7_gfx10<0x035>;
1104 defm DS_READ_B32 : DS_Real_gfx6_gfx7_gfx10<0x036>;
1105 defm DS_READ2_B32 : DS_Real_gfx6_gfx7_gfx10<0x037>;
1106 defm DS_READ2ST64_B32 : DS_Real_gfx6_gfx7_gfx10<0x038>;
1107 defm DS_READ_I8 : DS_Real_gfx6_gfx7_gfx10<0x039>;
1108 defm DS_READ_U8 : DS_Real_gfx6_gfx7_gfx10<0x03a>;
1109 defm DS_READ_I16 : DS_Real_gfx6_gfx7_gfx10<0x03b>;
1110 defm DS_READ_U16 : DS_Real_gfx6_gfx7_gfx10<0x03c>;
1111 defm DS_CONSUME : DS_Real_gfx6_gfx7_gfx10<0x03d>;
1112 defm DS_APPEND : DS_Real_gfx6_gfx7_gfx10<0x03e>;
1113 defm DS_ORDERED_COUNT : DS_Real_gfx6_gfx7_gfx10<0x03f>;
1114 defm DS_ADD_U64 : DS_Real_gfx6_gfx7_gfx10<0x040>;
1115 defm DS_SUB_U64 : DS_Real_gfx6_gfx7_gfx10<0x041>;
1116 defm DS_RSUB_U64 : DS_Real_gfx6_gfx7_gfx10<0x042>;
1117 defm DS_INC_U64 : DS_Real_gfx6_gfx7_gfx10<0x043>;
1118 defm DS_DEC_U64 : DS_Real_gfx6_gfx7_gfx10<0x044>;
1119 defm DS_MIN_I64 : DS_Real_gfx6_gfx7_gfx10<0x045>;
1120 defm DS_MAX_I64 : DS_Real_gfx6_gfx7_gfx10<0x046>;
1121 defm DS_MIN_U64 : DS_Real_gfx6_gfx7_gfx10<0x047>;
1122 defm DS_MAX_U64 : DS_Real_gfx6_gfx7_gfx10<0x048>;
1123 defm DS_AND_B64 : DS_Real_gfx6_gfx7_gfx10<0x049>;
1124 defm DS_OR_B64 : DS_Real_gfx6_gfx7_gfx10<0x04a>;
1125 defm DS_XOR_B64 : DS_Real_gfx6_gfx7_gfx10<0x04b>;
1126 defm DS_MSKOR_B64 : DS_Real_gfx6_gfx7_gfx10<0x04c>;
1127 defm DS_WRITE_B64 : DS_Real_gfx6_gfx7_gfx10<0x04d>;
1128 defm DS_WRITE2_B64 : DS_Real_gfx6_gfx7_gfx10<0x04e>;
1129 defm DS_WRITE2ST64_B64 : DS_Real_gfx6_gfx7_gfx10<0x04f>;
1130 defm DS_CMPST_B64 : DS_Real_gfx6_gfx7_gfx10<0x050>;
1131 defm DS_CMPST_F64 : DS_Real_gfx6_gfx7_gfx10<0x051>;
1132 defm DS_MIN_F64 : DS_Real_gfx6_gfx7_gfx10<0x052>;
1133 defm DS_MAX_F64 : DS_Real_gfx6_gfx7_gfx10<0x053>;
1134 defm DS_ADD_RTN_U64 : DS_Real_gfx6_gfx7_gfx10<0x060>;
1135 defm DS_SUB_RTN_U64 : DS_Real_gfx6_gfx7_gfx10<0x061>;
1136 defm DS_RSUB_RTN_U64 : DS_Real_gfx6_gfx7_gfx10<0x062>;
1137 defm DS_INC_RTN_U64 : DS_Real_gfx6_gfx7_gfx10<0x063>;
1138 defm DS_DEC_RTN_U64 : DS_Real_gfx6_gfx7_gfx10<0x064>;
1139 defm DS_MIN_RTN_I64 : DS_Real_gfx6_gfx7_gfx10<0x065>;
1140 defm DS_MAX_RTN_I64 : DS_Real_gfx6_gfx7_gfx10<0x066>;
1141 defm DS_MIN_RTN_U64 : DS_Real_gfx6_gfx7_gfx10<0x067>;
1142 defm DS_MAX_RTN_U64 : DS_Real_gfx6_gfx7_gfx10<0x068>;
1143 defm DS_AND_RTN_B64 : DS_Real_gfx6_gfx7_gfx10<0x069>;
1144 defm DS_OR_RTN_B64 : DS_Real_gfx6_gfx7_gfx10<0x06a>;
1145 defm DS_XOR_RTN_B64 : DS_Real_gfx6_gfx7_gfx10<0x06b>;
1146 defm DS_MSKOR_RTN_B64 : DS_Real_gfx6_gfx7_gfx10<0x06c>;
1147 defm DS_WRXCHG_RTN_B64 : DS_Real_gfx6_gfx7_gfx10<0x06d>;
1148 defm DS_WRXCHG2_RTN_B64 : DS_Real_gfx6_gfx7_gfx10<0x06e>;
1149 defm DS_WRXCHG2ST64_RTN_B64 : DS_Real_gfx6_gfx7_gfx10<0x06f>;
1150 defm DS_CMPST_RTN_B64 : DS_Real_gfx6_gfx7_gfx10<0x070>;
1151 defm DS_CMPST_RTN_F64 : DS_Real_gfx6_gfx7_gfx10<0x071>;
1152 defm DS_MIN_RTN_F64 : DS_Real_gfx6_gfx7_gfx10<0x072>;
1153 defm DS_MAX_RTN_F64 : DS_Real_gfx6_gfx7_gfx10<0x073>;
1154 defm DS_READ_B64 : DS_Real_gfx6_gfx7_gfx10<0x076>;
1155 defm DS_READ2_B64 : DS_Real_gfx6_gfx7_gfx10<0x077>;
1156 defm DS_READ2ST64_B64 : DS_Real_gfx6_gfx7_gfx10<0x078>;
1157 defm DS_ADD_SRC2_U32 : DS_Real_gfx6_gfx7_gfx10<0x080>;
1158 defm DS_SUB_SRC2_U32 : DS_Real_gfx6_gfx7_gfx10<0x081>;
1159 defm DS_RSUB_SRC2_U32 : DS_Real_gfx6_gfx7_gfx10<0x082>;
1160 defm DS_INC_SRC2_U32 : DS_Real_gfx6_gfx7_gfx10<0x083>;
1161 defm DS_DEC_SRC2_U32 : DS_Real_gfx6_gfx7_gfx10<0x084>;
1162 defm DS_MIN_SRC2_I32 : DS_Real_gfx6_gfx7_gfx10<0x085>;
1163 defm DS_MAX_SRC2_I32 : DS_Real_gfx6_gfx7_gfx10<0x086>;
1164 defm DS_MIN_SRC2_U32 : DS_Real_gfx6_gfx7_gfx10<0x087>;
1165 defm DS_MAX_SRC2_U32 : DS_Real_gfx6_gfx7_gfx10<0x088>;
1166 defm DS_AND_SRC2_B32 : DS_Real_gfx6_gfx7_gfx10<0x089>;
1167 defm DS_OR_SRC2_B32 : DS_Real_gfx6_gfx7_gfx10<0x08a>;
1168 defm DS_XOR_SRC2_B32 : DS_Real_gfx6_gfx7_gfx10<0x08b>;
1169 defm DS_WRITE_SRC2_B32 : DS_Real_gfx6_gfx7_gfx10<0x08d>;
1170 defm DS_MIN_SRC2_F32 : DS_Real_gfx6_gfx7_gfx10<0x092>;
1171 defm DS_MAX_SRC2_F32 : DS_Real_gfx6_gfx7_gfx10<0x093>;
1172 defm DS_ADD_SRC2_U64 : DS_Real_gfx6_gfx7_gfx10<0x0c0>;
1173 defm DS_SUB_SRC2_U64 : DS_Real_gfx6_gfx7_gfx10<0x0c1>;
1174 defm DS_RSUB_SRC2_U64 : DS_Real_gfx6_gfx7_gfx10<0x0c2>;
1175 defm DS_INC_SRC2_U64 : DS_Real_gfx6_gfx7_gfx10<0x0c3>;
1176 defm DS_DEC_SRC2_U64 : DS_Real_gfx6_gfx7_gfx10<0x0c4>;
1177 defm DS_MIN_SRC2_I64 : DS_Real_gfx6_gfx7_gfx10<0x0c5>;
1178 defm DS_MAX_SRC2_I64 : DS_Real_gfx6_gfx7_gfx10<0x0c6>;
1179 defm DS_MIN_SRC2_U64 : DS_Real_gfx6_gfx7_gfx10<0x0c7>;
1180 defm DS_MAX_SRC2_U64 : DS_Real_gfx6_gfx7_gfx10<0x0c8>;
1181 defm DS_AND_SRC2_B64 : DS_Real_gfx6_gfx7_gfx10<0x0c9>;
1182 defm DS_OR_SRC2_B64 : DS_Real_gfx6_gfx7_gfx10<0x0ca>;
1183 defm DS_XOR_SRC2_B64 : DS_Real_gfx6_gfx7_gfx10<0x0cb>;
1184 defm DS_WRITE_SRC2_B64 : DS_Real_gfx6_gfx7_gfx10<0x0cd>;
1185 defm DS_MIN_SRC2_F64 : DS_Real_gfx6_gfx7_gfx10<0x0d2>;
1186 defm DS_MAX_SRC2_F64 : DS_Real_gfx6_gfx7_gfx10<0x0d3>;
1188 //===----------------------------------------------------------------------===//
1190 //===----------------------------------------------------------------------===//
1192 class DS_Real_vi <bits<8> op, DS_Pseudo ps> :
1194 SIMCInstr <ps.Mnemonic, SIEncodingFamily.VI> {
1195 let AssemblerPredicate = isGFX8GFX9;
1196 let DecoderNamespace = "GFX8";
1199 let Inst{7-0} = !if(ps.has_offset0, offset0, 0);
1200 let Inst{15-8} = !if(ps.has_offset1, offset1, 0);
1201 let Inst{16} = !if(ps.has_gds, gds, ps.gdsValue);
1202 let Inst{24-17} = op;
1204 let Inst{31-26} = 0x36; // ds prefix
1205 let Inst{39-32} = !if(ps.has_addr, addr, !if(ps.has_gws_data0, data0{7-0}, 0));
1206 let Inst{47-40} = !if(ps.has_data0, data0{7-0}, 0);
1207 let Inst{55-48} = !if(ps.has_data1, data1{7-0}, 0);
1208 let Inst{63-56} = !if(ps.has_vdst, vdst{7-0}, 0);
1211 def DS_ADD_U32_vi : DS_Real_vi<0x0, DS_ADD_U32>;
1212 def DS_SUB_U32_vi : DS_Real_vi<0x1, DS_SUB_U32>;
1213 def DS_RSUB_U32_vi : DS_Real_vi<0x2, DS_RSUB_U32>;
1214 def DS_INC_U32_vi : DS_Real_vi<0x3, DS_INC_U32>;
1215 def DS_DEC_U32_vi : DS_Real_vi<0x4, DS_DEC_U32>;
1216 def DS_MIN_I32_vi : DS_Real_vi<0x5, DS_MIN_I32>;
1217 def DS_MAX_I32_vi : DS_Real_vi<0x6, DS_MAX_I32>;
1218 def DS_MIN_U32_vi : DS_Real_vi<0x7, DS_MIN_U32>;
1219 def DS_MAX_U32_vi : DS_Real_vi<0x8, DS_MAX_U32>;
1220 def DS_AND_B32_vi : DS_Real_vi<0x9, DS_AND_B32>;
1221 def DS_OR_B32_vi : DS_Real_vi<0xa, DS_OR_B32>;
1222 def DS_XOR_B32_vi : DS_Real_vi<0xb, DS_XOR_B32>;
1223 def DS_MSKOR_B32_vi : DS_Real_vi<0xc, DS_MSKOR_B32>;
1224 def DS_WRITE_B32_vi : DS_Real_vi<0xd, DS_WRITE_B32>;
1225 def DS_WRITE2_B32_vi : DS_Real_vi<0xe, DS_WRITE2_B32>;
1226 def DS_WRITE2ST64_B32_vi : DS_Real_vi<0xf, DS_WRITE2ST64_B32>;
1227 def DS_CMPST_B32_vi : DS_Real_vi<0x10, DS_CMPST_B32>;
1228 def DS_CMPST_F32_vi : DS_Real_vi<0x11, DS_CMPST_F32>;
1229 def DS_MIN_F32_vi : DS_Real_vi<0x12, DS_MIN_F32>;
1230 def DS_MAX_F32_vi : DS_Real_vi<0x13, DS_MAX_F32>;
1231 def DS_NOP_vi : DS_Real_vi<0x14, DS_NOP>;
1232 def DS_ADD_F32_vi : DS_Real_vi<0x15, DS_ADD_F32>;
1233 def DS_GWS_INIT_vi : DS_Real_vi<0x99, DS_GWS_INIT>;
1234 def DS_GWS_SEMA_V_vi : DS_Real_vi<0x9a, DS_GWS_SEMA_V>;
1235 def DS_GWS_SEMA_BR_vi : DS_Real_vi<0x9b, DS_GWS_SEMA_BR>;
1236 def DS_GWS_SEMA_P_vi : DS_Real_vi<0x9c, DS_GWS_SEMA_P>;
1237 def DS_GWS_BARRIER_vi : DS_Real_vi<0x9d, DS_GWS_BARRIER>;
1238 def DS_WRITE_ADDTID_B32_vi : DS_Real_vi<0x1d, DS_WRITE_ADDTID_B32>;
1239 def DS_WRITE_B8_vi : DS_Real_vi<0x1e, DS_WRITE_B8>;
1240 def DS_WRITE_B16_vi : DS_Real_vi<0x1f, DS_WRITE_B16>;
1241 def DS_ADD_RTN_U32_vi : DS_Real_vi<0x20, DS_ADD_RTN_U32>;
1242 def DS_SUB_RTN_U32_vi : DS_Real_vi<0x21, DS_SUB_RTN_U32>;
1243 def DS_RSUB_RTN_U32_vi : DS_Real_vi<0x22, DS_RSUB_RTN_U32>;
1244 def DS_INC_RTN_U32_vi : DS_Real_vi<0x23, DS_INC_RTN_U32>;
1245 def DS_DEC_RTN_U32_vi : DS_Real_vi<0x24, DS_DEC_RTN_U32>;
1246 def DS_MIN_RTN_I32_vi : DS_Real_vi<0x25, DS_MIN_RTN_I32>;
1247 def DS_MAX_RTN_I32_vi : DS_Real_vi<0x26, DS_MAX_RTN_I32>;
1248 def DS_MIN_RTN_U32_vi : DS_Real_vi<0x27, DS_MIN_RTN_U32>;
1249 def DS_MAX_RTN_U32_vi : DS_Real_vi<0x28, DS_MAX_RTN_U32>;
1250 def DS_AND_RTN_B32_vi : DS_Real_vi<0x29, DS_AND_RTN_B32>;
1251 def DS_OR_RTN_B32_vi : DS_Real_vi<0x2a, DS_OR_RTN_B32>;
1252 def DS_XOR_RTN_B32_vi : DS_Real_vi<0x2b, DS_XOR_RTN_B32>;
1253 def DS_MSKOR_RTN_B32_vi : DS_Real_vi<0x2c, DS_MSKOR_RTN_B32>;
1254 def DS_WRXCHG_RTN_B32_vi : DS_Real_vi<0x2d, DS_WRXCHG_RTN_B32>;
1255 def DS_WRXCHG2_RTN_B32_vi : DS_Real_vi<0x2e, DS_WRXCHG2_RTN_B32>;
1256 def DS_WRXCHG2ST64_RTN_B32_vi : DS_Real_vi<0x2f, DS_WRXCHG2ST64_RTN_B32>;
1257 def DS_CMPST_RTN_B32_vi : DS_Real_vi<0x30, DS_CMPST_RTN_B32>;
1258 def DS_CMPST_RTN_F32_vi : DS_Real_vi<0x31, DS_CMPST_RTN_F32>;
1259 def DS_MIN_RTN_F32_vi : DS_Real_vi<0x32, DS_MIN_RTN_F32>;
1260 def DS_MAX_RTN_F32_vi : DS_Real_vi<0x33, DS_MAX_RTN_F32>;
1261 def DS_WRAP_RTN_B32_vi : DS_Real_vi<0x34, DS_WRAP_RTN_B32>;
1262 def DS_ADD_RTN_F32_vi : DS_Real_vi<0x35, DS_ADD_RTN_F32>;
1263 def DS_READ_B32_vi : DS_Real_vi<0x36, DS_READ_B32>;
1264 def DS_READ2_B32_vi : DS_Real_vi<0x37, DS_READ2_B32>;
1265 def DS_READ2ST64_B32_vi : DS_Real_vi<0x38, DS_READ2ST64_B32>;
1266 def DS_READ_I8_vi : DS_Real_vi<0x39, DS_READ_I8>;
1267 def DS_READ_U8_vi : DS_Real_vi<0x3a, DS_READ_U8>;
1268 def DS_READ_I16_vi : DS_Real_vi<0x3b, DS_READ_I16>;
1269 def DS_READ_U16_vi : DS_Real_vi<0x3c, DS_READ_U16>;
1270 def DS_READ_ADDTID_B32_vi : DS_Real_vi<0xb6, DS_READ_ADDTID_B32>;
1271 def DS_CONSUME_vi : DS_Real_vi<0xbd, DS_CONSUME>;
1272 def DS_APPEND_vi : DS_Real_vi<0xbe, DS_APPEND>;
1273 def DS_ORDERED_COUNT_vi : DS_Real_vi<0xbf, DS_ORDERED_COUNT>;
1274 def DS_SWIZZLE_B32_vi : DS_Real_vi<0x3d, DS_SWIZZLE_B32>;
1275 def DS_PERMUTE_B32_vi : DS_Real_vi<0x3e, DS_PERMUTE_B32>;
1276 def DS_BPERMUTE_B32_vi : DS_Real_vi<0x3f, DS_BPERMUTE_B32>;
1278 def DS_ADD_U64_vi : DS_Real_vi<0x40, DS_ADD_U64>;
1279 def DS_SUB_U64_vi : DS_Real_vi<0x41, DS_SUB_U64>;
1280 def DS_RSUB_U64_vi : DS_Real_vi<0x42, DS_RSUB_U64>;
1281 def DS_INC_U64_vi : DS_Real_vi<0x43, DS_INC_U64>;
1282 def DS_DEC_U64_vi : DS_Real_vi<0x44, DS_DEC_U64>;
1283 def DS_MIN_I64_vi : DS_Real_vi<0x45, DS_MIN_I64>;
1284 def DS_MAX_I64_vi : DS_Real_vi<0x46, DS_MAX_I64>;
1285 def DS_MIN_U64_vi : DS_Real_vi<0x47, DS_MIN_U64>;
1286 def DS_MAX_U64_vi : DS_Real_vi<0x48, DS_MAX_U64>;
1287 def DS_AND_B64_vi : DS_Real_vi<0x49, DS_AND_B64>;
1288 def DS_OR_B64_vi : DS_Real_vi<0x4a, DS_OR_B64>;
1289 def DS_XOR_B64_vi : DS_Real_vi<0x4b, DS_XOR_B64>;
1290 def DS_MSKOR_B64_vi : DS_Real_vi<0x4c, DS_MSKOR_B64>;
1291 def DS_WRITE_B64_vi : DS_Real_vi<0x4d, DS_WRITE_B64>;
1292 def DS_WRITE2_B64_vi : DS_Real_vi<0x4E, DS_WRITE2_B64>;
1293 def DS_WRITE2ST64_B64_vi : DS_Real_vi<0x4f, DS_WRITE2ST64_B64>;
1294 def DS_CMPST_B64_vi : DS_Real_vi<0x50, DS_CMPST_B64>;
1295 def DS_CMPST_F64_vi : DS_Real_vi<0x51, DS_CMPST_F64>;
1296 def DS_MIN_F64_vi : DS_Real_vi<0x52, DS_MIN_F64>;
1297 def DS_MAX_F64_vi : DS_Real_vi<0x53, DS_MAX_F64>;
1299 def DS_WRITE_B8_D16_HI_vi : DS_Real_vi<0x54, DS_WRITE_B8_D16_HI>;
1300 def DS_WRITE_B16_D16_HI_vi : DS_Real_vi<0x55, DS_WRITE_B16_D16_HI>;
1302 def DS_READ_U8_D16_vi : DS_Real_vi<0x56, DS_READ_U8_D16>;
1303 def DS_READ_U8_D16_HI_vi : DS_Real_vi<0x57, DS_READ_U8_D16_HI>;
1304 def DS_READ_I8_D16_vi : DS_Real_vi<0x58, DS_READ_I8_D16>;
1305 def DS_READ_I8_D16_HI_vi : DS_Real_vi<0x59, DS_READ_I8_D16_HI>;
1306 def DS_READ_U16_D16_vi : DS_Real_vi<0x5a, DS_READ_U16_D16>;
1307 def DS_READ_U16_D16_HI_vi : DS_Real_vi<0x5b, DS_READ_U16_D16_HI>;
1309 def DS_ADD_RTN_U64_vi : DS_Real_vi<0x60, DS_ADD_RTN_U64>;
1310 def DS_SUB_RTN_U64_vi : DS_Real_vi<0x61, DS_SUB_RTN_U64>;
1311 def DS_RSUB_RTN_U64_vi : DS_Real_vi<0x62, DS_RSUB_RTN_U64>;
1312 def DS_INC_RTN_U64_vi : DS_Real_vi<0x63, DS_INC_RTN_U64>;
1313 def DS_DEC_RTN_U64_vi : DS_Real_vi<0x64, DS_DEC_RTN_U64>;
1314 def DS_MIN_RTN_I64_vi : DS_Real_vi<0x65, DS_MIN_RTN_I64>;
1315 def DS_MAX_RTN_I64_vi : DS_Real_vi<0x66, DS_MAX_RTN_I64>;
1316 def DS_MIN_RTN_U64_vi : DS_Real_vi<0x67, DS_MIN_RTN_U64>;
1317 def DS_MAX_RTN_U64_vi : DS_Real_vi<0x68, DS_MAX_RTN_U64>;
1318 def DS_AND_RTN_B64_vi : DS_Real_vi<0x69, DS_AND_RTN_B64>;
1319 def DS_OR_RTN_B64_vi : DS_Real_vi<0x6a, DS_OR_RTN_B64>;
1320 def DS_XOR_RTN_B64_vi : DS_Real_vi<0x6b, DS_XOR_RTN_B64>;
1321 def DS_MSKOR_RTN_B64_vi : DS_Real_vi<0x6c, DS_MSKOR_RTN_B64>;
1322 def DS_WRXCHG_RTN_B64_vi : DS_Real_vi<0x6d, DS_WRXCHG_RTN_B64>;
1323 def DS_WRXCHG2_RTN_B64_vi : DS_Real_vi<0x6e, DS_WRXCHG2_RTN_B64>;
1324 def DS_WRXCHG2ST64_RTN_B64_vi : DS_Real_vi<0x6f, DS_WRXCHG2ST64_RTN_B64>;
1325 def DS_CONDXCHG32_RTN_B64_vi : DS_Real_vi<0x7e, DS_CONDXCHG32_RTN_B64>;
1326 def DS_GWS_SEMA_RELEASE_ALL_vi : DS_Real_vi<0x98, DS_GWS_SEMA_RELEASE_ALL>;
1327 def DS_CMPST_RTN_B64_vi : DS_Real_vi<0x70, DS_CMPST_RTN_B64>;
1328 def DS_CMPST_RTN_F64_vi : DS_Real_vi<0x71, DS_CMPST_RTN_F64>;
1329 def DS_MIN_RTN_F64_vi : DS_Real_vi<0x72, DS_MIN_RTN_F64>;
1330 def DS_MAX_RTN_F64_vi : DS_Real_vi<0x73, DS_MAX_RTN_F64>;
1332 def DS_READ_B64_vi : DS_Real_vi<0x76, DS_READ_B64>;
1333 def DS_READ2_B64_vi : DS_Real_vi<0x77, DS_READ2_B64>;
1334 def DS_READ2ST64_B64_vi : DS_Real_vi<0x78, DS_READ2ST64_B64>;
1336 def DS_ADD_SRC2_U32_vi : DS_Real_vi<0x80, DS_ADD_SRC2_U32>;
1337 def DS_SUB_SRC2_U32_vi : DS_Real_vi<0x81, DS_SUB_SRC2_U32>;
1338 def DS_RSUB_SRC2_U32_vi : DS_Real_vi<0x82, DS_RSUB_SRC2_U32>;
1339 def DS_INC_SRC2_U32_vi : DS_Real_vi<0x83, DS_INC_SRC2_U32>;
1340 def DS_DEC_SRC2_U32_vi : DS_Real_vi<0x84, DS_DEC_SRC2_U32>;
1341 def DS_MIN_SRC2_I32_vi : DS_Real_vi<0x85, DS_MIN_SRC2_I32>;
1342 def DS_MAX_SRC2_I32_vi : DS_Real_vi<0x86, DS_MAX_SRC2_I32>;
1343 def DS_MIN_SRC2_U32_vi : DS_Real_vi<0x87, DS_MIN_SRC2_U32>;
1344 def DS_MAX_SRC2_U32_vi : DS_Real_vi<0x88, DS_MAX_SRC2_U32>;
1345 def DS_AND_SRC2_B32_vi : DS_Real_vi<0x89, DS_AND_SRC2_B32>;
1346 def DS_OR_SRC2_B32_vi : DS_Real_vi<0x8a, DS_OR_SRC2_B32>;
1347 def DS_XOR_SRC2_B32_vi : DS_Real_vi<0x8b, DS_XOR_SRC2_B32>;
1348 def DS_WRITE_SRC2_B32_vi : DS_Real_vi<0x8d, DS_WRITE_SRC2_B32>;
1349 def DS_MIN_SRC2_F32_vi : DS_Real_vi<0x92, DS_MIN_SRC2_F32>;
1350 def DS_MAX_SRC2_F32_vi : DS_Real_vi<0x93, DS_MAX_SRC2_F32>;
1351 def DS_ADD_SRC2_F32_vi : DS_Real_vi<0x95, DS_ADD_SRC2_F32>;
1352 def DS_ADD_SRC2_U64_vi : DS_Real_vi<0xc0, DS_ADD_SRC2_U64>;
1353 def DS_SUB_SRC2_U64_vi : DS_Real_vi<0xc1, DS_SUB_SRC2_U64>;
1354 def DS_RSUB_SRC2_U64_vi : DS_Real_vi<0xc2, DS_RSUB_SRC2_U64>;
1355 def DS_INC_SRC2_U64_vi : DS_Real_vi<0xc3, DS_INC_SRC2_U64>;
1356 def DS_DEC_SRC2_U64_vi : DS_Real_vi<0xc4, DS_DEC_SRC2_U64>;
1357 def DS_MIN_SRC2_I64_vi : DS_Real_vi<0xc5, DS_MIN_SRC2_I64>;
1358 def DS_MAX_SRC2_I64_vi : DS_Real_vi<0xc6, DS_MAX_SRC2_I64>;
1359 def DS_MIN_SRC2_U64_vi : DS_Real_vi<0xc7, DS_MIN_SRC2_U64>;
1360 def DS_MAX_SRC2_U64_vi : DS_Real_vi<0xc8, DS_MAX_SRC2_U64>;
1361 def DS_AND_SRC2_B64_vi : DS_Real_vi<0xc9, DS_AND_SRC2_B64>;
1362 def DS_OR_SRC2_B64_vi : DS_Real_vi<0xca, DS_OR_SRC2_B64>;
1363 def DS_XOR_SRC2_B64_vi : DS_Real_vi<0xcb, DS_XOR_SRC2_B64>;
1364 def DS_WRITE_SRC2_B64_vi : DS_Real_vi<0xcd, DS_WRITE_SRC2_B64>;
1365 def DS_MIN_SRC2_F64_vi : DS_Real_vi<0xd2, DS_MIN_SRC2_F64>;
1366 def DS_MAX_SRC2_F64_vi : DS_Real_vi<0xd3, DS_MAX_SRC2_F64>;
1367 def DS_WRITE_B96_vi : DS_Real_vi<0xde, DS_WRITE_B96>;
1368 def DS_WRITE_B128_vi : DS_Real_vi<0xdf, DS_WRITE_B128>;
1369 def DS_READ_B96_vi : DS_Real_vi<0xfe, DS_READ_B96>;
1370 def DS_READ_B128_vi : DS_Real_vi<0xff, DS_READ_B128>;
1372 let SubtargetPredicate = isGFX90APlus in {
1373 def DS_ADD_F64_vi : DS_Real_vi<0x5c, DS_ADD_F64>;
1374 def DS_ADD_RTN_F64_vi : DS_Real_vi<0x7c, DS_ADD_RTN_F64>;
1375 } // End SubtargetPredicate = isGFX90APlus