[PATCH] D142194: [AMDGPU][AsmParser] Fix matching immediate literals.
Ivan Kosarev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 9 03:45:11 PST 2023
kosarev updated this revision to Diff 496076.
kosarev added a comment.
Moved the test to gfx7_err_pos.s.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D142194/new/
https://reviews.llvm.org/D142194
Files:
llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp
llvm/test/MC/AMDGPU/gfx7_err_pos.s
Index: llvm/test/MC/AMDGPU/gfx7_err_pos.s
===================================================================
--- llvm/test/MC/AMDGPU/gfx7_err_pos.s
+++ llvm/test/MC/AMDGPU/gfx7_err_pos.s
@@ -36,3 +36,11 @@
// CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: literal operands are not supported
// CHECK-NEXT:{{^}}v_and_b32_e64 v0, 0.159154943091895317852646485335, v1
// CHECK-NEXT:{{^}} ^
+
+//==============================================================================
+// cache policy is not supported for SMRD instructions
+
+s_load_dword s5, s[2:3], glc
+// CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: cache policy is not supported for SMRD instructions
+// CHECK-NEXT:{{^}}s_load_dword s5, s[2:3], glc
+// CHECK-NEXT:{{^}} ^
Index: llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp
===================================================================
--- llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp
+++ llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp
@@ -347,6 +347,8 @@
return isImm() && Imm.Type == ImmT;
}
+ bool isImmLiteral() const { return isImmTy(ImmTyNone); }
+
bool isImmModifier() const {
return isImm() && Imm.Type != ImmTyNone;
}
@@ -7940,7 +7942,7 @@
//===----------------------------------------------------------------------===//
bool AMDGPUOperand::isSMRDOffset8() const {
- return isImm() && isUInt<8>(getImm());
+ return isImmLiteral() && isUInt<8>(getImm());
}
bool AMDGPUOperand::isSMEMOffset() const {
@@ -7951,7 +7953,7 @@
bool AMDGPUOperand::isSMRDLiteralOffset() const {
// 32-bit literals are only supported on CI and we only want to use them
// when the offset is > 8-bits.
- return isImm() && !isUInt<8>(getImm()) && isUInt<32>(getImm());
+ return isImmLiteral() && !isUInt<8>(getImm()) && isUInt<32>(getImm());
}
AMDGPUOperand::Ptr AMDGPUAsmParser::defaultSMRDOffset8() const {
@@ -8439,11 +8441,11 @@
}
bool AMDGPUOperand::isS16Imm() const {
- return isImm() && (isInt<16>(getImm()) || isUInt<16>(getImm()));
+ return isImmLiteral() && (isInt<16>(getImm()) || isUInt<16>(getImm()));
}
bool AMDGPUOperand::isU16Imm() const {
- return isImm() && isUInt<16>(getImm());
+ return isImmLiteral() && isUInt<16>(getImm());
}
//===----------------------------------------------------------------------===//
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D142194.496076.patch
Type: text/x-patch
Size: 2342 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230209/32cf7115/attachment.bin>
More information about the llvm-commits
mailing list