[llvm] f598dfb - [AMDGPU][MC][GFX8+] Correct SMEM offset parsing
Dmitry Preobrazhensky via llvm-commits
llvm-commits at lists.llvm.org
Fri May 20 04:01:01 PDT 2022
Author: Dmitry Preobrazhensky
Date: 2022-05-20T14:00:34+03:00
New Revision: f598dfb3bf8cc98ef9c1a5c3ddb82bdee30b9988
URL: https://github.com/llvm/llvm-project/commit/f598dfb3bf8cc98ef9c1a5c3ddb82bdee30b9988
DIFF: https://github.com/llvm/llvm-project/commit/f598dfb3bf8cc98ef9c1a5c3ddb82bdee30b9988.diff
LOG: [AMDGPU][MC][GFX8+] Correct SMEM offset parsing
Differential Revision: https://reviews.llvm.org/D125907
Added:
Modified:
llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp
llvm/test/MC/AMDGPU/gfx10_asm_smem.s
llvm/test/MC/AMDGPU/gfx8_asm_smem.s
llvm/test/MC/AMDGPU/gfx9_asm_smem.s
Removed:
################################################################################
diff --git a/llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp b/llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp
index e401f03e80d93..e3cddd64a4a58 100644
--- a/llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp
+++ b/llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp
@@ -7736,7 +7736,8 @@ bool AMDGPUOperand::isSMRDOffset8() const {
}
bool AMDGPUOperand::isSMEMOffset() const {
- return isImm(); // Offset range is checked later by validator.
+ return isImmTy(ImmTyNone) ||
+ isImmTy(ImmTyOffset); // Offset range is checked later by validator.
}
bool AMDGPUOperand::isSMRDLiteralOffset() const {
diff --git a/llvm/test/MC/AMDGPU/gfx10_asm_smem.s b/llvm/test/MC/AMDGPU/gfx10_asm_smem.s
index 1a24725acb74a..73559b450f448 100644
--- a/llvm/test/MC/AMDGPU/gfx10_asm_smem.s
+++ b/llvm/test/MC/AMDGPU/gfx10_asm_smem.s
@@ -1342,3 +1342,9 @@ s_buffer_atomic_umin s5, s[4:7], s2 dlc
s_buffer_atomic_xor s5, s[4:7], s2 dlc
// GFX10: encoding: [0x42,0x41,0x28,0xf5,0x00,0x00,0x00,0x04]
+
+s_load_dword s1, s[2:3] glc
+// GFX10: s_load_dword s1, s[2:3], 0x0 glc ; encoding: [0x41,0x00,0x01,0xf4,0x00,0x00,0x00,0xfa]
+
+s_load_dword s1, s[2:3] dlc
+// GFX10: s_load_dword s1, s[2:3], 0x0 dlc ; encoding: [0x41,0x40,0x00,0xf4,0x00,0x00,0x00,0xfa]
diff --git a/llvm/test/MC/AMDGPU/gfx8_asm_smem.s b/llvm/test/MC/AMDGPU/gfx8_asm_smem.s
index a39729b4b323d..5cdee0f8858c9 100644
--- a/llvm/test/MC/AMDGPU/gfx8_asm_smem.s
+++ b/llvm/test/MC/AMDGPU/gfx8_asm_smem.s
@@ -1163,3 +1163,6 @@ s_atc_probe_buffer 0x0, s[8:11], m0
s_atc_probe_buffer 0x0, s[8:11], 0x7ffff
// CHECK: [0x04,0x00,0x9e,0xc0,0xff,0xff,0x07,0x00]
+
+s_load_dword s1, s[2:3] glc
+// CHECK: s_load_dword s1, s[2:3], 0x0 glc ; encoding: [0x41,0x00,0x03,0xc0,0x00,0x00,0x00,0x00]
diff --git a/llvm/test/MC/AMDGPU/gfx9_asm_smem.s b/llvm/test/MC/AMDGPU/gfx9_asm_smem.s
index 1989062e3a509..d61dac88f457e 100644
--- a/llvm/test/MC/AMDGPU/gfx9_asm_smem.s
+++ b/llvm/test/MC/AMDGPU/gfx9_asm_smem.s
@@ -4475,3 +4475,6 @@ s_atomic_dec_x2 s[10:11], s[2:3], 0x0
s_atomic_dec_x2 s[10:11], s[2:3], s0 glc
// CHECK: [0x81,0x02,0xb1,0xc2,0x00,0x00,0x00,0x00]
+
+s_load_dword s1, s[2:3] glc
+// CHECK: s_load_dword s1, s[2:3], 0x0 glc ; encoding: [0x41,0x00,0x03,0xc0,0x00,0x00,0x00,0x00]
More information about the llvm-commits
mailing list