1 //===-- FLATInstructions.td - FLAT Instruction Defintions -----------------===//
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 def FLATAtomic : ComplexPattern<i64, 3, "SelectFlatAtomic", [], [], -10>;
10 def FLATOffset : ComplexPattern<i64, 3, "SelectFlatOffset<false>", [], [], -10>;
12 def FLATOffsetSigned : ComplexPattern<i64, 3, "SelectFlatOffset<true>", [], [], -10>;
13 def FLATSignedAtomic : ComplexPattern<i64, 3, "SelectFlatAtomicSigned", [], [], -10>;
15 //===----------------------------------------------------------------------===//
17 //===----------------------------------------------------------------------===//
19 class FLAT_Pseudo<string opName, dag outs, dag ins,
20 string asmOps, list<dag> pattern=[]> :
21 InstSI<outs, ins, "", pattern>,
22 SIMCInstr<opName, SIEncodingFamily.NONE> {
25 let isCodeGenOnly = 1;
29 let UseNamedOperandTable = 1;
30 let hasSideEffects = 0;
31 let SchedRW = [WriteVMEM];
33 string Mnemonic = opName;
34 string AsmOperands = asmOps;
36 bits<1> is_flat_global = 0;
37 bits<1> is_flat_scratch = 0;
41 // We need to distinguish having saddr and enabling saddr because
42 // saddr is only valid for scratch and global instructions. Pre-gfx9
43 // these bits were reserved, so we also don't necessarily want to
44 // set these bits to the disabled value for the original flat
45 // segment instructions.
46 bits<1> has_saddr = 0;
47 bits<1> enabled_saddr = 0;
48 bits<7> saddr_value = 0;
49 bits<1> has_vaddr = 1;
55 let SubtargetPredicate = !if(is_flat_global, HasFlatGlobalInsts,
56 !if(is_flat_scratch, HasFlatScratchInsts, HasFlatAddressSpace));
58 // TODO: M0 if it could possibly access LDS (before gfx9? only)?
59 let Uses = !if(is_flat_global, [EXEC], [EXEC, FLAT_SCR]);
61 // Internally, FLAT instruction are executed as both an LDS and a
62 // Buffer instruction; so, they increment both VM_CNT and LGKM_CNT
63 // and are not considered done until both have been decremented.
65 let LGKM_CNT = !if(!or(is_flat_global, is_flat_scratch), 0, 1);
68 class FLAT_Real <bits<7> op, FLAT_Pseudo ps> :
69 InstSI <ps.OutOperandList, ps.InOperandList, ps.Mnemonic # ps.AsmOperands, []>,
73 let isCodeGenOnly = 0;
75 // copy relevant pseudo op flags
76 let SubtargetPredicate = ps.SubtargetPredicate;
77 let AsmMatchConverter = ps.AsmMatchConverter;
78 let TSFlags = ps.TSFlags;
79 let UseNamedOperandTable = ps.UseNamedOperandTable;
91 bits<1> lds = 0; // XXX - What does this actually do?
93 // Segment, 00=flat, 01=scratch, 10=global, 11=reserved
94 bits<2> seg = !if(ps.is_flat_global, 0b10,
95 !if(ps.is_flat_scratch, 0b01, 0));
97 // Signed offset. Highest bit ignored for flat and treated as 12-bit
98 // unsigned for flat acceses.
100 bits<1> nv = 0; // XXX - What does this actually do?
102 // We don't use tfe right now, and it was removed in gfx9.
105 // Only valid on GFX9+
106 let Inst{12-0} = offset;
108 let Inst{15-14} = seg;
110 let Inst{16} = !if(ps.has_glc, glc, ps.glcValue);
112 let Inst{24-18} = op;
113 let Inst{31-26} = 0x37; // Encoding.
114 let Inst{39-32} = !if(ps.has_vaddr, vaddr, ?);
115 let Inst{47-40} = !if(ps.has_data, vdata, ?);
116 let Inst{54-48} = !if(ps.has_saddr, !if(ps.enabled_saddr, saddr, 0x7f), 0);
118 // 54-48 is reserved.
119 let Inst{55} = nv; // nv on GFX9+, TFE before.
120 let Inst{63-56} = !if(ps.has_vdst, vdst, ?);
123 class GlobalSaddrTable <bit is_saddr, string Name = ""> {
124 bit IsSaddr = is_saddr;
125 string SaddrOp = Name;
128 // TODO: Is exec allowed for saddr? The disabled value 0x7f is the
129 // same encoding value as exec_hi, so it isn't possible to use that if
130 // saddr is 32-bit (which isn't handled here yet).
131 class FLAT_Load_Pseudo <string opName, RegisterClass regClass,
132 bit HasTiedOutput = 0,
133 bit HasSignedOffset = 0, bit HasSaddr = 0, bit EnableSaddr = 0> : FLAT_Pseudo<
135 (outs regClass:$vdst),
139 !con((ins VReg_64:$vaddr),
140 !if(EnableSaddr, (ins SReg_64:$saddr), (ins))),
141 (ins !if(HasSignedOffset,offset_s13,offset_u12):$offset)),
142 (ins GLC:$glc, SLC:$slc)),
143 !if(HasTiedOutput, (ins regClass:$vdst_in), (ins))),
144 " $vdst, $vaddr"#!if(HasSaddr, !if(EnableSaddr, ", $saddr", ", off"), "")#"$offset$glc$slc"> {
147 let has_saddr = HasSaddr;
148 let enabled_saddr = EnableSaddr;
149 let PseudoInstr = opName#!if(!and(HasSaddr, EnableSaddr), "_SADDR", "");
152 let Constraints = !if(HasTiedOutput, "$vdst = $vdst_in", "");
153 let DisableEncoding = !if(HasTiedOutput, "$vdst_in", "");
156 class FLAT_Store_Pseudo <string opName, RegisterClass vdataClass,
157 bit HasSignedOffset = 0, bit HasSaddr = 0, bit EnableSaddr = 0> : FLAT_Pseudo<
162 !con((ins VReg_64:$vaddr, vdataClass:$vdata),
163 !if(EnableSaddr, (ins SReg_64:$saddr), (ins))),
164 (ins !if(HasSignedOffset,offset_s13,offset_u12):$offset)),
165 (ins GLC:$glc, SLC:$slc)),
166 " $vaddr, $vdata"#!if(HasSaddr, !if(EnableSaddr, ", $saddr", ", off"), "")#"$offset$glc$slc"> {
170 let has_saddr = HasSaddr;
171 let enabled_saddr = EnableSaddr;
172 let PseudoInstr = opName#!if(!and(HasSaddr, EnableSaddr), "_SADDR", "");
176 multiclass FLAT_Global_Load_Pseudo<string opName, RegisterClass regClass, bit HasTiedInput = 0> {
177 let is_flat_global = 1 in {
178 def "" : FLAT_Load_Pseudo<opName, regClass, HasTiedInput, 1, 1>,
179 GlobalSaddrTable<0, opName>;
180 def _SADDR : FLAT_Load_Pseudo<opName, regClass, HasTiedInput, 1, 1, 1>,
181 GlobalSaddrTable<1, opName>;
185 multiclass FLAT_Global_Store_Pseudo<string opName, RegisterClass regClass> {
186 let is_flat_global = 1 in {
187 def "" : FLAT_Store_Pseudo<opName, regClass, 1, 1>,
188 GlobalSaddrTable<0, opName>;
189 def _SADDR : FLAT_Store_Pseudo<opName, regClass, 1, 1, 1>,
190 GlobalSaddrTable<1, opName>;
194 class FLAT_Scratch_Load_Pseudo <string opName, RegisterClass regClass,
195 bit EnableSaddr = 0>: FLAT_Pseudo<
197 (outs regClass:$vdst),
199 (ins SReg_32_XEXEC_HI:$saddr, offset_s13:$offset, GLC:$glc, SLC:$slc),
200 (ins VGPR_32:$vaddr, offset_s13:$offset, GLC:$glc, SLC:$slc)),
201 " $vdst, "#!if(EnableSaddr, "off", "$vaddr")#!if(EnableSaddr, ", $saddr", ", off")#"$offset$glc$slc"> {
205 let enabled_saddr = EnableSaddr;
206 let has_vaddr = !if(EnableSaddr, 0, 1);
207 let PseudoInstr = opName#!if(EnableSaddr, "_SADDR", "");
211 class FLAT_Scratch_Store_Pseudo <string opName, RegisterClass vdataClass, bit EnableSaddr = 0> : FLAT_Pseudo<
215 (ins vdataClass:$vdata, SReg_32_XEXEC_HI:$saddr, offset_s13:$offset, GLC:$glc, SLC:$slc),
216 (ins vdataClass:$vdata, VGPR_32:$vaddr, offset_s13:$offset, GLC:$glc, SLC:$slc)),
217 " "#!if(EnableSaddr, "off", "$vaddr")#", $vdata, "#!if(EnableSaddr, "$saddr", "off")#"$offset$glc$slc"> {
222 let enabled_saddr = EnableSaddr;
223 let has_vaddr = !if(EnableSaddr, 0, 1);
224 let PseudoInstr = opName#!if(EnableSaddr, "_SADDR", "");
228 multiclass FLAT_Scratch_Load_Pseudo<string opName, RegisterClass regClass> {
229 let is_flat_scratch = 1 in {
230 def "" : FLAT_Scratch_Load_Pseudo<opName, regClass>;
231 def _SADDR : FLAT_Scratch_Load_Pseudo<opName, regClass, 1>;
235 multiclass FLAT_Scratch_Store_Pseudo<string opName, RegisterClass regClass> {
236 let is_flat_scratch = 1 in {
237 def "" : FLAT_Scratch_Store_Pseudo<opName, regClass>;
238 def _SADDR : FLAT_Scratch_Store_Pseudo<opName, regClass, 1>;
242 class FLAT_AtomicNoRet_Pseudo<string opName, dag outs, dag ins,
243 string asm, list<dag> pattern = []> :
244 FLAT_Pseudo<opName, outs, ins, asm, pattern> {
253 class FLAT_AtomicRet_Pseudo<string opName, dag outs, dag ins,
254 string asm, list<dag> pattern = []>
255 : FLAT_AtomicNoRet_Pseudo<opName, outs, ins, asm, pattern> {
256 let hasPostISelHook = 1;
259 let PseudoInstr = NAME # "_RTN";
262 multiclass FLAT_Atomic_Pseudo<
264 RegisterClass vdst_rc,
266 SDPatternOperator atomic = null_frag,
267 ValueType data_vt = vt,
268 RegisterClass data_rc = vdst_rc> {
269 def "" : FLAT_AtomicNoRet_Pseudo <opName,
271 (ins VReg_64:$vaddr, data_rc:$vdata, offset_u12:$offset, SLC:$slc),
272 " $vaddr, $vdata$offset$slc">,
273 GlobalSaddrTable<0, opName>,
274 AtomicNoRet <opName, 0> {
275 let PseudoInstr = NAME;
278 def _RTN : FLAT_AtomicRet_Pseudo <opName,
279 (outs vdst_rc:$vdst),
280 (ins VReg_64:$vaddr, data_rc:$vdata, offset_u12:$offset, SLC:$slc),
281 " $vdst, $vaddr, $vdata$offset glc$slc",
283 (atomic (FLATAtomic i64:$vaddr, i16:$offset, i1:$slc), data_vt:$vdata))]>,
284 GlobalSaddrTable<0, opName#"_rtn">,
285 AtomicNoRet <opName, 1>;
288 multiclass FLAT_Global_Atomic_Pseudo_NO_RTN<
290 RegisterClass vdst_rc,
292 SDPatternOperator atomic = null_frag,
293 ValueType data_vt = vt,
294 RegisterClass data_rc = vdst_rc> {
296 def "" : FLAT_AtomicNoRet_Pseudo <opName,
298 (ins VReg_64:$vaddr, data_rc:$vdata, offset_s13:$offset, SLC:$slc),
299 " $vaddr, $vdata, off$offset$slc">,
300 GlobalSaddrTable<0, opName>,
301 AtomicNoRet <opName, 0> {
303 let PseudoInstr = NAME;
306 def _SADDR : FLAT_AtomicNoRet_Pseudo <opName,
308 (ins VReg_64:$vaddr, data_rc:$vdata, SReg_64:$saddr, offset_s13:$offset, SLC:$slc),
309 " $vaddr, $vdata, $saddr$offset$slc">,
310 GlobalSaddrTable<1, opName>,
311 AtomicNoRet <opName#"_saddr", 0> {
313 let enabled_saddr = 1;
314 let PseudoInstr = NAME#"_SADDR";
318 multiclass FLAT_Global_Atomic_Pseudo_RTN<
320 RegisterClass vdst_rc,
322 SDPatternOperator atomic = null_frag,
323 ValueType data_vt = vt,
324 RegisterClass data_rc = vdst_rc> {
326 def _RTN : FLAT_AtomicRet_Pseudo <opName,
327 (outs vdst_rc:$vdst),
328 (ins VReg_64:$vaddr, data_rc:$vdata, offset_s13:$offset, SLC:$slc),
329 " $vdst, $vaddr, $vdata, off$offset glc$slc",
331 (atomic (FLATSignedAtomic i64:$vaddr, i16:$offset, i1:$slc), data_vt:$vdata))]>,
332 GlobalSaddrTable<0, opName#"_rtn">,
333 AtomicNoRet <opName, 1> {
337 def _SADDR_RTN : FLAT_AtomicRet_Pseudo <opName,
338 (outs vdst_rc:$vdst),
339 (ins VReg_64:$vaddr, data_rc:$vdata, SReg_64:$saddr, offset_s13:$offset, SLC:$slc),
340 " $vdst, $vaddr, $vdata, $saddr$offset glc$slc">,
341 GlobalSaddrTable<1, opName#"_rtn">,
342 AtomicNoRet <opName#"_saddr", 1> {
344 let enabled_saddr = 1;
345 let PseudoInstr = NAME#"_SADDR_RTN";
349 multiclass FLAT_Global_Atomic_Pseudo<
351 RegisterClass vdst_rc,
353 SDPatternOperator atomic = null_frag,
354 ValueType data_vt = vt,
355 RegisterClass data_rc = vdst_rc> :
356 FLAT_Global_Atomic_Pseudo_NO_RTN<opName, vdst_rc, vt, atomic, data_vt, data_rc>,
357 FLAT_Global_Atomic_Pseudo_RTN<opName, vdst_rc, vt, atomic, data_vt, data_rc>;
359 class flat_binary_atomic_op<SDNode atomic_op> : PatFrag<
360 (ops node:$ptr, node:$value),
361 (atomic_op node:$ptr, node:$value),
362 [{return cast<MemSDNode>(N)->getAddressSpace() == AMDGPUAS::FLAT_ADDRESS;}]
365 def atomic_cmp_swap_flat : flat_binary_atomic_op<AMDGPUatomic_cmp_swap>;
366 def atomic_swap_flat : flat_binary_atomic_op<atomic_swap>;
367 def atomic_add_flat : flat_binary_atomic_op<atomic_load_add>;
368 def atomic_and_flat : flat_binary_atomic_op<atomic_load_and>;
369 def atomic_max_flat : flat_binary_atomic_op<atomic_load_max>;
370 def atomic_min_flat : flat_binary_atomic_op<atomic_load_min>;
371 def atomic_or_flat : flat_binary_atomic_op<atomic_load_or>;
372 def atomic_sub_flat : flat_binary_atomic_op<atomic_load_sub>;
373 def atomic_umax_flat : flat_binary_atomic_op<atomic_load_umax>;
374 def atomic_umin_flat : flat_binary_atomic_op<atomic_load_umin>;
375 def atomic_xor_flat : flat_binary_atomic_op<atomic_load_xor>;
376 def atomic_inc_flat : flat_binary_atomic_op<SIatomic_inc>;
377 def atomic_dec_flat : flat_binary_atomic_op<SIatomic_dec>;
381 //===----------------------------------------------------------------------===//
383 //===----------------------------------------------------------------------===//
385 def FLAT_LOAD_UBYTE : FLAT_Load_Pseudo <"flat_load_ubyte", VGPR_32>;
386 def FLAT_LOAD_SBYTE : FLAT_Load_Pseudo <"flat_load_sbyte", VGPR_32>;
387 def FLAT_LOAD_USHORT : FLAT_Load_Pseudo <"flat_load_ushort", VGPR_32>;
388 def FLAT_LOAD_SSHORT : FLAT_Load_Pseudo <"flat_load_sshort", VGPR_32>;
389 def FLAT_LOAD_DWORD : FLAT_Load_Pseudo <"flat_load_dword", VGPR_32>;
390 def FLAT_LOAD_DWORDX2 : FLAT_Load_Pseudo <"flat_load_dwordx2", VReg_64>;
391 def FLAT_LOAD_DWORDX4 : FLAT_Load_Pseudo <"flat_load_dwordx4", VReg_128>;
392 def FLAT_LOAD_DWORDX3 : FLAT_Load_Pseudo <"flat_load_dwordx3", VReg_96>;
394 def FLAT_STORE_BYTE : FLAT_Store_Pseudo <"flat_store_byte", VGPR_32>;
395 def FLAT_STORE_SHORT : FLAT_Store_Pseudo <"flat_store_short", VGPR_32>;
396 def FLAT_STORE_DWORD : FLAT_Store_Pseudo <"flat_store_dword", VGPR_32>;
397 def FLAT_STORE_DWORDX2 : FLAT_Store_Pseudo <"flat_store_dwordx2", VReg_64>;
398 def FLAT_STORE_DWORDX4 : FLAT_Store_Pseudo <"flat_store_dwordx4", VReg_128>;
399 def FLAT_STORE_DWORDX3 : FLAT_Store_Pseudo <"flat_store_dwordx3", VReg_96>;
401 let SubtargetPredicate = HasD16LoadStore in {
402 def FLAT_LOAD_UBYTE_D16 : FLAT_Load_Pseudo <"flat_load_ubyte_d16", VGPR_32, 1>;
403 def FLAT_LOAD_UBYTE_D16_HI : FLAT_Load_Pseudo <"flat_load_ubyte_d16_hi", VGPR_32, 1>;
404 def FLAT_LOAD_SBYTE_D16 : FLAT_Load_Pseudo <"flat_load_sbyte_d16", VGPR_32, 1>;
405 def FLAT_LOAD_SBYTE_D16_HI : FLAT_Load_Pseudo <"flat_load_sbyte_d16_hi", VGPR_32, 1>;
406 def FLAT_LOAD_SHORT_D16 : FLAT_Load_Pseudo <"flat_load_short_d16", VGPR_32, 1>;
407 def FLAT_LOAD_SHORT_D16_HI : FLAT_Load_Pseudo <"flat_load_short_d16_hi", VGPR_32, 1>;
409 def FLAT_STORE_BYTE_D16_HI : FLAT_Store_Pseudo <"flat_store_byte_d16_hi", VGPR_32>;
410 def FLAT_STORE_SHORT_D16_HI : FLAT_Store_Pseudo <"flat_store_short_d16_hi", VGPR_32>;
413 defm FLAT_ATOMIC_CMPSWAP : FLAT_Atomic_Pseudo <"flat_atomic_cmpswap",
414 VGPR_32, i32, atomic_cmp_swap_flat,
417 defm FLAT_ATOMIC_CMPSWAP_X2 : FLAT_Atomic_Pseudo <"flat_atomic_cmpswap_x2",
418 VReg_64, i64, atomic_cmp_swap_flat,
421 defm FLAT_ATOMIC_SWAP : FLAT_Atomic_Pseudo <"flat_atomic_swap",
422 VGPR_32, i32, atomic_swap_flat>;
424 defm FLAT_ATOMIC_SWAP_X2 : FLAT_Atomic_Pseudo <"flat_atomic_swap_x2",
425 VReg_64, i64, atomic_swap_flat>;
427 defm FLAT_ATOMIC_ADD : FLAT_Atomic_Pseudo <"flat_atomic_add",
428 VGPR_32, i32, atomic_add_flat>;
430 defm FLAT_ATOMIC_SUB : FLAT_Atomic_Pseudo <"flat_atomic_sub",
431 VGPR_32, i32, atomic_sub_flat>;
433 defm FLAT_ATOMIC_SMIN : FLAT_Atomic_Pseudo <"flat_atomic_smin",
434 VGPR_32, i32, atomic_min_flat>;
436 defm FLAT_ATOMIC_UMIN : FLAT_Atomic_Pseudo <"flat_atomic_umin",
437 VGPR_32, i32, atomic_umin_flat>;
439 defm FLAT_ATOMIC_SMAX : FLAT_Atomic_Pseudo <"flat_atomic_smax",
440 VGPR_32, i32, atomic_max_flat>;
442 defm FLAT_ATOMIC_UMAX : FLAT_Atomic_Pseudo <"flat_atomic_umax",
443 VGPR_32, i32, atomic_umax_flat>;
445 defm FLAT_ATOMIC_AND : FLAT_Atomic_Pseudo <"flat_atomic_and",
446 VGPR_32, i32, atomic_and_flat>;
448 defm FLAT_ATOMIC_OR : FLAT_Atomic_Pseudo <"flat_atomic_or",
449 VGPR_32, i32, atomic_or_flat>;
451 defm FLAT_ATOMIC_XOR : FLAT_Atomic_Pseudo <"flat_atomic_xor",
452 VGPR_32, i32, atomic_xor_flat>;
454 defm FLAT_ATOMIC_INC : FLAT_Atomic_Pseudo <"flat_atomic_inc",
455 VGPR_32, i32, atomic_inc_flat>;
457 defm FLAT_ATOMIC_DEC : FLAT_Atomic_Pseudo <"flat_atomic_dec",
458 VGPR_32, i32, atomic_dec_flat>;
460 defm FLAT_ATOMIC_ADD_X2 : FLAT_Atomic_Pseudo <"flat_atomic_add_x2",
461 VReg_64, i64, atomic_add_flat>;
463 defm FLAT_ATOMIC_SUB_X2 : FLAT_Atomic_Pseudo <"flat_atomic_sub_x2",
464 VReg_64, i64, atomic_sub_flat>;
466 defm FLAT_ATOMIC_SMIN_X2 : FLAT_Atomic_Pseudo <"flat_atomic_smin_x2",
467 VReg_64, i64, atomic_min_flat>;
469 defm FLAT_ATOMIC_UMIN_X2 : FLAT_Atomic_Pseudo <"flat_atomic_umin_x2",
470 VReg_64, i64, atomic_umin_flat>;
472 defm FLAT_ATOMIC_SMAX_X2 : FLAT_Atomic_Pseudo <"flat_atomic_smax_x2",
473 VReg_64, i64, atomic_max_flat>;
475 defm FLAT_ATOMIC_UMAX_X2 : FLAT_Atomic_Pseudo <"flat_atomic_umax_x2",
476 VReg_64, i64, atomic_umax_flat>;
478 defm FLAT_ATOMIC_AND_X2 : FLAT_Atomic_Pseudo <"flat_atomic_and_x2",
479 VReg_64, i64, atomic_and_flat>;
481 defm FLAT_ATOMIC_OR_X2 : FLAT_Atomic_Pseudo <"flat_atomic_or_x2",
482 VReg_64, i64, atomic_or_flat>;
484 defm FLAT_ATOMIC_XOR_X2 : FLAT_Atomic_Pseudo <"flat_atomic_xor_x2",
485 VReg_64, i64, atomic_xor_flat>;
487 defm FLAT_ATOMIC_INC_X2 : FLAT_Atomic_Pseudo <"flat_atomic_inc_x2",
488 VReg_64, i64, atomic_inc_flat>;
490 defm FLAT_ATOMIC_DEC_X2 : FLAT_Atomic_Pseudo <"flat_atomic_dec_x2",
491 VReg_64, i64, atomic_dec_flat>;
493 let SubtargetPredicate = isCI in { // CI Only flat instructions : FIXME Only?
495 defm FLAT_ATOMIC_FCMPSWAP : FLAT_Atomic_Pseudo <"flat_atomic_fcmpswap",
496 VGPR_32, f32, null_frag, v2f32, VReg_64>;
498 defm FLAT_ATOMIC_FCMPSWAP_X2 : FLAT_Atomic_Pseudo <"flat_atomic_fcmpswap_x2",
499 VReg_64, f64, null_frag, v2f64, VReg_128>;
501 defm FLAT_ATOMIC_FMIN : FLAT_Atomic_Pseudo <"flat_atomic_fmin",
504 defm FLAT_ATOMIC_FMAX : FLAT_Atomic_Pseudo <"flat_atomic_fmax",
507 defm FLAT_ATOMIC_FMIN_X2 : FLAT_Atomic_Pseudo <"flat_atomic_fmin_x2",
510 defm FLAT_ATOMIC_FMAX_X2 : FLAT_Atomic_Pseudo <"flat_atomic_fmax_x2",
513 } // End SubtargetPredicate = isCI
515 let SubtargetPredicate = HasFlatGlobalInsts in {
516 defm GLOBAL_LOAD_UBYTE : FLAT_Global_Load_Pseudo <"global_load_ubyte", VGPR_32>;
517 defm GLOBAL_LOAD_SBYTE : FLAT_Global_Load_Pseudo <"global_load_sbyte", VGPR_32>;
518 defm GLOBAL_LOAD_USHORT : FLAT_Global_Load_Pseudo <"global_load_ushort", VGPR_32>;
519 defm GLOBAL_LOAD_SSHORT : FLAT_Global_Load_Pseudo <"global_load_sshort", VGPR_32>;
520 defm GLOBAL_LOAD_DWORD : FLAT_Global_Load_Pseudo <"global_load_dword", VGPR_32>;
521 defm GLOBAL_LOAD_DWORDX2 : FLAT_Global_Load_Pseudo <"global_load_dwordx2", VReg_64>;
522 defm GLOBAL_LOAD_DWORDX3 : FLAT_Global_Load_Pseudo <"global_load_dwordx3", VReg_96>;
523 defm GLOBAL_LOAD_DWORDX4 : FLAT_Global_Load_Pseudo <"global_load_dwordx4", VReg_128>;
525 defm GLOBAL_LOAD_UBYTE_D16 : FLAT_Global_Load_Pseudo <"global_load_ubyte_d16", VGPR_32, 1>;
526 defm GLOBAL_LOAD_UBYTE_D16_HI : FLAT_Global_Load_Pseudo <"global_load_ubyte_d16_hi", VGPR_32, 1>;
527 defm GLOBAL_LOAD_SBYTE_D16 : FLAT_Global_Load_Pseudo <"global_load_sbyte_d16", VGPR_32, 1>;
528 defm GLOBAL_LOAD_SBYTE_D16_HI : FLAT_Global_Load_Pseudo <"global_load_sbyte_d16_hi", VGPR_32, 1>;
529 defm GLOBAL_LOAD_SHORT_D16 : FLAT_Global_Load_Pseudo <"global_load_short_d16", VGPR_32, 1>;
530 defm GLOBAL_LOAD_SHORT_D16_HI : FLAT_Global_Load_Pseudo <"global_load_short_d16_hi", VGPR_32, 1>;
532 defm GLOBAL_STORE_BYTE : FLAT_Global_Store_Pseudo <"global_store_byte", VGPR_32>;
533 defm GLOBAL_STORE_SHORT : FLAT_Global_Store_Pseudo <"global_store_short", VGPR_32>;
534 defm GLOBAL_STORE_DWORD : FLAT_Global_Store_Pseudo <"global_store_dword", VGPR_32>;
535 defm GLOBAL_STORE_DWORDX2 : FLAT_Global_Store_Pseudo <"global_store_dwordx2", VReg_64>;
536 defm GLOBAL_STORE_DWORDX3 : FLAT_Global_Store_Pseudo <"global_store_dwordx3", VReg_96>;
537 defm GLOBAL_STORE_DWORDX4 : FLAT_Global_Store_Pseudo <"global_store_dwordx4", VReg_128>;
539 defm GLOBAL_STORE_BYTE_D16_HI : FLAT_Global_Store_Pseudo <"global_store_byte_d16_hi", VGPR_32>;
540 defm GLOBAL_STORE_SHORT_D16_HI : FLAT_Global_Store_Pseudo <"global_store_short_d16_hi", VGPR_32>;
542 let is_flat_global = 1 in {
543 defm GLOBAL_ATOMIC_CMPSWAP : FLAT_Global_Atomic_Pseudo <"global_atomic_cmpswap",
544 VGPR_32, i32, AMDGPUatomic_cmp_swap_global,
547 defm GLOBAL_ATOMIC_CMPSWAP_X2 : FLAT_Global_Atomic_Pseudo <"global_atomic_cmpswap_x2",
548 VReg_64, i64, AMDGPUatomic_cmp_swap_global,
551 defm GLOBAL_ATOMIC_SWAP : FLAT_Global_Atomic_Pseudo <"global_atomic_swap",
552 VGPR_32, i32, atomic_swap_global>;
554 defm GLOBAL_ATOMIC_SWAP_X2 : FLAT_Global_Atomic_Pseudo <"global_atomic_swap_x2",
555 VReg_64, i64, atomic_swap_global>;
557 defm GLOBAL_ATOMIC_ADD : FLAT_Global_Atomic_Pseudo <"global_atomic_add",
558 VGPR_32, i32, atomic_add_global>;
560 defm GLOBAL_ATOMIC_SUB : FLAT_Global_Atomic_Pseudo <"global_atomic_sub",
561 VGPR_32, i32, atomic_sub_global>;
563 defm GLOBAL_ATOMIC_SMIN : FLAT_Global_Atomic_Pseudo <"global_atomic_smin",
564 VGPR_32, i32, atomic_min_global>;
566 defm GLOBAL_ATOMIC_UMIN : FLAT_Global_Atomic_Pseudo <"global_atomic_umin",
567 VGPR_32, i32, atomic_umin_global>;
569 defm GLOBAL_ATOMIC_SMAX : FLAT_Global_Atomic_Pseudo <"global_atomic_smax",
570 VGPR_32, i32, atomic_max_global>;
572 defm GLOBAL_ATOMIC_UMAX : FLAT_Global_Atomic_Pseudo <"global_atomic_umax",
573 VGPR_32, i32, atomic_umax_global>;
575 defm GLOBAL_ATOMIC_AND : FLAT_Global_Atomic_Pseudo <"global_atomic_and",
576 VGPR_32, i32, atomic_and_global>;
578 defm GLOBAL_ATOMIC_OR : FLAT_Global_Atomic_Pseudo <"global_atomic_or",
579 VGPR_32, i32, atomic_or_global>;
581 defm GLOBAL_ATOMIC_XOR : FLAT_Global_Atomic_Pseudo <"global_atomic_xor",
582 VGPR_32, i32, atomic_xor_global>;
584 defm GLOBAL_ATOMIC_INC : FLAT_Global_Atomic_Pseudo <"global_atomic_inc",
585 VGPR_32, i32, atomic_inc_global>;
587 defm GLOBAL_ATOMIC_DEC : FLAT_Global_Atomic_Pseudo <"global_atomic_dec",
588 VGPR_32, i32, atomic_dec_global>;
590 defm GLOBAL_ATOMIC_ADD_X2 : FLAT_Global_Atomic_Pseudo <"global_atomic_add_x2",
591 VReg_64, i64, atomic_add_global>;
593 defm GLOBAL_ATOMIC_SUB_X2 : FLAT_Global_Atomic_Pseudo <"global_atomic_sub_x2",
594 VReg_64, i64, atomic_sub_global>;
596 defm GLOBAL_ATOMIC_SMIN_X2 : FLAT_Global_Atomic_Pseudo <"global_atomic_smin_x2",
597 VReg_64, i64, atomic_min_global>;
599 defm GLOBAL_ATOMIC_UMIN_X2 : FLAT_Global_Atomic_Pseudo <"global_atomic_umin_x2",
600 VReg_64, i64, atomic_umin_global>;
602 defm GLOBAL_ATOMIC_SMAX_X2 : FLAT_Global_Atomic_Pseudo <"global_atomic_smax_x2",
603 VReg_64, i64, atomic_max_global>;
605 defm GLOBAL_ATOMIC_UMAX_X2 : FLAT_Global_Atomic_Pseudo <"global_atomic_umax_x2",
606 VReg_64, i64, atomic_umax_global>;
608 defm GLOBAL_ATOMIC_AND_X2 : FLAT_Global_Atomic_Pseudo <"global_atomic_and_x2",
609 VReg_64, i64, atomic_and_global>;
611 defm GLOBAL_ATOMIC_OR_X2 : FLAT_Global_Atomic_Pseudo <"global_atomic_or_x2",
612 VReg_64, i64, atomic_or_global>;
614 defm GLOBAL_ATOMIC_XOR_X2 : FLAT_Global_Atomic_Pseudo <"global_atomic_xor_x2",
615 VReg_64, i64, atomic_xor_global>;
617 defm GLOBAL_ATOMIC_INC_X2 : FLAT_Global_Atomic_Pseudo <"global_atomic_inc_x2",
618 VReg_64, i64, atomic_inc_global>;
620 defm GLOBAL_ATOMIC_DEC_X2 : FLAT_Global_Atomic_Pseudo <"global_atomic_dec_x2",
621 VReg_64, i64, atomic_dec_global>;
622 } // End is_flat_global = 1
624 } // End SubtargetPredicate = HasFlatGlobalInsts
627 let SubtargetPredicate = HasFlatScratchInsts in {
628 defm SCRATCH_LOAD_UBYTE : FLAT_Scratch_Load_Pseudo <"scratch_load_ubyte", VGPR_32>;
629 defm SCRATCH_LOAD_SBYTE : FLAT_Scratch_Load_Pseudo <"scratch_load_sbyte", VGPR_32>;
630 defm SCRATCH_LOAD_USHORT : FLAT_Scratch_Load_Pseudo <"scratch_load_ushort", VGPR_32>;
631 defm SCRATCH_LOAD_SSHORT : FLAT_Scratch_Load_Pseudo <"scratch_load_sshort", VGPR_32>;
632 defm SCRATCH_LOAD_DWORD : FLAT_Scratch_Load_Pseudo <"scratch_load_dword", VGPR_32>;
633 defm SCRATCH_LOAD_DWORDX2 : FLAT_Scratch_Load_Pseudo <"scratch_load_dwordx2", VReg_64>;
634 defm SCRATCH_LOAD_DWORDX3 : FLAT_Scratch_Load_Pseudo <"scratch_load_dwordx3", VReg_96>;
635 defm SCRATCH_LOAD_DWORDX4 : FLAT_Scratch_Load_Pseudo <"scratch_load_dwordx4", VReg_128>;
637 defm SCRATCH_LOAD_UBYTE_D16 : FLAT_Scratch_Load_Pseudo <"scratch_load_ubyte_d16", VGPR_32>;
638 defm SCRATCH_LOAD_UBYTE_D16_HI : FLAT_Scratch_Load_Pseudo <"scratch_load_ubyte_d16_hi", VGPR_32>;
639 defm SCRATCH_LOAD_SBYTE_D16 : FLAT_Scratch_Load_Pseudo <"scratch_load_sbyte_d16", VGPR_32>;
640 defm SCRATCH_LOAD_SBYTE_D16_HI : FLAT_Scratch_Load_Pseudo <"scratch_load_sbyte_d16_hi", VGPR_32>;
641 defm SCRATCH_LOAD_SHORT_D16 : FLAT_Scratch_Load_Pseudo <"scratch_load_short_d16", VGPR_32>;
642 defm SCRATCH_LOAD_SHORT_D16_HI : FLAT_Scratch_Load_Pseudo <"scratch_load_short_d16_hi", VGPR_32>;
644 defm SCRATCH_STORE_BYTE : FLAT_Scratch_Store_Pseudo <"scratch_store_byte", VGPR_32>;
645 defm SCRATCH_STORE_SHORT : FLAT_Scratch_Store_Pseudo <"scratch_store_short", VGPR_32>;
646 defm SCRATCH_STORE_DWORD : FLAT_Scratch_Store_Pseudo <"scratch_store_dword", VGPR_32>;
647 defm SCRATCH_STORE_DWORDX2 : FLAT_Scratch_Store_Pseudo <"scratch_store_dwordx2", VReg_64>;
648 defm SCRATCH_STORE_DWORDX3 : FLAT_Scratch_Store_Pseudo <"scratch_store_dwordx3", VReg_96>;
649 defm SCRATCH_STORE_DWORDX4 : FLAT_Scratch_Store_Pseudo <"scratch_store_dwordx4", VReg_128>;
651 defm SCRATCH_STORE_BYTE_D16_HI : FLAT_Scratch_Store_Pseudo <"scratch_store_byte_d16_hi", VGPR_32>;
652 defm SCRATCH_STORE_SHORT_D16_HI : FLAT_Scratch_Store_Pseudo <"scratch_store_short_d16_hi", VGPR_32>;
654 } // End SubtargetPredicate = HasFlatScratchInsts
656 //===----------------------------------------------------------------------===//
658 //===----------------------------------------------------------------------===//
660 // Patterns for global loads with no offset.
661 class FlatLoadPat <FLAT_Pseudo inst, SDPatternOperator node, ValueType vt> : GCNPat <
662 (vt (node (FLATOffset i64:$vaddr, i16:$offset, i1:$slc))),
663 (inst $vaddr, $offset, 0, $slc)
666 multiclass FlatLoadPat_Hi16 <FLAT_Pseudo inst, SDPatternOperator node, ValueType vt = i16> {
668 (build_vector vt:$elt0, (vt (node (FLATOffset i64:$vaddr, i16:$offset, i1:$slc)))),
669 (v2i16 (inst $vaddr, $offset, 0, $slc, $elt0))
673 (build_vector f16:$elt0, (f16 (bitconvert (vt (node (FLATOffset i64:$vaddr, i16:$offset, i1:$slc)))))),
674 (v2f16 (inst $vaddr, $offset, 0, $slc, $elt0))
678 multiclass FlatSignedLoadPat_Hi16 <FLAT_Pseudo inst, SDPatternOperator node, ValueType vt = i16> {
680 (build_vector vt:$elt0, (vt (node (FLATOffsetSigned i64:$vaddr, i16:$offset, i1:$slc)))),
681 (v2i16 (inst $vaddr, $offset, 0, $slc, $elt0))
685 (build_vector f16:$elt0, (f16 (bitconvert (vt (node (FLATOffsetSigned i64:$vaddr, i16:$offset, i1:$slc)))))),
686 (v2f16 (inst $vaddr, $offset, 0, $slc, $elt0))
690 multiclass FlatLoadPat_Lo16 <FLAT_Pseudo inst, SDPatternOperator node, ValueType vt = i16> {
692 (build_vector (vt (node (FLATOffset i64:$vaddr, i16:$offset, i1:$slc))), (vt (Hi16Elt vt:$hi))),
693 (v2i16 (inst $vaddr, $offset, 0, $slc, $hi))
697 (build_vector (f16 (bitconvert (vt (node (FLATOffset i64:$vaddr, i16:$offset, i1:$slc))))), (f16 (Hi16Elt f16:$hi))),
698 (v2f16 (inst $vaddr, $offset, 0, $slc, $hi))
702 multiclass FlatSignedLoadPat_Lo16 <FLAT_Pseudo inst, SDPatternOperator node, ValueType vt = i16> {
704 (build_vector (vt (node (FLATOffsetSigned i64:$vaddr, i16:$offset, i1:$slc))), (vt (Hi16Elt vt:$hi))),
705 (v2i16 (inst $vaddr, $offset, 0, $slc, $hi))
709 (build_vector (f16 (bitconvert (vt (node (FLATOffsetSigned i64:$vaddr, i16:$offset, i1:$slc))))), (f16 (Hi16Elt f16:$hi))),
710 (v2f16 (inst $vaddr, $offset, 0, $slc, $hi))
714 class FlatLoadAtomicPat <FLAT_Pseudo inst, SDPatternOperator node, ValueType vt> : GCNPat <
715 (vt (node (FLATAtomic i64:$vaddr, i16:$offset, i1:$slc))),
716 (inst $vaddr, $offset, 0, $slc)
719 class FlatLoadSignedPat <FLAT_Pseudo inst, SDPatternOperator node, ValueType vt> : GCNPat <
720 (vt (node (FLATOffsetSigned i64:$vaddr, i16:$offset, i1:$slc))),
721 (inst $vaddr, $offset, 0, $slc)
724 class FlatStorePat <FLAT_Pseudo inst, SDPatternOperator node, ValueType vt> : GCNPat <
725 (node vt:$data, (FLATOffset i64:$vaddr, i16:$offset, i1:$slc)),
726 (inst $vaddr, $data, $offset, 0, $slc)
729 class FlatStoreSignedPat <FLAT_Pseudo inst, SDPatternOperator node, ValueType vt> : GCNPat <
730 (node vt:$data, (FLATOffsetSigned i64:$vaddr, i16:$offset, i1:$slc)),
731 (inst $vaddr, $data, $offset, 0, $slc)
734 class FlatStoreAtomicPat <FLAT_Pseudo inst, SDPatternOperator node, ValueType vt> : GCNPat <
735 // atomic store follows atomic binop convention so the address comes
737 (node (FLATAtomic i64:$vaddr, i16:$offset, i1:$slc), vt:$data),
738 (inst $vaddr, $data, $offset, 0, $slc)
741 class FlatStoreSignedAtomicPat <FLAT_Pseudo inst, SDPatternOperator node, ValueType vt> : GCNPat <
742 // atomic store follows atomic binop convention so the address comes
744 (node (FLATSignedAtomic i64:$vaddr, i16:$offset, i1:$slc), vt:$data),
745 (inst $vaddr, $data, $offset, 0, $slc)
748 class FlatAtomicPat <FLAT_Pseudo inst, SDPatternOperator node, ValueType vt,
749 ValueType data_vt = vt> : GCNPat <
750 (vt (node (FLATAtomic i64:$vaddr, i16:$offset, i1:$slc), data_vt:$data)),
751 (inst $vaddr, $data, $offset, $slc)
754 class FlatSignedAtomicPat <FLAT_Pseudo inst, SDPatternOperator node, ValueType vt,
755 ValueType data_vt = vt> : GCNPat <
756 (vt (node (FLATSignedAtomic i64:$vaddr, i16:$offset, i1:$slc), data_vt:$data)),
757 (inst $vaddr, $data, $offset, $slc)
760 let OtherPredicates = [HasFlatAddressSpace] in {
762 def : FlatLoadPat <FLAT_LOAD_UBYTE, az_extloadi8_flat, i32>;
763 def : FlatLoadPat <FLAT_LOAD_SBYTE, sextloadi8_flat, i32>;
764 def : FlatLoadPat <FLAT_LOAD_UBYTE, az_extloadi8_flat, i16>;
765 def : FlatLoadPat <FLAT_LOAD_SBYTE, sextloadi8_flat, i16>;
766 def : FlatLoadPat <FLAT_LOAD_USHORT, az_extloadi16_flat, i32>;
767 def : FlatLoadPat <FLAT_LOAD_USHORT, load_flat, i16>;
768 def : FlatLoadPat <FLAT_LOAD_SSHORT, sextloadi16_flat, i32>;
769 def : FlatLoadPat <FLAT_LOAD_DWORD, load_flat, i32>;
770 def : FlatLoadPat <FLAT_LOAD_DWORDX2, load_flat, v2i32>;
771 def : FlatLoadPat <FLAT_LOAD_DWORDX4, load_flat, v4i32>;
773 def : FlatLoadAtomicPat <FLAT_LOAD_DWORD, atomic_load_flat, i32>;
774 def : FlatLoadAtomicPat <FLAT_LOAD_DWORDX2, atomic_load_flat, i64>;
776 def : FlatStorePat <FLAT_STORE_BYTE, truncstorei8_flat, i32>;
777 def : FlatStorePat <FLAT_STORE_SHORT, truncstorei16_flat, i32>;
778 def : FlatStorePat <FLAT_STORE_DWORD, store_flat, i32>;
779 def : FlatStorePat <FLAT_STORE_DWORDX2, store_flat, v2i32>;
780 def : FlatStorePat <FLAT_STORE_DWORDX4, store_flat, v4i32>;
782 def : FlatStoreAtomicPat <FLAT_STORE_DWORD, atomic_store_flat, i32>;
783 def : FlatStoreAtomicPat <FLAT_STORE_DWORDX2, atomic_store_flat, i64>;
785 def : FlatAtomicPat <FLAT_ATOMIC_ADD_RTN, atomic_add_global, i32>;
786 def : FlatAtomicPat <FLAT_ATOMIC_SUB_RTN, atomic_sub_global, i32>;
787 def : FlatAtomicPat <FLAT_ATOMIC_INC_RTN, atomic_inc_global, i32>;
788 def : FlatAtomicPat <FLAT_ATOMIC_DEC_RTN, atomic_dec_global, i32>;
789 def : FlatAtomicPat <FLAT_ATOMIC_AND_RTN, atomic_and_global, i32>;
790 def : FlatAtomicPat <FLAT_ATOMIC_SMAX_RTN, atomic_max_global, i32>;
791 def : FlatAtomicPat <FLAT_ATOMIC_UMAX_RTN, atomic_umax_global, i32>;
792 def : FlatAtomicPat <FLAT_ATOMIC_SMIN_RTN, atomic_min_global, i32>;
793 def : FlatAtomicPat <FLAT_ATOMIC_UMIN_RTN, atomic_umin_global, i32>;
794 def : FlatAtomicPat <FLAT_ATOMIC_OR_RTN, atomic_or_global, i32>;
795 def : FlatAtomicPat <FLAT_ATOMIC_SWAP_RTN, atomic_swap_global, i32>;
796 def : FlatAtomicPat <FLAT_ATOMIC_CMPSWAP_RTN, AMDGPUatomic_cmp_swap_global, i32, v2i32>;
797 def : FlatAtomicPat <FLAT_ATOMIC_XOR_RTN, atomic_xor_global, i32>;
799 def : FlatAtomicPat <FLAT_ATOMIC_ADD_X2_RTN, atomic_add_global, i64>;
800 def : FlatAtomicPat <FLAT_ATOMIC_SUB_X2_RTN, atomic_sub_global, i64>;
801 def : FlatAtomicPat <FLAT_ATOMIC_INC_X2_RTN, atomic_inc_global, i64>;
802 def : FlatAtomicPat <FLAT_ATOMIC_DEC_X2_RTN, atomic_dec_global, i64>;
803 def : FlatAtomicPat <FLAT_ATOMIC_AND_X2_RTN, atomic_and_global, i64>;
804 def : FlatAtomicPat <FLAT_ATOMIC_SMAX_X2_RTN, atomic_max_global, i64>;
805 def : FlatAtomicPat <FLAT_ATOMIC_UMAX_X2_RTN, atomic_umax_global, i64>;
806 def : FlatAtomicPat <FLAT_ATOMIC_SMIN_X2_RTN, atomic_min_global, i64>;
807 def : FlatAtomicPat <FLAT_ATOMIC_UMIN_X2_RTN, atomic_umin_global, i64>;
808 def : FlatAtomicPat <FLAT_ATOMIC_OR_X2_RTN, atomic_or_global, i64>;
809 def : FlatAtomicPat <FLAT_ATOMIC_SWAP_X2_RTN, atomic_swap_global, i64>;
810 def : FlatAtomicPat <FLAT_ATOMIC_CMPSWAP_X2_RTN, AMDGPUatomic_cmp_swap_global, i64, v2i64>;
811 def : FlatAtomicPat <FLAT_ATOMIC_XOR_X2_RTN, atomic_xor_global, i64>;
813 def : FlatStorePat <FLAT_STORE_BYTE, truncstorei8_flat, i16>;
814 def : FlatStorePat <FLAT_STORE_SHORT, store_flat, i16>;
816 let OtherPredicates = [D16PreservesUnusedBits] in {
817 def : FlatStorePat <FLAT_STORE_SHORT_D16_HI, truncstorei16_hi16_flat, i32>;
818 def : FlatStorePat <FLAT_STORE_BYTE_D16_HI, truncstorei8_hi16_flat, i32>;
820 let AddedComplexity = 3 in {
821 defm : FlatLoadPat_Hi16 <FLAT_LOAD_UBYTE_D16_HI, az_extloadi8_flat>;
822 defm : FlatLoadPat_Hi16 <FLAT_LOAD_SBYTE_D16_HI, sextloadi8_flat>;
823 defm : FlatLoadPat_Hi16 <FLAT_LOAD_SHORT_D16_HI, load_flat>;
826 let AddedComplexity = 9 in {
827 defm : FlatLoadPat_Lo16 <FLAT_LOAD_UBYTE_D16, az_extloadi8_flat>;
828 defm : FlatLoadPat_Lo16 <FLAT_LOAD_SBYTE_D16, sextloadi8_flat>;
829 defm : FlatLoadPat_Lo16 <FLAT_LOAD_SHORT_D16, load_flat>;
833 } // End OtherPredicates = [HasFlatAddressSpace]
835 let OtherPredicates = [HasFlatGlobalInsts], AddedComplexity = 10 in {
837 def : FlatLoadSignedPat <GLOBAL_LOAD_UBYTE, az_extloadi8_global, i32>;
838 def : FlatLoadSignedPat <GLOBAL_LOAD_SBYTE, sextloadi8_global, i32>;
839 def : FlatLoadSignedPat <GLOBAL_LOAD_UBYTE, az_extloadi8_global, i16>;
840 def : FlatLoadSignedPat <GLOBAL_LOAD_SBYTE, sextloadi8_global, i16>;
841 def : FlatLoadSignedPat <GLOBAL_LOAD_USHORT, az_extloadi16_global, i32>;
842 def : FlatLoadSignedPat <GLOBAL_LOAD_SSHORT, sextloadi16_global, i32>;
843 def : FlatLoadSignedPat <GLOBAL_LOAD_USHORT, load_global, i16>;
845 def : FlatLoadSignedPat <GLOBAL_LOAD_DWORD, load_global, i32>;
846 def : FlatLoadSignedPat <GLOBAL_LOAD_DWORDX2, load_global, v2i32>;
847 def : FlatLoadSignedPat <GLOBAL_LOAD_DWORDX4, load_global, v4i32>;
849 def : FlatLoadAtomicPat <GLOBAL_LOAD_DWORD, atomic_load_global, i32>;
850 def : FlatLoadAtomicPat <GLOBAL_LOAD_DWORDX2, atomic_load_global, i64>;
852 def : FlatStoreSignedPat <GLOBAL_STORE_BYTE, truncstorei8_global, i32>;
853 def : FlatStoreSignedPat <GLOBAL_STORE_BYTE, truncstorei8_global, i16>;
854 def : FlatStoreSignedPat <GLOBAL_STORE_SHORT, truncstorei16_global, i32>;
855 def : FlatStoreSignedPat <GLOBAL_STORE_SHORT, store_global, i16>;
856 def : FlatStoreSignedPat <GLOBAL_STORE_DWORD, store_global, i32>;
857 def : FlatStoreSignedPat <GLOBAL_STORE_DWORDX2, store_global, v2i32>;
858 def : FlatStoreSignedPat <GLOBAL_STORE_DWORDX4, store_global, v4i32>;
860 let OtherPredicates = [D16PreservesUnusedBits] in {
861 def : FlatStoreSignedPat <GLOBAL_STORE_SHORT_D16_HI, truncstorei16_hi16_global, i32>;
862 def : FlatStoreSignedPat <GLOBAL_STORE_BYTE_D16_HI, truncstorei8_hi16_global, i32>;
864 defm : FlatSignedLoadPat_Hi16 <GLOBAL_LOAD_UBYTE_D16_HI, az_extloadi8_global>;
865 defm : FlatSignedLoadPat_Hi16 <GLOBAL_LOAD_SBYTE_D16_HI, sextloadi8_global>;
866 defm : FlatSignedLoadPat_Hi16 <GLOBAL_LOAD_SHORT_D16_HI, load_global>;
868 defm : FlatSignedLoadPat_Lo16 <GLOBAL_LOAD_UBYTE_D16, az_extloadi8_global>;
869 defm : FlatSignedLoadPat_Lo16 <GLOBAL_LOAD_SBYTE_D16, sextloadi8_global>;
870 defm : FlatSignedLoadPat_Lo16 <GLOBAL_LOAD_SHORT_D16, load_global>;
874 def : FlatStoreSignedAtomicPat <GLOBAL_STORE_DWORD, store_atomic_global, i32>;
875 def : FlatStoreSignedAtomicPat <GLOBAL_STORE_DWORDX2, store_atomic_global, i64>;
877 def : FlatSignedAtomicPat <GLOBAL_ATOMIC_ADD_RTN, atomic_add_global, i32>;
878 def : FlatSignedAtomicPat <GLOBAL_ATOMIC_SUB_RTN, atomic_sub_global, i32>;
879 def : FlatSignedAtomicPat <GLOBAL_ATOMIC_INC_RTN, atomic_inc_global, i32>;
880 def : FlatSignedAtomicPat <GLOBAL_ATOMIC_DEC_RTN, atomic_dec_global, i32>;
881 def : FlatSignedAtomicPat <GLOBAL_ATOMIC_AND_RTN, atomic_and_global, i32>;
882 def : FlatSignedAtomicPat <GLOBAL_ATOMIC_SMAX_RTN, atomic_max_global, i32>;
883 def : FlatSignedAtomicPat <GLOBAL_ATOMIC_UMAX_RTN, atomic_umax_global, i32>;
884 def : FlatSignedAtomicPat <GLOBAL_ATOMIC_SMIN_RTN, atomic_min_global, i32>;
885 def : FlatSignedAtomicPat <GLOBAL_ATOMIC_UMIN_RTN, atomic_umin_global, i32>;
886 def : FlatSignedAtomicPat <GLOBAL_ATOMIC_OR_RTN, atomic_or_global, i32>;
887 def : FlatSignedAtomicPat <GLOBAL_ATOMIC_SWAP_RTN, atomic_swap_global, i32>;
888 def : FlatSignedAtomicPat <GLOBAL_ATOMIC_CMPSWAP_RTN, AMDGPUatomic_cmp_swap_global, i32, v2i32>;
889 def : FlatSignedAtomicPat <GLOBAL_ATOMIC_XOR_RTN, atomic_xor_global, i32>;
891 def : FlatSignedAtomicPat <GLOBAL_ATOMIC_ADD_X2_RTN, atomic_add_global, i64>;
892 def : FlatSignedAtomicPat <GLOBAL_ATOMIC_SUB_X2_RTN, atomic_sub_global, i64>;
893 def : FlatSignedAtomicPat <GLOBAL_ATOMIC_INC_X2_RTN, atomic_inc_global, i64>;
894 def : FlatSignedAtomicPat <GLOBAL_ATOMIC_DEC_X2_RTN, atomic_dec_global, i64>;
895 def : FlatSignedAtomicPat <GLOBAL_ATOMIC_AND_X2_RTN, atomic_and_global, i64>;
896 def : FlatSignedAtomicPat <GLOBAL_ATOMIC_SMAX_X2_RTN, atomic_max_global, i64>;
897 def : FlatSignedAtomicPat <GLOBAL_ATOMIC_UMAX_X2_RTN, atomic_umax_global, i64>;
898 def : FlatSignedAtomicPat <GLOBAL_ATOMIC_SMIN_X2_RTN, atomic_min_global, i64>;
899 def : FlatSignedAtomicPat <GLOBAL_ATOMIC_UMIN_X2_RTN, atomic_umin_global, i64>;
900 def : FlatSignedAtomicPat <GLOBAL_ATOMIC_OR_X2_RTN, atomic_or_global, i64>;
901 def : FlatSignedAtomicPat <GLOBAL_ATOMIC_SWAP_X2_RTN, atomic_swap_global, i64>;
902 def : FlatSignedAtomicPat <GLOBAL_ATOMIC_CMPSWAP_X2_RTN, AMDGPUatomic_cmp_swap_global, i64, v2i64>;
903 def : FlatSignedAtomicPat <GLOBAL_ATOMIC_XOR_X2_RTN, atomic_xor_global, i64>;
905 } // End OtherPredicates = [HasFlatGlobalInsts]
908 //===----------------------------------------------------------------------===//
910 //===----------------------------------------------------------------------===//
912 //===----------------------------------------------------------------------===//
914 //===----------------------------------------------------------------------===//
916 class FLAT_Real_ci <bits<7> op, FLAT_Pseudo ps> :
918 SIMCInstr <ps.PseudoInstr, SIEncodingFamily.SI> {
919 let AssemblerPredicate = isCIOnly;
920 let DecoderNamespace="CI";
923 def FLAT_LOAD_UBYTE_ci : FLAT_Real_ci <0x8, FLAT_LOAD_UBYTE>;
924 def FLAT_LOAD_SBYTE_ci : FLAT_Real_ci <0x9, FLAT_LOAD_SBYTE>;
925 def FLAT_LOAD_USHORT_ci : FLAT_Real_ci <0xa, FLAT_LOAD_USHORT>;
926 def FLAT_LOAD_SSHORT_ci : FLAT_Real_ci <0xb, FLAT_LOAD_SSHORT>;
927 def FLAT_LOAD_DWORD_ci : FLAT_Real_ci <0xc, FLAT_LOAD_DWORD>;
928 def FLAT_LOAD_DWORDX2_ci : FLAT_Real_ci <0xd, FLAT_LOAD_DWORDX2>;
929 def FLAT_LOAD_DWORDX4_ci : FLAT_Real_ci <0xe, FLAT_LOAD_DWORDX4>;
930 def FLAT_LOAD_DWORDX3_ci : FLAT_Real_ci <0xf, FLAT_LOAD_DWORDX3>;
932 def FLAT_STORE_BYTE_ci : FLAT_Real_ci <0x18, FLAT_STORE_BYTE>;
933 def FLAT_STORE_SHORT_ci : FLAT_Real_ci <0x1a, FLAT_STORE_SHORT>;
934 def FLAT_STORE_DWORD_ci : FLAT_Real_ci <0x1c, FLAT_STORE_DWORD>;
935 def FLAT_STORE_DWORDX2_ci : FLAT_Real_ci <0x1d, FLAT_STORE_DWORDX2>;
936 def FLAT_STORE_DWORDX4_ci : FLAT_Real_ci <0x1e, FLAT_STORE_DWORDX4>;
937 def FLAT_STORE_DWORDX3_ci : FLAT_Real_ci <0x1f, FLAT_STORE_DWORDX3>;
939 multiclass FLAT_Real_Atomics_ci <bits<7> op, FLAT_Pseudo ps> {
940 def _ci : FLAT_Real_ci<op, !cast<FLAT_Pseudo>(ps.PseudoInstr)>;
941 def _RTN_ci : FLAT_Real_ci<op, !cast<FLAT_Pseudo>(ps.PseudoInstr # "_RTN")>;
944 defm FLAT_ATOMIC_SWAP : FLAT_Real_Atomics_ci <0x30, FLAT_ATOMIC_SWAP>;
945 defm FLAT_ATOMIC_CMPSWAP : FLAT_Real_Atomics_ci <0x31, FLAT_ATOMIC_CMPSWAP>;
946 defm FLAT_ATOMIC_ADD : FLAT_Real_Atomics_ci <0x32, FLAT_ATOMIC_ADD>;
947 defm FLAT_ATOMIC_SUB : FLAT_Real_Atomics_ci <0x33, FLAT_ATOMIC_SUB>;
948 defm FLAT_ATOMIC_SMIN : FLAT_Real_Atomics_ci <0x35, FLAT_ATOMIC_SMIN>;
949 defm FLAT_ATOMIC_UMIN : FLAT_Real_Atomics_ci <0x36, FLAT_ATOMIC_UMIN>;
950 defm FLAT_ATOMIC_SMAX : FLAT_Real_Atomics_ci <0x37, FLAT_ATOMIC_SMAX>;
951 defm FLAT_ATOMIC_UMAX : FLAT_Real_Atomics_ci <0x38, FLAT_ATOMIC_UMAX>;
952 defm FLAT_ATOMIC_AND : FLAT_Real_Atomics_ci <0x39, FLAT_ATOMIC_AND>;
953 defm FLAT_ATOMIC_OR : FLAT_Real_Atomics_ci <0x3a, FLAT_ATOMIC_OR>;
954 defm FLAT_ATOMIC_XOR : FLAT_Real_Atomics_ci <0x3b, FLAT_ATOMIC_XOR>;
955 defm FLAT_ATOMIC_INC : FLAT_Real_Atomics_ci <0x3c, FLAT_ATOMIC_INC>;
956 defm FLAT_ATOMIC_DEC : FLAT_Real_Atomics_ci <0x3d, FLAT_ATOMIC_DEC>;
957 defm FLAT_ATOMIC_SWAP_X2 : FLAT_Real_Atomics_ci <0x50, FLAT_ATOMIC_SWAP_X2>;
958 defm FLAT_ATOMIC_CMPSWAP_X2 : FLAT_Real_Atomics_ci <0x51, FLAT_ATOMIC_CMPSWAP_X2>;
959 defm FLAT_ATOMIC_ADD_X2 : FLAT_Real_Atomics_ci <0x52, FLAT_ATOMIC_ADD_X2>;
960 defm FLAT_ATOMIC_SUB_X2 : FLAT_Real_Atomics_ci <0x53, FLAT_ATOMIC_SUB_X2>;
961 defm FLAT_ATOMIC_SMIN_X2 : FLAT_Real_Atomics_ci <0x55, FLAT_ATOMIC_SMIN_X2>;
962 defm FLAT_ATOMIC_UMIN_X2 : FLAT_Real_Atomics_ci <0x56, FLAT_ATOMIC_UMIN_X2>;
963 defm FLAT_ATOMIC_SMAX_X2 : FLAT_Real_Atomics_ci <0x57, FLAT_ATOMIC_SMAX_X2>;
964 defm FLAT_ATOMIC_UMAX_X2 : FLAT_Real_Atomics_ci <0x58, FLAT_ATOMIC_UMAX_X2>;
965 defm FLAT_ATOMIC_AND_X2 : FLAT_Real_Atomics_ci <0x59, FLAT_ATOMIC_AND_X2>;
966 defm FLAT_ATOMIC_OR_X2 : FLAT_Real_Atomics_ci <0x5a, FLAT_ATOMIC_OR_X2>;
967 defm FLAT_ATOMIC_XOR_X2 : FLAT_Real_Atomics_ci <0x5b, FLAT_ATOMIC_XOR_X2>;
968 defm FLAT_ATOMIC_INC_X2 : FLAT_Real_Atomics_ci <0x5c, FLAT_ATOMIC_INC_X2>;
969 defm FLAT_ATOMIC_DEC_X2 : FLAT_Real_Atomics_ci <0x5d, FLAT_ATOMIC_DEC_X2>;
971 // CI Only flat instructions
972 defm FLAT_ATOMIC_FCMPSWAP : FLAT_Real_Atomics_ci <0x3e, FLAT_ATOMIC_FCMPSWAP>;
973 defm FLAT_ATOMIC_FMIN : FLAT_Real_Atomics_ci <0x3f, FLAT_ATOMIC_FMIN>;
974 defm FLAT_ATOMIC_FMAX : FLAT_Real_Atomics_ci <0x40, FLAT_ATOMIC_FMAX>;
975 defm FLAT_ATOMIC_FCMPSWAP_X2 : FLAT_Real_Atomics_ci <0x5e, FLAT_ATOMIC_FCMPSWAP_X2>;
976 defm FLAT_ATOMIC_FMIN_X2 : FLAT_Real_Atomics_ci <0x5f, FLAT_ATOMIC_FMIN_X2>;
977 defm FLAT_ATOMIC_FMAX_X2 : FLAT_Real_Atomics_ci <0x60, FLAT_ATOMIC_FMAX_X2>;
980 //===----------------------------------------------------------------------===//
982 //===----------------------------------------------------------------------===//
984 class FLAT_Real_vi <bits<7> op, FLAT_Pseudo ps> :
986 SIMCInstr <ps.PseudoInstr, SIEncodingFamily.VI> {
987 let AssemblerPredicate = isVI;
988 let DecoderNamespace="VI";
991 multiclass FLAT_Real_AllAddr_vi<bits<7> op> {
992 def _vi : FLAT_Real_vi<op, !cast<FLAT_Pseudo>(NAME)>;
993 def _SADDR_vi : FLAT_Real_vi<op, !cast<FLAT_Pseudo>(NAME#"_SADDR")>;
996 def FLAT_LOAD_UBYTE_vi : FLAT_Real_vi <0x10, FLAT_LOAD_UBYTE>;
997 def FLAT_LOAD_SBYTE_vi : FLAT_Real_vi <0x11, FLAT_LOAD_SBYTE>;
998 def FLAT_LOAD_USHORT_vi : FLAT_Real_vi <0x12, FLAT_LOAD_USHORT>;
999 def FLAT_LOAD_SSHORT_vi : FLAT_Real_vi <0x13, FLAT_LOAD_SSHORT>;
1000 def FLAT_LOAD_DWORD_vi : FLAT_Real_vi <0x14, FLAT_LOAD_DWORD>;
1001 def FLAT_LOAD_DWORDX2_vi : FLAT_Real_vi <0x15, FLAT_LOAD_DWORDX2>;
1002 def FLAT_LOAD_DWORDX4_vi : FLAT_Real_vi <0x17, FLAT_LOAD_DWORDX4>;
1003 def FLAT_LOAD_DWORDX3_vi : FLAT_Real_vi <0x16, FLAT_LOAD_DWORDX3>;
1005 def FLAT_STORE_BYTE_vi : FLAT_Real_vi <0x18, FLAT_STORE_BYTE>;
1006 def FLAT_STORE_BYTE_D16_HI_vi : FLAT_Real_vi <0x19, FLAT_STORE_BYTE_D16_HI>;
1007 def FLAT_STORE_SHORT_vi : FLAT_Real_vi <0x1a, FLAT_STORE_SHORT>;
1008 def FLAT_STORE_SHORT_D16_HI_vi : FLAT_Real_vi <0x1b, FLAT_STORE_SHORT_D16_HI>;
1009 def FLAT_STORE_DWORD_vi : FLAT_Real_vi <0x1c, FLAT_STORE_DWORD>;
1010 def FLAT_STORE_DWORDX2_vi : FLAT_Real_vi <0x1d, FLAT_STORE_DWORDX2>;
1011 def FLAT_STORE_DWORDX4_vi : FLAT_Real_vi <0x1f, FLAT_STORE_DWORDX4>;
1012 def FLAT_STORE_DWORDX3_vi : FLAT_Real_vi <0x1e, FLAT_STORE_DWORDX3>;
1014 def FLAT_LOAD_UBYTE_D16_vi : FLAT_Real_vi <0x20, FLAT_LOAD_UBYTE_D16>;
1015 def FLAT_LOAD_UBYTE_D16_HI_vi : FLAT_Real_vi <0x21, FLAT_LOAD_UBYTE_D16_HI>;
1016 def FLAT_LOAD_SBYTE_D16_vi : FLAT_Real_vi <0x22, FLAT_LOAD_SBYTE_D16>;
1017 def FLAT_LOAD_SBYTE_D16_HI_vi : FLAT_Real_vi <0x23, FLAT_LOAD_SBYTE_D16_HI>;
1018 def FLAT_LOAD_SHORT_D16_vi : FLAT_Real_vi <0x24, FLAT_LOAD_SHORT_D16>;
1019 def FLAT_LOAD_SHORT_D16_HI_vi : FLAT_Real_vi <0x25, FLAT_LOAD_SHORT_D16_HI>;
1021 multiclass FLAT_Real_Atomics_vi <bits<7> op, FLAT_Pseudo ps> {
1022 def _vi : FLAT_Real_vi<op, !cast<FLAT_Pseudo>(ps.PseudoInstr)>;
1023 def _RTN_vi : FLAT_Real_vi<op, !cast<FLAT_Pseudo>(ps.PseudoInstr # "_RTN")>;
1026 multiclass FLAT_Global_Real_Atomics_vi<bits<7> op> :
1027 FLAT_Real_AllAddr_vi<op> {
1028 def _RTN_vi : FLAT_Real_vi <op, !cast<FLAT_Pseudo>(NAME#"_RTN")>;
1029 def _SADDR_RTN_vi : FLAT_Real_vi <op, !cast<FLAT_Pseudo>(NAME#"_SADDR_RTN")>;
1033 defm FLAT_ATOMIC_SWAP : FLAT_Real_Atomics_vi <0x40, FLAT_ATOMIC_SWAP>;
1034 defm FLAT_ATOMIC_CMPSWAP : FLAT_Real_Atomics_vi <0x41, FLAT_ATOMIC_CMPSWAP>;
1035 defm FLAT_ATOMIC_ADD : FLAT_Real_Atomics_vi <0x42, FLAT_ATOMIC_ADD>;
1036 defm FLAT_ATOMIC_SUB : FLAT_Real_Atomics_vi <0x43, FLAT_ATOMIC_SUB>;
1037 defm FLAT_ATOMIC_SMIN : FLAT_Real_Atomics_vi <0x44, FLAT_ATOMIC_SMIN>;
1038 defm FLAT_ATOMIC_UMIN : FLAT_Real_Atomics_vi <0x45, FLAT_ATOMIC_UMIN>;
1039 defm FLAT_ATOMIC_SMAX : FLAT_Real_Atomics_vi <0x46, FLAT_ATOMIC_SMAX>;
1040 defm FLAT_ATOMIC_UMAX : FLAT_Real_Atomics_vi <0x47, FLAT_ATOMIC_UMAX>;
1041 defm FLAT_ATOMIC_AND : FLAT_Real_Atomics_vi <0x48, FLAT_ATOMIC_AND>;
1042 defm FLAT_ATOMIC_OR : FLAT_Real_Atomics_vi <0x49, FLAT_ATOMIC_OR>;
1043 defm FLAT_ATOMIC_XOR : FLAT_Real_Atomics_vi <0x4a, FLAT_ATOMIC_XOR>;
1044 defm FLAT_ATOMIC_INC : FLAT_Real_Atomics_vi <0x4b, FLAT_ATOMIC_INC>;
1045 defm FLAT_ATOMIC_DEC : FLAT_Real_Atomics_vi <0x4c, FLAT_ATOMIC_DEC>;
1046 defm FLAT_ATOMIC_SWAP_X2 : FLAT_Real_Atomics_vi <0x60, FLAT_ATOMIC_SWAP_X2>;
1047 defm FLAT_ATOMIC_CMPSWAP_X2 : FLAT_Real_Atomics_vi <0x61, FLAT_ATOMIC_CMPSWAP_X2>;
1048 defm FLAT_ATOMIC_ADD_X2 : FLAT_Real_Atomics_vi <0x62, FLAT_ATOMIC_ADD_X2>;
1049 defm FLAT_ATOMIC_SUB_X2 : FLAT_Real_Atomics_vi <0x63, FLAT_ATOMIC_SUB_X2>;
1050 defm FLAT_ATOMIC_SMIN_X2 : FLAT_Real_Atomics_vi <0x64, FLAT_ATOMIC_SMIN_X2>;
1051 defm FLAT_ATOMIC_UMIN_X2 : FLAT_Real_Atomics_vi <0x65, FLAT_ATOMIC_UMIN_X2>;
1052 defm FLAT_ATOMIC_SMAX_X2 : FLAT_Real_Atomics_vi <0x66, FLAT_ATOMIC_SMAX_X2>;
1053 defm FLAT_ATOMIC_UMAX_X2 : FLAT_Real_Atomics_vi <0x67, FLAT_ATOMIC_UMAX_X2>;
1054 defm FLAT_ATOMIC_AND_X2 : FLAT_Real_Atomics_vi <0x68, FLAT_ATOMIC_AND_X2>;
1055 defm FLAT_ATOMIC_OR_X2 : FLAT_Real_Atomics_vi <0x69, FLAT_ATOMIC_OR_X2>;
1056 defm FLAT_ATOMIC_XOR_X2 : FLAT_Real_Atomics_vi <0x6a, FLAT_ATOMIC_XOR_X2>;
1057 defm FLAT_ATOMIC_INC_X2 : FLAT_Real_Atomics_vi <0x6b, FLAT_ATOMIC_INC_X2>;
1058 defm FLAT_ATOMIC_DEC_X2 : FLAT_Real_Atomics_vi <0x6c, FLAT_ATOMIC_DEC_X2>;
1060 defm GLOBAL_LOAD_UBYTE : FLAT_Real_AllAddr_vi <0x10>;
1061 defm GLOBAL_LOAD_SBYTE : FLAT_Real_AllAddr_vi <0x11>;
1062 defm GLOBAL_LOAD_USHORT : FLAT_Real_AllAddr_vi <0x12>;
1063 defm GLOBAL_LOAD_SSHORT : FLAT_Real_AllAddr_vi <0x13>;
1064 defm GLOBAL_LOAD_DWORD : FLAT_Real_AllAddr_vi <0x14>;
1065 defm GLOBAL_LOAD_DWORDX2 : FLAT_Real_AllAddr_vi <0x15>;
1066 defm GLOBAL_LOAD_DWORDX3 : FLAT_Real_AllAddr_vi <0x16>;
1067 defm GLOBAL_LOAD_DWORDX4 : FLAT_Real_AllAddr_vi <0x17>;
1069 defm GLOBAL_LOAD_UBYTE_D16 : FLAT_Real_AllAddr_vi <0x20>;
1070 defm GLOBAL_LOAD_UBYTE_D16_HI : FLAT_Real_AllAddr_vi <0x21>;
1071 defm GLOBAL_LOAD_SBYTE_D16 : FLAT_Real_AllAddr_vi <0x22>;
1072 defm GLOBAL_LOAD_SBYTE_D16_HI : FLAT_Real_AllAddr_vi <0x23>;
1073 defm GLOBAL_LOAD_SHORT_D16 : FLAT_Real_AllAddr_vi <0x24>;
1074 defm GLOBAL_LOAD_SHORT_D16_HI : FLAT_Real_AllAddr_vi <0x25>;
1076 defm GLOBAL_STORE_BYTE : FLAT_Real_AllAddr_vi <0x18>;
1077 defm GLOBAL_STORE_BYTE_D16_HI : FLAT_Real_AllAddr_vi <0x19>;
1078 defm GLOBAL_STORE_SHORT : FLAT_Real_AllAddr_vi <0x1a>;
1079 defm GLOBAL_STORE_SHORT_D16_HI : FLAT_Real_AllAddr_vi <0x1b>;
1080 defm GLOBAL_STORE_DWORD : FLAT_Real_AllAddr_vi <0x1c>;
1081 defm GLOBAL_STORE_DWORDX2 : FLAT_Real_AllAddr_vi <0x1d>;
1082 defm GLOBAL_STORE_DWORDX3 : FLAT_Real_AllAddr_vi <0x1e>;
1083 defm GLOBAL_STORE_DWORDX4 : FLAT_Real_AllAddr_vi <0x1f>;
1086 defm GLOBAL_ATOMIC_SWAP : FLAT_Global_Real_Atomics_vi <0x40>;
1087 defm GLOBAL_ATOMIC_CMPSWAP : FLAT_Global_Real_Atomics_vi <0x41>;
1088 defm GLOBAL_ATOMIC_ADD : FLAT_Global_Real_Atomics_vi <0x42>;
1089 defm GLOBAL_ATOMIC_SUB : FLAT_Global_Real_Atomics_vi <0x43>;
1090 defm GLOBAL_ATOMIC_SMIN : FLAT_Global_Real_Atomics_vi <0x44>;
1091 defm GLOBAL_ATOMIC_UMIN : FLAT_Global_Real_Atomics_vi <0x45>;
1092 defm GLOBAL_ATOMIC_SMAX : FLAT_Global_Real_Atomics_vi <0x46>;
1093 defm GLOBAL_ATOMIC_UMAX : FLAT_Global_Real_Atomics_vi <0x47>;
1094 defm GLOBAL_ATOMIC_AND : FLAT_Global_Real_Atomics_vi <0x48>;
1095 defm GLOBAL_ATOMIC_OR : FLAT_Global_Real_Atomics_vi <0x49>;
1096 defm GLOBAL_ATOMIC_XOR : FLAT_Global_Real_Atomics_vi <0x4a>;
1097 defm GLOBAL_ATOMIC_INC : FLAT_Global_Real_Atomics_vi <0x4b>;
1098 defm GLOBAL_ATOMIC_DEC : FLAT_Global_Real_Atomics_vi <0x4c>;
1099 defm GLOBAL_ATOMIC_SWAP_X2 : FLAT_Global_Real_Atomics_vi <0x60>;
1100 defm GLOBAL_ATOMIC_CMPSWAP_X2 : FLAT_Global_Real_Atomics_vi <0x61>;
1101 defm GLOBAL_ATOMIC_ADD_X2 : FLAT_Global_Real_Atomics_vi <0x62>;
1102 defm GLOBAL_ATOMIC_SUB_X2 : FLAT_Global_Real_Atomics_vi <0x63>;
1103 defm GLOBAL_ATOMIC_SMIN_X2 : FLAT_Global_Real_Atomics_vi <0x64>;
1104 defm GLOBAL_ATOMIC_UMIN_X2 : FLAT_Global_Real_Atomics_vi <0x65>;
1105 defm GLOBAL_ATOMIC_SMAX_X2 : FLAT_Global_Real_Atomics_vi <0x66>;
1106 defm GLOBAL_ATOMIC_UMAX_X2 : FLAT_Global_Real_Atomics_vi <0x67>;
1107 defm GLOBAL_ATOMIC_AND_X2 : FLAT_Global_Real_Atomics_vi <0x68>;
1108 defm GLOBAL_ATOMIC_OR_X2 : FLAT_Global_Real_Atomics_vi <0x69>;
1109 defm GLOBAL_ATOMIC_XOR_X2 : FLAT_Global_Real_Atomics_vi <0x6a>;
1110 defm GLOBAL_ATOMIC_INC_X2 : FLAT_Global_Real_Atomics_vi <0x6b>;
1111 defm GLOBAL_ATOMIC_DEC_X2 : FLAT_Global_Real_Atomics_vi <0x6c>;
1113 defm SCRATCH_LOAD_UBYTE : FLAT_Real_AllAddr_vi <0x10>;
1114 defm SCRATCH_LOAD_SBYTE : FLAT_Real_AllAddr_vi <0x11>;
1115 defm SCRATCH_LOAD_USHORT : FLAT_Real_AllAddr_vi <0x12>;
1116 defm SCRATCH_LOAD_SSHORT : FLAT_Real_AllAddr_vi <0x13>;
1117 defm SCRATCH_LOAD_DWORD : FLAT_Real_AllAddr_vi <0x14>;
1118 defm SCRATCH_LOAD_DWORDX2 : FLAT_Real_AllAddr_vi <0x15>;
1119 defm SCRATCH_LOAD_DWORDX3 : FLAT_Real_AllAddr_vi <0x16>;
1120 defm SCRATCH_LOAD_DWORDX4 : FLAT_Real_AllAddr_vi <0x17>;
1121 defm SCRATCH_STORE_BYTE : FLAT_Real_AllAddr_vi <0x18>;
1122 defm SCRATCH_STORE_BYTE_D16_HI : FLAT_Real_AllAddr_vi <0x19>;
1123 defm SCRATCH_LOAD_UBYTE_D16 : FLAT_Real_AllAddr_vi <0x20>;
1124 defm SCRATCH_LOAD_UBYTE_D16_HI : FLAT_Real_AllAddr_vi <0x21>;
1125 defm SCRATCH_LOAD_SBYTE_D16 : FLAT_Real_AllAddr_vi <0x22>;
1126 defm SCRATCH_LOAD_SBYTE_D16_HI : FLAT_Real_AllAddr_vi <0x23>;
1127 defm SCRATCH_LOAD_SHORT_D16 : FLAT_Real_AllAddr_vi <0x24>;
1128 defm SCRATCH_LOAD_SHORT_D16_HI : FLAT_Real_AllAddr_vi <0x25>;
1129 defm SCRATCH_STORE_SHORT : FLAT_Real_AllAddr_vi <0x1a>;
1130 defm SCRATCH_STORE_SHORT_D16_HI : FLAT_Real_AllAddr_vi <0x1b>;
1131 defm SCRATCH_STORE_DWORD : FLAT_Real_AllAddr_vi <0x1c>;
1132 defm SCRATCH_STORE_DWORDX2 : FLAT_Real_AllAddr_vi <0x1d>;
1133 defm SCRATCH_STORE_DWORDX3 : FLAT_Real_AllAddr_vi <0x1e>;
1134 defm SCRATCH_STORE_DWORDX4 : FLAT_Real_AllAddr_vi <0x1f>;