Index: llvm/lib/Target/AMDGPU/AMDGPU.td =================================================================== --- llvm/lib/Target/AMDGPU/AMDGPU.td +++ llvm/lib/Target/AMDGPU/AMDGPU.td @@ -1137,6 +1137,9 @@ def HasD16LoadStore : Predicate<"Subtarget->hasD16LoadStore()">, AssemblerPredicate<(all_of FeatureGFX9Insts)>; +def HasFlatScratchSTMode : Predicate<"Subtarget->hasFlatScratchSTMode()">, + AssemblerPredicate<(all_of FeatureGFX10Insts)>; + def HasGFX10_BEncoding : Predicate<"Subtarget->hasGFX10_BEncoding()">, AssemblerPredicate<(all_of FeatureGFX10_BEncoding)>; Index: llvm/lib/Target/AMDGPU/AMDGPUSubtarget.h =================================================================== --- llvm/lib/Target/AMDGPU/AMDGPUSubtarget.h +++ llvm/lib/Target/AMDGPU/AMDGPUSubtarget.h @@ -750,6 +750,10 @@ return FlatScratchInsts; } + bool hasFlatScratchSTMode() const { + return hasFlatScratchInsts() && hasGFX10Insts(); + } + bool hasScalarFlatScratchInsts() const { return ScalarFlatScratchInsts; } @@ -1105,6 +1109,8 @@ bool hasHardClauses() const { return getGeneration() >= GFX10; } + bool hasGFX10Insts() const { return GFX10Insts; } + /// Return the maximum number of waves per SIMD for kernels using \p SGPRs /// SGPRs unsigned getOccupancyWithNumSGPRs(unsigned SGPRs) const; Index: llvm/lib/Target/AMDGPU/FLATInstructions.td =================================================================== --- llvm/lib/Target/AMDGPU/FLATInstructions.td +++ llvm/lib/Target/AMDGPU/FLATInstructions.td @@ -235,42 +235,49 @@ class FLAT_Scratch_Load_Pseudo : FLAT_Pseudo< + bit EnableSaddr = 0, + bit EnableVaddr = !if(EnableSaddr, 0, 1)> + : FLAT_Pseudo< opName, (outs regClass:$vdst), !con( - !if(EnableSaddr, - (ins SReg_32_XEXEC_HI:$saddr, flat_offset:$offset), - (ins VGPR_32:$vaddr, flat_offset:$offset)), - !if(HasTiedOutput, (ins GLC:$glc, SLC:$slc, DLC:$dlc, regClass:$vdst_in), - (ins GLC_0:$glc, SLC_0:$slc, DLC_0:$dlc))), - " $vdst, "#!if(EnableSaddr, "off", "$vaddr")#!if(EnableSaddr, ", $saddr", ", off")#"$offset$glc$slc$dlc"> { + !if(EnableSaddr, + (ins SReg_32_XEXEC_HI:$saddr, flat_offset:$offset), + !if(EnableVaddr, + (ins VGPR_32:$vaddr, flat_offset:$offset), + (ins flat_offset:$offset))), + !if(HasTiedOutput, (ins GLC:$glc, SLC:$slc, DLC:$dlc, regClass:$vdst_in), + (ins GLC_0:$glc, SLC_0:$slc, DLC_0:$dlc))), + " $vdst, "#!if(EnableVaddr, "$vaddr, ", "off, ")#!if(EnableSaddr, "$saddr", "off")#"$offset$glc$slc$dlc"> { let has_data = 0; let mayLoad = 1; let has_saddr = 1; let enabled_saddr = EnableSaddr; - let has_vaddr = !if(EnableSaddr, 0, 1); - let PseudoInstr = opName#!if(EnableSaddr, "_SADDR", ""); + let has_vaddr = EnableVaddr; + let PseudoInstr = opName#!if(EnableSaddr, "_SADDR", !if(EnableVaddr, "", "_ST")); let maybeAtomic = 1; let Constraints = !if(HasTiedOutput, "$vdst = $vdst_in", ""); let DisableEncoding = !if(HasTiedOutput, "$vdst_in", ""); } -class FLAT_Scratch_Store_Pseudo : FLAT_Pseudo< +class FLAT_Scratch_Store_Pseudo : FLAT_Pseudo< opName, (outs), !if(EnableSaddr, (ins vdataClass:$vdata, SReg_32_XEXEC_HI:$saddr, flat_offset:$offset, GLC_0:$glc, SLC_0:$slc, DLC_0:$dlc), - (ins vdataClass:$vdata, VGPR_32:$vaddr, flat_offset:$offset, GLC_0:$glc, SLC_0:$slc, DLC_0:$dlc)), - " "#!if(EnableSaddr, "off", "$vaddr")#", $vdata, "#!if(EnableSaddr, "$saddr", "off")#"$offset$glc$slc$dlc"> { + !if(EnableVaddr, + (ins vdataClass:$vdata, VGPR_32:$vaddr, flat_offset:$offset, GLC_0:$glc, SLC_0:$slc, DLC_0:$dlc), + (ins vdataClass:$vdata, flat_offset:$offset, GLC_0:$glc, SLC_0:$slc, DLC_0:$dlc))), + " "#!if(EnableVaddr, "$vaddr", "off")#", $vdata, "#!if(EnableSaddr, "$saddr", "off")#"$offset$glc$slc$dlc"> { let mayLoad = 0; let mayStore = 1; let has_vdst = 0; let has_saddr = 1; let enabled_saddr = EnableSaddr; - let has_vaddr = !if(EnableSaddr, 0, 1); - let PseudoInstr = opName#!if(EnableSaddr, "_SADDR", ""); + let has_vaddr = EnableVaddr; + let PseudoInstr = opName#!if(EnableSaddr, "_SADDR", !if(EnableVaddr, "", "_ST")); let maybeAtomic = 1; } @@ -278,6 +285,9 @@ let is_flat_scratch = 1 in { def "" : FLAT_Scratch_Load_Pseudo; def _SADDR : FLAT_Scratch_Load_Pseudo; + + let SubtargetPredicate = HasFlatScratchSTMode in + def _ST : FLAT_Scratch_Load_Pseudo; } } @@ -285,6 +295,9 @@ let is_flat_scratch = 1 in { def "" : FLAT_Scratch_Store_Pseudo; def _SADDR : FLAT_Scratch_Store_Pseudo; + + let SubtargetPredicate = HasFlatScratchSTMode in + def _ST : FLAT_Scratch_Store_Pseudo; } } @@ -1362,6 +1375,12 @@ FLAT_Real_gfx10(NAME#"_SADDR_RTN")>; } +multiclass FLAT_Real_ST_gfx10 op> { + def _ST_gfx10 : + FLAT_Real_gfx10(NAME#"_ST")> { + let Inst{54-48} = !cast(EXEC_HI.HWEncoding); + } +} multiclass FLAT_Real_AllAddr_gfx10 op> : FLAT_Real_Base_gfx10, @@ -1380,6 +1399,11 @@ FLAT_Real_RTN_gfx10, FLAT_Real_SADDR_RTN_gfx10; +multiclass FLAT_Real_ScratchAllAddr_gfx10 op> : + FLAT_Real_Base_gfx10, + FLAT_Real_SADDR_gfx10, + FLAT_Real_ST_gfx10; + // ENC_FLAT. defm FLAT_LOAD_UBYTE : FLAT_Real_Base_gfx10<0x008>; defm FLAT_LOAD_SBYTE : FLAT_Real_Base_gfx10<0x009>; @@ -1497,28 +1521,28 @@ defm GLOBAL_STORE_DWORD_ADDTID : FLAT_Real_Base_gfx10<0x017>; // ENC_FLAT_SCRATCH. -defm SCRATCH_LOAD_UBYTE : FLAT_Real_AllAddr_gfx10<0x008>; -defm SCRATCH_LOAD_SBYTE : FLAT_Real_AllAddr_gfx10<0x009>; -defm SCRATCH_LOAD_USHORT : FLAT_Real_AllAddr_gfx10<0x00a>; -defm SCRATCH_LOAD_SSHORT : FLAT_Real_AllAddr_gfx10<0x00b>; -defm SCRATCH_LOAD_DWORD : FLAT_Real_AllAddr_gfx10<0x00c>; -defm SCRATCH_LOAD_DWORDX2 : FLAT_Real_AllAddr_gfx10<0x00d>; -defm SCRATCH_LOAD_DWORDX4 : FLAT_Real_AllAddr_gfx10<0x00e>; -defm SCRATCH_LOAD_DWORDX3 : FLAT_Real_AllAddr_gfx10<0x00f>; -defm SCRATCH_STORE_BYTE : FLAT_Real_AllAddr_gfx10<0x018>; -defm SCRATCH_STORE_BYTE_D16_HI : FLAT_Real_AllAddr_gfx10<0x019>; -defm SCRATCH_STORE_SHORT : FLAT_Real_AllAddr_gfx10<0x01a>; -defm SCRATCH_STORE_SHORT_D16_HI : FLAT_Real_AllAddr_gfx10<0x01b>; -defm SCRATCH_STORE_DWORD : FLAT_Real_AllAddr_gfx10<0x01c>; -defm SCRATCH_STORE_DWORDX2 : FLAT_Real_AllAddr_gfx10<0x01d>; -defm SCRATCH_STORE_DWORDX4 : FLAT_Real_AllAddr_gfx10<0x01e>; -defm SCRATCH_STORE_DWORDX3 : FLAT_Real_AllAddr_gfx10<0x01f>; -defm SCRATCH_LOAD_UBYTE_D16 : FLAT_Real_AllAddr_gfx10<0x020>; -defm SCRATCH_LOAD_UBYTE_D16_HI : FLAT_Real_AllAddr_gfx10<0x021>; -defm SCRATCH_LOAD_SBYTE_D16 : FLAT_Real_AllAddr_gfx10<0x022>; -defm SCRATCH_LOAD_SBYTE_D16_HI : FLAT_Real_AllAddr_gfx10<0x023>; -defm SCRATCH_LOAD_SHORT_D16 : FLAT_Real_AllAddr_gfx10<0x024>; -defm SCRATCH_LOAD_SHORT_D16_HI : FLAT_Real_AllAddr_gfx10<0x025>; +defm SCRATCH_LOAD_UBYTE : FLAT_Real_ScratchAllAddr_gfx10<0x008>; +defm SCRATCH_LOAD_SBYTE : FLAT_Real_ScratchAllAddr_gfx10<0x009>; +defm SCRATCH_LOAD_USHORT : FLAT_Real_ScratchAllAddr_gfx10<0x00a>; +defm SCRATCH_LOAD_SSHORT : FLAT_Real_ScratchAllAddr_gfx10<0x00b>; +defm SCRATCH_LOAD_DWORD : FLAT_Real_ScratchAllAddr_gfx10<0x00c>; +defm SCRATCH_LOAD_DWORDX2 : FLAT_Real_ScratchAllAddr_gfx10<0x00d>; +defm SCRATCH_LOAD_DWORDX4 : FLAT_Real_ScratchAllAddr_gfx10<0x00e>; +defm SCRATCH_LOAD_DWORDX3 : FLAT_Real_ScratchAllAddr_gfx10<0x00f>; +defm SCRATCH_STORE_BYTE : FLAT_Real_ScratchAllAddr_gfx10<0x018>; +defm SCRATCH_STORE_BYTE_D16_HI : FLAT_Real_ScratchAllAddr_gfx10<0x019>; +defm SCRATCH_STORE_SHORT : FLAT_Real_ScratchAllAddr_gfx10<0x01a>; +defm SCRATCH_STORE_SHORT_D16_HI : FLAT_Real_ScratchAllAddr_gfx10<0x01b>; +defm SCRATCH_STORE_DWORD : FLAT_Real_ScratchAllAddr_gfx10<0x01c>; +defm SCRATCH_STORE_DWORDX2 : FLAT_Real_ScratchAllAddr_gfx10<0x01d>; +defm SCRATCH_STORE_DWORDX4 : FLAT_Real_ScratchAllAddr_gfx10<0x01e>; +defm SCRATCH_STORE_DWORDX3 : FLAT_Real_ScratchAllAddr_gfx10<0x01f>; +defm SCRATCH_LOAD_UBYTE_D16 : FLAT_Real_ScratchAllAddr_gfx10<0x020>; +defm SCRATCH_LOAD_UBYTE_D16_HI : FLAT_Real_ScratchAllAddr_gfx10<0x021>; +defm SCRATCH_LOAD_SBYTE_D16 : FLAT_Real_ScratchAllAddr_gfx10<0x022>; +defm SCRATCH_LOAD_SBYTE_D16_HI : FLAT_Real_ScratchAllAddr_gfx10<0x023>; +defm SCRATCH_LOAD_SHORT_D16 : FLAT_Real_ScratchAllAddr_gfx10<0x024>; +defm SCRATCH_LOAD_SHORT_D16_HI : FLAT_Real_ScratchAllAddr_gfx10<0x025>; let SubtargetPredicate = HasAtomicFaddInsts in { Index: llvm/test/MC/AMDGPU/flat-scratch-instructions.s =================================================================== --- llvm/test/MC/AMDGPU/flat-scratch-instructions.s +++ llvm/test/MC/AMDGPU/flat-scratch-instructions.s @@ -15,6 +15,11 @@ // GFX9-ERR: error: failed parsing operand // VI-ERR: error: instruction not supported on this GPU +scratch_load_ubyte v1, off, off +// GFX10: encoding: [0x00,0x40,0x20,0xdc,0x00,0x00,0x7f,0x01] +// GFX9-ERR: error: operands are not valid for this GPU or mode +// VI-ERR: error: instruction not supported on this GPU + scratch_load_sbyte v1, v2, off // GFX10: encoding: [0x00,0x40,0x24,0xdc,0x02,0x00,0x7d,0x01] // GFX9: scratch_load_sbyte v1, v2, off ; encoding: [0x00,0x40,0x44,0xdc,0x02,0x00,0x7f,0x01] @@ -25,6 +30,11 @@ // GFX9-ERR: error: failed parsing operand // VI-ERR: error: instruction not supported on this GPU +scratch_load_sbyte v1, off, off +// GFX10: encoding: [0x00,0x40,0x24,0xdc,0x00,0x00,0x7f,0x01] +// GFX9-ERR: error: operands are not valid for this GPU or mode +// VI-ERR: error: instruction not supported on this GPU + scratch_load_ushort v1, v2, off // GFX10: encoding: [0x00,0x40,0x28,0xdc,0x02,0x00,0x7d,0x01] // GFX9: scratch_load_ushort v1, v2, off ; encoding: [0x00,0x40,0x48,0xdc,0x02,0x00,0x7f,0x01] @@ -35,6 +45,11 @@ // GFX9-ERR: error: failed parsing operand // VI-ERR: error: instruction not supported on this GPU +scratch_load_ushort v1, off, off +// GFX10: encoding: [0x00,0x40,0x28,0xdc,0x00,0x00,0x7f,0x01] +// GFX9-ERR: error: operands are not valid for this GPU or mode +// VI-ERR: error: instruction not supported on this GPU + scratch_load_sshort v1, v2, off // GFX10: encoding: [0x00,0x40,0x2c,0xdc,0x02,0x00,0x7d,0x01] // GFX9: scratch_load_sshort v1, v2, off ; encoding: [0x00,0x40,0x4c,0xdc,0x02,0x00,0x7f,0x01] @@ -45,6 +60,11 @@ // GFX9-ERR: error: failed parsing operand // VI-ERR: error: instruction not supported on this GPU +scratch_load_sshort v1, off, off +// GFX10: encoding: [0x00,0x40,0x2c,0xdc,0x00,0x00,0x7f,0x01] +// GFX9-ERR: error: operands are not valid for this GPU or mode +// VI-ERR: error: instruction not supported on this GPU + scratch_load_dword v1, v2, off // GFX10: encoding: [0x00,0x40,0x30,0xdc,0x02,0x00,0x7d,0x01] // GFX9: scratch_load_dword v1, v2, off ; encoding: [0x00,0x40,0x50,0xdc,0x02,0x00,0x7f,0x01] @@ -55,6 +75,11 @@ // GFX9-ERR: error: failed parsing operand // VI-ERR: error: instruction not supported on this GPU +scratch_load_dword v1, off, off +// GFX10: encoding: [0x00,0x40,0x30,0xdc,0x00,0x00,0x7f,0x01] +// GFX9-ERR: error: operands are not valid for this GPU or mode +// VI-ERR: error: instruction not supported on this GPU + scratch_load_dwordx2 v[1:2], v3, off // GFX10: encoding: [0x00,0x40,0x34,0xdc,0x03,0x00,0x7d,0x01] // GFX9: scratch_load_dwordx2 v[1:2], v3, off ; encoding: [0x00,0x40,0x54,0xdc,0x03,0x00,0x7f,0x01] @@ -65,6 +90,11 @@ // GFX9-ERR: error: failed parsing operand // VI-ERR: error: instruction not supported on this GPU +scratch_load_dwordx2 v[1:2], off, off +// GFX10: encoding: [0x00,0x40,0x34,0xdc,0x00,0x00,0x7f,0x01] +// GFX9-ERR: error: operands are not valid for this GPU or mode +// VI-ERR: error: instruction not supported on this GPU + scratch_load_dwordx3 v[1:3], v4, off // GFX10: encoding: [0x00,0x40,0x3c,0xdc,0x04,0x00,0x7d,0x01] // GFX9: scratch_load_dwordx3 v[1:3], v4, off ; encoding: [0x00,0x40,0x58,0xdc,0x04,0x00,0x7f,0x01] @@ -75,6 +105,11 @@ // GFX9-ERR: error: failed parsing operand // VI-ERR: error: instruction not supported on this GPU +scratch_load_dwordx3 v[1:3], off, off +// GFX10: encoding: [0x00,0x40,0x3c,0xdc,0x00,0x00,0x7f,0x01] +// GFX9-ERR: error: operands are not valid for this GPU or mode +// VI-ERR: error: instruction not supported on this GPU + scratch_load_dwordx4 v[1:4], v5, off // GFX10: encoding: [0x00,0x40,0x38,0xdc,0x05,0x00,0x7d,0x01] // GFX9: scratch_load_dwordx4 v[1:4], v5, off ; encoding: [0x00,0x40,0x5c,0xdc,0x05,0x00,0x7f,0x01] @@ -85,6 +120,11 @@ // GFX9-ERR: error: failed parsing operand // VI-ERR: error: instruction not supported on this GPU +scratch_load_dwordx4 v[1:4], off, off +// GFX10: encoding: [0x00,0x40,0x38,0xdc,0x00,0x00,0x7f,0x01] +// GFX9-ERR: error: operands are not valid for this GPU or mode +// VI-ERR: error: instruction not supported on this GPU + scratch_load_dword v1, v2, off offset:0 // GFX10: encoding: [0x00,0x40,0x30,0xdc,0x02,0x00,0x7d,0x01] // GFX9: scratch_load_dword v1, v2, off ; encoding: [0x00,0x40,0x50,0xdc,0x02,0x00,0x7f,0x01] @@ -135,6 +175,11 @@ // GFX9: scratch_load_dword v255, off, s0 offset:2048 ; encoding: [0x00,0x48,0x50,0xdc,0x00,0x00,0x00,0xff] // VI-ERR: :1: error: instruction not supported on this GPU +scratch_load_dword v1, off, off offset:2047 +// GFX10: scratch_load_dword v1, off, off offset:2047 ; encoding: [0xff,0x47,0x30,0xdc,0x00,0x00,0x7f,0x01] +// GFX9-ERR: error: operands are not valid for this GPU or mode +// VI-ERR: error: instruction not supported on this GPU + scratch_store_byte v1, v2, off // GFX10: encoding: [0x00,0x40,0x60,0xdc,0x01,0x02,0x7d,0x00] // GFX9: scratch_store_byte v1, v2, off ; encoding: [0x00,0x40,0x60,0xdc,0x01,0x02,0x7f,0x00] @@ -145,6 +190,11 @@ // GFX9-ERR: error: failed parsing operand // VI-ERR: error: instruction not supported on this GPU +scratch_store_byte off, v2, off +// GFX10: encoding: [0x00,0x40,0x60,0xdc,0x00,0x02,0x7f,0x00] +// GFX9-ERR: error: operands are not valid for this GPU or mode +// VI-ERR: error: instruction not supported on this GPU + scratch_store_short v1, v2, off // GFX10: encoding: [0x00,0x40,0x68,0xdc,0x01,0x02,0x7d,0x00] // GFX9: scratch_store_short v1, v2, off ; encoding: [0x00,0x40,0x68,0xdc,0x01,0x02,0x7f,0x00] @@ -155,6 +205,11 @@ // GFX9-ERR: error: failed parsing operand // VI-ERR: error: instruction not supported on this GPU +scratch_store_short off, v2, off +// GFX10: encoding: [0x00,0x40,0x68,0xdc,0x00,0x02,0x7f,0x00] +// GFX9-ERR: error: operands are not valid for this GPU or mode +// VI-ERR: error: instruction not supported on this GPU + scratch_store_dword v1, v2, off // GFX10: encoding: [0x00,0x40,0x70,0xdc,0x01,0x02,0x7d,0x00] // GFX9: scratch_store_dword v1, v2, off ; encoding: [0x00,0x40,0x70,0xdc,0x01,0x02,0x7f,0x00] @@ -165,6 +220,11 @@ // GFX9-ERR: error: failed parsing operand // VI-ERR: error: instruction not supported on this GPU +scratch_store_dword off, v2, off +// GFX10: encoding: [0x00,0x40,0x70,0xdc,0x00,0x02,0x7f,0x00] +// GFX9-ERR: error: operands are not valid for this GPU or mode +// VI-ERR: error: instruction not supported on this GPU + scratch_store_dwordx2 v1, v[2:3], off // GFX10: encoding: [0x00,0x40,0x74,0xdc,0x01,0x02,0x7d,0x00] // GFX9: scratch_store_dwordx2 v1, v[2:3], off ; encoding: [0x00,0x40,0x74,0xdc,0x01,0x02,0x7f,0x00] @@ -175,6 +235,11 @@ // GFX9-ERR: error: failed parsing operand // VI-ERR: error: instruction not supported on this GPU +scratch_store_dwordx2 off, v[2:3], off +// GFX10: encoding: [0x00,0x40,0x74,0xdc,0x00,0x02,0x7f,0x00] +// GFX9-ERR: error: operands are not valid for this GPU or mode +// VI-ERR: error: instruction not supported on this GPU + scratch_store_dwordx3 v1, v[2:4], off // GFX10: encoding: [0x00,0x40,0x7c,0xdc,0x01,0x02,0x7d,0x00] // GFX9: scratch_store_dwordx3 v1, v[2:4], off ; encoding: [0x00,0x40,0x78,0xdc,0x01,0x02,0x7f,0x00] @@ -185,6 +250,11 @@ // GFX9-ERR: error: failed parsing operand // VI-ERR: error: instruction not supported on this GPU +scratch_store_dwordx3 off, v[2:4], off +// GFX10: encoding: [0x00,0x40,0x7c,0xdc,0x00,0x02,0x7f,0x00] +// GFX9-ERR: error: operands are not valid for this GPU or mode +// VI-ERR: error: instruction not supported on this GPU + scratch_store_dwordx4 v1, v[2:5], off // GFX10: encoding: [0x00,0x40,0x78,0xdc,0x01,0x02,0x7d,0x00] // GFX9: scratch_store_dwordx4 v1, v[2:5], off ; encoding: [0x00,0x40,0x7c,0xdc,0x01,0x02,0x7f,0x00] @@ -195,6 +265,11 @@ // GFX9-ERR: error: failed parsing operand // VI-ERR: error: instruction not supported on this GPU +scratch_store_dwordx4 off, v[2:5], off +// GFX10: encoding: [0x00,0x40,0x78,0xdc,0x00,0x02,0x7f,0x00] +// GFX9-ERR: error: operands are not valid for this GPU or mode +// VI-ERR: error: instruction not supported on this GPU + scratch_store_dword v1, v2, off offset:12 // GFX10: encoding: [0x0c,0x40,0x70,0xdc,0x01,0x02,0x7d,0x00] // GFX9: scratch_store_dword v1, v2, off offset:12 ; encoding: [0x0c,0x40,0x70,0xdc,0x01,0x02,0x7f,0x00] @@ -220,6 +295,11 @@ // GFX9: scratch_store_dword off, v2, s1 offset:12 ; encoding: [0x0c,0x40,0x70,0xdc,0x00,0x02,0x01,0x00] // VI-ERR: error: instruction not supported on this GPU +scratch_store_dword off, v2, off offset:2047 +// GFX10: scratch_store_dword off, v2, off offset:2047 ; encoding: [0xff,0x47,0x70,0xdc,0x00,0x02,0x7f,0x00] +// GFX9-ERR: error: operands are not valid for this GPU or mode +// VI-ERR: error: instruction not supported on this GPU + // FIXME: Should error about multiple offsets scratch_load_dword v1, v2, s1 // GFX10-ERR: error: invalid operand for instruction @@ -276,37 +356,77 @@ // GFX9: scratch_load_ubyte_d16 v1, v2, off ; encoding: [0x00,0x40,0x80,0xdc,0x02,0x00,0x7f,0x01] // VI-ERR: error: instruction not supported on this GPU +scratch_load_ubyte_d16 v1, off, off +// GFX10: encoding: [0x00,0x40,0x80,0xdc,0x00,0x00,0x7f,0x01] +// GFX9-ERR: error: operands are not valid for this GPU or mode +// VI-ERR: error: instruction not supported on this GPU + scratch_load_ubyte_d16_hi v1, v2, off // GFX10: encoding: [0x00,0x40,0x84,0xdc,0x02,0x00,0x7d,0x01] // GFX9: scratch_load_ubyte_d16_hi v1, v2, off ; encoding: [0x00,0x40,0x84,0xdc,0x02,0x00,0x7f,0x01] // VI-ERR: error: instruction not supported on this GPU +scratch_load_ubyte_d16_hi v1, off, off +// GFX10: encoding: [0x00,0x40,0x84,0xdc,0x00,0x00,0x7f,0x01] +// GFX9-ERR: error: operands are not valid for this GPU or mode +// VI-ERR: error: instruction not supported on this GPU + scratch_load_sbyte_d16 v1, v2, off // GFX10: encoding: [0x00,0x40,0x88,0xdc,0x02,0x00,0x7d,0x01] // GFX9: scratch_load_sbyte_d16 v1, v2, off ; encoding: [0x00,0x40,0x88,0xdc,0x02,0x00,0x7f,0x01] // VI-ERR: error: instruction not supported on this GPU +scratch_load_sbyte_d16 v1, off, off +// GFX10: encoding: [0x00,0x40,0x88,0xdc,0x00,0x00,0x7f,0x01] +// GFX9-ERR: error: operands are not valid for this GPU or mode +// VI-ERR: error: instruction not supported on this GPU + scratch_load_sbyte_d16_hi v1, v2, off // GFX10: encoding: [0x00,0x40,0x8c,0xdc,0x02,0x00,0x7d,0x01] // GFX9: scratch_load_sbyte_d16_hi v1, v2, off ; encoding: [0x00,0x40,0x8c,0xdc,0x02,0x00,0x7f,0x01] // VI-ERR: error: instruction not supported on this GPU +scratch_load_sbyte_d16_hi v1, off, off +// GFX10: encoding: [0x00,0x40,0x8c,0xdc,0x00,0x00,0x7f,0x01] +// GFX9-ERR: error: operands are not valid for this GPU or mode +// VI-ERR: error: instruction not supported on this GPU + scratch_load_short_d16 v1, v2, off // GFX10: encoding: [0x00,0x40,0x90,0xdc,0x02,0x00,0x7d,0x01] // GFX9: scratch_load_short_d16 v1, v2, off ; encoding: [0x00,0x40,0x90,0xdc,0x02,0x00,0x7f,0x01] // VI-ERR: error: instruction not supported on this GPU +scratch_load_short_d16 v1, off, off +// GFX10: encoding: [0x00,0x40,0x90,0xdc,0x00,0x00,0x7f,0x01] +// GFX9-ERR: error: operands are not valid for this GPU or mode +// VI-ERR: error: instruction not supported on this GPU + scratch_load_short_d16_hi v1, v2, off // GFX10: encoding: [0x00,0x40,0x94,0xdc,0x02,0x00,0x7d,0x01] // GFX9: scratch_load_short_d16_hi v1, v2, off ; encoding: [0x00,0x40,0x94,0xdc,0x02,0x00,0x7f,0x01] // VI-ERR: error: instruction not supported on this GPU +scratch_load_short_d16_hi v1, off, off +// GFX10: encoding: [0x00,0x40,0x94,0xdc,0x00,0x00,0x7f,0x01] +// GFX9-ERR: error: operands are not valid for this GPU or mode +// VI-ERR: error: instruction not supported on this GPU + scratch_store_byte_d16_hi off, v2, s1 // GFX10: encoding: [0x00,0x40,0x64,0xdc,0x00,0x02,0x01,0x00] // GFX9: scratch_store_byte_d16_hi off, v2, s1 ; encoding: [0x00,0x40,0x64,0xdc,0x00,0x02,0x01,0x00] // VI-ERR: error: instruction not supported on this GPU +scratch_store_byte_d16_hi off, v2, off +// GFX10: encoding: [0x00,0x40,0x64,0xdc,0x00,0x02,0x7f,0x00] +// GFX9-ERR: error: operands are not valid for this GPU or mode +// VI-ERR: error: instruction not supported on this GPU + scratch_store_short_d16_hi off, v2, s1 // GFX10: encoding: [0x00,0x40,0x6c,0xdc,0x00,0x02,0x01,0x00] // GFX9: scratch_store_short_d16_hi off, v2, s1 ; encoding: [0x00,0x40,0x6c,0xdc,0x00,0x02,0x01,0x00] // VI-ERR: error: instruction not supported on this GPU + +scratch_store_short_d16_hi off, v2, off +// GFX10: encoding: [0x00,0x40,0x6c,0xdc,0x00,0x02,0x7f,0x00] +// GFX9-ERR: error: operands are not valid for this GPU or mode +// VI-ERR: error: instruction not supported on this GPU Index: llvm/test/MC/Disassembler/AMDGPU/gfx10_dasm_all.txt =================================================================== --- llvm/test/MC/Disassembler/AMDGPU/gfx10_dasm_all.txt +++ llvm/test/MC/Disassembler/AMDGPU/gfx10_dasm_all.txt @@ -19748,6 +19748,78 @@ # GFX10: scratch_store_short_d16_hi off, v2, s1 ; encoding: [0x00,0x40,0x6c,0xdc,0x00,0x02,0x01,0x00] 0x00,0x40,0x6c,0xdc,0x00,0x02,0x01,0x00 +# GFX10: scratch_load_ubyte v1, off, off ; encoding: [0x00,0x40,0x20,0xdc,0x00,0x00,0x7f,0x01] +0x00,0x40,0x20,0xdc,0x00,0x00,0x7f,0x01 + +# GFX10: scratch_load_sbyte v1, off, off ; encoding: [0x00,0x40,0x24,0xdc,0x00,0x00,0x7f,0x01] +0x00,0x40,0x24,0xdc,0x00,0x00,0x7f,0x01 + +# GFX10: scratch_load_ushort v1, off, off ; encoding: [0x00,0x40,0x28,0xdc,0x00,0x00,0x7f,0x01] +0x00,0x40,0x28,0xdc,0x00,0x00,0x7f,0x01 + +# GFX10: scratch_load_sshort v1, off, off ; encoding: [0x00,0x40,0x2c,0xdc,0x00,0x00,0x7f,0x01] +0x00,0x40,0x2c,0xdc,0x00,0x00,0x7f,0x01 + +# GFX10: scratch_load_dword v1, off, off ; encoding: [0x00,0x40,0x30,0xdc,0x00,0x00,0x7f,0x01] +0x00,0x40,0x30,0xdc,0x00,0x00,0x7f,0x01 + +# GFX10: scratch_load_dwordx2 v[1:2], off, off ; encoding: [0x00,0x40,0x34,0xdc,0x00,0x00,0x7f,0x01] +0x00,0x40,0x34,0xdc,0x00,0x00,0x7f,0x01 + +# GFX10: scratch_load_dwordx3 v[1:3], off, off ; encoding: [0x00,0x40,0x3c,0xdc,0x00,0x00,0x7f,0x01] +0x00,0x40,0x3c,0xdc,0x00,0x00,0x7f,0x01 + +# GFX10: scratch_load_dwordx4 v[1:4], off, off ; encoding: [0x00,0x40,0x38,0xdc,0x00,0x00,0x7f,0x01] +0x00,0x40,0x38,0xdc,0x00,0x00,0x7f,0x01 + +# GFX10: scratch_load_dword v1, off, off offset:2047 ; encoding: [0xff,0x47,0x30,0xdc,0x00,0x00,0x7f,0x01] +0xff,0x47,0x30,0xdc,0x00,0x00,0x7f,0x01 + +# GFX10: scratch_store_byte off, v2, off ; encoding: [0x00,0x40,0x60,0xdc,0x00,0x02,0x7f,0x00] +0x00,0x40,0x60,0xdc,0x00,0x02,0x7f,0x00 + +# GFX10: scratch_store_short off, v2, off ; encoding: [0x00,0x40,0x68,0xdc,0x00,0x02,0x7f,0x00] +0x00,0x40,0x68,0xdc,0x00,0x02,0x7f,0x00 + +# GFX10: scratch_store_dword off, v2, off ; encoding: [0x00,0x40,0x70,0xdc,0x00,0x02,0x7f,0x00] +0x00,0x40,0x70,0xdc,0x00,0x02,0x7f,0x00 + +# GFX10: scratch_store_dwordx2 off, v[2:3], off ; encoding: [0x00,0x40,0x74,0xdc,0x00,0x02,0x7f,0x00] +0x00,0x40,0x74,0xdc,0x00,0x02,0x7f,0x00 + +# GFX10: scratch_store_dwordx3 off, v[2:4], off ; encoding: [0x00,0x40,0x7c,0xdc,0x00,0x02,0x7f,0x00] +0x00,0x40,0x7c,0xdc,0x00,0x02,0x7f,0x00 + +# GFX10: scratch_store_dwordx4 off, v[2:5], off ; encoding: [0x00,0x40,0x78,0xdc,0x00,0x02,0x7f,0x00] +0x00,0x40,0x78,0xdc,0x00,0x02,0x7f,0x00 + +# GFX10: scratch_store_dword off, v2, off offset:2047 ; encoding: [0xff,0x47,0x70,0xdc,0x00,0x02,0x7f,0x00] +0xff,0x47,0x70,0xdc,0x00,0x02,0x7f,0x00 + +# GFX10: scratch_load_ubyte_d16 v1, off, off ; encoding: [0x00,0x40,0x80,0xdc,0x00,0x00,0x7f,0x01] +0x00,0x40,0x80,0xdc,0x00,0x00,0x7f,0x01 + +# GFX10: scratch_load_ubyte_d16_hi v1, off, off ; encoding: [0x00,0x40,0x84,0xdc,0x00,0x00,0x7f,0x01] +0x00,0x40,0x84,0xdc,0x00,0x00,0x7f,0x01 + +# GFX10: scratch_load_sbyte_d16 v1, off, off ; encoding: [0x00,0x40,0x88,0xdc,0x00,0x00,0x7f,0x01] +0x00,0x40,0x88,0xdc,0x00,0x00,0x7f,0x01 + +# GFX10: scratch_load_sbyte_d16_hi v1, off, off ; encoding: [0x00,0x40,0x8c,0xdc,0x00,0x00,0x7f,0x01] +0x00,0x40,0x8c,0xdc,0x00,0x00,0x7f,0x01 + +# GFX10: scratch_load_short_d16 v1, off, off ; encoding: [0x00,0x40,0x90,0xdc,0x00,0x00,0x7f,0x01] +0x00,0x40,0x90,0xdc,0x00,0x00,0x7f,0x01 + +# GFX10: scratch_load_short_d16_hi v1, off, off ; encoding: [0x00,0x40,0x94,0xdc,0x00,0x00,0x7f,0x01] +0x00,0x40,0x94,0xdc,0x00,0x00,0x7f,0x01 + +# GFX10: scratch_store_byte_d16_hi off, v2, off ; encoding: [0x00,0x40,0x64,0xdc,0x00,0x02,0x7f,0x00] +0x00,0x40,0x64,0xdc,0x00,0x02,0x7f,0x00 + +# GFX10: scratch_store_short_d16_hi off, v2, off ; encoding: [0x00,0x40,0x6c,0xdc,0x00,0x02,0x7f,0x00] +0x00,0x40,0x6c,0xdc,0x00,0x02,0x7f,0x00 + # GFX10: v_add3_u32 v255, v1, v2, v3 ; encoding: [0xff,0x00,0x6d,0xd7,0x01,0x05,0x0e,0x04] 0xff,0x00,0x6d,0xd7,0x01,0x05,0x0e,0x04