blob: 8e315f4d80ff426b2a0697ae012c802a04f7e949 [file] [log] [blame]
Evan Chengd6cb4522009-11-03 21:40:02 +00001; RUN: llc < %s -march=x86 -mattr=+sse2 | FileCheck %s
2; Increment in loop bb.i28.i adjusted to 2, to prevent loop reversal from
Dale Johannesen0b31ad52009-05-11 17:15:42 +00003; kicking in.
Evan Cheng16ebb8c2007-11-30 21:23:43 +00004
5declare fastcc void @rdft(i32, i32, double*, i32*, double*)
6
Evan Chengd2b9d302008-06-25 01:16:38 +00007define 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 {
Evan Cheng16ebb8c2007-11-30 21:23:43 +00008entry:
9 br label %bb.i5
10
11bb.i5: ; preds = %bb.i5, %entry
12 %nfft_init.0.i = phi i32 [ 1, %entry ], [ %tmp7.i3, %bb.i5 ] ; <i32> [#uses=1]
Owen Anderson7279a052008-08-05 18:03:01 +000013 %foo = phi i1 [1, %entry], [0, %bb.i5]
Evan Cheng16ebb8c2007-11-30 21:23:43 +000014 %tmp7.i3 = shl i32 %nfft_init.0.i, 1 ; <i32> [#uses=2]
Owen Anderson7279a052008-08-05 18:03:01 +000015 br i1 %foo, label %bb.i5, label %mp_unexp_mp2d.exit.i
Evan Cheng16ebb8c2007-11-30 21:23:43 +000016
17mp_unexp_mp2d.exit.i: ; preds = %bb.i5
Owen Anderson7279a052008-08-05 18:03:01 +000018 br i1 %foo, label %cond_next.i, label %cond_true.i
Evan Cheng16ebb8c2007-11-30 21:23:43 +000019
20cond_true.i: ; preds = %mp_unexp_mp2d.exit.i
21 ret void
22
23cond_next.i: ; preds = %mp_unexp_mp2d.exit.i
24 %tmp22.i = sdiv i32 0, 2 ; <i32> [#uses=2]
Owen Anderson7279a052008-08-05 18:03:01 +000025 br i1 %foo, label %cond_true29.i, label %cond_next36.i
Evan Cheng16ebb8c2007-11-30 21:23:43 +000026
27cond_true29.i: ; preds = %cond_next.i
28 ret void
29
30cond_next36.i: ; preds = %cond_next.i
31 store i32 %tmp22.i, i32* null, align 4
Owen Anderson7279a052008-08-05 18:03:01 +000032 %tmp8.i14.i = select i1 %foo, i32 1, i32 0 ; <i32> [#uses=1]
Evan Cheng16ebb8c2007-11-30 21:23:43 +000033 br label %bb.i28.i
34
35bb.i28.i: ; preds = %bb.i28.i, %cond_next36.i
Evan Chengd6cb4522009-11-03 21:40:02 +000036; CHECK: %bb.i28.i
37; CHECK: addl $2
Dan Gohmand7df9e12010-02-12 10:34:29 +000038; CHECK: addl $-2
Evan Cheng16ebb8c2007-11-30 21:23:43 +000039 %j.0.reg2mem.0.i16.i = phi i32 [ 0, %cond_next36.i ], [ %indvar.next39.i, %bb.i28.i ] ; <i32> [#uses=2]
40 %din_addr.1.reg2mem.0.i17.i = phi double [ 0.000000e+00, %cond_next36.i ], [ %tmp16.i25.i, %bb.i28.i ] ; <double> [#uses=1]
41 %tmp1.i18.i = fptosi double %din_addr.1.reg2mem.0.i17.i to i32 ; <i32> [#uses=2]
42 %tmp4.i19.i = icmp slt i32 %tmp1.i18.i, %radix ; <i1> [#uses=1]
43 %x.0.i21.i = select i1 %tmp4.i19.i, i32 %tmp1.i18.i, i32 0 ; <i32> [#uses=1]
44 %tmp41.sum.i = add i32 %j.0.reg2mem.0.i16.i, 2 ; <i32> [#uses=0]
45 %tmp1213.i23.i = sitofp i32 %x.0.i21.i to double ; <double> [#uses=1]
Dan Gohman7ce405e2009-06-04 22:49:04 +000046 %tmp15.i24.i = fsub double 0.000000e+00, %tmp1213.i23.i ; <double> [#uses=1]
47 %tmp16.i25.i = fmul double 0.000000e+00, %tmp15.i24.i ; <double> [#uses=1]
Dale Johannesen0b31ad52009-05-11 17:15:42 +000048 %indvar.next39.i = add i32 %j.0.reg2mem.0.i16.i, 2 ; <i32> [#uses=2]
Evan Cheng16ebb8c2007-11-30 21:23:43 +000049 %exitcond40.i = icmp eq i32 %indvar.next39.i, %tmp8.i14.i ; <i1> [#uses=1]
50 br i1 %exitcond40.i, label %mp_unexp_d2mp.exit29.i, label %bb.i28.i
51
52mp_unexp_d2mp.exit29.i: ; preds = %bb.i28.i
53 %tmp46.i = sub i32 0, %tmp22.i ; <i32> [#uses=1]
54 store i32 %tmp46.i, i32* null, align 4
Owen Anderson7279a052008-08-05 18:03:01 +000055 br i1 %exitcond40.i, label %bb.i.i, label %mp_sqrt_init.exit
Evan Cheng16ebb8c2007-11-30 21:23:43 +000056
57bb.i.i: ; preds = %bb.i.i, %mp_unexp_d2mp.exit29.i
58 br label %bb.i.i
59
60mp_sqrt_init.exit: ; preds = %mp_unexp_d2mp.exit29.i
61 tail call fastcc void @mp_mul_csqu( i32 0, double* %tmp1fft )
62 tail call fastcc void @rdft( i32 0, i32 -1, double* null, i32* %ip, double* %w )
63 tail call fastcc void @mp_mul_d2i( i32 0, i32 %radix, i32 0, double* %tmp1fft, i32* %tmp2 )
Owen Anderson7279a052008-08-05 18:03:01 +000064 br i1 %exitcond40.i, label %cond_false.i, label %cond_true36.i
Evan Cheng16ebb8c2007-11-30 21:23:43 +000065
66cond_true36.i: ; preds = %mp_sqrt_init.exit
67 ret void
68
69cond_false.i: ; preds = %mp_sqrt_init.exit
70 tail call fastcc void @mp_round( i32 0, i32 %radix, i32 0, i32* %out )
71 tail call fastcc void @mp_add( i32 0, i32 %radix, i32* %tmp1, i32* %tmp2, i32* %tmp1 )
72 tail call fastcc void @mp_sub( i32 0, i32 %radix, i32* %in, i32* %tmp2, i32* %tmp2 )
73 tail call fastcc void @mp_round( i32 0, i32 %radix, i32 0, i32* %tmp1 )
74 tail call fastcc void @mp_mul_d2i( i32 0, i32 %radix, i32 %tmp7.i3, double* %tmp2fft, i32* %tmp2 )
75 ret void
76}
77
78declare fastcc void @mp_add(i32, i32, i32*, i32*, i32*)
79
80declare fastcc void @mp_sub(i32, i32, i32*, i32*, i32*)
81
82declare fastcc void @mp_round(i32, i32, i32, i32*)
83
84declare fastcc void @mp_mul_csqu(i32, double*)
85
86declare fastcc void @mp_mul_d2i(i32, i32, i32, double*, i32*)