Enable two-address remat by default.
[oota-llvm.git] / test / CodeGen / X86 / 2007-11-30-LoadFolding-Bug.ll
1 ; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 -stats |& \
2 ; RUN:   grep {1 .*folded into instructions}
3
4 declare fastcc void @rdft(i32, i32, double*, i32*, double*)
5
6 define fastcc void @mp_sqrt(i32 %n, i32 %radix, i32* %in, i32* %out, i32* %tmp1, i32* %tmp2, i32 %nfft, double* %tmp1fft, double* %tmp2fft, i32* %ip, double* %w) nounwind {
7 entry:
8         br label %bb.i5
9
10 bb.i5:          ; preds = %bb.i5, %entry
11         %nfft_init.0.i = phi i32 [ 1, %entry ], [ %tmp7.i3, %bb.i5 ]            ; <i32> [#uses=1]
12         %tmp7.i3 = shl i32 %nfft_init.0.i, 1            ; <i32> [#uses=2]
13         br i1 false, label %bb.i5, label %mp_unexp_mp2d.exit.i
14
15 mp_unexp_mp2d.exit.i:           ; preds = %bb.i5
16         br i1 false, label %cond_next.i, label %cond_true.i
17
18 cond_true.i:            ; preds = %mp_unexp_mp2d.exit.i
19         ret void
20
21 cond_next.i:            ; preds = %mp_unexp_mp2d.exit.i
22         %tmp22.i = sdiv i32 0, 2                ; <i32> [#uses=2]
23         br i1 false, label %cond_true29.i, label %cond_next36.i
24
25 cond_true29.i:          ; preds = %cond_next.i
26         ret void
27
28 cond_next36.i:          ; preds = %cond_next.i
29         store i32 %tmp22.i, i32* null, align 4
30         %tmp8.i14.i = select i1 false, i32 1, i32 0             ; <i32> [#uses=1]
31         br label %bb.i28.i
32
33 bb.i28.i:               ; preds = %bb.i28.i, %cond_next36.i
34         %j.0.reg2mem.0.i16.i = phi i32 [ 0, %cond_next36.i ], [ %indvar.next39.i, %bb.i28.i ]           ; <i32> [#uses=2]
35         %din_addr.1.reg2mem.0.i17.i = phi double [ 0.000000e+00, %cond_next36.i ], [ %tmp16.i25.i, %bb.i28.i ]          ; <double> [#uses=1]
36         %tmp1.i18.i = fptosi double %din_addr.1.reg2mem.0.i17.i to i32          ; <i32> [#uses=2]
37         %tmp4.i19.i = icmp slt i32 %tmp1.i18.i, %radix          ; <i1> [#uses=1]
38         %x.0.i21.i = select i1 %tmp4.i19.i, i32 %tmp1.i18.i, i32 0              ; <i32> [#uses=1]
39         %tmp41.sum.i = add i32 %j.0.reg2mem.0.i16.i, 2          ; <i32> [#uses=0]
40         %tmp1213.i23.i = sitofp i32 %x.0.i21.i to double                ; <double> [#uses=1]
41         %tmp15.i24.i = sub double 0.000000e+00, %tmp1213.i23.i          ; <double> [#uses=1]
42         %tmp16.i25.i = mul double 0.000000e+00, %tmp15.i24.i            ; <double> [#uses=1]
43         %indvar.next39.i = add i32 %j.0.reg2mem.0.i16.i, 1              ; <i32> [#uses=2]
44         %exitcond40.i = icmp eq i32 %indvar.next39.i, %tmp8.i14.i               ; <i1> [#uses=1]
45         br i1 %exitcond40.i, label %mp_unexp_d2mp.exit29.i, label %bb.i28.i
46
47 mp_unexp_d2mp.exit29.i:         ; preds = %bb.i28.i
48         %tmp46.i = sub i32 0, %tmp22.i          ; <i32> [#uses=1]
49         store i32 %tmp46.i, i32* null, align 4
50         br i1 false, label %bb.i.i, label %mp_sqrt_init.exit
51
52 bb.i.i:         ; preds = %bb.i.i, %mp_unexp_d2mp.exit29.i
53         br label %bb.i.i
54
55 mp_sqrt_init.exit:              ; preds = %mp_unexp_d2mp.exit29.i
56         tail call fastcc void @mp_mul_csqu( i32 0, double* %tmp1fft )
57         tail call fastcc void @rdft( i32 0, i32 -1, double* null, i32* %ip, double* %w )
58         tail call fastcc void @mp_mul_d2i( i32 0, i32 %radix, i32 0, double* %tmp1fft, i32* %tmp2 )
59         br i1 false, label %cond_false.i, label %cond_true36.i
60
61 cond_true36.i:          ; preds = %mp_sqrt_init.exit
62         ret void
63
64 cond_false.i:           ; preds = %mp_sqrt_init.exit
65         tail call fastcc void @mp_round( i32 0, i32 %radix, i32 0, i32* %out )
66         tail call fastcc void @mp_add( i32 0, i32 %radix, i32* %tmp1, i32* %tmp2, i32* %tmp1 )
67         tail call fastcc void @mp_sub( i32 0, i32 %radix, i32* %in, i32* %tmp2, i32* %tmp2 )
68         tail call fastcc void @mp_round( i32 0, i32 %radix, i32 0, i32* %tmp1 )
69         tail call fastcc void @mp_mul_d2i( i32 0, i32 %radix, i32 %tmp7.i3, double* %tmp2fft, i32* %tmp2 )
70         ret void
71 }
72
73 declare fastcc void @mp_add(i32, i32, i32*, i32*, i32*)
74
75 declare fastcc void @mp_sub(i32, i32, i32*, i32*, i32*)
76
77 declare fastcc void @mp_round(i32, i32, i32, i32*)
78
79 declare fastcc void @mp_mul_csqu(i32, double*)
80
81 declare fastcc void @mp_mul_d2i(i32, i32, i32, double*, i32*)