Fix disassembly of Thumb2 BFI instructions with bit range of [0, 32).
authorOwen Anderson <resistor@mac.com>
Fri, 16 Sep 2011 22:29:48 +0000 (22:29 +0000)
committerOwen Anderson <resistor@mac.com>
Fri, 16 Sep 2011 22:29:48 +0000 (22:29 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139964 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/ARM/Disassembler/ARMDisassembler.cpp
test/MC/Disassembler/ARM/thumb2.txt

index 2818e77afc9e27847328905a6e9a46365d19f040..71cda57008c8f8c0611bbaa9c7e287aa8e4bbe41 100644 (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;
 }
index 855043b4fc372bc04b2ebc6e7d23522e3c109d7d..0f3b3255aec3aca502846e839d1c7066459ceef8 100644 (file)
 # 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
 
 
 #------------------------------------------------------------------------------