[PATCH] D36559: [ARM] Clarify legal addressing modes for ARM and Thumb2. NFC

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 10 12:32:22 PDT 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL310653: [ARM] Clarify legal addressing modes for ARM and Thumb2. NFC (authored by efriedma).

Changed prior to commit:
  https://reviews.llvm.org/D36559?vs=110500&id=110621#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D36559

Files:
  llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp


Index: llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp
===================================================================
--- llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp
+++ llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp
@@ -12357,8 +12357,13 @@
     Scale = Scale & ~1;
     return Scale == 2 || Scale == 4 || Scale == 8;
   case MVT::i64:
+    // FIXME: What are we trying to model here? ldrd doesn't have an r + r
+    // version in Thumb mode.
     // r + r
-    if (((unsigned)AM.HasBaseReg + Scale) <= 2)
+    if (Scale == 1)
+      return true;
+    // r * 2 (this can be lowered to r + r).
+    if (!AM.HasBaseReg && Scale == 2)
       return true;
     return false;
   case MVT::isVoid:
@@ -12416,8 +12421,11 @@
       return isPowerOf2_32(Scale & ~1);
     case MVT::i16:
     case MVT::i64:
-      // r + r
-      if (((unsigned)AM.HasBaseReg + Scale) <= 2)
+      // r +/- r
+      if (Scale == 1 || (AM.HasBaseReg && Scale == -1))
+        return true;
+      // r * 2 (this can be lowered to r + r).
+      if (!AM.HasBaseReg && Scale == 2)
         return true;
       return false;
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D36559.110621.patch
Type: text/x-patch
Size: 1101 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170810/acb4381c/attachment.bin>


More information about the llvm-commits mailing list