Skip to content

Commit 40a0e34

Browse files
committed
[RISCV] Use location of negative sign if present for error in parseZcmpStackAdj
As far as the user is concerned the negative sign and the number are a single value so the error should point to the beginning.
1 parent 1edb6b0 commit 40a0e34

File tree

5 files changed

+14
-15
lines changed

5 files changed

+14
-15
lines changed

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2673,9 +2673,8 @@ ParseStatus RISCVAsmParser::parseRegListCommon(OperandVector &Operands,
26732673

26742674
ParseStatus RISCVAsmParser::parseZcmpStackAdj(OperandVector &Operands,
26752675
bool ExpectNegative) {
2676-
bool Negative = parseOptionalToken(AsmToken::Minus);
2677-
26782676
SMLoc S = getLoc();
2677+
bool Negative = parseOptionalToken(AsmToken::Minus);
26792678

26802679
if (getTok().isNot(AsmToken::Integer))
26812680
return ParseStatus::NoMatch;

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,16 @@ qc.cm.push {ra}, 16
2222
# CHECK-ERROR: :[[@LINE+1]]:24: error: stack adjustment for register list must be a multiple of 16 bytes in the range [-64, -16]
2323
qc.cm.pushfp {ra, s0}, 16
2424

25-
# CHECK-ERROR: :[[@LINE+1]]:25: error: stack adjustment for register list must be a multiple of 16 bytes in the range [16, 64]
25+
# CHECK-ERROR: :[[@LINE+1]]:24: error: stack adjustment for register list must be a multiple of 16 bytes in the range [16, 64]
2626
qc.cm.pop {ra, s0-s1}, -32
2727

28-
# CHECK-ERROR: :[[@LINE+1]]:19: error: stack adjustment for register list must be a multiple of 16 bytes in the range [-64, -16]
28+
# CHECK-ERROR: :[[@LINE+1]]:18: error: stack adjustment for register list must be a multiple of 16 bytes in the range [-64, -16]
2929
qc.cm.push {ra}, -8
3030

31-
# CHECK-ERROR: :[[@LINE+1]]:25: error: stack adjustment for register list must be a multiple of 16 bytes in the range [-64, -16]
31+
# CHECK-ERROR: :[[@LINE+1]]:24: error: stack adjustment for register list must be a multiple of 16 bytes in the range [-64, -16]
3232
qc.cm.pushfp {ra, s0}, -12
3333

34-
# CHECK-ERROR: :[[@LINE+1]]:25: error: stack adjustment for register list must be a multiple of 16 bytes in the range [16, 64]
34+
# CHECK-ERROR: :[[@LINE+1]]:24: error: stack adjustment for register list must be a multiple of 16 bytes in the range [16, 64]
3535
qc.cm.pop {ra, s0-s1}, -40
3636

3737
# CHECK-ERROR: :[[@LINE+1]]:17: error: register list must include 's0' or 'x8'

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ cm.popretz {ra, s0-s1}, 112
1919
# CHECK-ERROR: :[[@LINE+1]]:15: error: stack adjustment for register list must be a multiple of 16 bytes in the range [-64, -16]
2020
cm.push {ra}, 16
2121

22-
# CHECK-ERROR: :[[@LINE+1]]:22: error: stack adjustment for register list must be a multiple of 16 bytes in the range [16, 64]
22+
# CHECK-ERROR: :[[@LINE+1]]:21: error: stack adjustment for register list must be a multiple of 16 bytes in the range [16, 64]
2323
cm.pop {ra, s0-s1}, -32
2424

25-
# CHECK-ERROR: :[[@LINE+1]]:16: error: stack adjustment for register list must be a multiple of 16 bytes in the range [-64, -16]
25+
# CHECK-ERROR: :[[@LINE+1]]:15: error: stack adjustment for register list must be a multiple of 16 bytes in the range [-64, -16]
2626
cm.push {ra}, -8
2727

2828
# CHECK-ERROR: :[[@LINE+1]]:9: error: register list must start from 'ra' or 'x1'

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@ qc.cm.push {ra}, 16
2222
# CHECK-ERROR: :[[@LINE+1]]:24: error: stack adjustment for register list must be a multiple of 16 bytes in the range [-64, -16]
2323
qc.cm.pushfp {ra, s0}, 16
2424

25-
# CHECK-ERROR: :[[@LINE+1]]:25: error: stack adjustment for register list must be a multiple of 16 bytes in the range [32, 80]
25+
# CHECK-ERROR: :[[@LINE+1]]:24: error: stack adjustment for register list must be a multiple of 16 bytes in the range [32, 80]
2626
qc.cm.pop {ra, s0-s1}, -32
2727

28-
# CHECK-ERROR: :[[@LINE+1]]:19: error: stack adjustment for register list must be a multiple of 16 bytes in the range [-64, -16]
28+
# CHECK-ERROR: :[[@LINE+1]]:18: error: stack adjustment for register list must be a multiple of 16 bytes in the range [-64, -16]
2929
qc.cm.push {ra}, -15
3030

31-
# CHECK-ERROR: :[[@LINE+1]]:23: error: stack adjustment for register list must be a multiple of 16 bytes in the range [-64, -16]
31+
# CHECK-ERROR: :[[@LINE+1]]:22: error: stack adjustment for register list must be a multiple of 16 bytes in the range [-64, -16]
3232
qc.cm.push {ra, s0}, -15
3333

34-
# CHECK-ERROR: :[[@LINE+1]]:25: error: stack adjustment for register list must be a multiple of 16 bytes in the range [32, 80]
34+
# CHECK-ERROR: :[[@LINE+1]]:24: error: stack adjustment for register list must be a multiple of 16 bytes in the range [32, 80]
3535
qc.cm.pop {ra, s0-s1}, -33

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ cm.popretz {ra, s0-s1}, 112
1919
# CHECK-ERROR: :[[@LINE+1]]:15: error: stack adjustment for register list must be a multiple of 16 bytes in the range [-64, -16]
2020
cm.push {ra}, 16
2121

22-
# CHECK-ERROR: :[[@LINE+1]]:22: error: stack adjustment for register list must be a multiple of 16 bytes in the range [32, 80]
22+
# CHECK-ERROR: :[[@LINE+1]]:21: error: stack adjustment for register list must be a multiple of 16 bytes in the range [32, 80]
2323
cm.pop {ra, s0-s1}, -32
2424

25-
# CHECK-ERROR: :[[@LINE+1]]:16: error: stack adjustment for register list must be a multiple of 16 bytes in the range [-64, -16]
25+
# CHECK-ERROR: :[[@LINE+1]]:15: error: stack adjustment for register list must be a multiple of 16 bytes in the range [-64, -16]
2626
cm.push {ra}, -15
2727

28-
# CHECK-ERROR: :[[@LINE+1]]:22: error: stack adjustment for register list must be a multiple of 16 bytes in the range [32, 80]
28+
# CHECK-ERROR: :[[@LINE+1]]:21: error: stack adjustment for register list must be a multiple of 16 bytes in the range [32, 80]
2929
cm.pop {ra, s0-s1}, -33
3030

3131
# CHECK-ERROR: :[[@LINE+1]]:9: error: register list must start from 'ra' or 'x1'

0 commit comments

Comments
 (0)