Do not treat FP_REG_KILL as terminator in branch analysis (X86).
[oota-llvm.git] / test / CodeGen / X86 / 2007-06-14-branchfold.ll
1 ; RUN: llvm-as < %s | llc -mcpu=i686 | grep jmp | wc -l | grep 1
2 ; check that branch folding understands FP_REG_KILL is not a branch
3 ; the remaining jmp can be removed if we take advantage of knowing
4 ; abort does not return
5
6 ; ModuleID = 'g.bc'
7 target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64"
8 target triple = "i686-pc-linux-gnu"
9   %struct.FRAME.c34003a = type { float, float }
10 @report_E = global i8 0   ; <i8*> [#uses=0]
11
12 define void @main() {
13 entry:
14   %FRAME.31 = alloca %struct.FRAME.c34003a, align 8   ; <%struct.FRAME.c34003a*> [#uses=4]
15   %tmp20 = call i32 @report__ident_int( i32 -50 )   ; <i32> [#uses=1]
16   %tmp2021 = sitofp i32 %tmp20 to float   ; <float> [#uses=5]
17   %tmp23 = fcmp ult float %tmp2021, 0xC7EFFFFFE0000000    ; <i1> [#uses=1]
18   %tmp26 = fcmp ugt float %tmp2021, 0x47EFFFFFE0000000    ; <i1> [#uses=1]
19   %bothcond = or i1 %tmp23, %tmp26    ; <i1> [#uses=1]
20   br i1 %bothcond, label %bb, label %bb30
21
22 bb:   ; preds = %entry
23   unwind
24
25 bb30:   ; preds = %entry
26   %tmp35 = call i32 @report__ident_int( i32 50 )    ; <i32> [#uses=1]
27   %tmp3536 = sitofp i32 %tmp35 to float   ; <float> [#uses=4]
28   %tmp38 = fcmp ult float %tmp3536, 0xC7EFFFFFE0000000    ; <i1> [#uses=1]
29   %tmp44 = fcmp ugt float %tmp3536, 0x47EFFFFFE0000000    ; <i1> [#uses=1]
30   %bothcond226 = or i1 %tmp38, %tmp44   ; <i1> [#uses=1]
31   br i1 %bothcond226, label %bb47, label %bb49
32
33 bb47:   ; preds = %bb30
34   unwind
35
36 bb49:   ; preds = %bb30
37   %tmp60 = fcmp ult float %tmp3536, %tmp2021    ; <i1> [#uses=1]
38   %tmp60.not = xor i1 %tmp60, true    ; <i1> [#uses=1]
39   %tmp65 = fcmp olt float %tmp2021, 0xC7EFFFFFE0000000    ; <i1> [#uses=1]
40   %bothcond227 = and i1 %tmp65, %tmp60.not    ; <i1> [#uses=1]
41   br i1 %bothcond227, label %cond_true68, label %cond_next70
42
43 cond_true68:    ; preds = %bb49
44   unwind
45
46 cond_next70:    ; preds = %bb49
47   %tmp71 = call i32 @report__ident_int( i32 -30 )   ; <i32> [#uses=1]
48   %tmp7172 = sitofp i32 %tmp71 to float   ; <float> [#uses=3]
49   %tmp74 = fcmp ult float %tmp7172, 0xC7EFFFFFE0000000    ; <i1> [#uses=1]
50   %tmp80 = fcmp ugt float %tmp7172, 0x47EFFFFFE0000000    ; <i1> [#uses=1]
51   %bothcond228 = or i1 %tmp74, %tmp80   ; <i1> [#uses=1]
52   br i1 %bothcond228, label %bb83, label %bb85
53
54 bb83:   ; preds = %cond_next70
55   unwind
56
57 bb85:   ; preds = %cond_next70
58   %tmp90 = getelementptr %struct.FRAME.c34003a* %FRAME.31, i32 0, i32 1   ; <float*> [#uses=3]
59   store float %tmp7172, float* %tmp90
60   %tmp92 = call i32 @report__ident_int( i32 30 )    ; <i32> [#uses=1]
61   %tmp9293 = sitofp i32 %tmp92 to float   ; <float> [#uses=7]
62   %tmp95 = fcmp ult float %tmp9293, 0xC7EFFFFFE0000000    ; <i1> [#uses=1]
63   %tmp101 = fcmp ugt float %tmp9293, 0x47EFFFFFE0000000   ; <i1> [#uses=1]
64   %bothcond229 = or i1 %tmp95, %tmp101    ; <i1> [#uses=1]
65   br i1 %bothcond229, label %bb104, label %bb106
66
67 bb104:    ; preds = %bb85
68   unwind
69
70 bb106:    ; preds = %bb85
71   %tmp111 = getelementptr %struct.FRAME.c34003a* %FRAME.31, i32 0, i32 0    ; <float*> [#uses=2]
72   store float %tmp9293, float* %tmp111
73   %tmp123 = load float* %tmp90    ; <float> [#uses=4]
74   %tmp125 = fcmp ult float %tmp9293, %tmp123    ; <i1> [#uses=1]
75   br i1 %tmp125, label %cond_next147, label %cond_true128
76
77 cond_true128:   ; preds = %bb106
78   %tmp133 = fcmp olt float %tmp123, %tmp2021    ; <i1> [#uses=1]
79   %tmp142 = fcmp ogt float %tmp9293, %tmp3536   ; <i1> [#uses=1]
80   %bothcond230 = or i1 %tmp133, %tmp142   ; <i1> [#uses=1]
81   br i1 %bothcond230, label %bb145, label %cond_next147
82
83 bb145:    ; preds = %cond_true128
84   unwind
85
86 cond_next147:   ; preds = %cond_true128, %bb106
87   %tmp157 = fcmp ugt float %tmp123, -3.000000e+01   ; <i1> [#uses=1]
88   %tmp165 = fcmp ult float %tmp9293, -3.000000e+01    ; <i1> [#uses=1]
89   %bothcond231 = or i1 %tmp157, %tmp165   ; <i1> [#uses=1]
90   br i1 %bothcond231, label %bb168, label %bb169
91
92 bb168:    ; preds = %cond_next147
93   unwind
94
95 bb169:    ; preds = %cond_next147
96   %tmp176 = fcmp ugt float %tmp123, 3.000000e+01    ; <i1> [#uses=1]
97   %tmp184 = fcmp ult float %tmp9293, 3.000000e+01   ; <i1> [#uses=1]
98   %bothcond232 = or i1 %tmp176, %tmp184   ; <i1> [#uses=1]
99   br i1 %bothcond232, label %bb187, label %bb188
100
101 bb187:    ; preds = %bb169
102   unwind
103
104 bb188:    ; preds = %bb169
105   %tmp192 = call fastcc float @c34003a__ident.154( %struct.FRAME.c34003a* %FRAME.31, float 3.000000e+01 )   ; <float> [#uses=2]
106   %tmp194 = load float* %tmp90    ; <float> [#uses=1]
107   %tmp196 = fcmp ugt float %tmp194, 0.000000e+00    ; <i1> [#uses=1]
108   br i1 %tmp196, label %bb207, label %cond_next200
109
110 cond_next200:   ; preds = %bb188
111   %tmp202 = load float* %tmp111   ; <float> [#uses=1]
112   %tmp204 = fcmp ult float %tmp202, 0.000000e+00    ; <i1> [#uses=1]
113   br i1 %tmp204, label %bb207, label %bb208
114
115 bb207:    ; preds = %cond_next200, %bb188
116   unwind
117
118 bb208:    ; preds = %cond_next200
119   %tmp212 = call fastcc float @c34003a__ident.154( %struct.FRAME.c34003a* %FRAME.31, float 0.000000e+00 )   ; <float> [#uses=1]
120   %tmp214 = fcmp oge float %tmp212, %tmp192   ; <i1> [#uses=1]
121   %tmp217 = fcmp oge float %tmp192, 1.000000e+02    ; <i1> [#uses=1]
122   %tmp221 = or i1 %tmp214, %tmp217    ; <i1> [#uses=1]
123   br i1 %tmp221, label %cond_true224, label %UnifiedReturnBlock
124
125 cond_true224:   ; preds = %bb208
126   call void @abort( ) noreturn
127   ret void
128
129 UnifiedReturnBlock:   ; preds = %bb208
130   ret void
131 }
132
133 declare fastcc float @c34003a__ident.154(%struct.FRAME.c34003a* %CHAIN.32, float %x) 
134
135 declare i32 @report__ident_int(i32 %x)
136
137 declare void @abort() noreturn