1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-02-01 05:01:59 +01:00

Fix disassembly of Thumb2 LDRSH with a #-0 offset.

llvm-svn: 139943
This commit is contained in:
Owen Anderson 2011-09-16 21:08:33 +00:00
parent 916a6c71aa
commit 5804085f26
3 changed files with 9 additions and 3 deletions

View File

@ -2731,7 +2731,10 @@ static DecodeStatus DecodeT2AddrModeImm0_1020s4(llvm::MCInst &Inst,unsigned Val,
static DecodeStatus DecodeT2Imm8(llvm::MCInst &Inst, unsigned Val, static DecodeStatus DecodeT2Imm8(llvm::MCInst &Inst, unsigned Val,
uint64_t Address, const void *Decoder) { uint64_t Address, const void *Decoder) {
int imm = Val & 0xFF; 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)); Inst.addOperand(MCOperand::CreateImm(imm));
return MCDisassembler::Success; return MCDisassembler::Success;

View File

@ -802,7 +802,9 @@ void ARMInstPrinter::printT2AddrModeImm8Operand(const MCInst *MI,
int32_t OffImm = (int32_t)MO2.getImm(); int32_t OffImm = (int32_t)MO2.getImm();
// Don't print +0. // Don't print +0.
if (OffImm < 0) if (OffImm == INT32_MIN)
O << ", #-0";
else if (OffImm < 0)
O << ", #-" << -OffImm; O << ", #-" << -OffImm;
else if (OffImm > 0) else if (OffImm > 0)
O << ", #" << OffImm; O << ", #" << OffImm;

View File

@ -751,13 +751,14 @@
# CHECK: ldrsh.w r5, [r6, #33] # CHECK: ldrsh.w r5, [r6, #33]
# CHECK: ldrsh.w r5, [r6, #257] # CHECK: ldrsh.w r5, [r6, #257]
# CHECK: ldrsh.w lr, [r7, #257] # CHECK: ldrsh.w lr, [r7, #257]
# CHECK: ldrsh r10, [r5, #-0]
0x35 0xf9 0x04 0x5c 0x35 0xf9 0x04 0x5c
0xb6 0xf9 0x20 0x50 0xb6 0xf9 0x20 0x50
0xb6 0xf9 0x21 0x50 0xb6 0xf9 0x21 0x50
0xb6 0xf9 0x01 0x51 0xb6 0xf9 0x01 0x51
0xb7 0xf9 0x01 0xe1 0xb7 0xf9 0x01 0xe1
0x35 0xf9 0x00 0xac
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# LDRSH(register) # LDRSH(register)