Fix ctlz and cttz. llvm definition requires them to return number of bits in of the...
[oota-llvm.git] / test / CodeGen / X86 / loop-strength-reduce4.ll
1 ; RUN: llvm-as < %s | llc -march=x86 | grep cmp | grep 64
2 ; RUN: llvm-as < %s | llc -march=x86 | not grep inc
3
4 @state = external global [0 x i32]              ; <[0 x i32]*> [#uses=4]
5 @S = external global [0 x i32]          ; <[0 x i32]*> [#uses=4]
6
7 define i32 @foo() {
8 entry:
9         br label %bb
10
11 bb:             ; preds = %bb, %entry
12         %indvar = phi i32 [ 0, %entry ], [ %indvar.next, %bb ]          ; <i32> [#uses=2]
13         %t.063.0 = phi i32 [ 0, %entry ], [ %tmp47, %bb ]               ; <i32> [#uses=1]
14         %j.065.0 = shl i32 %indvar, 2           ; <i32> [#uses=4]
15         %tmp3 = getelementptr [0 x i32]* @state, i32 0, i32 %j.065.0            ; <i32*> [#uses=2]
16         %tmp4 = load i32* %tmp3, align 4                ; <i32> [#uses=1]
17         %tmp6 = getelementptr [0 x i32]* @S, i32 0, i32 %t.063.0                ; <i32*> [#uses=1]
18         %tmp7 = load i32* %tmp6, align 4                ; <i32> [#uses=1]
19         %tmp8 = xor i32 %tmp7, %tmp4            ; <i32> [#uses=2]
20         store i32 %tmp8, i32* %tmp3, align 4
21         %tmp1378 = or i32 %j.065.0, 1           ; <i32> [#uses=1]
22         %tmp16 = getelementptr [0 x i32]* @state, i32 0, i32 %tmp1378           ; <i32*> [#uses=2]
23         %tmp17 = load i32* %tmp16, align 4              ; <i32> [#uses=1]
24         %tmp19 = getelementptr [0 x i32]* @S, i32 0, i32 %tmp8          ; <i32*> [#uses=1]
25         %tmp20 = load i32* %tmp19, align 4              ; <i32> [#uses=1]
26         %tmp21 = xor i32 %tmp20, %tmp17         ; <i32> [#uses=2]
27         store i32 %tmp21, i32* %tmp16, align 4
28         %tmp2680 = or i32 %j.065.0, 2           ; <i32> [#uses=1]
29         %tmp29 = getelementptr [0 x i32]* @state, i32 0, i32 %tmp2680           ; <i32*> [#uses=2]
30         %tmp30 = load i32* %tmp29, align 4              ; <i32> [#uses=1]
31         %tmp32 = getelementptr [0 x i32]* @S, i32 0, i32 %tmp21         ; <i32*> [#uses=1]
32         %tmp33 = load i32* %tmp32, align 4              ; <i32> [#uses=1]
33         %tmp34 = xor i32 %tmp33, %tmp30         ; <i32> [#uses=2]
34         store i32 %tmp34, i32* %tmp29, align 4
35         %tmp3982 = or i32 %j.065.0, 3           ; <i32> [#uses=1]
36         %tmp42 = getelementptr [0 x i32]* @state, i32 0, i32 %tmp3982           ; <i32*> [#uses=2]
37         %tmp43 = load i32* %tmp42, align 4              ; <i32> [#uses=1]
38         %tmp45 = getelementptr [0 x i32]* @S, i32 0, i32 %tmp34         ; <i32*> [#uses=1]
39         %tmp46 = load i32* %tmp45, align 4              ; <i32> [#uses=1]
40         %tmp47 = xor i32 %tmp46, %tmp43         ; <i32> [#uses=3]
41         store i32 %tmp47, i32* %tmp42, align 4
42         %indvar.next = add i32 %indvar, 1               ; <i32> [#uses=2]
43         %exitcond = icmp eq i32 %indvar.next, 4         ; <i1> [#uses=1]
44         br i1 %exitcond, label %bb57, label %bb
45
46 bb57:           ; preds = %bb
47         %tmp59 = and i32 %tmp47, 255            ; <i32> [#uses=1]
48         ret i32 %tmp59
49 }