1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -passes=instcombine -S | FileCheck %s
4 define i32 @main1(i32 %argc) {
6 ; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[ARGC:%.*]], 3
7 ; CHECK-NEXT: [[TMP2:%.*]] = icmp eq i32 [[TMP1]], 3
8 ; CHECK-NEXT: [[RETVAL_0:%.*]] = select i1 [[TMP2]], i32 2, i32 1
9 ; CHECK-NEXT: ret i32 [[RETVAL_0]]
11 %and = and i32 %argc, 1
12 %tobool = icmp ne i32 %and, 0
13 %and2 = and i32 %argc, 2
14 %tobool3 = icmp ne i32 %and2, 0
15 %or.cond = and i1 %tobool, %tobool3
16 %retval.0 = select i1 %or.cond, i32 2, i32 1
20 define i32 @main1_logical(i32 %argc) {
21 ; CHECK-LABEL: @main1_logical(
22 ; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[ARGC:%.*]], 3
23 ; CHECK-NEXT: [[TMP2:%.*]] = icmp eq i32 [[TMP1]], 3
24 ; CHECK-NEXT: [[RETVAL_0:%.*]] = select i1 [[TMP2]], i32 2, i32 1
25 ; CHECK-NEXT: ret i32 [[RETVAL_0]]
27 %and = and i32 %argc, 1
28 %tobool = icmp ne i32 %and, 0
29 %and2 = and i32 %argc, 2
30 %tobool3 = icmp ne i32 %and2, 0
31 %or.cond = select i1 %tobool, i1 %tobool3, i1 false
32 %retval.0 = select i1 %or.cond, i32 2, i32 1
36 define i32 @main2(i32 %argc) {
37 ; CHECK-LABEL: @main2(
38 ; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[ARGC:%.*]], 3
39 ; CHECK-NEXT: [[DOTNOT:%.*]] = icmp eq i32 [[TMP1]], 3
40 ; CHECK-NEXT: [[STOREMERGE:%.*]] = zext i1 [[DOTNOT]] to i32
41 ; CHECK-NEXT: ret i32 [[STOREMERGE]]
43 %and = and i32 %argc, 1
44 %tobool = icmp eq i32 %and, 0
45 %and2 = and i32 %argc, 2
46 %tobool3 = icmp eq i32 %and2, 0
47 %or.cond = or i1 %tobool, %tobool3
48 %storemerge = select i1 %or.cond, i32 0, i32 1
52 define i32 @main2_logical(i32 %argc) {
53 ; CHECK-LABEL: @main2_logical(
54 ; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[ARGC:%.*]], 3
55 ; CHECK-NEXT: [[DOTNOT:%.*]] = icmp eq i32 [[TMP1]], 3
56 ; CHECK-NEXT: [[STOREMERGE:%.*]] = zext i1 [[DOTNOT]] to i32
57 ; CHECK-NEXT: ret i32 [[STOREMERGE]]
59 %and = and i32 %argc, 1
60 %tobool = icmp eq i32 %and, 0
61 %and2 = and i32 %argc, 2
62 %tobool3 = icmp eq i32 %and2, 0
63 %or.cond = select i1 %tobool, i1 true, i1 %tobool3
64 %storemerge = select i1 %or.cond, i32 0, i32 1
68 ; tests to check combining (icmp eq (A & B), C) & (icmp eq (A & D), E)
69 ; tests to check if (icmp eq (A & B), 0) is treated like (icmp eq (A & B), B)
70 ; if B is a single bit constant
72 ; (icmp eq (A & B), 0) & (icmp eq (A & D), 0) -> (icmp eq (A & (B|D)), 0)
73 define i32 @main3(i32 %argc) {
74 ; CHECK-LABEL: @main3(
75 ; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[ARGC:%.*]], 55
76 ; CHECK-NEXT: [[TMP2:%.*]] = icmp ne i32 [[TMP1]], 0
77 ; CHECK-NEXT: [[STOREMERGE:%.*]] = zext i1 [[TMP2]] to i32
78 ; CHECK-NEXT: ret i32 [[STOREMERGE]]
80 %and = and i32 %argc, 7
81 %tobool = icmp eq i32 %and, 0
82 %and2 = and i32 %argc, 48
83 %tobool3 = icmp eq i32 %and2, 0
84 %and.cond = and i1 %tobool, %tobool3
85 %storemerge = select i1 %and.cond, i32 0, i32 1
89 define i32 @main3_logical(i32 %argc) {
90 ; CHECK-LABEL: @main3_logical(
91 ; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[ARGC:%.*]], 55
92 ; CHECK-NEXT: [[TMP2:%.*]] = icmp ne i32 [[TMP1]], 0
93 ; CHECK-NEXT: [[STOREMERGE:%.*]] = zext i1 [[TMP2]] to i32
94 ; CHECK-NEXT: ret i32 [[STOREMERGE]]
96 %and = and i32 %argc, 7
97 %tobool = icmp eq i32 %and, 0
98 %and2 = and i32 %argc, 48
99 %tobool3 = icmp eq i32 %and2, 0
100 %and.cond = select i1 %tobool, i1 %tobool3, i1 false
101 %storemerge = select i1 %and.cond, i32 0, i32 1
105 define i32 @main3b(i32 %argc) {
106 ; CHECK-LABEL: @main3b(
107 ; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[ARGC:%.*]], 23
108 ; CHECK-NEXT: [[TMP2:%.*]] = icmp ne i32 [[TMP1]], 0
109 ; CHECK-NEXT: [[STOREMERGE:%.*]] = zext i1 [[TMP2]] to i32
110 ; CHECK-NEXT: ret i32 [[STOREMERGE]]
112 %and = and i32 %argc, 7
113 %tobool = icmp eq i32 %and, 0
114 %and2 = and i32 %argc, 16
115 %tobool3 = icmp ne i32 %and2, 16
116 %and.cond = and i1 %tobool, %tobool3
117 %storemerge = select i1 %and.cond, i32 0, i32 1
121 define i32 @main3b_logical(i32 %argc) {
122 ; CHECK-LABEL: @main3b_logical(
123 ; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[ARGC:%.*]], 23
124 ; CHECK-NEXT: [[TMP2:%.*]] = icmp ne i32 [[TMP1]], 0
125 ; CHECK-NEXT: [[STOREMERGE:%.*]] = zext i1 [[TMP2]] to i32
126 ; CHECK-NEXT: ret i32 [[STOREMERGE]]
128 %and = and i32 %argc, 7
129 %tobool = icmp eq i32 %and, 0
130 %and2 = and i32 %argc, 16
131 %tobool3 = icmp ne i32 %and2, 16
132 %and.cond = select i1 %tobool, i1 %tobool3, i1 false
133 %storemerge = select i1 %and.cond, i32 0, i32 1
137 define i32 @main3e_like(i32 %argc, i32 %argc2, i32 %argc3) {
138 ; CHECK-LABEL: @main3e_like(
139 ; CHECK-NEXT: [[TMP1:%.*]] = or i32 [[ARGC2:%.*]], [[ARGC3:%.*]]
140 ; CHECK-NEXT: [[TMP2:%.*]] = and i32 [[TMP1]], [[ARGC:%.*]]
141 ; CHECK-NEXT: [[TMP3:%.*]] = icmp ne i32 [[TMP2]], 0
142 ; CHECK-NEXT: [[STOREMERGE:%.*]] = zext i1 [[TMP3]] to i32
143 ; CHECK-NEXT: ret i32 [[STOREMERGE]]
145 %and = and i32 %argc, %argc2
146 %tobool = icmp eq i32 %and, 0
147 %and2 = and i32 %argc, %argc3
148 %tobool3 = icmp eq i32 %and2, 0
149 %and.cond = and i1 %tobool, %tobool3
150 %storemerge = select i1 %and.cond, i32 0, i32 1
154 define i32 @main3e_like_logical(i32 %argc, i32 %argc2, i32 %argc3) {
155 ; CHECK-LABEL: @main3e_like_logical(
156 ; CHECK-NEXT: [[AND:%.*]] = and i32 [[ARGC:%.*]], [[ARGC2:%.*]]
157 ; CHECK-NEXT: [[TOBOOL:%.*]] = icmp ne i32 [[AND]], 0
158 ; CHECK-NEXT: [[AND2:%.*]] = and i32 [[ARGC]], [[ARGC3:%.*]]
159 ; CHECK-NEXT: [[TOBOOL3:%.*]] = icmp ne i32 [[AND2]], 0
160 ; CHECK-NEXT: [[AND_COND:%.*]] = select i1 [[TOBOOL]], i1 true, i1 [[TOBOOL3]]
161 ; CHECK-NEXT: [[STOREMERGE:%.*]] = zext i1 [[AND_COND]] to i32
162 ; CHECK-NEXT: ret i32 [[STOREMERGE]]
164 %and = and i32 %argc, %argc2
165 %tobool = icmp eq i32 %and, 0
166 %and2 = and i32 %argc, %argc3
167 %tobool3 = icmp eq i32 %and2, 0
168 %and.cond = select i1 %tobool, i1 %tobool3, i1 false
169 %storemerge = select i1 %and.cond, i32 0, i32 1
173 ; (icmp ne (A & B), 0) | (icmp ne (A & D), 0) -> (icmp ne (A & (B|D)), 0)
174 define i32 @main3c(i32 %argc) {
175 ; CHECK-LABEL: @main3c(
176 ; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[ARGC:%.*]], 55
177 ; CHECK-NEXT: [[DOTNOT:%.*]] = icmp eq i32 [[TMP1]], 0
178 ; CHECK-NEXT: [[STOREMERGE:%.*]] = zext i1 [[DOTNOT]] to i32
179 ; CHECK-NEXT: ret i32 [[STOREMERGE]]
181 %and = and i32 %argc, 7
182 %tobool = icmp ne i32 %and, 0
183 %and2 = and i32 %argc, 48
184 %tobool3 = icmp ne i32 %and2, 0
185 %or.cond = or i1 %tobool, %tobool3
186 %storemerge = select i1 %or.cond, i32 0, i32 1
190 define i32 @main3c_logical(i32 %argc) {
191 ; CHECK-LABEL: @main3c_logical(
192 ; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[ARGC:%.*]], 55
193 ; CHECK-NEXT: [[DOTNOT:%.*]] = icmp eq i32 [[TMP1]], 0
194 ; CHECK-NEXT: [[STOREMERGE:%.*]] = zext i1 [[DOTNOT]] to i32
195 ; CHECK-NEXT: ret i32 [[STOREMERGE]]
197 %and = and i32 %argc, 7
198 %tobool = icmp ne i32 %and, 0
199 %and2 = and i32 %argc, 48
200 %tobool3 = icmp ne i32 %and2, 0
201 %or.cond = select i1 %tobool, i1 true, i1 %tobool3
202 %storemerge = select i1 %or.cond, i32 0, i32 1
206 define i32 @main3d(i32 %argc) {
207 ; CHECK-LABEL: @main3d(
208 ; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[ARGC:%.*]], 23
209 ; CHECK-NEXT: [[DOTNOT:%.*]] = icmp eq i32 [[TMP1]], 0
210 ; CHECK-NEXT: [[STOREMERGE:%.*]] = zext i1 [[DOTNOT]] to i32
211 ; CHECK-NEXT: ret i32 [[STOREMERGE]]
213 %and = and i32 %argc, 7
214 %tobool = icmp ne i32 %and, 0
215 %and2 = and i32 %argc, 16
216 %tobool3 = icmp eq i32 %and2, 16
217 %or.cond = or i1 %tobool, %tobool3
218 %storemerge = select i1 %or.cond, i32 0, i32 1
222 define i32 @main3d_logical(i32 %argc) {
223 ; CHECK-LABEL: @main3d_logical(
224 ; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[ARGC:%.*]], 23
225 ; CHECK-NEXT: [[DOTNOT:%.*]] = icmp eq i32 [[TMP1]], 0
226 ; CHECK-NEXT: [[STOREMERGE:%.*]] = zext i1 [[DOTNOT]] to i32
227 ; CHECK-NEXT: ret i32 [[STOREMERGE]]
229 %and = and i32 %argc, 7
230 %tobool = icmp ne i32 %and, 0
231 %and2 = and i32 %argc, 16
232 %tobool3 = icmp eq i32 %and2, 16
233 %or.cond = select i1 %tobool, i1 true, i1 %tobool3
234 %storemerge = select i1 %or.cond, i32 0, i32 1
238 define i32 @main3f_like(i32 %argc, i32 %argc2, i32 %argc3) {
239 ; CHECK-LABEL: @main3f_like(
240 ; CHECK-NEXT: [[TMP1:%.*]] = or i32 [[ARGC2:%.*]], [[ARGC3:%.*]]
241 ; CHECK-NEXT: [[TMP2:%.*]] = and i32 [[TMP1]], [[ARGC:%.*]]
242 ; CHECK-NEXT: [[DOTNOT:%.*]] = icmp eq i32 [[TMP2]], 0
243 ; CHECK-NEXT: [[STOREMERGE:%.*]] = zext i1 [[DOTNOT]] to i32
244 ; CHECK-NEXT: ret i32 [[STOREMERGE]]
246 %and = and i32 %argc, %argc2
247 %tobool = icmp ne i32 %and, 0
248 %and2 = and i32 %argc, %argc3
249 %tobool3 = icmp ne i32 %and2, 0
250 %or.cond = or i1 %tobool, %tobool3
251 %storemerge = select i1 %or.cond, i32 0, i32 1
255 define i32 @main3f_like_logical(i32 %argc, i32 %argc2, i32 %argc3) {
256 ; CHECK-LABEL: @main3f_like_logical(
257 ; CHECK-NEXT: [[AND:%.*]] = and i32 [[ARGC:%.*]], [[ARGC2:%.*]]
258 ; CHECK-NEXT: [[TOBOOL:%.*]] = icmp eq i32 [[AND]], 0
259 ; CHECK-NEXT: [[AND2:%.*]] = and i32 [[ARGC]], [[ARGC3:%.*]]
260 ; CHECK-NEXT: [[TOBOOL3:%.*]] = icmp eq i32 [[AND2]], 0
261 ; CHECK-NEXT: [[OR_COND:%.*]] = select i1 [[TOBOOL]], i1 [[TOBOOL3]], i1 false
262 ; CHECK-NEXT: [[STOREMERGE:%.*]] = zext i1 [[OR_COND]] to i32
263 ; CHECK-NEXT: ret i32 [[STOREMERGE]]
265 %and = and i32 %argc, %argc2
266 %tobool = icmp ne i32 %and, 0
267 %and2 = and i32 %argc, %argc3
268 %tobool3 = icmp ne i32 %and2, 0
269 %or.cond = select i1 %tobool, i1 true, i1 %tobool3
270 %storemerge = select i1 %or.cond, i32 0, i32 1
274 ; (icmp eq (A & B), B) & (icmp eq (A & D), D) -> (icmp eq (A & (B|D)), (B|D))
275 define i32 @main4(i32 %argc) {
276 ; CHECK-LABEL: @main4(
277 ; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[ARGC:%.*]], 55
278 ; CHECK-NEXT: [[TMP2:%.*]] = icmp ne i32 [[TMP1]], 55
279 ; CHECK-NEXT: [[STOREMERGE:%.*]] = zext i1 [[TMP2]] to i32
280 ; CHECK-NEXT: ret i32 [[STOREMERGE]]
282 %and = and i32 %argc, 7
283 %tobool = icmp eq i32 %and, 7
284 %and2 = and i32 %argc, 48
285 %tobool3 = icmp eq i32 %and2, 48
286 %and.cond = and i1 %tobool, %tobool3
287 %storemerge = select i1 %and.cond, i32 0, i32 1
291 define <2 x i32> @main4_splat(<2 x i32> %argc) {
292 ; CHECK-LABEL: @main4_splat(
293 ; CHECK-NEXT: [[TMP1:%.*]] = and <2 x i32> [[ARGC:%.*]], <i32 55, i32 55>
294 ; CHECK-NEXT: [[TMP2:%.*]] = icmp ne <2 x i32> [[TMP1]], <i32 55, i32 55>
295 ; CHECK-NEXT: [[STOREMERGE:%.*]] = zext <2 x i1> [[TMP2]] to <2 x i32>
296 ; CHECK-NEXT: ret <2 x i32> [[STOREMERGE]]
298 %and = and <2 x i32> %argc, <i32 7, i32 7>
299 %tobool = icmp eq <2 x i32> %and, <i32 7, i32 7>
300 %and2 = and <2 x i32> %argc, <i32 48, i32 48>
301 %tobool3 = icmp eq <2 x i32> %and2, <i32 48, i32 48>
302 %and.cond = and <2 x i1> %tobool, %tobool3
303 %storemerge = select <2 x i1> %and.cond, <2 x i32> <i32 0, i32 0>, <2 x i32> <i32 1, i32 1>
304 ret <2 x i32> %storemerge
307 define i32 @main4_logical(i32 %argc) {
308 ; CHECK-LABEL: @main4_logical(
309 ; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[ARGC:%.*]], 55
310 ; CHECK-NEXT: [[TMP2:%.*]] = icmp ne i32 [[TMP1]], 55
311 ; CHECK-NEXT: [[STOREMERGE:%.*]] = zext i1 [[TMP2]] to i32
312 ; CHECK-NEXT: ret i32 [[STOREMERGE]]
314 %and = and i32 %argc, 7
315 %tobool = icmp eq i32 %and, 7
316 %and2 = and i32 %argc, 48
317 %tobool3 = icmp eq i32 %and2, 48
318 %and.cond = select i1 %tobool, i1 %tobool3, i1 false
319 %storemerge = select i1 %and.cond, i32 0, i32 1
323 define i32 @main4b(i32 %argc) {
324 ; CHECK-LABEL: @main4b(
325 ; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[ARGC:%.*]], 23
326 ; CHECK-NEXT: [[TMP2:%.*]] = icmp ne i32 [[TMP1]], 23
327 ; CHECK-NEXT: [[STOREMERGE:%.*]] = zext i1 [[TMP2]] to i32
328 ; CHECK-NEXT: ret i32 [[STOREMERGE]]
330 %and = and i32 %argc, 7
331 %tobool = icmp eq i32 %and, 7
332 %and2 = and i32 %argc, 16
333 %tobool3 = icmp ne i32 %and2, 0
334 %and.cond = and i1 %tobool, %tobool3
335 %storemerge = select i1 %and.cond, i32 0, i32 1
339 define i32 @main4b_logical(i32 %argc) {
340 ; CHECK-LABEL: @main4b_logical(
341 ; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[ARGC:%.*]], 23
342 ; CHECK-NEXT: [[TMP2:%.*]] = icmp ne i32 [[TMP1]], 23
343 ; CHECK-NEXT: [[STOREMERGE:%.*]] = zext i1 [[TMP2]] to i32
344 ; CHECK-NEXT: ret i32 [[STOREMERGE]]
346 %and = and i32 %argc, 7
347 %tobool = icmp eq i32 %and, 7
348 %and2 = and i32 %argc, 16
349 %tobool3 = icmp ne i32 %and2, 0
350 %and.cond = select i1 %tobool, i1 %tobool3, i1 false
351 %storemerge = select i1 %and.cond, i32 0, i32 1
355 define i32 @main4e_like(i32 %argc, i32 %argc2, i32 %argc3) {
356 ; CHECK-LABEL: @main4e_like(
357 ; CHECK-NEXT: [[TMP1:%.*]] = or i32 [[ARGC2:%.*]], [[ARGC3:%.*]]
358 ; CHECK-NEXT: [[TMP2:%.*]] = and i32 [[TMP1]], [[ARGC:%.*]]
359 ; CHECK-NEXT: [[TMP3:%.*]] = icmp ne i32 [[TMP2]], [[TMP1]]
360 ; CHECK-NEXT: [[STOREMERGE:%.*]] = zext i1 [[TMP3]] to i32
361 ; CHECK-NEXT: ret i32 [[STOREMERGE]]
363 %and = and i32 %argc, %argc2
364 %tobool = icmp eq i32 %and, %argc2
365 %and2 = and i32 %argc, %argc3
366 %tobool3 = icmp eq i32 %and2, %argc3
367 %and.cond = and i1 %tobool, %tobool3
368 %storemerge = select i1 %and.cond, i32 0, i32 1
372 define i32 @main4e_like_logical(i32 %argc, i32 %argc2, i32 %argc3) {
373 ; CHECK-LABEL: @main4e_like_logical(
374 ; CHECK-NEXT: [[AND:%.*]] = and i32 [[ARGC:%.*]], [[ARGC2:%.*]]
375 ; CHECK-NEXT: [[TOBOOL:%.*]] = icmp ne i32 [[AND]], [[ARGC2]]
376 ; CHECK-NEXT: [[AND2:%.*]] = and i32 [[ARGC]], [[ARGC3:%.*]]
377 ; CHECK-NEXT: [[TOBOOL3:%.*]] = icmp ne i32 [[AND2]], [[ARGC3]]
378 ; CHECK-NEXT: [[AND_COND:%.*]] = select i1 [[TOBOOL]], i1 true, i1 [[TOBOOL3]]
379 ; CHECK-NEXT: [[STOREMERGE:%.*]] = zext i1 [[AND_COND]] to i32
380 ; CHECK-NEXT: ret i32 [[STOREMERGE]]
382 %and = and i32 %argc, %argc2
383 %tobool = icmp eq i32 %and, %argc2
384 %and2 = and i32 %argc, %argc3
385 %tobool3 = icmp eq i32 %and2, %argc3
386 %and.cond = select i1 %tobool, i1 %tobool3, i1 false
387 %storemerge = select i1 %and.cond, i32 0, i32 1
391 ; (icmp ne (A & B), B) | (icmp ne (A & D), D) -> (icmp ne (A & (B|D)), (B|D))
392 define i32 @main4c(i32 %argc) {
393 ; CHECK-LABEL: @main4c(
394 ; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[ARGC:%.*]], 55
395 ; CHECK-NEXT: [[DOTNOT:%.*]] = icmp eq i32 [[TMP1]], 55
396 ; CHECK-NEXT: [[STOREMERGE:%.*]] = zext i1 [[DOTNOT]] to i32
397 ; CHECK-NEXT: ret i32 [[STOREMERGE]]
399 %and = and i32 %argc, 7
400 %tobool = icmp ne i32 %and, 7
401 %and2 = and i32 %argc, 48
402 %tobool3 = icmp ne i32 %and2, 48
403 %or.cond = or i1 %tobool, %tobool3
404 %storemerge = select i1 %or.cond, i32 0, i32 1
408 define i32 @main4c_logical(i32 %argc) {
409 ; CHECK-LABEL: @main4c_logical(
410 ; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[ARGC:%.*]], 55
411 ; CHECK-NEXT: [[DOTNOT:%.*]] = icmp eq i32 [[TMP1]], 55
412 ; CHECK-NEXT: [[STOREMERGE:%.*]] = zext i1 [[DOTNOT]] to i32
413 ; CHECK-NEXT: ret i32 [[STOREMERGE]]
415 %and = and i32 %argc, 7
416 %tobool = icmp ne i32 %and, 7
417 %and2 = and i32 %argc, 48
418 %tobool3 = icmp ne i32 %and2, 48
419 %or.cond = select i1 %tobool, i1 true, i1 %tobool3
420 %storemerge = select i1 %or.cond, i32 0, i32 1
424 define i32 @main4d(i32 %argc) {
425 ; CHECK-LABEL: @main4d(
426 ; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[ARGC:%.*]], 23
427 ; CHECK-NEXT: [[DOTNOT:%.*]] = icmp eq i32 [[TMP1]], 23
428 ; CHECK-NEXT: [[STOREMERGE:%.*]] = zext i1 [[DOTNOT]] to i32
429 ; CHECK-NEXT: ret i32 [[STOREMERGE]]
431 %and = and i32 %argc, 7
432 %tobool = icmp ne i32 %and, 7
433 %and2 = and i32 %argc, 16
434 %tobool3 = icmp eq i32 %and2, 0
435 %or.cond = or i1 %tobool, %tobool3
436 %storemerge = select i1 %or.cond, i32 0, i32 1
440 define i32 @main4d_logical(i32 %argc) {
441 ; CHECK-LABEL: @main4d_logical(
442 ; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[ARGC:%.*]], 23
443 ; CHECK-NEXT: [[DOTNOT:%.*]] = icmp eq i32 [[TMP1]], 23
444 ; CHECK-NEXT: [[STOREMERGE:%.*]] = zext i1 [[DOTNOT]] to i32
445 ; CHECK-NEXT: ret i32 [[STOREMERGE]]
447 %and = and i32 %argc, 7
448 %tobool = icmp ne i32 %and, 7
449 %and2 = and i32 %argc, 16
450 %tobool3 = icmp eq i32 %and2, 0
451 %or.cond = select i1 %tobool, i1 true, i1 %tobool3
452 %storemerge = select i1 %or.cond, i32 0, i32 1
456 define i32 @main4f_like(i32 %argc, i32 %argc2, i32 %argc3) {
457 ; CHECK-LABEL: @main4f_like(
458 ; CHECK-NEXT: [[TMP1:%.*]] = or i32 [[ARGC2:%.*]], [[ARGC3:%.*]]
459 ; CHECK-NEXT: [[TMP2:%.*]] = and i32 [[TMP1]], [[ARGC:%.*]]
460 ; CHECK-NEXT: [[DOTNOT:%.*]] = icmp eq i32 [[TMP2]], [[TMP1]]
461 ; CHECK-NEXT: [[STOREMERGE:%.*]] = zext i1 [[DOTNOT]] to i32
462 ; CHECK-NEXT: ret i32 [[STOREMERGE]]
464 %and = and i32 %argc, %argc2
465 %tobool = icmp ne i32 %and, %argc2
466 %and2 = and i32 %argc, %argc3
467 %tobool3 = icmp ne i32 %and2, %argc3
468 %or.cond = or i1 %tobool, %tobool3
469 %storemerge = select i1 %or.cond, i32 0, i32 1
473 define i32 @main4f_like_logical(i32 %argc, i32 %argc2, i32 %argc3) {
474 ; CHECK-LABEL: @main4f_like_logical(
475 ; CHECK-NEXT: [[AND:%.*]] = and i32 [[ARGC:%.*]], [[ARGC2:%.*]]
476 ; CHECK-NEXT: [[TOBOOL:%.*]] = icmp eq i32 [[AND]], [[ARGC2]]
477 ; CHECK-NEXT: [[AND2:%.*]] = and i32 [[ARGC]], [[ARGC3:%.*]]
478 ; CHECK-NEXT: [[TOBOOL3:%.*]] = icmp eq i32 [[AND2]], [[ARGC3]]
479 ; CHECK-NEXT: [[OR_COND:%.*]] = select i1 [[TOBOOL]], i1 [[TOBOOL3]], i1 false
480 ; CHECK-NEXT: [[STOREMERGE:%.*]] = zext i1 [[OR_COND]] to i32
481 ; CHECK-NEXT: ret i32 [[STOREMERGE]]
483 %and = and i32 %argc, %argc2
484 %tobool = icmp ne i32 %and, %argc2
485 %and2 = and i32 %argc, %argc3
486 %tobool3 = icmp ne i32 %and2, %argc3
487 %or.cond = select i1 %tobool, i1 true, i1 %tobool3
488 %storemerge = select i1 %or.cond, i32 0, i32 1
492 ; (icmp eq (A & B), A) & (icmp eq (A & D), A) -> (icmp eq (A & (B&D)), A)
493 define i32 @main5_like(i32 %argc, i32 %argc2) {
494 ; CHECK-LABEL: @main5_like(
495 ; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[ARGC:%.*]], [[ARGC2:%.*]]
496 ; CHECK-NEXT: [[TMP2:%.*]] = and i32 [[TMP1]], 7
497 ; CHECK-NEXT: [[TMP3:%.*]] = icmp ne i32 [[TMP2]], 7
498 ; CHECK-NEXT: [[STOREMERGE:%.*]] = zext i1 [[TMP3]] to i32
499 ; CHECK-NEXT: ret i32 [[STOREMERGE]]
501 %and = and i32 %argc, 7
502 %tobool = icmp eq i32 %and, 7
503 %and2 = and i32 %argc2, 7
504 %tobool3 = icmp eq i32 %and2, 7
505 %and.cond = and i1 %tobool, %tobool3
506 %storemerge = select i1 %and.cond, i32 0, i32 1
510 define i32 @main5_like_logical(i32 %argc, i32 %argc2) {
511 ; CHECK-LABEL: @main5_like_logical(
512 ; CHECK-NEXT: [[AND:%.*]] = and i32 [[ARGC:%.*]], 7
513 ; CHECK-NEXT: [[TOBOOL:%.*]] = icmp ne i32 [[AND]], 7
514 ; CHECK-NEXT: [[AND2:%.*]] = and i32 [[ARGC2:%.*]], 7
515 ; CHECK-NEXT: [[TOBOOL3:%.*]] = icmp ne i32 [[AND2]], 7
516 ; CHECK-NEXT: [[AND_COND:%.*]] = select i1 [[TOBOOL]], i1 true, i1 [[TOBOOL3]]
517 ; CHECK-NEXT: [[STOREMERGE:%.*]] = zext i1 [[AND_COND]] to i32
518 ; CHECK-NEXT: ret i32 [[STOREMERGE]]
520 %and = and i32 %argc, 7
521 %tobool = icmp eq i32 %and, 7
522 %and2 = and i32 %argc2, 7
523 %tobool3 = icmp eq i32 %and2, 7
524 %and.cond = select i1 %tobool, i1 %tobool3, i1 false
525 %storemerge = select i1 %and.cond, i32 0, i32 1
529 define i32 @main5e_like(i32 %argc, i32 %argc2, i32 %argc3) {
530 ; CHECK-LABEL: @main5e_like(
531 ; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[ARGC2:%.*]], [[ARGC3:%.*]]
532 ; CHECK-NEXT: [[TMP2:%.*]] = and i32 [[TMP1]], [[ARGC:%.*]]
533 ; CHECK-NEXT: [[TMP3:%.*]] = icmp ne i32 [[TMP2]], [[ARGC]]
534 ; CHECK-NEXT: [[STOREMERGE:%.*]] = zext i1 [[TMP3]] to i32
535 ; CHECK-NEXT: ret i32 [[STOREMERGE]]
537 %and = and i32 %argc, %argc2
538 %tobool = icmp eq i32 %and, %argc
539 %and2 = and i32 %argc, %argc3
540 %tobool3 = icmp eq i32 %and2, %argc
541 %and.cond = and i1 %tobool, %tobool3
542 %storemerge = select i1 %and.cond, i32 0, i32 1
546 define i32 @main5e_like_logical(i32 %argc, i32 %argc2, i32 %argc3) {
547 ; CHECK-LABEL: @main5e_like_logical(
548 ; CHECK-NEXT: [[AND:%.*]] = and i32 [[ARGC:%.*]], [[ARGC2:%.*]]
549 ; CHECK-NEXT: [[TOBOOL:%.*]] = icmp ne i32 [[AND]], [[ARGC]]
550 ; CHECK-NEXT: [[AND2:%.*]] = and i32 [[ARGC]], [[ARGC3:%.*]]
551 ; CHECK-NEXT: [[TOBOOL3:%.*]] = icmp ne i32 [[AND2]], [[ARGC]]
552 ; CHECK-NEXT: [[AND_COND:%.*]] = select i1 [[TOBOOL]], i1 true, i1 [[TOBOOL3]]
553 ; CHECK-NEXT: [[STOREMERGE:%.*]] = zext i1 [[AND_COND]] to i32
554 ; CHECK-NEXT: ret i32 [[STOREMERGE]]
556 %and = and i32 %argc, %argc2
557 %tobool = icmp eq i32 %and, %argc
558 %and2 = and i32 %argc, %argc3
559 %tobool3 = icmp eq i32 %and2, %argc
560 %and.cond = select i1 %tobool, i1 %tobool3, i1 false
561 %storemerge = select i1 %and.cond, i32 0, i32 1
565 ; (icmp ne (A & B), A) | (icmp ne (A & D), A) -> (icmp ne (A & (B&D)), A)
566 define i32 @main5c_like(i32 %argc, i32 %argc2) {
567 ; CHECK-LABEL: @main5c_like(
568 ; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[ARGC:%.*]], [[ARGC2:%.*]]
569 ; CHECK-NEXT: [[TMP2:%.*]] = and i32 [[TMP1]], 7
570 ; CHECK-NEXT: [[DOTNOT:%.*]] = icmp eq i32 [[TMP2]], 7
571 ; CHECK-NEXT: [[STOREMERGE:%.*]] = zext i1 [[DOTNOT]] to i32
572 ; CHECK-NEXT: ret i32 [[STOREMERGE]]
574 %and = and i32 %argc, 7
575 %tobool = icmp ne i32 %and, 7
576 %and2 = and i32 %argc2, 7
577 %tobool3 = icmp ne i32 %and2, 7
578 %or.cond = or i1 %tobool, %tobool3
579 %storemerge = select i1 %or.cond, i32 0, i32 1
583 define i32 @main5c_like_logical(i32 %argc, i32 %argc2) {
584 ; CHECK-LABEL: @main5c_like_logical(
585 ; CHECK-NEXT: [[AND:%.*]] = and i32 [[ARGC:%.*]], 7
586 ; CHECK-NEXT: [[TOBOOL:%.*]] = icmp eq i32 [[AND]], 7
587 ; CHECK-NEXT: [[AND2:%.*]] = and i32 [[ARGC2:%.*]], 7
588 ; CHECK-NEXT: [[TOBOOL3:%.*]] = icmp eq i32 [[AND2]], 7
589 ; CHECK-NEXT: [[OR_COND:%.*]] = select i1 [[TOBOOL]], i1 [[TOBOOL3]], i1 false
590 ; CHECK-NEXT: [[STOREMERGE:%.*]] = zext i1 [[OR_COND]] to i32
591 ; CHECK-NEXT: ret i32 [[STOREMERGE]]
593 %and = and i32 %argc, 7
594 %tobool = icmp ne i32 %and, 7
595 %and2 = and i32 %argc2, 7
596 %tobool3 = icmp ne i32 %and2, 7
597 %or.cond = select i1 %tobool, i1 true, i1 %tobool3
598 %storemerge = select i1 %or.cond, i32 0, i32 1
602 define i32 @main5f_like(i32 %argc, i32 %argc2, i32 %argc3) {
603 ; CHECK-LABEL: @main5f_like(
604 ; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[ARGC2:%.*]], [[ARGC3:%.*]]
605 ; CHECK-NEXT: [[TMP2:%.*]] = and i32 [[TMP1]], [[ARGC:%.*]]
606 ; CHECK-NEXT: [[DOTNOT:%.*]] = icmp eq i32 [[TMP2]], [[ARGC]]
607 ; CHECK-NEXT: [[STOREMERGE:%.*]] = zext i1 [[DOTNOT]] to i32
608 ; CHECK-NEXT: ret i32 [[STOREMERGE]]
610 %and = and i32 %argc, %argc2
611 %tobool = icmp ne i32 %and, %argc
612 %and2 = and i32 %argc, %argc3
613 %tobool3 = icmp ne i32 %and2, %argc
614 %or.cond = or i1 %tobool, %tobool3
615 %storemerge = select i1 %or.cond, i32 0, i32 1
619 define i32 @main5f_like_logical(i32 %argc, i32 %argc2, i32 %argc3) {
620 ; CHECK-LABEL: @main5f_like_logical(
621 ; CHECK-NEXT: [[AND:%.*]] = and i32 [[ARGC:%.*]], [[ARGC2:%.*]]
622 ; CHECK-NEXT: [[TOBOOL:%.*]] = icmp eq i32 [[AND]], [[ARGC]]
623 ; CHECK-NEXT: [[AND2:%.*]] = and i32 [[ARGC]], [[ARGC3:%.*]]
624 ; CHECK-NEXT: [[TOBOOL3:%.*]] = icmp eq i32 [[AND2]], [[ARGC]]
625 ; CHECK-NEXT: [[OR_COND:%.*]] = select i1 [[TOBOOL]], i1 [[TOBOOL3]], i1 false
626 ; CHECK-NEXT: [[STOREMERGE:%.*]] = zext i1 [[OR_COND]] to i32
627 ; CHECK-NEXT: ret i32 [[STOREMERGE]]
629 %and = and i32 %argc, %argc2
630 %tobool = icmp ne i32 %and, %argc
631 %and2 = and i32 %argc, %argc3
632 %tobool3 = icmp ne i32 %and2, %argc
633 %or.cond = select i1 %tobool, i1 true, i1 %tobool3
634 %storemerge = select i1 %or.cond, i32 0, i32 1
638 ; (icmp eq (A & B), C) & (icmp eq (A & D), E) -> (icmp eq (A & (B|D)), (C|E))
639 ; if B, C, D, E are constant, and it's possible
640 define i32 @main6(i32 %argc) {
641 ; CHECK-LABEL: @main6(
642 ; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[ARGC:%.*]], 55
643 ; CHECK-NEXT: [[TMP2:%.*]] = icmp ne i32 [[TMP1]], 19
644 ; CHECK-NEXT: [[STOREMERGE:%.*]] = zext i1 [[TMP2]] to i32
645 ; CHECK-NEXT: ret i32 [[STOREMERGE]]
647 %and = and i32 %argc, 7
648 %tobool = icmp eq i32 %and, 3
649 %and2 = and i32 %argc, 48
650 %tobool3 = icmp eq i32 %and2, 16
651 %and.cond = and i1 %tobool, %tobool3
652 %storemerge = select i1 %and.cond, i32 0, i32 1
656 define i32 @main6_logical(i32 %argc) {
657 ; CHECK-LABEL: @main6_logical(
658 ; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[ARGC:%.*]], 55
659 ; CHECK-NEXT: [[TMP2:%.*]] = icmp ne i32 [[TMP1]], 19
660 ; CHECK-NEXT: [[STOREMERGE:%.*]] = zext i1 [[TMP2]] to i32
661 ; CHECK-NEXT: ret i32 [[STOREMERGE]]
663 %and = and i32 %argc, 7
664 %tobool = icmp eq i32 %and, 3
665 %and2 = and i32 %argc, 48
666 %tobool3 = icmp eq i32 %and2, 16
667 %and.cond = select i1 %tobool, i1 %tobool3, i1 false
668 %storemerge = select i1 %and.cond, i32 0, i32 1
672 define i32 @main6b(i32 %argc) {
673 ; CHECK-LABEL: @main6b(
674 ; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[ARGC:%.*]], 23
675 ; CHECK-NEXT: [[TMP2:%.*]] = icmp ne i32 [[TMP1]], 19
676 ; CHECK-NEXT: [[STOREMERGE:%.*]] = zext i1 [[TMP2]] to i32
677 ; CHECK-NEXT: ret i32 [[STOREMERGE]]
679 %and = and i32 %argc, 7
680 %tobool = icmp eq i32 %and, 3
681 %and2 = and i32 %argc, 16
682 %tobool3 = icmp ne i32 %and2, 0
683 %and.cond = and i1 %tobool, %tobool3
684 %storemerge = select i1 %and.cond, i32 0, i32 1
688 define i32 @main6b_logical(i32 %argc) {
689 ; CHECK-LABEL: @main6b_logical(
690 ; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[ARGC:%.*]], 23
691 ; CHECK-NEXT: [[TMP2:%.*]] = icmp ne i32 [[TMP1]], 19
692 ; CHECK-NEXT: [[STOREMERGE:%.*]] = zext i1 [[TMP2]] to i32
693 ; CHECK-NEXT: ret i32 [[STOREMERGE]]
695 %and = and i32 %argc, 7
696 %tobool = icmp eq i32 %and, 3
697 %and2 = and i32 %argc, 16
698 %tobool3 = icmp ne i32 %and2, 0
699 %and.cond = select i1 %tobool, i1 %tobool3, i1 false
700 %storemerge = select i1 %and.cond, i32 0, i32 1
704 ; (icmp ne (A & B), C) | (icmp ne (A & D), E) -> (icmp ne (A & (B|D)), (C|E))
705 ; if B, C, D, E are constant, and it's possible
706 define i32 @main6c(i32 %argc) {
707 ; CHECK-LABEL: @main6c(
708 ; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[ARGC:%.*]], 55
709 ; CHECK-NEXT: [[DOTNOT:%.*]] = icmp eq i32 [[TMP1]], 19
710 ; CHECK-NEXT: [[STOREMERGE:%.*]] = zext i1 [[DOTNOT]] to i32
711 ; CHECK-NEXT: ret i32 [[STOREMERGE]]
713 %and = and i32 %argc, 7
714 %tobool = icmp ne i32 %and, 3
715 %and2 = and i32 %argc, 48
716 %tobool3 = icmp ne i32 %and2, 16
717 %or.cond = or i1 %tobool, %tobool3
718 %storemerge = select i1 %or.cond, i32 0, i32 1
722 define i32 @main6c_logical(i32 %argc) {
723 ; CHECK-LABEL: @main6c_logical(
724 ; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[ARGC:%.*]], 55
725 ; CHECK-NEXT: [[DOTNOT:%.*]] = icmp eq i32 [[TMP1]], 19
726 ; CHECK-NEXT: [[STOREMERGE:%.*]] = zext i1 [[DOTNOT]] to i32
727 ; CHECK-NEXT: ret i32 [[STOREMERGE]]
729 %and = and i32 %argc, 7
730 %tobool = icmp ne i32 %and, 3
731 %and2 = and i32 %argc, 48
732 %tobool3 = icmp ne i32 %and2, 16
733 %or.cond = select i1 %tobool, i1 true, i1 %tobool3
734 %storemerge = select i1 %or.cond, i32 0, i32 1
738 define i32 @main6d(i32 %argc) {
739 ; CHECK-LABEL: @main6d(
740 ; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[ARGC:%.*]], 23
741 ; CHECK-NEXT: [[DOTNOT:%.*]] = icmp eq i32 [[TMP1]], 19
742 ; CHECK-NEXT: [[STOREMERGE:%.*]] = zext i1 [[DOTNOT]] to i32
743 ; CHECK-NEXT: ret i32 [[STOREMERGE]]
745 %and = and i32 %argc, 7
746 %tobool = icmp ne i32 %and, 3
747 %and2 = and i32 %argc, 16
748 %tobool3 = icmp eq i32 %and2, 0
749 %or.cond = or i1 %tobool, %tobool3
750 %storemerge = select i1 %or.cond, i32 0, i32 1
754 define i32 @main6d_logical(i32 %argc) {
755 ; CHECK-LABEL: @main6d_logical(
756 ; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[ARGC:%.*]], 23
757 ; CHECK-NEXT: [[DOTNOT:%.*]] = icmp eq i32 [[TMP1]], 19
758 ; CHECK-NEXT: [[STOREMERGE:%.*]] = zext i1 [[DOTNOT]] to i32
759 ; CHECK-NEXT: ret i32 [[STOREMERGE]]
761 %and = and i32 %argc, 7
762 %tobool = icmp ne i32 %and, 3
763 %and2 = and i32 %argc, 16
764 %tobool3 = icmp eq i32 %and2, 0
765 %or.cond = select i1 %tobool, i1 true, i1 %tobool3
766 %storemerge = select i1 %or.cond, i32 0, i32 1
770 ; test parameter permutations
771 ; (B & A) == B & (D & A) == D
772 define i32 @main7a(i32 %argc, i32 %argc2, i32 %argc3) {
773 ; CHECK-LABEL: @main7a(
774 ; CHECK-NEXT: [[TMP1:%.*]] = or i32 [[ARGC2:%.*]], [[ARGC3:%.*]]
775 ; CHECK-NEXT: [[TMP2:%.*]] = and i32 [[TMP1]], [[ARGC:%.*]]
776 ; CHECK-NEXT: [[TMP3:%.*]] = icmp ne i32 [[TMP2]], [[TMP1]]
777 ; CHECK-NEXT: [[STOREMERGE:%.*]] = zext i1 [[TMP3]] to i32
778 ; CHECK-NEXT: ret i32 [[STOREMERGE]]
780 %and1 = and i32 %argc2, %argc
781 %tobool = icmp eq i32 %and1, %argc2
782 %and2 = and i32 %argc3, %argc
783 %tobool3 = icmp eq i32 %and2, %argc3
784 %and.cond = and i1 %tobool, %tobool3
785 %storemerge = select i1 %and.cond, i32 0, i32 1
789 define i32 @main7a_logical(i32 %argc, i32 %argc2, i32 %argc3) {
790 ; CHECK-LABEL: @main7a_logical(
791 ; CHECK-NEXT: [[AND1:%.*]] = and i32 [[ARGC2:%.*]], [[ARGC:%.*]]
792 ; CHECK-NEXT: [[TOBOOL:%.*]] = icmp ne i32 [[AND1]], [[ARGC2]]
793 ; CHECK-NEXT: [[AND2:%.*]] = and i32 [[ARGC3:%.*]], [[ARGC]]
794 ; CHECK-NEXT: [[TOBOOL3:%.*]] = icmp ne i32 [[AND2]], [[ARGC3]]
795 ; CHECK-NEXT: [[AND_COND:%.*]] = select i1 [[TOBOOL]], i1 true, i1 [[TOBOOL3]]
796 ; CHECK-NEXT: [[STOREMERGE:%.*]] = zext i1 [[AND_COND]] to i32
797 ; CHECK-NEXT: ret i32 [[STOREMERGE]]
799 %and1 = and i32 %argc2, %argc
800 %tobool = icmp eq i32 %and1, %argc2
801 %and2 = and i32 %argc3, %argc
802 %tobool3 = icmp eq i32 %and2, %argc3
803 %and.cond = select i1 %tobool, i1 %tobool3, i1 false
804 %storemerge = select i1 %and.cond, i32 0, i32 1
808 ; B == (A & B) & D == (A & D)
809 define i32 @main7b(i32 %argc, i32 %argc2, i32 %argc3) {
810 ; CHECK-LABEL: @main7b(
811 ; CHECK-NEXT: [[TMP1:%.*]] = or i32 [[ARGC2:%.*]], [[ARGC3:%.*]]
812 ; CHECK-NEXT: [[TMP2:%.*]] = and i32 [[TMP1]], [[ARGC:%.*]]
813 ; CHECK-NEXT: [[TMP3:%.*]] = icmp ne i32 [[TMP2]], [[TMP1]]
814 ; CHECK-NEXT: [[STOREMERGE:%.*]] = zext i1 [[TMP3]] to i32
815 ; CHECK-NEXT: ret i32 [[STOREMERGE]]
817 %and1 = and i32 %argc, %argc2
818 %tobool = icmp eq i32 %argc2, %and1
819 %and2 = and i32 %argc, %argc3
820 %tobool3 = icmp eq i32 %argc3, %and2
821 %and.cond = and i1 %tobool, %tobool3
822 %storemerge = select i1 %and.cond, i32 0, i32 1
826 define i32 @main7b_logical(i32 %argc, i32 %argc2, i32 %argc3) {
827 ; CHECK-LABEL: @main7b_logical(
828 ; CHECK-NEXT: [[AND1:%.*]] = and i32 [[ARGC:%.*]], [[ARGC2:%.*]]
829 ; CHECK-NEXT: [[TOBOOL:%.*]] = icmp ne i32 [[AND1]], [[ARGC2]]
830 ; CHECK-NEXT: [[AND2:%.*]] = and i32 [[ARGC]], [[ARGC3:%.*]]
831 ; CHECK-NEXT: [[TOBOOL3:%.*]] = icmp ne i32 [[AND2]], [[ARGC3]]
832 ; CHECK-NEXT: [[AND_COND:%.*]] = select i1 [[TOBOOL]], i1 true, i1 [[TOBOOL3]]
833 ; CHECK-NEXT: [[STOREMERGE:%.*]] = zext i1 [[AND_COND]] to i32
834 ; CHECK-NEXT: ret i32 [[STOREMERGE]]
836 %and1 = and i32 %argc, %argc2
837 %tobool = icmp eq i32 %argc2, %and1
838 %and2 = and i32 %argc, %argc3
839 %tobool3 = icmp eq i32 %argc3, %and2
840 %and.cond = select i1 %tobool, i1 %tobool3, i1 false
841 %storemerge = select i1 %and.cond, i32 0, i32 1
845 ; B == (B & A) & D == (D & A)
846 define i32 @main7c(i32 %argc, i32 %argc2, i32 %argc3) {
847 ; CHECK-LABEL: @main7c(
848 ; CHECK-NEXT: [[TMP1:%.*]] = or i32 [[ARGC2:%.*]], [[ARGC3:%.*]]
849 ; CHECK-NEXT: [[TMP2:%.*]] = and i32 [[TMP1]], [[ARGC:%.*]]
850 ; CHECK-NEXT: [[TMP3:%.*]] = icmp ne i32 [[TMP2]], [[TMP1]]
851 ; CHECK-NEXT: [[STOREMERGE:%.*]] = zext i1 [[TMP3]] to i32
852 ; CHECK-NEXT: ret i32 [[STOREMERGE]]
854 %and1 = and i32 %argc2, %argc
855 %tobool = icmp eq i32 %argc2, %and1
856 %and2 = and i32 %argc3, %argc
857 %tobool3 = icmp eq i32 %argc3, %and2
858 %and.cond = and i1 %tobool, %tobool3
859 %storemerge = select i1 %and.cond, i32 0, i32 1
863 define i32 @main7c_logical(i32 %argc, i32 %argc2, i32 %argc3) {
864 ; CHECK-LABEL: @main7c_logical(
865 ; CHECK-NEXT: [[AND1:%.*]] = and i32 [[ARGC2:%.*]], [[ARGC:%.*]]
866 ; CHECK-NEXT: [[TOBOOL:%.*]] = icmp ne i32 [[AND1]], [[ARGC2]]
867 ; CHECK-NEXT: [[AND2:%.*]] = and i32 [[ARGC3:%.*]], [[ARGC]]
868 ; CHECK-NEXT: [[TOBOOL3:%.*]] = icmp ne i32 [[AND2]], [[ARGC3]]
869 ; CHECK-NEXT: [[AND_COND:%.*]] = select i1 [[TOBOOL]], i1 true, i1 [[TOBOOL3]]
870 ; CHECK-NEXT: [[STOREMERGE:%.*]] = zext i1 [[AND_COND]] to i32
871 ; CHECK-NEXT: ret i32 [[STOREMERGE]]
873 %and1 = and i32 %argc2, %argc
874 %tobool = icmp eq i32 %argc2, %and1
875 %and2 = and i32 %argc3, %argc
876 %tobool3 = icmp eq i32 %argc3, %and2
877 %and.cond = select i1 %tobool, i1 %tobool3, i1 false
878 %storemerge = select i1 %and.cond, i32 0, i32 1
882 ; (A & (B & C)) == (B & C) & (A & (D & E)) == (D & E)
883 define i32 @main7d(i32 %argc, i32 %argc2, i32 %argc3, i32 %argc4, i32 %argc5) {
884 ; CHECK-LABEL: @main7d(
885 ; CHECK-NEXT: [[BC:%.*]] = and i32 [[ARGC2:%.*]], [[ARGC4:%.*]]
886 ; CHECK-NEXT: [[DE:%.*]] = and i32 [[ARGC3:%.*]], [[ARGC5:%.*]]
887 ; CHECK-NEXT: [[TMP1:%.*]] = or i32 [[BC]], [[DE]]
888 ; CHECK-NEXT: [[TMP2:%.*]] = and i32 [[TMP1]], [[ARGC:%.*]]
889 ; CHECK-NEXT: [[TMP3:%.*]] = icmp ne i32 [[TMP2]], [[TMP1]]
890 ; CHECK-NEXT: [[STOREMERGE:%.*]] = zext i1 [[TMP3]] to i32
891 ; CHECK-NEXT: ret i32 [[STOREMERGE]]
893 %bc = and i32 %argc2, %argc4
894 %de = and i32 %argc3, %argc5
895 %and1 = and i32 %argc, %bc
896 %tobool = icmp eq i32 %and1, %bc
897 %and2 = and i32 %argc, %de
898 %tobool3 = icmp eq i32 %and2, %de
899 %and.cond = and i1 %tobool, %tobool3
900 %storemerge = select i1 %and.cond, i32 0, i32 1
904 define i32 @main7d_logical(i32 %argc, i32 %argc2, i32 %argc3, i32 %argc4, i32 %argc5) {
905 ; CHECK-LABEL: @main7d_logical(
906 ; CHECK-NEXT: [[BC:%.*]] = and i32 [[ARGC2:%.*]], [[ARGC4:%.*]]
907 ; CHECK-NEXT: [[DE:%.*]] = and i32 [[ARGC3:%.*]], [[ARGC5:%.*]]
908 ; CHECK-NEXT: [[AND1:%.*]] = and i32 [[BC]], [[ARGC:%.*]]
909 ; CHECK-NEXT: [[TOBOOL:%.*]] = icmp ne i32 [[AND1]], [[BC]]
910 ; CHECK-NEXT: [[AND2:%.*]] = and i32 [[DE]], [[ARGC]]
911 ; CHECK-NEXT: [[TOBOOL3:%.*]] = icmp ne i32 [[AND2]], [[DE]]
912 ; CHECK-NEXT: [[AND_COND:%.*]] = select i1 [[TOBOOL]], i1 true, i1 [[TOBOOL3]]
913 ; CHECK-NEXT: [[STOREMERGE:%.*]] = zext i1 [[AND_COND]] to i32
914 ; CHECK-NEXT: ret i32 [[STOREMERGE]]
916 %bc = and i32 %argc2, %argc4
917 %de = and i32 %argc3, %argc5
918 %and1 = and i32 %argc, %bc
919 %tobool = icmp eq i32 %and1, %bc
920 %and2 = and i32 %argc, %de
921 %tobool3 = icmp eq i32 %and2, %de
922 %and.cond = select i1 %tobool, i1 %tobool3, i1 false
923 %storemerge = select i1 %and.cond, i32 0, i32 1
927 ; ((B & C) & A) == (B & C) & ((D & E) & A) == (D & E)
928 define i32 @main7e(i32 %argc, i32 %argc2, i32 %argc3, i32 %argc4, i32 %argc5) {
929 ; CHECK-LABEL: @main7e(
930 ; CHECK-NEXT: [[BC:%.*]] = and i32 [[ARGC2:%.*]], [[ARGC4:%.*]]
931 ; CHECK-NEXT: [[DE:%.*]] = and i32 [[ARGC3:%.*]], [[ARGC5:%.*]]
932 ; CHECK-NEXT: [[TMP1:%.*]] = or i32 [[BC]], [[DE]]
933 ; CHECK-NEXT: [[TMP2:%.*]] = and i32 [[TMP1]], [[ARGC:%.*]]
934 ; CHECK-NEXT: [[TMP3:%.*]] = icmp ne i32 [[TMP2]], [[TMP1]]
935 ; CHECK-NEXT: [[STOREMERGE:%.*]] = zext i1 [[TMP3]] to i32
936 ; CHECK-NEXT: ret i32 [[STOREMERGE]]
938 %bc = and i32 %argc2, %argc4
939 %de = and i32 %argc3, %argc5
940 %and1 = and i32 %bc, %argc
941 %tobool = icmp eq i32 %and1, %bc
942 %and2 = and i32 %de, %argc
943 %tobool3 = icmp eq i32 %and2, %de
944 %and.cond = and i1 %tobool, %tobool3
945 %storemerge = select i1 %and.cond, i32 0, i32 1
949 define i32 @main7e_logical(i32 %argc, i32 %argc2, i32 %argc3, i32 %argc4, i32 %argc5) {
950 ; CHECK-LABEL: @main7e_logical(
951 ; CHECK-NEXT: [[BC:%.*]] = and i32 [[ARGC2:%.*]], [[ARGC4:%.*]]
952 ; CHECK-NEXT: [[DE:%.*]] = and i32 [[ARGC3:%.*]], [[ARGC5:%.*]]
953 ; CHECK-NEXT: [[AND1:%.*]] = and i32 [[BC]], [[ARGC:%.*]]
954 ; CHECK-NEXT: [[TOBOOL:%.*]] = icmp ne i32 [[AND1]], [[BC]]
955 ; CHECK-NEXT: [[AND2:%.*]] = and i32 [[DE]], [[ARGC]]
956 ; CHECK-NEXT: [[TOBOOL3:%.*]] = icmp ne i32 [[AND2]], [[DE]]
957 ; CHECK-NEXT: [[AND_COND:%.*]] = select i1 [[TOBOOL]], i1 true, i1 [[TOBOOL3]]
958 ; CHECK-NEXT: [[STOREMERGE:%.*]] = zext i1 [[AND_COND]] to i32
959 ; CHECK-NEXT: ret i32 [[STOREMERGE]]
961 %bc = and i32 %argc2, %argc4
962 %de = and i32 %argc3, %argc5
963 %and1 = and i32 %bc, %argc
964 %tobool = icmp eq i32 %and1, %bc
965 %and2 = and i32 %de, %argc
966 %tobool3 = icmp eq i32 %and2, %de
967 %and.cond = select i1 %tobool, i1 %tobool3, i1 false
968 %storemerge = select i1 %and.cond, i32 0, i32 1
972 ; (B & C) == (A & (B & C)) & (D & E) == (A & (D & E))
973 define i32 @main7f(i32 %argc, i32 %argc2, i32 %argc3, i32 %argc4, i32 %argc5) {
974 ; CHECK-LABEL: @main7f(
975 ; CHECK-NEXT: [[BC:%.*]] = and i32 [[ARGC2:%.*]], [[ARGC4:%.*]]
976 ; CHECK-NEXT: [[DE:%.*]] = and i32 [[ARGC3:%.*]], [[ARGC5:%.*]]
977 ; CHECK-NEXT: [[TMP1:%.*]] = or i32 [[BC]], [[DE]]
978 ; CHECK-NEXT: [[TMP2:%.*]] = and i32 [[TMP1]], [[ARGC:%.*]]
979 ; CHECK-NEXT: [[TMP3:%.*]] = icmp ne i32 [[TMP2]], [[TMP1]]
980 ; CHECK-NEXT: [[STOREMERGE:%.*]] = zext i1 [[TMP3]] to i32
981 ; CHECK-NEXT: ret i32 [[STOREMERGE]]
983 %bc = and i32 %argc2, %argc4
984 %de = and i32 %argc3, %argc5
985 %and1 = and i32 %argc, %bc
986 %tobool = icmp eq i32 %bc, %and1
987 %and2 = and i32 %argc, %de
988 %tobool3 = icmp eq i32 %de, %and2
989 %and.cond = and i1 %tobool, %tobool3
990 %storemerge = select i1 %and.cond, i32 0, i32 1
994 define i32 @main7f_logical(i32 %argc, i32 %argc2, i32 %argc3, i32 %argc4, i32 %argc5) {
995 ; CHECK-LABEL: @main7f_logical(
996 ; CHECK-NEXT: [[BC:%.*]] = and i32 [[ARGC2:%.*]], [[ARGC4:%.*]]
997 ; CHECK-NEXT: [[DE:%.*]] = and i32 [[ARGC3:%.*]], [[ARGC5:%.*]]
998 ; CHECK-NEXT: [[AND1:%.*]] = and i32 [[BC]], [[ARGC:%.*]]
999 ; CHECK-NEXT: [[TOBOOL:%.*]] = icmp ne i32 [[BC]], [[AND1]]
1000 ; CHECK-NEXT: [[AND2:%.*]] = and i32 [[DE]], [[ARGC]]
1001 ; CHECK-NEXT: [[TOBOOL3:%.*]] = icmp ne i32 [[DE]], [[AND2]]
1002 ; CHECK-NEXT: [[AND_COND:%.*]] = select i1 [[TOBOOL]], i1 true, i1 [[TOBOOL3]]
1003 ; CHECK-NEXT: [[STOREMERGE:%.*]] = zext i1 [[AND_COND]] to i32
1004 ; CHECK-NEXT: ret i32 [[STOREMERGE]]
1006 %bc = and i32 %argc2, %argc4
1007 %de = and i32 %argc3, %argc5
1008 %and1 = and i32 %argc, %bc
1009 %tobool = icmp eq i32 %bc, %and1
1010 %and2 = and i32 %argc, %de
1011 %tobool3 = icmp eq i32 %de, %and2
1012 %and.cond = select i1 %tobool, i1 %tobool3, i1 false
1013 %storemerge = select i1 %and.cond, i32 0, i32 1
1017 ; (B & C) == ((B & C) & A) & (D & E) == ((D & E) & A)
1018 define i32 @main7g(i32 %argc, i32 %argc2, i32 %argc3, i32 %argc4, i32 %argc5) {
1019 ; CHECK-LABEL: @main7g(
1020 ; CHECK-NEXT: [[BC:%.*]] = and i32 [[ARGC2:%.*]], [[ARGC4:%.*]]
1021 ; CHECK-NEXT: [[DE:%.*]] = and i32 [[ARGC3:%.*]], [[ARGC5:%.*]]
1022 ; CHECK-NEXT: [[TMP1:%.*]] = or i32 [[BC]], [[DE]]
1023 ; CHECK-NEXT: [[TMP2:%.*]] = and i32 [[TMP1]], [[ARGC:%.*]]
1024 ; CHECK-NEXT: [[TMP3:%.*]] = icmp ne i32 [[TMP2]], [[TMP1]]
1025 ; CHECK-NEXT: [[STOREMERGE:%.*]] = zext i1 [[TMP3]] to i32
1026 ; CHECK-NEXT: ret i32 [[STOREMERGE]]
1028 %bc = and i32 %argc2, %argc4
1029 %de = and i32 %argc3, %argc5
1030 %and1 = and i32 %bc, %argc
1031 %tobool = icmp eq i32 %bc, %and1
1032 %and2 = and i32 %de, %argc
1033 %tobool3 = icmp eq i32 %de, %and2
1034 %and.cond = and i1 %tobool, %tobool3
1035 %storemerge = select i1 %and.cond, i32 0, i32 1
1039 define i32 @main7g_logical(i32 %argc, i32 %argc2, i32 %argc3, i32 %argc4, i32 %argc5) {
1040 ; CHECK-LABEL: @main7g_logical(
1041 ; CHECK-NEXT: [[BC:%.*]] = and i32 [[ARGC2:%.*]], [[ARGC4:%.*]]
1042 ; CHECK-NEXT: [[DE:%.*]] = and i32 [[ARGC3:%.*]], [[ARGC5:%.*]]
1043 ; CHECK-NEXT: [[AND1:%.*]] = and i32 [[BC]], [[ARGC:%.*]]
1044 ; CHECK-NEXT: [[TOBOOL:%.*]] = icmp ne i32 [[BC]], [[AND1]]
1045 ; CHECK-NEXT: [[AND2:%.*]] = and i32 [[DE]], [[ARGC]]
1046 ; CHECK-NEXT: [[TOBOOL3:%.*]] = icmp ne i32 [[DE]], [[AND2]]
1047 ; CHECK-NEXT: [[AND_COND:%.*]] = select i1 [[TOBOOL]], i1 true, i1 [[TOBOOL3]]
1048 ; CHECK-NEXT: [[STOREMERGE:%.*]] = zext i1 [[AND_COND]] to i32
1049 ; CHECK-NEXT: ret i32 [[STOREMERGE]]
1051 %bc = and i32 %argc2, %argc4
1052 %de = and i32 %argc3, %argc5
1053 %and1 = and i32 %bc, %argc
1054 %tobool = icmp eq i32 %bc, %and1
1055 %and2 = and i32 %de, %argc
1056 %tobool3 = icmp eq i32 %de, %and2
1057 %and.cond = select i1 %tobool, i1 %tobool3, i1 false
1058 %storemerge = select i1 %and.cond, i32 0, i32 1
1062 define i32 @main8(i32 %argc) {
1063 ; CHECK-LABEL: @main8(
1064 ; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[ARGC:%.*]], 192
1065 ; CHECK-NEXT: [[DOTNOT:%.*]] = icmp eq i32 [[TMP1]], 0
1066 ; CHECK-NEXT: [[RETVAL_0:%.*]] = select i1 [[DOTNOT]], i32 1, i32 2
1067 ; CHECK-NEXT: ret i32 [[RETVAL_0]]
1069 %and = and i32 %argc, 64
1070 %tobool = icmp ne i32 %and, 0
1071 %trunc2 = trunc i32 %argc to i8
1072 %tobool3 = icmp slt i8 %trunc2, 0
1073 %or.cond = or i1 %tobool, %tobool3
1074 %retval.0 = select i1 %or.cond, i32 2, i32 1
1078 define i32 @main8_logical(i32 %argc) {
1079 ; CHECK-LABEL: @main8_logical(
1080 ; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[ARGC:%.*]], 192
1081 ; CHECK-NEXT: [[DOTNOT:%.*]] = icmp eq i32 [[TMP1]], 0
1082 ; CHECK-NEXT: [[RETVAL_0:%.*]] = select i1 [[DOTNOT]], i32 1, i32 2
1083 ; CHECK-NEXT: ret i32 [[RETVAL_0]]
1085 %and = and i32 %argc, 64
1086 %tobool = icmp ne i32 %and, 0
1087 %trunc2 = trunc i32 %argc to i8
1088 %tobool3 = icmp slt i8 %trunc2, 0
1089 %or.cond = select i1 %tobool, i1 true, i1 %tobool3
1090 %retval.0 = select i1 %or.cond, i32 2, i32 1
1094 define i32 @main9(i32 %argc) {
1095 ; CHECK-LABEL: @main9(
1096 ; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[ARGC:%.*]], 192
1097 ; CHECK-NEXT: [[TMP2:%.*]] = icmp eq i32 [[TMP1]], 192
1098 ; CHECK-NEXT: [[RETVAL_0:%.*]] = select i1 [[TMP2]], i32 2, i32 1
1099 ; CHECK-NEXT: ret i32 [[RETVAL_0]]
1101 %and = and i32 %argc, 64
1102 %tobool = icmp ne i32 %and, 0
1103 %trunc2 = trunc i32 %argc to i8
1104 %tobool3 = icmp slt i8 %trunc2, 0
1105 %or.cond = and i1 %tobool, %tobool3
1106 %retval.0 = select i1 %or.cond, i32 2, i32 1
1110 define i32 @main9_logical(i32 %argc) {
1111 ; CHECK-LABEL: @main9_logical(
1112 ; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[ARGC:%.*]], 192
1113 ; CHECK-NEXT: [[TMP2:%.*]] = icmp eq i32 [[TMP1]], 192
1114 ; CHECK-NEXT: [[RETVAL_0:%.*]] = select i1 [[TMP2]], i32 2, i32 1
1115 ; CHECK-NEXT: ret i32 [[RETVAL_0]]
1117 %and = and i32 %argc, 64
1118 %tobool = icmp ne i32 %and, 0
1119 %trunc2 = trunc i32 %argc to i8
1120 %tobool3 = icmp slt i8 %trunc2, 0
1121 %or.cond = select i1 %tobool, i1 %tobool3, i1 false
1122 %retval.0 = select i1 %or.cond, i32 2, i32 1
1126 define i32 @main10(i32 %argc) {
1127 ; CHECK-LABEL: @main10(
1128 ; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[ARGC:%.*]], 192
1129 ; CHECK-NEXT: [[TMP2:%.*]] = icmp eq i32 [[TMP1]], 0
1130 ; CHECK-NEXT: [[RETVAL_0:%.*]] = select i1 [[TMP2]], i32 2, i32 1
1131 ; CHECK-NEXT: ret i32 [[RETVAL_0]]
1133 %and = and i32 %argc, 64
1134 %tobool = icmp eq i32 %and, 0
1135 %trunc2 = trunc i32 %argc to i8
1136 %tobool3 = icmp sge i8 %trunc2, 0
1137 %or.cond = and i1 %tobool, %tobool3
1138 %retval.0 = select i1 %or.cond, i32 2, i32 1
1142 define i32 @main10_logical(i32 %argc) {
1143 ; CHECK-LABEL: @main10_logical(
1144 ; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[ARGC:%.*]], 192
1145 ; CHECK-NEXT: [[TMP2:%.*]] = icmp eq i32 [[TMP1]], 0
1146 ; CHECK-NEXT: [[RETVAL_0:%.*]] = select i1 [[TMP2]], i32 2, i32 1
1147 ; CHECK-NEXT: ret i32 [[RETVAL_0]]
1149 %and = and i32 %argc, 64
1150 %tobool = icmp eq i32 %and, 0
1151 %trunc2 = trunc i32 %argc to i8
1152 %tobool3 = icmp sge i8 %trunc2, 0
1153 %or.cond = select i1 %tobool, i1 %tobool3, i1 false
1154 %retval.0 = select i1 %or.cond, i32 2, i32 1
1158 define i32 @main11(i32 %argc) {
1159 ; CHECK-LABEL: @main11(
1160 ; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[ARGC:%.*]], 192
1161 ; CHECK-NEXT: [[DOTNOT:%.*]] = icmp eq i32 [[TMP1]], 192
1162 ; CHECK-NEXT: [[RETVAL_0:%.*]] = select i1 [[DOTNOT]], i32 1, i32 2
1163 ; CHECK-NEXT: ret i32 [[RETVAL_0]]
1165 %and = and i32 %argc, 64
1166 %tobool = icmp eq i32 %and, 0
1167 %trunc2 = trunc i32 %argc to i8
1168 %tobool3 = icmp sge i8 %trunc2, 0
1169 %or.cond = or i1 %tobool, %tobool3
1170 %retval.0 = select i1 %or.cond, i32 2, i32 1
1174 define i32 @main11_logical(i32 %argc) {
1175 ; CHECK-LABEL: @main11_logical(
1176 ; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[ARGC:%.*]], 192
1177 ; CHECK-NEXT: [[DOTNOT:%.*]] = icmp eq i32 [[TMP1]], 192
1178 ; CHECK-NEXT: [[RETVAL_0:%.*]] = select i1 [[DOTNOT]], i32 1, i32 2
1179 ; CHECK-NEXT: ret i32 [[RETVAL_0]]
1181 %and = and i32 %argc, 64
1182 %tobool = icmp eq i32 %and, 0
1183 %trunc2 = trunc i32 %argc to i8
1184 %tobool3 = icmp sge i8 %trunc2, 0
1185 %or.cond = select i1 %tobool, i1 true, i1 %tobool3
1186 %retval.0 = select i1 %or.cond, i32 2, i32 1
1190 define i32 @main12(i32 %argc) {
1191 ; CHECK-LABEL: @main12(
1192 ; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[ARGC:%.*]], 32896
1193 ; CHECK-NEXT: [[DOTNOT:%.*]] = icmp eq i32 [[TMP1]], 0
1194 ; CHECK-NEXT: [[RETVAL_0:%.*]] = select i1 [[DOTNOT]], i32 1, i32 2
1195 ; CHECK-NEXT: ret i32 [[RETVAL_0]]
1197 %trunc = trunc i32 %argc to i16
1198 %tobool = icmp slt i16 %trunc, 0
1199 %trunc2 = trunc i32 %argc to i8
1200 %tobool3 = icmp slt i8 %trunc2, 0
1201 %or.cond = or i1 %tobool, %tobool3
1202 %retval.0 = select i1 %or.cond, i32 2, i32 1
1206 define i32 @main12_logical(i32 %argc) {
1207 ; CHECK-LABEL: @main12_logical(
1208 ; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[ARGC:%.*]], 32896
1209 ; CHECK-NEXT: [[DOTNOT:%.*]] = icmp eq i32 [[TMP1]], 0
1210 ; CHECK-NEXT: [[RETVAL_0:%.*]] = select i1 [[DOTNOT]], i32 1, i32 2
1211 ; CHECK-NEXT: ret i32 [[RETVAL_0]]
1213 %trunc = trunc i32 %argc to i16
1214 %tobool = icmp slt i16 %trunc, 0
1215 %trunc2 = trunc i32 %argc to i8
1216 %tobool3 = icmp slt i8 %trunc2, 0
1217 %or.cond = select i1 %tobool, i1 true, i1 %tobool3
1218 %retval.0 = select i1 %or.cond, i32 2, i32 1
1222 define i32 @main13(i32 %argc) {
1223 ; CHECK-LABEL: @main13(
1224 ; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[ARGC:%.*]], 32896
1225 ; CHECK-NEXT: [[TMP2:%.*]] = icmp eq i32 [[TMP1]], 32896
1226 ; CHECK-NEXT: [[RETVAL_0:%.*]] = select i1 [[TMP2]], i32 2, i32 1
1227 ; CHECK-NEXT: ret i32 [[RETVAL_0]]
1229 %trunc = trunc i32 %argc to i16
1230 %tobool = icmp slt i16 %trunc, 0
1231 %trunc2 = trunc i32 %argc to i8
1232 %tobool3 = icmp slt i8 %trunc2, 0
1233 %or.cond = and i1 %tobool, %tobool3
1234 %retval.0 = select i1 %or.cond, i32 2, i32 1
1238 define i32 @main13_logical(i32 %argc) {
1239 ; CHECK-LABEL: @main13_logical(
1240 ; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[ARGC:%.*]], 32896
1241 ; CHECK-NEXT: [[TMP2:%.*]] = icmp eq i32 [[TMP1]], 32896
1242 ; CHECK-NEXT: [[RETVAL_0:%.*]] = select i1 [[TMP2]], i32 2, i32 1
1243 ; CHECK-NEXT: ret i32 [[RETVAL_0]]
1245 %trunc = trunc i32 %argc to i16
1246 %tobool = icmp slt i16 %trunc, 0
1247 %trunc2 = trunc i32 %argc to i8
1248 %tobool3 = icmp slt i8 %trunc2, 0
1249 %or.cond = select i1 %tobool, i1 %tobool3, i1 false
1250 %retval.0 = select i1 %or.cond, i32 2, i32 1
1254 define i32 @main14(i32 %argc) {
1255 ; CHECK-LABEL: @main14(
1256 ; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[ARGC:%.*]], 32896
1257 ; CHECK-NEXT: [[TMP2:%.*]] = icmp eq i32 [[TMP1]], 0
1258 ; CHECK-NEXT: [[RETVAL_0:%.*]] = select i1 [[TMP2]], i32 2, i32 1
1259 ; CHECK-NEXT: ret i32 [[RETVAL_0]]
1261 %trunc = trunc i32 %argc to i16
1262 %tobool = icmp sge i16 %trunc, 0
1263 %trunc2 = trunc i32 %argc to i8
1264 %tobool3 = icmp sge i8 %trunc2, 0
1265 %or.cond = and i1 %tobool, %tobool3
1266 %retval.0 = select i1 %or.cond, i32 2, i32 1
1270 define i32 @main14_logical(i32 %argc) {
1271 ; CHECK-LABEL: @main14_logical(
1272 ; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[ARGC:%.*]], 32896
1273 ; CHECK-NEXT: [[TMP2:%.*]] = icmp eq i32 [[TMP1]], 0
1274 ; CHECK-NEXT: [[RETVAL_0:%.*]] = select i1 [[TMP2]], i32 2, i32 1
1275 ; CHECK-NEXT: ret i32 [[RETVAL_0]]
1277 %trunc = trunc i32 %argc to i16
1278 %tobool = icmp sge i16 %trunc, 0
1279 %trunc2 = trunc i32 %argc to i8
1280 %tobool3 = icmp sge i8 %trunc2, 0
1281 %or.cond = select i1 %tobool, i1 %tobool3, i1 false
1282 %retval.0 = select i1 %or.cond, i32 2, i32 1
1286 define i32 @main15(i32 %argc) {
1287 ; CHECK-LABEL: @main15(
1288 ; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[ARGC:%.*]], 32896
1289 ; CHECK-NEXT: [[DOTNOT:%.*]] = icmp eq i32 [[TMP1]], 32896
1290 ; CHECK-NEXT: [[RETVAL_0:%.*]] = select i1 [[DOTNOT]], i32 1, i32 2
1291 ; CHECK-NEXT: ret i32 [[RETVAL_0]]
1293 %trunc = trunc i32 %argc to i16
1294 %tobool = icmp sge i16 %trunc, 0
1295 %trunc2 = trunc i32 %argc to i8
1296 %tobool3 = icmp sge i8 %trunc2, 0
1297 %or.cond = or i1 %tobool, %tobool3
1298 %retval.0 = select i1 %or.cond, i32 2, i32 1
1302 define i32 @main15_logical(i32 %argc) {
1303 ; CHECK-LABEL: @main15_logical(
1304 ; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[ARGC:%.*]], 32896
1305 ; CHECK-NEXT: [[DOTNOT:%.*]] = icmp eq i32 [[TMP1]], 32896
1306 ; CHECK-NEXT: [[RETVAL_0:%.*]] = select i1 [[DOTNOT]], i32 1, i32 2
1307 ; CHECK-NEXT: ret i32 [[RETVAL_0]]
1309 %trunc = trunc i32 %argc to i16
1310 %tobool = icmp sge i16 %trunc, 0
1311 %trunc2 = trunc i32 %argc to i8
1312 %tobool3 = icmp sge i8 %trunc2, 0
1313 %or.cond = select i1 %tobool, i1 true, i1 %tobool3
1314 %retval.0 = select i1 %or.cond, i32 2, i32 1