[llvm-commits] CVS: llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp

Chris Lattner lattner at cs.uiuc.edu
Sun Aug 7 23:26:02 PDT 2005



Changes in directory llvm/lib/Transforms/Scalar:

LoopStrengthReduce.cpp updated: 1.39 -> 1.40
---
Log message:

Not all constants are legal immediates in load/store instructions.


---
Diffs of the changes:  (+7 -1)

 LoopStrengthReduce.cpp |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletion(-)


Index: llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
diff -u llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.39 llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.40
--- llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.39	Mon Aug  8 00:47:49 2005
+++ llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp	Mon Aug  8 01:25:50 2005
@@ -435,7 +435,13 @@
 static bool isTargetConstant(const SCEVHandle &V) {
 
   // FIXME: Look at the target to decide if &GV is a legal constant immediate.
-  if (isa<SCEVConstant>(V)) return true;
+  if (SCEVConstant *SC = dyn_cast<SCEVConstant>(V)) {
+    // PPC allows a sign-extended 16-bit immediate field.
+    if ((int64_t)SC->getValue()->getRawValue() > -(1 << 16) &&
+        (int64_t)SC->getValue()->getRawValue() < (1 << 16)-1)
+      return true;
+    return false;
+  }
 
   return false;     // ENABLE this for x86
 






More information about the llvm-commits mailing list