Skip to content

Commit 5dd46d9

Browse files
committed
[RISCV] Fix off by 1 typo in decodeVMaskReg. NFC
We're decoding a 1 bit field, but checked that the value was <= 2 instead of <= 1. This isn't a functional change because the generated disassembler code that calls this only extracts 1 bit.
1 parent 7aedd7d commit 5dd46d9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

llvm/lib/Target/RISCV/Disassembler/RISCVDisassembler.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,9 +258,9 @@ static DecodeStatus DecodeVRM8RegisterClass(MCInst &Inst, uint32_t RegNo,
258258
static DecodeStatus decodeVMaskReg(MCInst &Inst, uint32_t RegNo,
259259
uint64_t Address,
260260
const MCDisassembler *Decoder) {
261-
if (RegNo > 2) {
261+
if (RegNo >= 2)
262262
return MCDisassembler::Fail;
263-
}
263+
264264
MCRegister Reg = (RegNo == 0) ? RISCV::V0 : RISCV::NoRegister;
265265

266266
Inst.addOperand(MCOperand::createReg(Reg));

0 commit comments

Comments
 (0)