[llvm] bb87c91 - [AArch64][SVE]Add error message in the AsmParser for SVEPattern (#82668)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 26 03:30:09 PST 2024
Author: CarolineConcatto
Date: 2024-02-26T11:30:04Z
New Revision: bb87c914fec6526fbda81991ce0d35e60040ab9f
URL: https://github.com/llvm/llvm-project/commit/bb87c914fec6526fbda81991ce0d35e60040ab9f
DIFF: https://github.com/llvm/llvm-project/commit/bb87c914fec6526fbda81991ce0d35e60040ab9f.diff
LOG: [AArch64][SVE]Add error message in the AsmParser for SVEPattern (#82668)
All assembly instructions that have an operand using sve_pred_enum and
mistakenly use '#' in front of it would fail without an error message.
Added:
Modified:
llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp
llvm/test/MC/AArch64/SVE/cntb-diagnostics.s
llvm/test/MC/AArch64/SVE/ptrue-diagnostics.s
Removed:
################################################################################
diff --git a/llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp b/llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp
index 9774b5491ef11c..b807aaf76fdb00 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("invalid operand for instruction");
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..d338deb636eaab 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: invalid operand for instruction
+// 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..02a94b23661e62 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: invalid operand for instruction
+// CHECK-NEXT: ptrue p0.s, #all
+// CHECK-NOT: [[@LINE-3]]:{{[0-9]+}}:$
More information about the llvm-commits
mailing list