1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -loop-idiom -mtriple=riscv32 -mattr=+experimental-zbb -S < %s | FileCheck %s --check-prefixes=CPOP
3 ; RUN: opt -loop-idiom -mtriple=riscv64 -mattr=+experimental-zbb -S < %s | FileCheck %s --check-prefixes=CPOP
4 ; RUN: opt -loop-idiom -mtriple=riscv32 -mattr=+experimental-b -S < %s | FileCheck %s --check-prefixes=CPOP
5 ; RUN: opt -loop-idiom -mtriple=riscv64 -mattr=+experimental-b -S < %s | FileCheck %s --check-prefixes=CPOP
6 ; RUN: opt -loop-idiom -mtriple=riscv32 -S < %s | FileCheck %s --check-prefixes=NOCPOP
7 ; RUN: opt -loop-idiom -mtriple=riscv64 -S < %s | FileCheck %s --check-prefixes=NOCPOP
9 ; Mostly copied from AMDGPU version.
11 ;To recognize this pattern:
12 ;int popcount(unsigned long long a) {
22 define i32 @popcount_i64(i64 %a) nounwind uwtable readnone ssp {
23 ; CPOP-LABEL: @popcount_i64(
25 ; CPOP-NEXT: [[TMP0:%.*]] = call i64 @llvm.ctpop.i64(i64 [[A:%.*]])
26 ; CPOP-NEXT: [[TMP1:%.*]] = trunc i64 [[TMP0]] to i32
27 ; CPOP-NEXT: [[TMP2:%.*]] = icmp eq i32 [[TMP1]], 0
28 ; CPOP-NEXT: br i1 [[TMP2]], label [[WHILE_END:%.*]], label [[WHILE_BODY_PREHEADER:%.*]]
29 ; CPOP: while.body.preheader:
30 ; CPOP-NEXT: br label [[WHILE_BODY:%.*]]
32 ; CPOP-NEXT: [[TCPHI:%.*]] = phi i32 [ [[TMP1]], [[WHILE_BODY_PREHEADER]] ], [ [[TCDEC:%.*]], [[WHILE_BODY]] ]
33 ; CPOP-NEXT: [[C_05:%.*]] = phi i32 [ [[INC:%.*]], [[WHILE_BODY]] ], [ 0, [[WHILE_BODY_PREHEADER]] ]
34 ; CPOP-NEXT: [[A_ADDR_04:%.*]] = phi i64 [ [[AND:%.*]], [[WHILE_BODY]] ], [ [[A]], [[WHILE_BODY_PREHEADER]] ]
35 ; CPOP-NEXT: [[INC]] = add nsw i32 [[C_05]], 1
36 ; CPOP-NEXT: [[SUB:%.*]] = add i64 [[A_ADDR_04]], -1
37 ; CPOP-NEXT: [[AND]] = and i64 [[SUB]], [[A_ADDR_04]]
38 ; CPOP-NEXT: [[TCDEC]] = sub nsw i32 [[TCPHI]], 1
39 ; CPOP-NEXT: [[TOBOOL:%.*]] = icmp sle i32 [[TCDEC]], 0
40 ; CPOP-NEXT: br i1 [[TOBOOL]], label [[WHILE_END_LOOPEXIT:%.*]], label [[WHILE_BODY]]
41 ; CPOP: while.end.loopexit:
42 ; CPOP-NEXT: [[INC_LCSSA:%.*]] = phi i32 [ [[TMP1]], [[WHILE_BODY]] ]
43 ; CPOP-NEXT: br label [[WHILE_END]]
45 ; CPOP-NEXT: [[C_0_LCSSA:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[INC_LCSSA]], [[WHILE_END_LOOPEXIT]] ]
46 ; CPOP-NEXT: ret i32 [[C_0_LCSSA]]
48 ; NOCPOP-LABEL: @popcount_i64(
50 ; NOCPOP-NEXT: [[TOBOOL3:%.*]] = icmp eq i64 [[A:%.*]], 0
51 ; NOCPOP-NEXT: br i1 [[TOBOOL3]], label [[WHILE_END:%.*]], label [[WHILE_BODY_PREHEADER:%.*]]
52 ; NOCPOP: while.body.preheader:
53 ; NOCPOP-NEXT: br label [[WHILE_BODY:%.*]]
55 ; NOCPOP-NEXT: [[C_05:%.*]] = phi i32 [ [[INC:%.*]], [[WHILE_BODY]] ], [ 0, [[WHILE_BODY_PREHEADER]] ]
56 ; NOCPOP-NEXT: [[A_ADDR_04:%.*]] = phi i64 [ [[AND:%.*]], [[WHILE_BODY]] ], [ [[A]], [[WHILE_BODY_PREHEADER]] ]
57 ; NOCPOP-NEXT: [[INC]] = add nsw i32 [[C_05]], 1
58 ; NOCPOP-NEXT: [[SUB:%.*]] = add i64 [[A_ADDR_04]], -1
59 ; NOCPOP-NEXT: [[AND]] = and i64 [[SUB]], [[A_ADDR_04]]
60 ; NOCPOP-NEXT: [[TOBOOL:%.*]] = icmp eq i64 [[AND]], 0
61 ; NOCPOP-NEXT: br i1 [[TOBOOL]], label [[WHILE_END_LOOPEXIT:%.*]], label [[WHILE_BODY]]
62 ; NOCPOP: while.end.loopexit:
63 ; NOCPOP-NEXT: [[INC_LCSSA:%.*]] = phi i32 [ [[INC]], [[WHILE_BODY]] ]
64 ; NOCPOP-NEXT: br label [[WHILE_END]]
66 ; NOCPOP-NEXT: [[C_0_LCSSA:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[INC_LCSSA]], [[WHILE_END_LOOPEXIT]] ]
67 ; NOCPOP-NEXT: ret i32 [[C_0_LCSSA]]
70 %tobool3 = icmp eq i64 %a, 0
71 br i1 %tobool3, label %while.end, label %while.body
73 while.body: ; preds = %entry, %while.body
74 %c.05 = phi i32 [ %inc, %while.body ], [ 0, %entry ]
75 %a.addr.04 = phi i64 [ %and, %while.body ], [ %a, %entry ]
76 %inc = add nsw i32 %c.05, 1
77 %sub = add i64 %a.addr.04, -1
78 %and = and i64 %sub, %a.addr.04
79 %tobool = icmp eq i64 %and, 0
80 br i1 %tobool, label %while.end, label %while.body
82 while.end: ; preds = %while.body, %entry
83 %c.0.lcssa = phi i32 [ 0, %entry ], [ %inc, %while.body ]
87 define i32 @popcount_i32(i32 %a) nounwind uwtable readnone ssp {
88 ; CPOP-LABEL: @popcount_i32(
90 ; CPOP-NEXT: [[TMP0:%.*]] = call i32 @llvm.ctpop.i32(i32 [[A:%.*]])
91 ; CPOP-NEXT: [[TMP1:%.*]] = icmp eq i32 [[TMP0]], 0
92 ; CPOP-NEXT: br i1 [[TMP1]], label [[WHILE_END:%.*]], label [[WHILE_BODY_PREHEADER:%.*]]
93 ; CPOP: while.body.preheader:
94 ; CPOP-NEXT: br label [[WHILE_BODY:%.*]]
96 ; CPOP-NEXT: [[TCPHI:%.*]] = phi i32 [ [[TMP0]], [[WHILE_BODY_PREHEADER]] ], [ [[TCDEC:%.*]], [[WHILE_BODY]] ]
97 ; CPOP-NEXT: [[C_05:%.*]] = phi i32 [ [[INC:%.*]], [[WHILE_BODY]] ], [ 0, [[WHILE_BODY_PREHEADER]] ]
98 ; CPOP-NEXT: [[A_ADDR_04:%.*]] = phi i32 [ [[AND:%.*]], [[WHILE_BODY]] ], [ [[A]], [[WHILE_BODY_PREHEADER]] ]
99 ; CPOP-NEXT: [[INC]] = add nsw i32 [[C_05]], 1
100 ; CPOP-NEXT: [[SUB:%.*]] = add i32 [[A_ADDR_04]], -1
101 ; CPOP-NEXT: [[AND]] = and i32 [[SUB]], [[A_ADDR_04]]
102 ; CPOP-NEXT: [[TCDEC]] = sub nsw i32 [[TCPHI]], 1
103 ; CPOP-NEXT: [[TOBOOL:%.*]] = icmp sle i32 [[TCDEC]], 0
104 ; CPOP-NEXT: br i1 [[TOBOOL]], label [[WHILE_END_LOOPEXIT:%.*]], label [[WHILE_BODY]]
105 ; CPOP: while.end.loopexit:
106 ; CPOP-NEXT: [[INC_LCSSA:%.*]] = phi i32 [ [[TMP0]], [[WHILE_BODY]] ]
107 ; CPOP-NEXT: br label [[WHILE_END]]
109 ; CPOP-NEXT: [[C_0_LCSSA:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[INC_LCSSA]], [[WHILE_END_LOOPEXIT]] ]
110 ; CPOP-NEXT: ret i32 [[C_0_LCSSA]]
112 ; NOCPOP-LABEL: @popcount_i32(
113 ; NOCPOP-NEXT: entry:
114 ; NOCPOP-NEXT: [[TOBOOL3:%.*]] = icmp eq i32 [[A:%.*]], 0
115 ; NOCPOP-NEXT: br i1 [[TOBOOL3]], label [[WHILE_END:%.*]], label [[WHILE_BODY_PREHEADER:%.*]]
116 ; NOCPOP: while.body.preheader:
117 ; NOCPOP-NEXT: br label [[WHILE_BODY:%.*]]
118 ; NOCPOP: while.body:
119 ; NOCPOP-NEXT: [[C_05:%.*]] = phi i32 [ [[INC:%.*]], [[WHILE_BODY]] ], [ 0, [[WHILE_BODY_PREHEADER]] ]
120 ; NOCPOP-NEXT: [[A_ADDR_04:%.*]] = phi i32 [ [[AND:%.*]], [[WHILE_BODY]] ], [ [[A]], [[WHILE_BODY_PREHEADER]] ]
121 ; NOCPOP-NEXT: [[INC]] = add nsw i32 [[C_05]], 1
122 ; NOCPOP-NEXT: [[SUB:%.*]] = add i32 [[A_ADDR_04]], -1
123 ; NOCPOP-NEXT: [[AND]] = and i32 [[SUB]], [[A_ADDR_04]]
124 ; NOCPOP-NEXT: [[TOBOOL:%.*]] = icmp eq i32 [[AND]], 0
125 ; NOCPOP-NEXT: br i1 [[TOBOOL]], label [[WHILE_END_LOOPEXIT:%.*]], label [[WHILE_BODY]]
126 ; NOCPOP: while.end.loopexit:
127 ; NOCPOP-NEXT: [[INC_LCSSA:%.*]] = phi i32 [ [[INC]], [[WHILE_BODY]] ]
128 ; NOCPOP-NEXT: br label [[WHILE_END]]
130 ; NOCPOP-NEXT: [[C_0_LCSSA:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[INC_LCSSA]], [[WHILE_END_LOOPEXIT]] ]
131 ; NOCPOP-NEXT: ret i32 [[C_0_LCSSA]]
134 %tobool3 = icmp eq i32 %a, 0
135 br i1 %tobool3, label %while.end, label %while.body
137 while.body: ; preds = %entry, %while.body
138 %c.05 = phi i32 [ %inc, %while.body ], [ 0, %entry ]
139 %a.addr.04 = phi i32 [ %and, %while.body ], [ %a, %entry ]
140 %inc = add nsw i32 %c.05, 1
141 %sub = add i32 %a.addr.04, -1
142 %and = and i32 %sub, %a.addr.04
143 %tobool = icmp eq i32 %and, 0
144 br i1 %tobool, label %while.end, label %while.body
146 while.end: ; preds = %while.body, %entry
147 %c.0.lcssa = phi i32 [ 0, %entry ], [ %inc, %while.body ]
151 define i32 @popcount_i128(i128 %a) nounwind uwtable readnone ssp {
152 ; CPOP-LABEL: @popcount_i128(
154 ; CPOP-NEXT: [[TMP0:%.*]] = call i128 @llvm.ctpop.i128(i128 [[A:%.*]])
155 ; CPOP-NEXT: [[TMP1:%.*]] = trunc i128 [[TMP0]] to i32
156 ; CPOP-NEXT: [[TMP2:%.*]] = icmp eq i32 [[TMP1]], 0
157 ; CPOP-NEXT: br i1 [[TMP2]], label [[WHILE_END:%.*]], label [[WHILE_BODY_PREHEADER:%.*]]
158 ; CPOP: while.body.preheader:
159 ; CPOP-NEXT: br label [[WHILE_BODY:%.*]]
161 ; CPOP-NEXT: [[TCPHI:%.*]] = phi i32 [ [[TMP1]], [[WHILE_BODY_PREHEADER]] ], [ [[TCDEC:%.*]], [[WHILE_BODY]] ]
162 ; CPOP-NEXT: [[C_05:%.*]] = phi i32 [ [[INC:%.*]], [[WHILE_BODY]] ], [ 0, [[WHILE_BODY_PREHEADER]] ]
163 ; CPOP-NEXT: [[A_ADDR_04:%.*]] = phi i128 [ [[AND:%.*]], [[WHILE_BODY]] ], [ [[A]], [[WHILE_BODY_PREHEADER]] ]
164 ; CPOP-NEXT: [[INC]] = add nsw i32 [[C_05]], 1
165 ; CPOP-NEXT: [[SUB:%.*]] = add i128 [[A_ADDR_04]], -1
166 ; CPOP-NEXT: [[AND]] = and i128 [[SUB]], [[A_ADDR_04]]
167 ; CPOP-NEXT: [[TCDEC]] = sub nsw i32 [[TCPHI]], 1
168 ; CPOP-NEXT: [[TOBOOL:%.*]] = icmp sle i32 [[TCDEC]], 0
169 ; CPOP-NEXT: br i1 [[TOBOOL]], label [[WHILE_END_LOOPEXIT:%.*]], label [[WHILE_BODY]]
170 ; CPOP: while.end.loopexit:
171 ; CPOP-NEXT: [[INC_LCSSA:%.*]] = phi i32 [ [[TMP1]], [[WHILE_BODY]] ]
172 ; CPOP-NEXT: br label [[WHILE_END]]
174 ; CPOP-NEXT: [[C_0_LCSSA:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[INC_LCSSA]], [[WHILE_END_LOOPEXIT]] ]
175 ; CPOP-NEXT: ret i32 [[C_0_LCSSA]]
177 ; NOCPOP-LABEL: @popcount_i128(
178 ; NOCPOP-NEXT: entry:
179 ; NOCPOP-NEXT: [[TOBOOL3:%.*]] = icmp eq i128 [[A:%.*]], 0
180 ; NOCPOP-NEXT: br i1 [[TOBOOL3]], label [[WHILE_END:%.*]], label [[WHILE_BODY_PREHEADER:%.*]]
181 ; NOCPOP: while.body.preheader:
182 ; NOCPOP-NEXT: br label [[WHILE_BODY:%.*]]
183 ; NOCPOP: while.body:
184 ; NOCPOP-NEXT: [[C_05:%.*]] = phi i32 [ [[INC:%.*]], [[WHILE_BODY]] ], [ 0, [[WHILE_BODY_PREHEADER]] ]
185 ; NOCPOP-NEXT: [[A_ADDR_04:%.*]] = phi i128 [ [[AND:%.*]], [[WHILE_BODY]] ], [ [[A]], [[WHILE_BODY_PREHEADER]] ]
186 ; NOCPOP-NEXT: [[INC]] = add nsw i32 [[C_05]], 1
187 ; NOCPOP-NEXT: [[SUB:%.*]] = add i128 [[A_ADDR_04]], -1
188 ; NOCPOP-NEXT: [[AND]] = and i128 [[SUB]], [[A_ADDR_04]]
189 ; NOCPOP-NEXT: [[TOBOOL:%.*]] = icmp eq i128 [[AND]], 0
190 ; NOCPOP-NEXT: br i1 [[TOBOOL]], label [[WHILE_END_LOOPEXIT:%.*]], label [[WHILE_BODY]]
191 ; NOCPOP: while.end.loopexit:
192 ; NOCPOP-NEXT: [[INC_LCSSA:%.*]] = phi i32 [ [[INC]], [[WHILE_BODY]] ]
193 ; NOCPOP-NEXT: br label [[WHILE_END]]
195 ; NOCPOP-NEXT: [[C_0_LCSSA:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[INC_LCSSA]], [[WHILE_END_LOOPEXIT]] ]
196 ; NOCPOP-NEXT: ret i32 [[C_0_LCSSA]]
199 %tobool3 = icmp eq i128 %a, 0
200 br i1 %tobool3, label %while.end, label %while.body
202 while.body: ; preds = %entry, %while.body
203 %c.05 = phi i32 [ %inc, %while.body ], [ 0, %entry ]
204 %a.addr.04 = phi i128 [ %and, %while.body ], [ %a, %entry ]
205 %inc = add nsw i32 %c.05, 1
206 %sub = add i128 %a.addr.04, -1
207 %and = and i128 %sub, %a.addr.04
208 %tobool = icmp eq i128 %and, 0
209 br i1 %tobool, label %while.end, label %while.body
211 while.end: ; preds = %while.body, %entry
212 %c.0.lcssa = phi i32 [ 0, %entry ], [ %inc, %while.body ]
216 ; To recognize this pattern:
217 ;int popcount(unsigned long long a, int mydata1, int mydata2) {
225 ; return c + mydata1 + mydata2;
228 define i32 @popcount2(i64 %a, i32 %mydata1, i32 %mydata2) nounwind uwtable readnone ssp {
229 ; CPOP-LABEL: @popcount2(
231 ; CPOP-NEXT: [[TMP0:%.*]] = call i64 @llvm.ctpop.i64(i64 [[A:%.*]])
232 ; CPOP-NEXT: [[TMP1:%.*]] = trunc i64 [[TMP0]] to i32
233 ; CPOP-NEXT: [[TMP2:%.*]] = icmp eq i32 [[TMP1]], 0
234 ; CPOP-NEXT: br i1 [[TMP2]], label [[WHILE_END:%.*]], label [[WHILE_BODY_PREHEADER:%.*]]
235 ; CPOP: while.body.preheader:
236 ; CPOP-NEXT: br label [[WHILE_BODY:%.*]]
238 ; CPOP-NEXT: [[TCPHI:%.*]] = phi i32 [ [[TMP1]], [[WHILE_BODY_PREHEADER]] ], [ [[TCDEC:%.*]], [[WHILE_BODY]] ]
239 ; CPOP-NEXT: [[C_013:%.*]] = phi i32 [ [[INC:%.*]], [[WHILE_BODY]] ], [ 0, [[WHILE_BODY_PREHEADER]] ]
240 ; CPOP-NEXT: [[MYDATA2_ADDR_012:%.*]] = phi i32 [ [[MUL1:%.*]], [[WHILE_BODY]] ], [ [[MYDATA2:%.*]], [[WHILE_BODY_PREHEADER]] ]
241 ; CPOP-NEXT: [[MYDATA1_ADDR_011:%.*]] = phi i32 [ [[MUL:%.*]], [[WHILE_BODY]] ], [ [[MYDATA1:%.*]], [[WHILE_BODY_PREHEADER]] ]
242 ; CPOP-NEXT: [[A_ADDR_010:%.*]] = phi i64 [ [[AND:%.*]], [[WHILE_BODY]] ], [ [[A]], [[WHILE_BODY_PREHEADER]] ]
243 ; CPOP-NEXT: [[INC]] = add nsw i32 [[C_013]], 1
244 ; CPOP-NEXT: [[SUB:%.*]] = add i64 [[A_ADDR_010]], -1
245 ; CPOP-NEXT: [[AND]] = and i64 [[SUB]], [[A_ADDR_010]]
246 ; CPOP-NEXT: [[MUL]] = mul nsw i32 [[INC]], [[MYDATA1_ADDR_011]]
247 ; CPOP-NEXT: [[CONV:%.*]] = trunc i64 [[AND]] to i32
248 ; CPOP-NEXT: [[MUL1]] = mul nsw i32 [[CONV]], [[MYDATA2_ADDR_012]]
249 ; CPOP-NEXT: [[TCDEC]] = sub nsw i32 [[TCPHI]], 1
250 ; CPOP-NEXT: [[TOBOOL:%.*]] = icmp sle i32 [[TCDEC]], 0
251 ; CPOP-NEXT: br i1 [[TOBOOL]], label [[WHILE_END_LOOPEXIT:%.*]], label [[WHILE_BODY]]
252 ; CPOP: while.end.loopexit:
253 ; CPOP-NEXT: [[INC_LCSSA:%.*]] = phi i32 [ [[TMP1]], [[WHILE_BODY]] ]
254 ; CPOP-NEXT: [[MUL_LCSSA:%.*]] = phi i32 [ [[MUL]], [[WHILE_BODY]] ]
255 ; CPOP-NEXT: [[MUL1_LCSSA:%.*]] = phi i32 [ [[MUL1]], [[WHILE_BODY]] ]
256 ; CPOP-NEXT: br label [[WHILE_END]]
258 ; CPOP-NEXT: [[C_0_LCSSA:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[INC_LCSSA]], [[WHILE_END_LOOPEXIT]] ]
259 ; CPOP-NEXT: [[MYDATA2_ADDR_0_LCSSA:%.*]] = phi i32 [ [[MYDATA2]], [[ENTRY]] ], [ [[MUL1_LCSSA]], [[WHILE_END_LOOPEXIT]] ]
260 ; CPOP-NEXT: [[MYDATA1_ADDR_0_LCSSA:%.*]] = phi i32 [ [[MYDATA1]], [[ENTRY]] ], [ [[MUL_LCSSA]], [[WHILE_END_LOOPEXIT]] ]
261 ; CPOP-NEXT: [[ADD:%.*]] = add i32 [[MYDATA2_ADDR_0_LCSSA]], [[MYDATA1_ADDR_0_LCSSA]]
262 ; CPOP-NEXT: [[ADD2:%.*]] = add i32 [[ADD]], [[C_0_LCSSA]]
263 ; CPOP-NEXT: ret i32 [[ADD2]]
265 ; NOCPOP-LABEL: @popcount2(
266 ; NOCPOP-NEXT: entry:
267 ; NOCPOP-NEXT: [[TOBOOL9:%.*]] = icmp eq i64 [[A:%.*]], 0
268 ; NOCPOP-NEXT: br i1 [[TOBOOL9]], label [[WHILE_END:%.*]], label [[WHILE_BODY_PREHEADER:%.*]]
269 ; NOCPOP: while.body.preheader:
270 ; NOCPOP-NEXT: br label [[WHILE_BODY:%.*]]
271 ; NOCPOP: while.body:
272 ; NOCPOP-NEXT: [[C_013:%.*]] = phi i32 [ [[INC:%.*]], [[WHILE_BODY]] ], [ 0, [[WHILE_BODY_PREHEADER]] ]
273 ; NOCPOP-NEXT: [[MYDATA2_ADDR_012:%.*]] = phi i32 [ [[MUL1:%.*]], [[WHILE_BODY]] ], [ [[MYDATA2:%.*]], [[WHILE_BODY_PREHEADER]] ]
274 ; NOCPOP-NEXT: [[MYDATA1_ADDR_011:%.*]] = phi i32 [ [[MUL:%.*]], [[WHILE_BODY]] ], [ [[MYDATA1:%.*]], [[WHILE_BODY_PREHEADER]] ]
275 ; NOCPOP-NEXT: [[A_ADDR_010:%.*]] = phi i64 [ [[AND:%.*]], [[WHILE_BODY]] ], [ [[A]], [[WHILE_BODY_PREHEADER]] ]
276 ; NOCPOP-NEXT: [[INC]] = add nsw i32 [[C_013]], 1
277 ; NOCPOP-NEXT: [[SUB:%.*]] = add i64 [[A_ADDR_010]], -1
278 ; NOCPOP-NEXT: [[AND]] = and i64 [[SUB]], [[A_ADDR_010]]
279 ; NOCPOP-NEXT: [[MUL]] = mul nsw i32 [[INC]], [[MYDATA1_ADDR_011]]
280 ; NOCPOP-NEXT: [[CONV:%.*]] = trunc i64 [[AND]] to i32
281 ; NOCPOP-NEXT: [[MUL1]] = mul nsw i32 [[CONV]], [[MYDATA2_ADDR_012]]
282 ; NOCPOP-NEXT: [[TOBOOL:%.*]] = icmp eq i64 [[AND]], 0
283 ; NOCPOP-NEXT: br i1 [[TOBOOL]], label [[WHILE_END_LOOPEXIT:%.*]], label [[WHILE_BODY]]
284 ; NOCPOP: while.end.loopexit:
285 ; NOCPOP-NEXT: [[INC_LCSSA:%.*]] = phi i32 [ [[INC]], [[WHILE_BODY]] ]
286 ; NOCPOP-NEXT: [[MUL_LCSSA:%.*]] = phi i32 [ [[MUL]], [[WHILE_BODY]] ]
287 ; NOCPOP-NEXT: [[MUL1_LCSSA:%.*]] = phi i32 [ [[MUL1]], [[WHILE_BODY]] ]
288 ; NOCPOP-NEXT: br label [[WHILE_END]]
290 ; NOCPOP-NEXT: [[C_0_LCSSA:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[INC_LCSSA]], [[WHILE_END_LOOPEXIT]] ]
291 ; NOCPOP-NEXT: [[MYDATA2_ADDR_0_LCSSA:%.*]] = phi i32 [ [[MYDATA2]], [[ENTRY]] ], [ [[MUL1_LCSSA]], [[WHILE_END_LOOPEXIT]] ]
292 ; NOCPOP-NEXT: [[MYDATA1_ADDR_0_LCSSA:%.*]] = phi i32 [ [[MYDATA1]], [[ENTRY]] ], [ [[MUL_LCSSA]], [[WHILE_END_LOOPEXIT]] ]
293 ; NOCPOP-NEXT: [[ADD:%.*]] = add i32 [[MYDATA2_ADDR_0_LCSSA]], [[MYDATA1_ADDR_0_LCSSA]]
294 ; NOCPOP-NEXT: [[ADD2:%.*]] = add i32 [[ADD]], [[C_0_LCSSA]]
295 ; NOCPOP-NEXT: ret i32 [[ADD2]]
298 %tobool9 = icmp eq i64 %a, 0
299 br i1 %tobool9, label %while.end, label %while.body
301 while.body: ; preds = %entry, %while.body
302 %c.013 = phi i32 [ %inc, %while.body ], [ 0, %entry ]
303 %mydata2.addr.012 = phi i32 [ %mul1, %while.body ], [ %mydata2, %entry ]
304 %mydata1.addr.011 = phi i32 [ %mul, %while.body ], [ %mydata1, %entry ]
305 %a.addr.010 = phi i64 [ %and, %while.body ], [ %a, %entry ]
306 %inc = add nsw i32 %c.013, 1
307 %sub = add i64 %a.addr.010, -1
308 %and = and i64 %sub, %a.addr.010
309 %mul = mul nsw i32 %inc, %mydata1.addr.011
310 %conv = trunc i64 %and to i32
311 %mul1 = mul nsw i32 %conv, %mydata2.addr.012
312 %tobool = icmp eq i64 %and, 0
313 br i1 %tobool, label %while.end, label %while.body
315 while.end: ; preds = %while.body, %entry
316 %c.0.lcssa = phi i32 [ 0, %entry ], [ %inc, %while.body ]
317 %mydata2.addr.0.lcssa = phi i32 [ %mydata2, %entry ], [ %mul1, %while.body ]
318 %mydata1.addr.0.lcssa = phi i32 [ %mydata1, %entry ], [ %mul, %while.body ]
319 %add = add i32 %mydata2.addr.0.lcssa, %mydata1.addr.0.lcssa
320 %add2 = add i32 %add, %c.0.lcssa