Re-implement the main strength-reduction portion of LoopStrengthReduction.
[oota-llvm.git] / test / CodeGen / X86 / 2006-05-11-InstrSched.ll
1 ; RUN: llc < %s -march=x86 -mattr=+sse2 -stats -realign-stack=0 |&\
2 ; RUN:     grep {asm-printer} | grep 34
3
4 target datalayout = "e-p:32:32"
5 define void @foo(i32* %mc, i32* %bp, i32* %ms, i32* %xmb, i32* %mpp, i32* %tpmm, i32* %ip, i32* %tpim, i32* %dpp, i32* %tpdm, i32* %bpi, i32 %M) nounwind {
6 entry:
7         %tmp9 = icmp slt i32 %M, 5              ; <i1> [#uses=1]
8         br i1 %tmp9, label %return, label %cond_true
9
10 cond_true:              ; preds = %cond_true, %entry
11         %indvar = phi i32 [ 0, %entry ], [ %indvar.next, %cond_true ]           ; <i32> [#uses=2]
12         %tmp. = shl i32 %indvar, 2              ; <i32> [#uses=1]
13         %tmp.10 = add nsw i32 %tmp., 1          ; <i32> [#uses=2]
14         %tmp31 = add nsw i32 %tmp.10, -1                ; <i32> [#uses=4]
15         %tmp32 = getelementptr i32* %mpp, i32 %tmp31            ; <i32*> [#uses=1]
16         %tmp34 = bitcast i32* %tmp32 to <16 x i8>*              ; <i8*> [#uses=1]
17         %tmp = load <16 x i8>* %tmp34, align 1
18         %tmp42 = getelementptr i32* %tpmm, i32 %tmp31           ; <i32*> [#uses=1]
19         %tmp42.upgrd.1 = bitcast i32* %tmp42 to <4 x i32>*              ; <<4 x i32>*> [#uses=1]
20         %tmp46 = load <4 x i32>* %tmp42.upgrd.1         ; <<4 x i32>> [#uses=1]
21         %tmp54 = bitcast <16 x i8> %tmp to <4 x i32>            ; <<4 x i32>> [#uses=1]
22         %tmp55 = add <4 x i32> %tmp54, %tmp46           ; <<4 x i32>> [#uses=2]
23         %tmp55.upgrd.2 = bitcast <4 x i32> %tmp55 to <2 x i64>          ; <<2 x i64>> [#uses=1]
24         %tmp62 = getelementptr i32* %ip, i32 %tmp31             ; <i32*> [#uses=1]
25         %tmp65 = bitcast i32* %tmp62 to <16 x i8>*              ; <i8*> [#uses=1]
26         %tmp66 = load <16 x i8>* %tmp65, align 1
27         %tmp73 = getelementptr i32* %tpim, i32 %tmp31           ; <i32*> [#uses=1]
28         %tmp73.upgrd.3 = bitcast i32* %tmp73 to <4 x i32>*              ; <<4 x i32>*> [#uses=1]
29         %tmp77 = load <4 x i32>* %tmp73.upgrd.3         ; <<4 x i32>> [#uses=1]
30         %tmp87 = bitcast <16 x i8> %tmp66 to <4 x i32>          ; <<4 x i32>> [#uses=1]
31         %tmp88 = add <4 x i32> %tmp87, %tmp77           ; <<4 x i32>> [#uses=2]
32         %tmp88.upgrd.4 = bitcast <4 x i32> %tmp88 to <2 x i64>          ; <<2 x i64>> [#uses=1]
33         %tmp99 = tail call <4 x i32> @llvm.x86.sse2.pcmpgt.d( <4 x i32> %tmp88, <4 x i32> %tmp55 )              ; <<4 x i32>> [#uses=1]
34         %tmp99.upgrd.5 = bitcast <4 x i32> %tmp99 to <2 x i64>          ; <<2 x i64>> [#uses=2]
35         %tmp110 = xor <2 x i64> %tmp99.upgrd.5, < i64 -1, i64 -1 >              ; <<2 x i64>> [#uses=1]
36         %tmp111 = and <2 x i64> %tmp110, %tmp55.upgrd.2         ; <<2 x i64>> [#uses=1]
37         %tmp121 = and <2 x i64> %tmp99.upgrd.5, %tmp88.upgrd.4          ; <<2 x i64>> [#uses=1]
38         %tmp131 = or <2 x i64> %tmp121, %tmp111         ; <<2 x i64>> [#uses=1]
39         %tmp137 = getelementptr i32* %mc, i32 %tmp.10           ; <i32*> [#uses=1]
40         %tmp137.upgrd.7 = bitcast i32* %tmp137 to <2 x i64>*            ; <<2 x i64>*> [#uses=1]
41         store <2 x i64> %tmp131, <2 x i64>* %tmp137.upgrd.7
42         %tmp147 = add nsw i32 %tmp.10, 8                ; <i32> [#uses=1]
43         %tmp.upgrd.8 = icmp ne i32 %tmp147, %M          ; <i1> [#uses=1]
44         %indvar.next = add i32 %indvar, 1               ; <i32> [#uses=1]
45         br i1 %tmp.upgrd.8, label %cond_true, label %return
46
47 return:         ; preds = %cond_true, %entry
48         ret void
49 }
50
51 declare <4 x i32> @llvm.x86.sse2.pcmpgt.d(<4 x i32>, <4 x i32>)