It adds support for negative zero offsets for loads and stores.
authorMihai Popa <mihail.popa@gmail.com>
Tue, 11 Jun 2013 09:48:35 +0000 (09:48 +0000)
committerMihai Popa <mihail.popa@gmail.com>
Tue, 11 Jun 2013 09:48:35 +0000 (09:48 +0000)
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

lib/Target/ARM/AsmParser/ARMAsmParser.cpp
test/MC/ARM/arm-memory-instructions.s

index 314d37d7d589972d9ce9d4a741f4e64b2886ebff..c59ca64c1171f691515149d16a5c1a33e3feb30b 100644 (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
index d8d9130b690bcaf5ee39574919842c2ad8c2cf2b..e9f0c3da7c0f49d0f2649890631e90514d62d816 100644 (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)