[llvm] [RISCV] Try to disassemble 48-bit and larger instructions as 32-bit instructions first. (PR #175122)
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 9 09:38:42 PST 2026
================
@@ -831,15 +831,18 @@ DecodeStatus RISCVDisassembler::getInstruction(MCInst &MI, uint64_t &Size,
if ((Bytes[0] & 0b11) != 0b11)
return getInstruction16(MI, Size, Bytes, Address, CS);
- // It's a 32 bit instruction if bit 1:0 are 0b11(checked above) and bits 4:2
- // are not 0b111.
+ // Try to decode as a 32-bit instruction first.
+ DecodeStatus Result = getInstruction32(MI, Size, Bytes, Address, CS);
+ if (Result != MCDisassembler::Fail)
+ return Result;
+
+ // If bits [4:2] are 0b111 this might be a 48-bit or larger instruction.
----------------
topperc wrote:
I've expanded the comment.
https://github.com/llvm/llvm-project/pull/175122
More information about the llvm-commits
mailing list