Index: lib/Target/AMDGPU/MIMGInstructions.td =================================================================== --- lib/Target/AMDGPU/MIMGInstructions.td +++ lib/Target/AMDGPU/MIMGInstructions.td @@ -98,12 +98,13 @@ } class MIMG_Atomic_Helper : MIMG_Helper < + RegisterClass addr_rc, string dns=""> : MIMG_Helper < (outs data_rc:$vdst), (ins data_rc:$vdata, addr_rc:$vaddr, SReg_256:$srsrc, dmask:$dmask, unorm:$unorm, GLC:$glc, slc:$slc, r128:$r128, tfe:$tfe, lwe:$lwe, da:$da), - asm#" $vdst, $vaddr, $srsrc$dmask$unorm$glc$slc$r128$tfe$lwe$da"> { + asm#" $vdst, $vaddr, $srsrc$dmask$unorm$glc$slc$r128$tfe$lwe$da", + !if(!eq(addr_rc.Size, 32), dns, "")> { let mayLoad = 1; let mayStore = 1; let hasSideEffects = 1; // FIXME: Remove this @@ -115,23 +116,21 @@ class MIMG_Atomic_Real_si : - MIMG_Atomic_Helper, + MIMG_Atomic_Helper, SIMCInstr, MIMGe { let isCodeGenOnly = 0; let AssemblerPredicates = [isSICI]; - let DecoderNamespace = "SICI"; let DisableDecoder = DisableSIDecoder; } class MIMG_Atomic_Real_vi : - MIMG_Atomic_Helper, + MIMG_Atomic_Helper, SIMCInstr, MIMGe { let isCodeGenOnly = 0; let AssemblerPredicates = [isVI]; - let DecoderNamespace = "VI"; let DisableDecoder = DisableVIDecoder; } Index: test/MC/Disassembler/AMDGPU/mimg_vi.txt =================================================================== --- test/MC/Disassembler/AMDGPU/mimg_vi.txt +++ test/MC/Disassembler/AMDGPU/mimg_vi.txt @@ -1,5 +1,9 @@ # RUN: llvm-mc -arch=amdgcn -mcpu=tonga -disassemble -show-encoding < %s | FileCheck -check-prefix=VI %s +#===------------------------------------------------------------------------===# +# Image load/store +#===------------------------------------------------------------------------===# + # VI: image_load v[0:3], v4, s[8:15] dmask:0xf unorm ; encoding: [0x00,0x1f,0x00,0xf0,0x04,0x00,0x02,0x00] 0x00 0x1f 0x00 0xf0 0x04 0x00 0x02 0x00 @@ -37,3 +41,31 @@ # VI: image_load v255, v0, s[0:7] dmask:0x3 unorm ; encoding: [0x00,0x13,0x00,0xf0,0x00,0xff,0x00,0x00] 0x00 0x13 0x00 0xf0 0x00 0xff 0x00 0x00 + +#===------------------------------------------------------------------------===# +# Image atomics +#===------------------------------------------------------------------------===# + +# VI: image_atomic_add v5, v1, s[8:15] dmask:0x1 unorm ; encoding: [0x00,0x11,0x48,0xf0,0x01,0x05,0x02,0x00] +0x00,0x11,0x48,0xf0,0x01,0x05,0x02,0x00 + +# VI: image_atomic_add v252, v1, s[8:15] dmask:0x1 unorm ; encoding: [0x00,0x11,0x48,0xf0,0x01,0xfc,0x02,0x00] +0x00,0x11,0x48,0xf0,0x01,0xfc,0x02,0x00 + +# VI: image_atomic_add v5, v255, s[8:15] dmask:0x1 unorm ; encoding: [0x00,0x11,0x48,0xf0,0xff,0x05,0x02,0x00] +0x00,0x11,0x48,0xf0,0xff,0x05,0x02,0x00 + +# VI: image_atomic_add v5, v1, s[92:99] dmask:0x1 unorm ; encoding: [0x00,0x11,0x48,0xf0,0x01,0x05,0x17,0x00] +0x00,0x11,0x48,0xf0,0x01,0x05,0x17,0x00 + +# VI: image_atomic_add v5, v1, s[8:15] dmask:0x1 unorm glc ; encoding: [0x00,0x31,0x48,0xf0,0x01,0x05,0x02,0x00] +0x00,0x31,0x48,0xf0,0x01,0x05,0x02,0x00 + +# VI: image_atomic_add v5, v1, s[8:15] dmask:0x1 unorm slc ; encoding: [0x00,0x11,0x48,0xf2,0x01,0x05,0x02,0x00] +0x00,0x11,0x48,0xf2,0x01,0x05,0x02,0x00 + +# VI: image_atomic_add v5, v1, s[8:15] dmask:0x1 unorm lwe ; encoding: [0x00,0x11,0x4a,0xf0,0x01,0x05,0x02,0x00] +0x00,0x11,0x4a,0xf0,0x01,0x05,0x02,0x00 + +# VI: image_atomic_add v5, v1, s[8:15] dmask:0x1 unorm da ; encoding: [0x00,0x51,0x48,0xf0,0x01,0x05,0x02,0x00] +0x00,0x51,0x48,0xf0,0x01,0x05,0x02,0x00