Fix issue with disassembler decoding CBZ/CBNZ immediates as negatives when the upper...
authorGordon Keiser <gkeiser@arxan.com>
Thu, 28 Mar 2013 19:22:28 +0000 (19:22 +0000)
committerGordon Keiser <gkeiser@arxan.com>
Thu, 28 Mar 2013 19:22:28 +0000 (19:22 +0000)
They should always be zero-extended, not sign extended.  Added test case.

llvm-svn: 178275

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

index ec895c3..2e009e5 100644 (file)
@@ -3049,9 +3049,9 @@ static DecodeStatus DecodeT2BROperand(MCInst &Inst, unsigned Val,
 
 static DecodeStatus DecodeThumbCmpBROperand(MCInst &Inst, unsigned Val,
                                  uint64_t Address, const void *Decoder) {
-  if (!tryAddingSymbolicOperand(Address, Address + SignExtend32<7>(Val<<1) + 4,
+  if (!tryAddingSymbolicOperand(Address, Address + (Val<<1) + 4,
                                 true, 2, Inst, Decoder))
-    Inst.addOperand(MCOperand::CreateImm(SignExtend32<7>(Val << 1)));
+    Inst.addOperand(MCOperand::CreateImm(Val << 1));
   return MCDisassembler::Success;
 }
 
index 0baa98a..31f75b3 100644 (file)
 #------------------------------------------------------------------------------
 # CHECK: cbnz    r7, #6
 # CHECK: cbnz    r7, #12
+# CHECK: cbz     r4, #64
 
 0x1f 0xb9
 0x37 0xb9
+0x04 0xb3
+
 
 #------------------------------------------------------------------------------
 # CDP/CDP2