[llvm] [AArch64][SVE]Add error message in the AsmParser for SVEPattern (PR #82668)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 22 10:16:09 PST 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-mc
Author: None (CarolineConcatto)
<details>
<summary>Changes</summary>
All assembly instructions that have an operand using sve_pred_enum and mistakenly use '#' in front of it would fail without an error message.
---
Full diff: https://github.com/llvm/llvm-project/pull/82668.diff
3 Files Affected:
- (modified) llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp (+1-1)
- (modified) llvm/test/MC/AArch64/SVE/cntb-diagnostics.s (+5)
- (modified) llvm/test/MC/AArch64/SVE/ptrue-diagnostics.s (+5)
``````````diff
diff --git a/llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp b/llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp
index 9774b5491ef11c..9ac60b2cc4323f 100644
--- a/llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp
+++ b/llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp
@@ -7939,7 +7939,7 @@ ParseStatus AArch64AsmParser::tryParseSVEPattern(OperandVector &Operands) {
auto *MCE = dyn_cast<MCConstantExpr>(ImmVal);
if (!MCE)
- return ParseStatus::Failure;
+ return TokError("expected immediate operand");
Pattern = MCE->getValue();
} else {
diff --git a/llvm/test/MC/AArch64/SVE/cntb-diagnostics.s b/llvm/test/MC/AArch64/SVE/cntb-diagnostics.s
index 90ec58809fdd9a..53f80330af7123 100644
--- a/llvm/test/MC/AArch64/SVE/cntb-diagnostics.s
+++ b/llvm/test/MC/AArch64/SVE/cntb-diagnostics.s
@@ -55,3 +55,8 @@ cntb x0, vl512
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid operand
// CHECK-NEXT: cntb x0, vl512
// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
+
+cntb x0, #all, mul #1
+// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: expected immediate operand
+// CHECK-NEXT: cntb x0, #all, mul #1
+// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
diff --git a/llvm/test/MC/AArch64/SVE/ptrue-diagnostics.s b/llvm/test/MC/AArch64/SVE/ptrue-diagnostics.s
index 51001265acbc71..c9e259c31d7870 100644
--- a/llvm/test/MC/AArch64/SVE/ptrue-diagnostics.s
+++ b/llvm/test/MC/AArch64/SVE/ptrue-diagnostics.s
@@ -27,3 +27,8 @@ ptrue p0.s, #32
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid predicate pattern
// CHECK-NEXT: ptrue p0.s, #32
// CHECK-NOT: [[@LINE-3]]:{{[0-9]+}}:
+
+ptrue p0.s, #all
+// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: expected immediate operand
+// CHECK-NEXT: ptrue p0.s, #all
+// CHECK-NOT: [[@LINE-3]]:{{[0-9]+}}:$
``````````
</details>
https://github.com/llvm/llvm-project/pull/82668
More information about the llvm-commits
mailing list