Fix disassembly of Thumb2 BFI instructions with bit range of [0, 32).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139964 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Owen Anderson 2011-09-16 22:29:48 +00:00
parent 47313df81c
commit 89db0f690c
2 changed files with 6 additions and 0 deletions

View File

@ -1003,8 +1003,12 @@ static DecodeStatus DecodeBitfieldMaskOperand(llvm::MCInst &Inst, unsigned Val,
// create the final mask.
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;
Inst.addOperand(MCOperand::CreateImm(~(msb_mask ^ lsb_mask)));
return MCDisassembler::Success;
}

View File

@ -186,10 +186,12 @@
# CHECK: bfi r5, r2, #3, #17
# CHECK: it ne
# CHECK: bfine r5, r2, #3, #17
# CHECK: bfi r6, r0, #0, #32
0x62 0xf3 0xd3 0x05
0x18 0xbf
0x62 0xf3 0xd3 0x05
0x60 0xf3 0x1f 0x06
#------------------------------------------------------------------------------