Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions llvm/lib/Target/RISCV/Disassembler/RISCVDisassembler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -453,9 +453,10 @@ static DecodeStatus decodeCLUIImmOperand(MCInst &Inst, uint32_t Imm,
int64_t Address,
const MCDisassembler *Decoder) {
assert(isUInt<6>(Imm) && "Invalid immediate");
if (Imm > 31) {
if (Imm == 0)
return MCDisassembler::Fail;
if (Imm > 31)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This Imm > 31 check seems unnecessary. SignExtend64<6> won't do anything to a number less than or equal to 31. But we don't have to change it in this patch.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting. A simple enough thing to check and change.

Imm = (SignExtend64<6>(Imm) & 0xfffff);
}
Inst.addOperand(MCOperand::createImm(Imm));
return MCDisassembler::Success;
}
Expand Down
Loading