[llvm-commits] [llvm] r139943 - in /llvm/trunk: lib/Target/ARM/Disassembler/ARMDisassembler.cpp lib/Target/ARM/InstPrinter/ARMInstPrinter.cpp test/MC/Disassembler/ARM/thumb2.txt
Owen Anderson
resistor at mac.com
Fri Sep 16 14:08:33 PDT 2011
Author: resistor
Date: Fri Sep 16 16:08:33 2011
New Revision: 139943
URL: http://llvm.org/viewvc/llvm-project?rev=139943&view=rev
Log:
Fix disassembly of Thumb2 LDRSH with a #-0 offset.
Modified:
llvm/trunk/lib/Target/ARM/Disassembler/ARMDisassembler.cpp
llvm/trunk/lib/Target/ARM/InstPrinter/ARMInstPrinter.cpp
llvm/trunk/test/MC/Disassembler/ARM/thumb2.txt
Modified: llvm/trunk/lib/Target/ARM/Disassembler/ARMDisassembler.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/Disassembler/ARMDisassembler.cpp?rev=139943&r1=139942&r2=139943&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/Disassembler/ARMDisassembler.cpp (original)
+++ llvm/trunk/lib/Target/ARM/Disassembler/ARMDisassembler.cpp Fri Sep 16 16:08:33 2011
@@ -2731,7 +2731,10 @@
static DecodeStatus DecodeT2Imm8(llvm::MCInst &Inst, unsigned Val,
uint64_t Address, const void *Decoder) {
int imm = Val & 0xFF;
- if (!(Val & 0x100)) imm *= -1;
+ if (Val == 0)
+ imm = INT32_MIN;
+ else if (!(Val & 0x100))
+ imm *= -1;
Inst.addOperand(MCOperand::CreateImm(imm));
return MCDisassembler::Success;
Modified: llvm/trunk/lib/Target/ARM/InstPrinter/ARMInstPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/InstPrinter/ARMInstPrinter.cpp?rev=139943&r1=139942&r2=139943&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/InstPrinter/ARMInstPrinter.cpp (original)
+++ llvm/trunk/lib/Target/ARM/InstPrinter/ARMInstPrinter.cpp Fri Sep 16 16:08:33 2011
@@ -802,7 +802,9 @@
int32_t OffImm = (int32_t)MO2.getImm();
// Don't print +0.
- if (OffImm < 0)
+ if (OffImm == INT32_MIN)
+ O << ", #-0";
+ else if (OffImm < 0)
O << ", #-" << -OffImm;
else if (OffImm > 0)
O << ", #" << OffImm;
Modified: llvm/trunk/test/MC/Disassembler/ARM/thumb2.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/Disassembler/ARM/thumb2.txt?rev=139943&r1=139942&r2=139943&view=diff
==============================================================================
--- llvm/trunk/test/MC/Disassembler/ARM/thumb2.txt (original)
+++ llvm/trunk/test/MC/Disassembler/ARM/thumb2.txt Fri Sep 16 16:08:33 2011
@@ -751,13 +751,14 @@
# CHECK: ldrsh.w r5, [r6, #33]
# CHECK: ldrsh.w r5, [r6, #257]
# CHECK: ldrsh.w lr, [r7, #257]
+# CHECK: ldrsh r10, [r5, #-0]
0x35 0xf9 0x04 0x5c
0xb6 0xf9 0x20 0x50
0xb6 0xf9 0x21 0x50
0xb6 0xf9 0x01 0x51
0xb7 0xf9 0x01 0xe1
-
+0x35 0xf9 0x00 0xac
#------------------------------------------------------------------------------
# LDRSH(register)
More information about the llvm-commits
mailing list