summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen/X86/loop-strength-reduce4.ll
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2010-01-21 02:09:26 +0000
committerDan Gohman <gohman@apple.com>2010-01-21 02:09:26 +0000
commit51ad99d2c514a8923a2519e37b43f774d95ef9a5 (patch)
tree4dedf54ab5c92f08d11a647e31a5f249f3abf4fc /llvm/test/CodeGen/X86/loop-strength-reduce4.ll
parent626aba43d0960b8a99c1dd1680c866cc3f13bbf9 (diff)
downloadbcm5719-llvm-51ad99d2c514a8923a2519e37b43f774d95ef9a5.tar.gz
bcm5719-llvm-51ad99d2c514a8923a2519e37b43f774d95ef9a5.zip
Re-implement the main strength-reduction portion of LoopStrengthReduction.
This new version is much more aggressive about doing "full" reduction in cases where it reduces register pressure, and also more aggressive about rewriting induction variables to count down (or up) to zero when doing so reduces register pressure. It currently uses fairly simplistic algorithms for finding reuse opportunities, but it introduces a new framework allows it to combine multiple strategies at once to form hybrid solutions, instead of doing all full-reduction or all base+index. llvm-svn: 94061
Diffstat (limited to 'llvm/test/CodeGen/X86/loop-strength-reduce4.ll')
-rw-r--r--llvm/test/CodeGen/X86/loop-strength-reduce4.ll18
1 files changed, 16 insertions, 2 deletions
diff --git a/llvm/test/CodeGen/X86/loop-strength-reduce4.ll b/llvm/test/CodeGen/X86/loop-strength-reduce4.ll
index 07e46eca75e..6c0eb8c0df9 100644
--- a/llvm/test/CodeGen/X86/loop-strength-reduce4.ll
+++ b/llvm/test/CodeGen/X86/loop-strength-reduce4.ll
@@ -1,5 +1,19 @@
-; RUN: llc < %s -march=x86 | grep cmp | grep 64
-; RUN: llc < %s -march=x86 | not grep inc
+; RUN: llc < %s -march=x86 -relocation-model=static -mtriple=i686-apple-darwin | FileCheck %s -check-prefix=STATIC
+; RUN: llc < %s -march=x86 -relocation-model=pic | FileCheck %s -check-prefix=PIC
+
+; By starting the IV at -64 instead of 0, a cmp is eliminated,
+; as the flags from the add can be used directly.
+
+; STATIC: movl $-64, %ecx
+
+; STATIC: movl %eax, _state+76(%ecx)
+; STATIC: addl $16, %ecx
+; STATIC: jne
+
+; In PIC mode the symbol can't be folded, so the change-compare-stride
+; trick applies.
+
+; PIC: cmpl $64
@state = external global [0 x i32] ; <[0 x i32]*> [#uses=4]
@S = external global [0 x i32] ; <[0 x i32]*> [#uses=4]
OpenPOWER on IntegriCloud