[llvm-commits] CVS: llvm/lib/Target/ARM/ARMISelLowering.cpp
Chris Lattner
sabre at nondot.org
Mon Apr 2 17:14:15 PDT 2007
Changes in directory llvm/lib/Target/ARM:
ARMISelLowering.cpp updated: 1.37 -> 1.38
---
Log message:
Arm supports negative strides as well, add them. This lets us compile:
CodeGen/ARM/arm-negative-stride.ll to:
LBB1_2: @bb
str r1, [r3, -r0, lsl #2]
add r0, r0, #1
cmp r0, r2
bne LBB1_2 @bb
---
Diffs of the changes: (+6 -3)
ARMISelLowering.cpp | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
Index: llvm/lib/Target/ARM/ARMISelLowering.cpp
diff -u llvm/lib/Target/ARM/ARMISelLowering.cpp:1.37 llvm/lib/Target/ARM/ARMISelLowering.cpp:1.38
--- llvm/lib/Target/ARM/ARMISelLowering.cpp:1.37 Mon Apr 2 13:51:18 2007
+++ llvm/lib/Target/ARM/ARMISelLowering.cpp Mon Apr 2 19:13:57 2007
@@ -1323,7 +1323,7 @@
// This assumes i64 is legalized to a pair of i32. If not (i.e.
// ldrd / strd are used, then its address mode is same as i16.
// r + r
- if (AM.Scale == 2)
+ if (AM.Scale == 1)
return true;
// r + r << imm
if (!isPowerOf2_32(AM.Scale & ~1))
@@ -1422,7 +1422,9 @@
case MVT::i1:
case MVT::i8:
case MVT::i32:
- // Allow: r + r
+ if (S < 0) S = -S;
+ if (S == 1) return true; // Allow: r + r
+
// Allow: r << imm
// Allow: r + r << imm
S &= ~1;
@@ -1431,7 +1433,8 @@
// 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.
-
+ if (S == 1) return true; // Allow: r + r
+
// 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