It adds support for negative zero offsets for loads and stores.

Negative zero is returned by the primary expression parser as INT32_MIN, so all that the method needs to do is to accept this value.
Behavior already present for Thumb2.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183734 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Mihai Popa 2013-06-11 09:48:35 +00:00
parent 16ad92ad3c
commit 55ab7315d0
2 changed files with 5 additions and 2 deletions

View File

@ -994,7 +994,7 @@ public:
const MCConstantExpr *CE = dyn_cast<MCConstantExpr>(getImm());
if (!CE) return false;
int64_t Val = CE->getValue();
return Val > -4096 && Val < 4096;
return (Val == INT32_MIN) || (Val > -4096 && Val < 4096);
}
bool isAddrMode3() const {
// If we have an immediate that's not a constant, treat it as a label

View File

@ -16,12 +16,14 @@ _func:
ldr r2, [r4, #4095]!
ldr r1, [r2], #30
ldr r3, [r1], #-30
ldr r9, [r2], #-0
@ CHECK: ldr r5, [r7] @ encoding: [0x00,0x50,0x97,0xe5]
@ CHECK: ldr r6, [r3, #63] @ encoding: [0x3f,0x60,0x93,0xe5]
@ CHECK: ldr r2, [r4, #4095]! @ encoding: [0xff,0x2f,0xb4,0xe5]
@ CHECK: ldr r1, [r2], #30 @ encoding: [0x1e,0x10,0x92,0xe4]
@ CHECK: ldr r3, [r1], #-30 @ encoding: [0x1e,0x30,0x11,0xe4]
@ CHECK: ldr r9, [r2], #-0 @ encoding: [0x00,0x90,0x12,0xe4]
@------------------------------------------------------------------------------
@ FIXME: LDR (literal)
@ -308,13 +310,14 @@ Lbaz: .quad 0
str r3, [r5, #40]!
str r9, [sp], #4095
str r1, [r7], #-128
str r1, [r0], #-0
@ CHECK: str r8, [r12] @ encoding: [0x00,0x80,0x8c,0xe5]
@ CHECK: str r7, [r1, #12] @ encoding: [0x0c,0x70,0x81,0xe5]
@ CHECK: str r3, [r5, #40]! @ encoding: [0x28,0x30,0xa5,0xe5]
@ CHECK: str r9, [sp], #4095 @ encoding: [0xff,0x9f,0x8d,0xe4]
@ CHECK: str r1, [r7], #-128 @ encoding: [0x80,0x10,0x07,0xe4]
@ CHECK: str r1, [r0], #-0 @ encoding: [0x00,0x10,0x00,0xe4]
@------------------------------------------------------------------------------
@ FIXME: STR (literal)