[llvm-commits] CVS: llvm/lib/Target/ARM/ARMISelLowering.cpp

Chris Lattner sabre at nondot.org
Mon Apr 2 11:51:35 PDT 2007



Changes in directory llvm/lib/Target/ARM:

ARMISelLowering.cpp updated: 1.36 -> 1.37
---
Log message:

fix the CodeGen/ARM/2007-03-13-InstrSched.ll regression: allow IV's with scales
to be folded into non-store instructions.


---
Diffs of the changes:  (+20 -4)

 ARMISelLowering.cpp |   24 ++++++++++++++++++++----
 1 files changed, 20 insertions(+), 4 deletions(-)


Index: llvm/lib/Target/ARM/ARMISelLowering.cpp
diff -u llvm/lib/Target/ARM/ARMISelLowering.cpp:1.36 llvm/lib/Target/ARM/ARMISelLowering.cpp:1.37
--- llvm/lib/Target/ARM/ARMISelLowering.cpp:1.36	Mon Apr  2 12:24:08 2007
+++ llvm/lib/Target/ARM/ARMISelLowering.cpp	Mon Apr  2 13:51:18 2007
@@ -1332,6 +1332,15 @@
       // r + r
       if (((unsigned)AM.HasBaseReg + AM.Scale) <= 2)
         return true;
+
+    case MVT::isVoid:
+      // Note, we allow "void" uses (basically, uses that aren't loads or
+      // stores), because arm allows folding a scale into many arithmetic
+      // operations.  This should be made more precise and revisited later.
+      
+      // Allow r << imm, but the imm has to be a multiple of two.
+      if (AM.Scale & 1) return false;
+      return isPowerOf2_32(AM.Scale);
     }
     break;
   }
@@ -1413,12 +1422,19 @@
   case MVT::i1:
   case MVT::i8:
   case MVT::i32:
-    // r + r
-    if (S == 2)
-      return true;
-    // r + r << imm
+    // Allow: r + r
+    // Allow: r << imm
+    // Allow: r + r << imm
     S &= ~1;
     return isPowerOf2_32(S);
+  case MVT::isVoid:
+    // Note, we allow "void" uses (basically, uses that aren't loads or
+    // stores), because arm allows folding a scale into many arithmetic
+    // operations.  This should be made more precise and revisited later.
+    
+    // Allow r << imm, but the imm has to be a multiple of two.
+    if (S & 1) return false;
+    return isPowerOf2_32(S);
   }
 }
 






More information about the llvm-commits mailing list