Skip to content

Commit c8f434d

Browse files
committed
fixup! Fix error message
Change-Id: I4d10a0480e008419f6e962e7467b9076f7bd9826
1 parent 1497fcd commit c8f434d

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1667,10 +1667,11 @@ bool RISCVAsmParser::matchAndEmitInstruction(SMLoc IDLoc, unsigned &Opcode,
16671667
return generateImmOutOfRangeError(Operands, ErrorInfo, 1, (1 << 5));
16681668
case Match_InvalidUImm5GE6Plus1:
16691669
return generateImmOutOfRangeError(Operands, ErrorInfo, 6, (1 << 5));
1670-
case Match_InvalidUImm5Slist:
1671-
return generateImmOutOfRangeError(
1672-
Operands, ErrorInfo, 0, (1 << 5) - 1,
1673-
"immediate must be one of: 0, 1, 2, 4, 8, 15, 16, 31 in the range ");
1670+
case Match_InvalidUImm5Slist: {
1671+
SMLoc ErrorLoc = ((RISCVOperand &)*Operands[ErrorInfo]).getStartLoc();
1672+
return Error(ErrorLoc,
1673+
"immediate must be one of: 0, 1, 2, 4, 8, 15, 16, 31");
1674+
}
16741675
case Match_InvalidUImm6:
16751676
return generateImmOutOfRangeError(Operands, ErrorInfo, 0, (1 << 6) - 1);
16761677
case Match_InvalidUImm7:

llvm/test/MC/RISCV/xqcisync-invalid.s

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ qc.syncwl
6969
qc.syncwl 1
7070

7171

72-
# CHECK-PLUS: :[[@LINE+1]]:11: error: immediate must be one of: 0, 1, 2, 4, 8, 15, 16, 31 in the range [0, 31]
72+
# CHECK-PLUS: :[[@LINE+1]]:11: error: immediate must be one of: 0, 1, 2, 4, 8, 15, 16, 31
7373
qc.c.sync 45
7474

7575
# CHECK: :[[@LINE+1]]:15: error: invalid operand for instruction
@@ -82,7 +82,7 @@ qc.c.sync
8282
qc.c.sync 8
8383

8484

85-
# CHECK-PLUS: :[[@LINE+1]]:12: error: immediate must be one of: 0, 1, 2, 4, 8, 15, 16, 31 in the range [0, 31]
85+
# CHECK-PLUS: :[[@LINE+1]]:12: error: immediate must be one of: 0, 1, 2, 4, 8, 15, 16, 31
8686
qc.c.syncr 56
8787

8888
# CHECK: :[[@LINE+1]]:16: error: invalid operand for instruction
@@ -95,7 +95,7 @@ qc.c.syncr
9595
qc.c.syncr 8
9696

9797

98-
# CHECK-PLUS: :[[@LINE+1]]:13: error: immediate must be one of: 0, 1, 2, 4, 8, 15, 16, 31 in the range [0, 31]
98+
# CHECK-PLUS: :[[@LINE+1]]:13: error: immediate must be one of: 0, 1, 2, 4, 8, 15, 16, 31
9999
qc.c.syncwf 88
100100

101101
# CHECK: :[[@LINE+1]]:16: error: invalid operand for instruction
@@ -108,7 +108,7 @@ qc.c.syncwf
108108
qc.c.syncwf 31
109109

110110

111-
# CHECK-PLUS: :[[@LINE+1]]:13: error: immediate must be one of: 0, 1, 2, 4, 8, 15, 16, 31 in the range [0, 31]
111+
# CHECK-PLUS: :[[@LINE+1]]:13: error: immediate must be one of: 0, 1, 2, 4, 8, 15, 16, 31
112112
qc.c.syncwl 99
113113

114114
# CHECK: :[[@LINE+1]]:17: error: invalid operand for instruction

0 commit comments

Comments
 (0)