[X86] Part 2 to fix x86-64 fp128 calling convention.
[oota-llvm.git] / test / Transforms / SimplifyCFG / merge-cond-stores-2.ll
1 ; RUN: opt -S < %s -simplifycfg -simplifycfg-merge-cond-stores=true -simplifycfg-merge-cond-stores-aggressively=false -phi-node-folding-threshold=2 | FileCheck %s
2
3 target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"
4 target triple = "armv7--linux-gnueabihf"
5
6 ; This is a bit reversal that has been run through the early optimizer (-mem2reg -gvn -instcombine).
7 ; There should be no additional PHIs created at all. The store should be on its own in a predicated
8 ; block and there should be no PHIs.
9
10 ; CHECK-LABEL: @f
11 ; CHECK-NOT: phi
12 ; CHECK: br i1 {{.*}}, label %[[L:.*]], label %[[R:.*]]
13 ; CHECK: [[L]] ; preds = 
14 ; CHECK-NEXT: store
15 ; CHECK-NEXT: br label %[[R]]
16 ; CHECK: [[R]] ; preds = 
17 ; CHECK-NEXT: ret i32 0
18
19 define i32 @f(i32* %b) {
20 entry:
21   %0 = load i32, i32* %b, align 4
22   %and = and i32 %0, 1
23   %tobool = icmp eq i32 %and, 0
24   br i1 %tobool, label %if.end, label %if.then
25
26 if.then:                                          ; preds = %entry
27   %or = or i32 %0, -2147483648
28   store i32 %or, i32* %b, align 4
29   br label %if.end
30
31 if.end:                                           ; preds = %entry, %if.then
32   %1 = phi i32 [ %0, %entry ], [ %or, %if.then ]
33   %and1 = and i32 %1, 2
34   %tobool2 = icmp eq i32 %and1, 0
35   br i1 %tobool2, label %if.end5, label %if.then3
36
37 if.then3:                                         ; preds = %if.end
38   %or4 = or i32 %1, 1073741824
39   store i32 %or4, i32* %b, align 4
40   br label %if.end5
41
42 if.end5:                                          ; preds = %if.end, %if.then3
43   %2 = phi i32 [ %1, %if.end ], [ %or4, %if.then3 ]
44   %and6 = and i32 %2, 4
45   %tobool7 = icmp eq i32 %and6, 0
46   br i1 %tobool7, label %if.end10, label %if.then8
47
48 if.then8:                                         ; preds = %if.end5
49   %or9 = or i32 %2, 536870912
50   store i32 %or9, i32* %b, align 4
51   br label %if.end10
52
53 if.end10:                                         ; preds = %if.end5, %if.then8
54   %3 = phi i32 [ %2, %if.end5 ], [ %or9, %if.then8 ]
55   %and11 = and i32 %3, 8
56   %tobool12 = icmp eq i32 %and11, 0
57   br i1 %tobool12, label %if.end15, label %if.then13
58
59 if.then13:                                        ; preds = %if.end10
60   %or14 = or i32 %3, 268435456
61   store i32 %or14, i32* %b, align 4
62   br label %if.end15
63
64 if.end15:                                         ; preds = %if.end10, %if.then13
65   %4 = phi i32 [ %3, %if.end10 ], [ %or14, %if.then13 ]
66   %and16 = and i32 %4, 16
67   %tobool17 = icmp eq i32 %and16, 0
68   br i1 %tobool17, label %if.end20, label %if.then18
69
70 if.then18:                                        ; preds = %if.end15
71   %or19 = or i32 %4, 134217728
72   store i32 %or19, i32* %b, align 4
73   br label %if.end20
74
75 if.end20:                                         ; preds = %if.end15, %if.then18
76   %5 = phi i32 [ %4, %if.end15 ], [ %or19, %if.then18 ]
77   %and21 = and i32 %5, 32
78   %tobool22 = icmp eq i32 %and21, 0
79   br i1 %tobool22, label %if.end25, label %if.then23
80
81 if.then23:                                        ; preds = %if.end20
82   %or24 = or i32 %5, 67108864
83   store i32 %or24, i32* %b, align 4
84   br label %if.end25
85
86 if.end25:                                         ; preds = %if.end20, %if.then23
87   %6 = phi i32 [ %5, %if.end20 ], [ %or24, %if.then23 ]
88   %and26 = and i32 %6, 64
89   %tobool27 = icmp eq i32 %and26, 0
90   br i1 %tobool27, label %if.end30, label %if.then28
91
92 if.then28:                                        ; preds = %if.end25
93   %or29 = or i32 %6, 33554432
94   store i32 %or29, i32* %b, align 4
95   br label %if.end30
96
97 if.end30:                                         ; preds = %if.end25, %if.then28
98   %7 = phi i32 [ %6, %if.end25 ], [ %or29, %if.then28 ]
99   %and31 = and i32 %7, 256
100   %tobool32 = icmp eq i32 %and31, 0
101   br i1 %tobool32, label %if.end35, label %if.then33
102
103 if.then33:                                        ; preds = %if.end30
104   %or34 = or i32 %7, 8388608
105   store i32 %or34, i32* %b, align 4
106   br label %if.end35
107
108 if.end35:                                         ; preds = %if.end30, %if.then33
109   %8 = phi i32 [ %7, %if.end30 ], [ %or34, %if.then33 ]
110   %and36 = and i32 %8, 512
111   %tobool37 = icmp eq i32 %and36, 0
112   br i1 %tobool37, label %if.end40, label %if.then38
113
114 if.then38:                                        ; preds = %if.end35
115   %or39 = or i32 %8, 4194304
116   store i32 %or39, i32* %b, align 4
117   br label %if.end40
118
119 if.end40:                                         ; preds = %if.end35, %if.then38
120   %9 = phi i32 [ %8, %if.end35 ], [ %or39, %if.then38 ]
121   %and41 = and i32 %9, 1024
122   %tobool42 = icmp eq i32 %and41, 0
123   br i1 %tobool42, label %if.end45, label %if.then43
124
125 if.then43:                                        ; preds = %if.end40
126   %or44 = or i32 %9, 2097152
127   store i32 %or44, i32* %b, align 4
128   br label %if.end45
129
130 if.end45:                                         ; preds = %if.end40, %if.then43
131   %10 = phi i32 [ %9, %if.end40 ], [ %or44, %if.then43 ]
132   %and46 = and i32 %10, 2048
133   %tobool47 = icmp eq i32 %and46, 0
134   br i1 %tobool47, label %if.end50, label %if.then48
135
136 if.then48:                                        ; preds = %if.end45
137   %or49 = or i32 %10, 1048576
138   store i32 %or49, i32* %b, align 4
139   br label %if.end50
140
141 if.end50:                                         ; preds = %if.end45, %if.then48
142   %11 = phi i32 [ %10, %if.end45 ], [ %or49, %if.then48 ]
143   %and51 = and i32 %11, 4096
144   %tobool52 = icmp eq i32 %and51, 0
145   br i1 %tobool52, label %if.end55, label %if.then53
146
147 if.then53:                                        ; preds = %if.end50
148   %or54 = or i32 %11, 524288
149   store i32 %or54, i32* %b, align 4
150   br label %if.end55
151
152 if.end55:                                         ; preds = %if.end50, %if.then53
153   %12 = phi i32 [ %11, %if.end50 ], [ %or54, %if.then53 ]
154   %and56 = and i32 %12, 8192
155   %tobool57 = icmp eq i32 %and56, 0
156   br i1 %tobool57, label %if.end60, label %if.then58
157
158 if.then58:                                        ; preds = %if.end55
159   %or59 = or i32 %12, 262144
160   store i32 %or59, i32* %b, align 4
161   br label %if.end60
162
163 if.end60:                                         ; preds = %if.end55, %if.then58
164   %13 = phi i32 [ %12, %if.end55 ], [ %or59, %if.then58 ]
165   %and61 = and i32 %13, 16384
166   %tobool62 = icmp eq i32 %and61, 0
167   br i1 %tobool62, label %if.end65, label %if.then63
168
169 if.then63:                                        ; preds = %if.end60
170   %or64 = or i32 %13, 131072
171   store i32 %or64, i32* %b, align 4
172   br label %if.end65
173
174 if.end65:                                         ; preds = %if.end60, %if.then63
175   %14 = phi i32 [ %13, %if.end60 ], [ %or64, %if.then63 ]
176   %and66 = and i32 %14, 32768
177   %tobool67 = icmp eq i32 %and66, 0
178   br i1 %tobool67, label %if.end70, label %if.then68
179
180 if.then68:                                        ; preds = %if.end65
181   %or69 = or i32 %14, 65536
182   store i32 %or69, i32* %b, align 4
183   br label %if.end70
184
185 if.end70:                                         ; preds = %if.end65, %if.then68
186   %15 = phi i32 [ %14, %if.end65 ], [ %or69, %if.then68 ]
187   %and71 = and i32 %15, 128
188   %tobool72 = icmp eq i32 %and71, 0
189   br i1 %tobool72, label %if.end75, label %if.then73
190
191 if.then73:                                        ; preds = %if.end70
192   %or74 = or i32 %15, 16777216
193   store i32 %or74, i32* %b, align 4
194   br label %if.end75
195
196 if.end75:                                         ; preds = %if.end70, %if.then73
197   ret i32 0
198 }