Optimized FCMP_OEQ and FCMP_UNE for x86.
[oota-llvm.git] / test / CodeGen / X86 / 2008-02-08-LoadFoldingBug.ll
1 ; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 | grep andpd | not grep esp
2
3 declare double @llvm.sqrt.f64(double) nounwind readnone 
4
5 declare fastcc void @ApplyGivens(double**, double, double, i32, i32, i32, i32) nounwind 
6
7 declare double @fabs(double)
8
9 define void @main_bb114_2E_outer_2E_i_bb3_2E_i27(double** %tmp12.sub.i.i, [51 x double*]* %tmp12.i.i.i, i32 %i.0.reg2mem.0.ph.i, i32 %tmp11688.i, i32 %tmp19.i, i32 %tmp24.i, [51 x double*]* %tmp12.i.i) {
10 newFuncRoot:
11         br label %bb3.i27
12
13 bb111.i77.bb121.i_crit_edge.exitStub:           ; preds = %bb111.i77
14         ret void
15
16 bb3.i27:                ; preds = %bb111.i77.bb3.i27_crit_edge, %newFuncRoot
17         %indvar94.i = phi i32 [ 0, %newFuncRoot ], [ %tmp113.i76, %bb111.i77.bb3.i27_crit_edge ]                ; <i32> [#uses=6]
18         %tmp6.i20 = getelementptr [51 x double*]* %tmp12.i.i, i32 0, i32 %indvar94.i            ; <double**> [#uses=1]
19         %tmp7.i21 = load double** %tmp6.i20, align 4            ; <double*> [#uses=2]
20         %tmp10.i = add i32 %indvar94.i, %i.0.reg2mem.0.ph.i             ; <i32> [#uses=5]
21         %tmp11.i22 = getelementptr double* %tmp7.i21, i32 %tmp10.i              ; <double*> [#uses=1]
22         %tmp12.i23 = load double* %tmp11.i22, align 8           ; <double> [#uses=4]
23         %tmp20.i24 = add i32 %tmp19.i, %indvar94.i              ; <i32> [#uses=3]
24         %tmp21.i = getelementptr double* %tmp7.i21, i32 %tmp20.i24              ; <double*> [#uses=1]
25         %tmp22.i25 = load double* %tmp21.i, align 8             ; <double> [#uses=3]
26         %tmp1.i.i26 = fcmp oeq double %tmp12.i23, 0.000000e+00          ; <i1> [#uses=1]
27         br i1 %tmp1.i.i26, label %bb3.i27.Givens.exit.i49_crit_edge, label %bb5.i.i31
28
29 bb5.i.i31:              ; preds = %bb3.i27
30         %tmp7.i.i28 = call double @fabs( double %tmp12.i23 ) nounwind           ; <double> [#uses=1]
31         %tmp9.i.i29 = call double @fabs( double %tmp22.i25 ) nounwind           ; <double> [#uses=1]
32         %tmp10.i.i30 = fcmp ogt double %tmp7.i.i28, %tmp9.i.i29         ; <i1> [#uses=1]
33         br i1 %tmp10.i.i30, label %bb13.i.i37, label %bb30.i.i43
34
35 bb13.i.i37:             ; preds = %bb5.i.i31
36         %tmp15.i.i32 = sub double -0.000000e+00, %tmp22.i25             ; <double> [#uses=1]
37         %tmp17.i.i33 = fdiv double %tmp15.i.i32, %tmp12.i23             ; <double> [#uses=3]
38         %tmp20.i4.i = mul double %tmp17.i.i33, %tmp17.i.i33             ; <double> [#uses=1]
39         %tmp21.i.i34 = add double %tmp20.i4.i, 1.000000e+00             ; <double> [#uses=1]
40         %tmp22.i.i35 = call double @llvm.sqrt.f64( double %tmp21.i.i34 ) nounwind               ; <double> [#uses=1]
41         %tmp23.i5.i = fdiv double 1.000000e+00, %tmp22.i.i35            ; <double> [#uses=2]
42         %tmp28.i.i36 = mul double %tmp23.i5.i, %tmp17.i.i33             ; <double> [#uses=1]
43         br label %Givens.exit.i49
44
45 bb30.i.i43:             ; preds = %bb5.i.i31
46         %tmp32.i.i38 = sub double -0.000000e+00, %tmp12.i23             ; <double> [#uses=1]
47         %tmp34.i.i39 = fdiv double %tmp32.i.i38, %tmp22.i25             ; <double> [#uses=3]
48         %tmp37.i6.i = mul double %tmp34.i.i39, %tmp34.i.i39             ; <double> [#uses=1]
49         %tmp38.i.i40 = add double %tmp37.i6.i, 1.000000e+00             ; <double> [#uses=1]
50         %tmp39.i7.i = call double @llvm.sqrt.f64( double %tmp38.i.i40 ) nounwind                ; <double> [#uses=1]
51         %tmp40.i.i41 = fdiv double 1.000000e+00, %tmp39.i7.i            ; <double> [#uses=2]
52         %tmp45.i.i42 = mul double %tmp40.i.i41, %tmp34.i.i39            ; <double> [#uses=1]
53         br label %Givens.exit.i49
54
55 Givens.exit.i49:                ; preds = %bb3.i27.Givens.exit.i49_crit_edge, %bb30.i.i43, %bb13.i.i37
56         %s.0.i44 = phi double [ %tmp45.i.i42, %bb30.i.i43 ], [ %tmp23.i5.i, %bb13.i.i37 ], [ 0.000000e+00, %bb3.i27.Givens.exit.i49_crit_edge ]         ; <double> [#uses=2]
57         %c.0.i45 = phi double [ %tmp40.i.i41, %bb30.i.i43 ], [ %tmp28.i.i36, %bb13.i.i37 ], [ 1.000000e+00, %bb3.i27.Givens.exit.i49_crit_edge ]                ; <double> [#uses=2]
58         %tmp26.i46 = add i32 %tmp24.i, %indvar94.i              ; <i32> [#uses=2]
59         %tmp27.i47 = icmp slt i32 %tmp26.i46, 51                ; <i1> [#uses=1]
60         %min.i48 = select i1 %tmp27.i47, i32 %tmp26.i46, i32 50         ; <i32> [#uses=1]
61         call fastcc void @ApplyGivens( double** %tmp12.sub.i.i, double %s.0.i44, double %c.0.i45, i32 %tmp20.i24, i32 %tmp10.i, i32 %indvar94.i, i32 %min.i48 ) nounwind 
62         br label %codeRepl
63
64 codeRepl:               ; preds = %Givens.exit.i49
65         call void @main_bb114_2E_outer_2E_i_bb3_2E_i27_bb_2E_i48_2E_i( i32 %tmp10.i, i32 %tmp20.i24, double %s.0.i44, double %c.0.i45, [51 x double*]* %tmp12.i.i.i )
66         br label %ApplyRGivens.exit49.i
67
68 ApplyRGivens.exit49.i:          ; preds = %codeRepl
69         %tmp10986.i = icmp sgt i32 %tmp11688.i, %tmp10.i                ; <i1> [#uses=1]
70         br i1 %tmp10986.i, label %ApplyRGivens.exit49.i.bb52.i57_crit_edge, label %ApplyRGivens.exit49.i.bb111.i77_crit_edge
71
72 codeRepl1:              ; preds = %ApplyRGivens.exit49.i.bb52.i57_crit_edge
73         call void @main_bb114_2E_outer_2E_i_bb3_2E_i27_bb52_2E_i57( i32 %tmp10.i, double** %tmp12.sub.i.i, [51 x double*]* %tmp12.i.i.i, i32 %i.0.reg2mem.0.ph.i, i32 %tmp11688.i, i32 %tmp19.i, i32 %tmp24.i, [51 x double*]* %tmp12.i.i )
74         br label %bb105.i.bb111.i77_crit_edge
75
76 bb111.i77:              ; preds = %bb105.i.bb111.i77_crit_edge, %ApplyRGivens.exit49.i.bb111.i77_crit_edge
77         %tmp113.i76 = add i32 %indvar94.i, 1            ; <i32> [#uses=2]
78         %tmp118.i = icmp sgt i32 %tmp11688.i, %tmp113.i76               ; <i1> [#uses=1]
79         br i1 %tmp118.i, label %bb111.i77.bb3.i27_crit_edge, label %bb111.i77.bb121.i_crit_edge.exitStub
80
81 bb3.i27.Givens.exit.i49_crit_edge:              ; preds = %bb3.i27
82         br label %Givens.exit.i49
83
84 ApplyRGivens.exit49.i.bb52.i57_crit_edge:               ; preds = %ApplyRGivens.exit49.i
85         br label %codeRepl1
86
87 ApplyRGivens.exit49.i.bb111.i77_crit_edge:              ; preds = %ApplyRGivens.exit49.i
88         br label %bb111.i77
89
90 bb105.i.bb111.i77_crit_edge:            ; preds = %codeRepl1
91         br label %bb111.i77
92
93 bb111.i77.bb3.i27_crit_edge:            ; preds = %bb111.i77
94         br label %bb3.i27
95 }
96
97 declare void @main_bb114_2E_outer_2E_i_bb3_2E_i27_bb_2E_i48_2E_i(i32, i32, double, double, [51 x double*]*)
98
99 declare void @main_bb114_2E_outer_2E_i_bb3_2E_i27_bb52_2E_i57(i32, double**, [51 x double*]*, i32, i32, i32, i32, [51 x double*]*)