Re-implement the main strength-reduction portion of LoopStrengthReduction.
[oota-llvm.git] / test / CodeGen / X86 / stride-reuse.ll
1 ; RUN: llc < %s -march=x86 | not grep lea
2 ; RUN: llc < %s -march=x86-64 | not grep lea
3
4 @B = external global [1000 x float], align 32
5 @A = external global [1000 x float], align 32
6 @P = external global [1000 x i32], align 32
7
8 define void @foo(i32 %m) nounwind {
9 entry:
10         %tmp1 = icmp sgt i32 %m, 0
11         br i1 %tmp1, label %bb, label %return
12
13 bb:
14         %i.019.0 = phi i32 [ %indvar.next, %bb ], [ 0, %entry ]
15         %tmp2 = getelementptr [1000 x float]* @B, i32 0, i32 %i.019.0
16         %tmp3 = load float* %tmp2, align 4
17         %tmp4 = fmul float %tmp3, 2.000000e+00
18         %tmp5 = getelementptr [1000 x float]* @A, i32 0, i32 %i.019.0
19         store float %tmp4, float* %tmp5, align 4
20         %tmp8 = shl i32 %i.019.0, 1
21         %tmp9 = add i32 %tmp8, 64
22         %tmp10 = getelementptr [1000 x i32]* @P, i32 0, i32 %i.019.0
23         store i32 %tmp9, i32* %tmp10, align 4
24         %indvar.next = add i32 %i.019.0, 1
25         %exitcond = icmp eq i32 %indvar.next, %m
26         br i1 %exitcond, label %return, label %bb
27
28 return:
29         ret void
30 }