Thumb2 encoding choice correction for PLD.
authorJim Grosbach <grosbach@apple.com>
Tue, 6 Dec 2011 04:49:29 +0000 (04:49 +0000)
committerJim Grosbach <grosbach@apple.com>
Tue, 6 Dec 2011 04:49:29 +0000 (04:49 +0000)
Using encoding T1 for offset of #0 and encoding T2 for #-0.

rdar://10532413

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@145919 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/ARM/AsmParser/ARMAsmParser.cpp
test/MC/ARM/basic-thumb2-instructions.s

index 07679a60ffdfd67d151777969027f92fcc75931b..e4a7094232b8b6b4bfed4ae241dc2cb11abfe0d1 100644 (file)
@@ -916,9 +916,9 @@ public:
     if (!isMemory() || Memory.OffsetRegNum != 0 || Memory.Alignment != 0)
       return false;
     // Immediate offset in range [-255, -1].
-    if (!Memory.OffsetImm) return true;
+    if (!Memory.OffsetImm) return false;
     int64_t Val = Memory.OffsetImm->getValue();
-    return Val > -256 && Val < 0;
+    return (Val == INT32_MIN) || (Val > -256 && Val < 0);
   }
   bool isMemUImm12Offset() const {
     if (!isMemory() || Memory.OffsetRegNum != 0 || Memory.Alignment != 0)
index 205ca35a45d36ec55cfe28424c291e9bb0f8b99e..5de5104ac30134bcebe9c0f790065e71c169e105 100644 (file)
@@ -1371,12 +1371,16 @@ _func:
         pld [r6, #33]
         pld [r6, #257]
         pld [r7, #257]
+        pld [r1, #0]
+        pld [r1, #-0]
 
 @ CHECK: pld   [r5, #-4]               @ encoding: [0x15,0xf8,0x04,0xfc]
 @ CHECK: pld   [r6, #32]               @ encoding: [0x96,0xf8,0x20,0xf0]
 @ CHECK: pld   [r6, #33]               @ encoding: [0x96,0xf8,0x21,0xf0]
 @ CHECK: pld   [r6, #257]              @ encoding: [0x96,0xf8,0x01,0xf1]
 @ CHECK: pld   [r7, #257]              @ encoding: [0x97,0xf8,0x01,0xf1]
+@ CHECK: pld   [r1]                    @ encoding: [0x91,0xf8,0x00,0xf0]
+@ CHECK: pld   [r1, #-0]               @ encoding: [0x11,0xf8,0x00,0xfc]
 
 
 @------------------------------------------------------------------------------