Skip to content

Commit b7fbcf2

Browse files
committed
Address xen0n's comments
1 parent 02bc62c commit b7fbcf2

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

llvm/lib/Target/LoongArch/AsmParser/LoongArchAsmParser.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1633,6 +1633,9 @@ LoongArchAsmParser::validateTargetOperandClass(MCParsedAsmOperand &AsmOp,
16331633
return Match_Success;
16341634
}
16351635

1636+
if (Kind == MCK_GPRNoR0R1 && (Reg == LoongArch::R0 || Reg == LoongArch::R1))
1637+
return Match_RequiresOpnd2NotR0R1;
1638+
16361639
return Match_InvalidOperand;
16371640
}
16381641

llvm/test/MC/LoongArch/Basic/Privilege/invalid.s

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33

44
## csrxchg: rj != 0,1
55
csrxchg $a0, $zero, 0
6-
# ERR: :[[#@LINE-1]]:15: error: invalid operand for instruction
6+
# ERR: :[[#@LINE-1]]:15: error: must not be $r0 or $r1
77
csrxchg $a0, $ra, 0
8-
# ERR: :[[#@LINE-1]]:15: error: invalid operand for instruction
8+
# ERR: :[[#@LINE-1]]:15: error: must not be $r0 or $r1
99

1010
## LoongArch64 mnemonics
1111
iocsrrd.d $a0, $a1

llvm/test/MC/LoongArch/lvz/lvz-err.s

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ gcsrxchg $a0, $a1, -1
1919
# CHECK: :[[#@LINE-1]]:20: error: immediate must be an integer in the range [0, 16383]
2020

2121
gcsrxchg $a0, $ra, 1
22-
# CHECK: :[[#@LINE-1]]:16: error: invalid operand for instruction
22+
# CHECK: :[[#@LINE-1]]:16: error: must not be $r0 or $r1
2323

2424
gcsrxchg $a0, $zero, 1
25-
# CHECK: :[[#@LINE-1]]:16: error: invalid operand for instruction
25+
# CHECK: :[[#@LINE-1]]:16: error: must not be $r0 or $r1
2626

2727
hvcl 32768
2828
# CHECK: :[[#@LINE-1]]:6: error: immediate must be an integer in the range [0, 32767]

0 commit comments

Comments
 (0)