Fix bitfield decoding based on Eli's feedback.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139969 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Owen Anderson 2011-09-16 23:04:48 +00:00
parent 166e0539c9
commit 8b22778431

View File

@ -1004,10 +1004,9 @@ static DecodeStatus DecodeBitfieldMaskOperand(llvm::MCInst &Inst, unsigned Val,
unsigned msb = fieldFromInstruction32(Val, 5, 5);
unsigned lsb = fieldFromInstruction32(Val, 0, 5);
uint32_t msb_mask = (1 << (msb+1)) - 1;
if (msb == 31) msb_mask = 0xFFFFFFFF;
uint32_t lsb_mask = (1 << lsb) - 1;
if (lsb == 31) lsb_mask = 0xFFFFFFFF;
uint32_t msb_mask = 0xFFFFFFFF;
if (msb != 31) msb_mask = (1U << (msb+1)) - 1;
uint32_t lsb_mask = (1U << lsb) - 1;
Inst.addOperand(MCOperand::CreateImm(~(msb_mask ^ lsb_mask)));
return MCDisassembler::Success;