Skip to content

Commit bb87c91

Browse files
[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.
1 parent d0b1fec commit bb87c91

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7939,7 +7939,7 @@ ParseStatus AArch64AsmParser::tryParseSVEPattern(OperandVector &Operands) {
79397939

79407940
auto *MCE = dyn_cast<MCConstantExpr>(ImmVal);
79417941
if (!MCE)
7942-
return ParseStatus::Failure;
7942+
return TokError("invalid operand for instruction");
79437943

79447944
Pattern = MCE->getValue();
79457945
} else {

llvm/test/MC/AArch64/SVE/cntb-diagnostics.s

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,8 @@ cntb x0, vl512
5555
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid operand
5656
// CHECK-NEXT: cntb x0, vl512
5757
// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
58+
59+
cntb x0, #all, mul #1
60+
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid operand for instruction
61+
// CHECK-NEXT: cntb x0, #all, mul #1
62+
// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:

llvm/test/MC/AArch64/SVE/ptrue-diagnostics.s

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,8 @@ ptrue p0.s, #32
2727
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid predicate pattern
2828
// CHECK-NEXT: ptrue p0.s, #32
2929
// CHECK-NOT: [[@LINE-3]]:{{[0-9]+}}:
30+
31+
ptrue p0.s, #all
32+
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid operand for instruction
33+
// CHECK-NEXT: ptrue p0.s, #all
34+
// CHECK-NOT: [[@LINE-3]]:{{[0-9]+}}:$

0 commit comments

Comments
 (0)