1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -passes=instcombine -S -o - %s | FileCheck %s
4 define i1 @masked_and_notallzeroes(i32 %A) {
5 ; CHECK-LABEL: @masked_and_notallzeroes(
6 ; CHECK-NEXT: [[MASK1:%.*]] = and i32 [[A:%.*]], 7
7 ; CHECK-NEXT: [[TST1:%.*]] = icmp ne i32 [[MASK1]], 0
8 ; CHECK-NEXT: ret i1 [[TST1]]
10 %mask1 = and i32 %A, 7
11 %tst1 = icmp ne i32 %mask1, 0
12 %mask2 = and i32 %A, 39
13 %tst2 = icmp ne i32 %mask2, 0
14 %res = and i1 %tst1, %tst2
18 define <2 x i1> @masked_and_notallzeroes_splat(<2 x i32> %A) {
19 ; CHECK-LABEL: @masked_and_notallzeroes_splat(
20 ; CHECK-NEXT: [[MASK1:%.*]] = and <2 x i32> [[A:%.*]], splat (i32 7)
21 ; CHECK-NEXT: [[TST1:%.*]] = icmp ne <2 x i32> [[MASK1]], zeroinitializer
22 ; CHECK-NEXT: ret <2 x i1> [[TST1]]
24 %mask1 = and <2 x i32> %A, <i32 7, i32 7>
25 %tst1 = icmp ne <2 x i32> %mask1, <i32 0, i32 0>
26 %mask2 = and <2 x i32> %A, <i32 39, i32 39>
27 %tst2 = icmp ne <2 x i32> %mask2, <i32 0, i32 0>
28 %res = and <2 x i1> %tst1, %tst2
32 define i1 @masked_and_notallzeroes_logical(i32 %A) {
33 ; CHECK-LABEL: @masked_and_notallzeroes_logical(
34 ; CHECK-NEXT: [[MASK1:%.*]] = and i32 [[A:%.*]], 7
35 ; CHECK-NEXT: [[TST1:%.*]] = icmp ne i32 [[MASK1]], 0
36 ; CHECK-NEXT: ret i1 [[TST1]]
38 %mask1 = and i32 %A, 7
39 %tst1 = icmp ne i32 %mask1, 0
40 %mask2 = and i32 %A, 39
41 %tst2 = icmp ne i32 %mask2, 0
42 %res = select i1 %tst1, i1 %tst2, i1 false
46 define i1 @masked_or_allzeroes(i32 %A) {
47 ; CHECK-LABEL: @masked_or_allzeroes(
48 ; CHECK-NEXT: [[MASK1:%.*]] = and i32 [[A:%.*]], 7
49 ; CHECK-NEXT: [[TST1:%.*]] = icmp eq i32 [[MASK1]], 0
50 ; CHECK-NEXT: ret i1 [[TST1]]
52 %mask1 = and i32 %A, 7
53 %tst1 = icmp eq i32 %mask1, 0
54 %mask2 = and i32 %A, 39
55 %tst2 = icmp eq i32 %mask2, 0
56 %res = or i1 %tst1, %tst2
60 define i1 @masked_or_allzeroes_logical(i32 %A) {
61 ; CHECK-LABEL: @masked_or_allzeroes_logical(
62 ; CHECK-NEXT: [[MASK1:%.*]] = and i32 [[A:%.*]], 7
63 ; CHECK-NEXT: [[TST1:%.*]] = icmp eq i32 [[MASK1]], 0
64 ; CHECK-NEXT: ret i1 [[TST1]]
66 %mask1 = and i32 %A, 7
67 %tst1 = icmp eq i32 %mask1, 0
68 %mask2 = and i32 %A, 39
69 %tst2 = icmp eq i32 %mask2, 0
70 %res = select i1 %tst1, i1 true, i1 %tst2
74 define i1 @masked_and_notallones(i32 %A) {
75 ; CHECK-LABEL: @masked_and_notallones(
76 ; CHECK-NEXT: [[MASK1:%.*]] = and i32 [[A:%.*]], 7
77 ; CHECK-NEXT: [[TST1:%.*]] = icmp ne i32 [[MASK1]], 7
78 ; CHECK-NEXT: ret i1 [[TST1]]
80 %mask1 = and i32 %A, 7
81 %tst1 = icmp ne i32 %mask1, 7
82 %mask2 = and i32 %A, 39
83 %tst2 = icmp ne i32 %mask2, 39
84 %res = and i1 %tst1, %tst2
88 define i1 @masked_and_notallones_logical(i32 %A) {
89 ; CHECK-LABEL: @masked_and_notallones_logical(
90 ; CHECK-NEXT: [[MASK1:%.*]] = and i32 [[A:%.*]], 7
91 ; CHECK-NEXT: [[TST1:%.*]] = icmp ne i32 [[MASK1]], 7
92 ; CHECK-NEXT: ret i1 [[TST1]]
94 %mask1 = and i32 %A, 7
95 %tst1 = icmp ne i32 %mask1, 7
96 %mask2 = and i32 %A, 39
97 %tst2 = icmp ne i32 %mask2, 39
98 %res = select i1 %tst1, i1 %tst2, i1 false
102 define i1 @masked_or_allones(i32 %A) {
103 ; CHECK-LABEL: @masked_or_allones(
104 ; CHECK-NEXT: [[MASK1:%.*]] = and i32 [[A:%.*]], 7
105 ; CHECK-NEXT: [[TST1:%.*]] = icmp eq i32 [[MASK1]], 7
106 ; CHECK-NEXT: ret i1 [[TST1]]
108 %mask1 = and i32 %A, 7
109 %tst1 = icmp eq i32 %mask1, 7
110 %mask2 = and i32 %A, 39
111 %tst2 = icmp eq i32 %mask2, 39
112 %res = or i1 %tst1, %tst2
116 define i1 @masked_or_allones_logical(i32 %A) {
117 ; CHECK-LABEL: @masked_or_allones_logical(
118 ; CHECK-NEXT: [[MASK1:%.*]] = and i32 [[A:%.*]], 7
119 ; CHECK-NEXT: [[TST1:%.*]] = icmp eq i32 [[MASK1]], 7
120 ; CHECK-NEXT: ret i1 [[TST1]]
122 %mask1 = and i32 %A, 7
123 %tst1 = icmp eq i32 %mask1, 7
124 %mask2 = and i32 %A, 39
125 %tst2 = icmp eq i32 %mask2, 39
126 %res = select i1 %tst1, i1 true, i1 %tst2
130 define i1 @masked_and_notA(i32 %A) {
131 ; CHECK-LABEL: @masked_and_notA(
132 ; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[A:%.*]], -79
133 ; CHECK-NEXT: [[TST2:%.*]] = icmp ne i32 [[TMP1]], 0
134 ; CHECK-NEXT: ret i1 [[TST2]]
136 %mask1 = and i32 %A, 14
137 %tst1 = icmp ne i32 %mask1, %A
138 %mask2 = and i32 %A, 78
139 %tst2 = icmp ne i32 %mask2, %A
140 %res = and i1 %tst1, %tst2
144 define i1 @masked_and_notA_logical(i32 %A) {
145 ; CHECK-LABEL: @masked_and_notA_logical(
146 ; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[A:%.*]], -79
147 ; CHECK-NEXT: [[TST2:%.*]] = icmp ne i32 [[TMP1]], 0
148 ; CHECK-NEXT: ret i1 [[TST2]]
150 %mask1 = and i32 %A, 14
151 %tst1 = icmp ne i32 %mask1, %A
152 %mask2 = and i32 %A, 78
153 %tst2 = icmp ne i32 %mask2, %A
154 %res = select i1 %tst1, i1 %tst2, i1 false
158 define i1 @masked_and_notA_slightly_optimized(i32 %A) {
159 ; CHECK-LABEL: @masked_and_notA_slightly_optimized(
160 ; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[A:%.*]], -40
161 ; CHECK-NEXT: [[TST2:%.*]] = icmp ne i32 [[TMP1]], 0
162 ; CHECK-NEXT: ret i1 [[TST2]]
164 %t0 = icmp uge i32 %A, 8
165 %mask2 = and i32 %A, 39
166 %tst2 = icmp ne i32 %mask2, %A
167 %res = and i1 %t0, %tst2
171 define i1 @masked_and_notA_slightly_optimized_logical(i32 %A) {
172 ; CHECK-LABEL: @masked_and_notA_slightly_optimized_logical(
173 ; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[A:%.*]], -40
174 ; CHECK-NEXT: [[TST2:%.*]] = icmp ne i32 [[TMP1]], 0
175 ; CHECK-NEXT: ret i1 [[TST2]]
177 %t0 = icmp uge i32 %A, 8
178 %mask2 = and i32 %A, 39
179 %tst2 = icmp ne i32 %mask2, %A
180 %res = select i1 %t0, i1 %tst2, i1 false
184 define i1 @masked_or_A(i32 %A) {
185 ; CHECK-LABEL: @masked_or_A(
186 ; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[A:%.*]], -79
187 ; CHECK-NEXT: [[TST2:%.*]] = icmp eq i32 [[TMP1]], 0
188 ; CHECK-NEXT: ret i1 [[TST2]]
190 %mask1 = and i32 %A, 14
191 %tst1 = icmp eq i32 %mask1, %A
192 %mask2 = and i32 %A, 78
193 %tst2 = icmp eq i32 %mask2, %A
194 %res = or i1 %tst1, %tst2
198 define i1 @masked_or_A_logical(i32 %A) {
199 ; CHECK-LABEL: @masked_or_A_logical(
200 ; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[A:%.*]], -79
201 ; CHECK-NEXT: [[TST2:%.*]] = icmp eq i32 [[TMP1]], 0
202 ; CHECK-NEXT: ret i1 [[TST2]]
204 %mask1 = and i32 %A, 14
205 %tst1 = icmp eq i32 %mask1, %A
206 %mask2 = and i32 %A, 78
207 %tst2 = icmp eq i32 %mask2, %A
208 %res = select i1 %tst1, i1 true, i1 %tst2
212 define i1 @masked_or_A_slightly_optimized(i32 %A) {
213 ; CHECK-LABEL: @masked_or_A_slightly_optimized(
214 ; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[A:%.*]], -40
215 ; CHECK-NEXT: [[TST2:%.*]] = icmp eq i32 [[TMP1]], 0
216 ; CHECK-NEXT: ret i1 [[TST2]]
218 %t0 = icmp ult i32 %A, 8
219 %mask2 = and i32 %A, 39
220 %tst2 = icmp eq i32 %mask2, %A
221 %res = or i1 %t0, %tst2
225 define i1 @masked_or_A_slightly_optimized_logical(i32 %A) {
226 ; CHECK-LABEL: @masked_or_A_slightly_optimized_logical(
227 ; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[A:%.*]], -40
228 ; CHECK-NEXT: [[TST2:%.*]] = icmp eq i32 [[TMP1]], 0
229 ; CHECK-NEXT: ret i1 [[TST2]]
231 %t0 = icmp ult i32 %A, 8
232 %mask2 = and i32 %A, 39
233 %tst2 = icmp eq i32 %mask2, %A
234 %res = select i1 %t0, i1 true, i1 %tst2
238 define i1 @masked_or_allzeroes_notoptimised(i32 %A) {
239 ; CHECK-LABEL: @masked_or_allzeroes_notoptimised(
240 ; CHECK-NEXT: [[MASK1:%.*]] = and i32 [[A:%.*]], 15
241 ; CHECK-NEXT: [[TST1:%.*]] = icmp eq i32 [[MASK1]], 0
242 ; CHECK-NEXT: [[MASK2:%.*]] = and i32 [[A]], 39
243 ; CHECK-NEXT: [[TST2:%.*]] = icmp eq i32 [[MASK2]], 0
244 ; CHECK-NEXT: [[RES:%.*]] = or i1 [[TST1]], [[TST2]]
245 ; CHECK-NEXT: ret i1 [[RES]]
247 %mask1 = and i32 %A, 15
248 %tst1 = icmp eq i32 %mask1, 0
249 %mask2 = and i32 %A, 39
250 %tst2 = icmp eq i32 %mask2, 0
251 %res = or i1 %tst1, %tst2
255 define i1 @masked_or_allzeroes_notoptimised_logical(i32 %A) {
256 ; CHECK-LABEL: @masked_or_allzeroes_notoptimised_logical(
257 ; CHECK-NEXT: [[MASK1:%.*]] = and i32 [[A:%.*]], 15
258 ; CHECK-NEXT: [[TST1:%.*]] = icmp eq i32 [[MASK1]], 0
259 ; CHECK-NEXT: [[MASK2:%.*]] = and i32 [[A]], 39
260 ; CHECK-NEXT: [[TST2:%.*]] = icmp eq i32 [[MASK2]], 0
261 ; CHECK-NEXT: [[RES:%.*]] = or i1 [[TST1]], [[TST2]]
262 ; CHECK-NEXT: ret i1 [[RES]]
264 %mask1 = and i32 %A, 15
265 %tst1 = icmp eq i32 %mask1, 0
266 %mask2 = and i32 %A, 39
267 %tst2 = icmp eq i32 %mask2, 0
268 %res = select i1 %tst1, i1 true, i1 %tst2
272 define i1 @nomask_lhs(i32 %in) {
273 ; CHECK-LABEL: @nomask_lhs(
274 ; CHECK-NEXT: [[MASKED:%.*]] = and i32 [[IN:%.*]], 1
275 ; CHECK-NEXT: [[TST2:%.*]] = icmp eq i32 [[MASKED]], 0
276 ; CHECK-NEXT: ret i1 [[TST2]]
278 %tst1 = icmp eq i32 %in, 0
279 %masked = and i32 %in, 1
280 %tst2 = icmp eq i32 %masked, 0
281 %val = or i1 %tst1, %tst2
285 define i1 @nomask_lhs_logical(i32 %in) {
286 ; CHECK-LABEL: @nomask_lhs_logical(
287 ; CHECK-NEXT: [[MASKED:%.*]] = and i32 [[IN:%.*]], 1
288 ; CHECK-NEXT: [[TST2:%.*]] = icmp eq i32 [[MASKED]], 0
289 ; CHECK-NEXT: ret i1 [[TST2]]
291 %tst1 = icmp eq i32 %in, 0
292 %masked = and i32 %in, 1
293 %tst2 = icmp eq i32 %masked, 0
294 %val = select i1 %tst1, i1 true, i1 %tst2
298 define i1 @nomask_rhs(i32 %in) {
299 ; CHECK-LABEL: @nomask_rhs(
300 ; CHECK-NEXT: [[MASKED:%.*]] = and i32 [[IN:%.*]], 1
301 ; CHECK-NEXT: [[TST1:%.*]] = icmp eq i32 [[MASKED]], 0
302 ; CHECK-NEXT: ret i1 [[TST1]]
304 %masked = and i32 %in, 1
305 %tst1 = icmp eq i32 %masked, 0
306 %tst2 = icmp eq i32 %in, 0
307 %val = or i1 %tst1, %tst2
311 define i1 @nomask_rhs_logical(i32 %in) {
312 ; CHECK-LABEL: @nomask_rhs_logical(
313 ; CHECK-NEXT: [[MASKED:%.*]] = and i32 [[IN:%.*]], 1
314 ; CHECK-NEXT: [[TST1:%.*]] = icmp eq i32 [[MASKED]], 0
315 ; CHECK-NEXT: ret i1 [[TST1]]
317 %masked = and i32 %in, 1
318 %tst1 = icmp eq i32 %masked, 0
319 %tst2 = icmp eq i32 %in, 0
320 %val = select i1 %tst1, i1 true, i1 %tst2
324 ; TODO: This test simplifies to a constant, so the functionality and test could be in InstSimplify.
326 define i1 @fold_mask_cmps_to_false(i32 %x) {
327 ; CHECK-LABEL: @fold_mask_cmps_to_false(
328 ; CHECK-NEXT: ret i1 false
330 %t1 = and i32 %x, 2147483647
331 %t2 = icmp eq i32 %t1, 0
332 %t3 = icmp eq i32 %x, 2147483647
333 %t4 = and i1 %t3, %t2
337 define i1 @fold_mask_cmps_to_false_logical(i32 %x) {
338 ; CHECK-LABEL: @fold_mask_cmps_to_false_logical(
339 ; CHECK-NEXT: ret i1 false
341 %t1 = and i32 %x, 2147483647
342 %t2 = icmp eq i32 %t1, 0
343 %t3 = icmp eq i32 %x, 2147483647
344 %t4 = select i1 %t3, i1 %t2, i1 false
348 ; TODO: This test simplifies to a constant, so the functionality and test could be in InstSimplify.
350 define i1 @fold_mask_cmps_to_true(i32 %x) {
351 ; CHECK-LABEL: @fold_mask_cmps_to_true(
352 ; CHECK-NEXT: ret i1 true
354 %t1 = and i32 %x, 2147483647
355 %t2 = icmp ne i32 %t1, 0
356 %t3 = icmp ne i32 %x, 2147483647
361 define i1 @fold_mask_cmps_to_true_logical(i32 %x) {
362 ; CHECK-LABEL: @fold_mask_cmps_to_true_logical(
363 ; CHECK-NEXT: ret i1 true
365 %t1 = and i32 %x, 2147483647
366 %t2 = icmp ne i32 %t1, 0
367 %t3 = icmp ne i32 %x, 2147483647
368 %t4 = select i1 %t3, i1 true, i1 %t2
372 define <2 x i1> @nomask_splat_and_B_allones(<2 x i32> %A) {
373 ; CHECK-LABEL: @nomask_splat_and_B_allones(
374 ; CHECK-NEXT: [[RES:%.*]] = icmp ugt <2 x i32> [[A:%.*]], splat (i32 -268435457)
375 ; CHECK-NEXT: ret <2 x i1> [[RES]]
377 %tst1 = icmp slt <2 x i32> %A, <i32 0, i32 poison>
378 %mask2 = and <2 x i32> %A, <i32 1879048192, i32 1879048192>
379 %tst2 = icmp eq <2 x i32> %mask2, <i32 1879048192, i32 1879048192>
380 %res = and <2 x i1> %tst1, %tst2
384 define <2 x i1> @nomask_splat_and_B_mixed(<2 x i32> %A) {
385 ; CHECK-LABEL: @nomask_splat_and_B_mixed(
386 ; CHECK-NEXT: [[TMP1:%.*]] = and <2 x i32> [[A:%.*]], splat (i32 -268435456)
387 ; CHECK-NEXT: [[RES:%.*]] = icmp eq <2 x i32> [[TMP1]], splat (i32 1879048192)
388 ; CHECK-NEXT: ret <2 x i1> [[RES]]
390 %tst1 = icmp sgt <2 x i32> %A, <i32 -1, i32 poison>
391 %mask2 = and <2 x i32> %A, <i32 1879048192, i32 1879048192>
392 %tst2 = icmp eq <2 x i32> %mask2, <i32 1879048192, i32 1879048192>
393 %res = and <2 x i1> %tst1, %tst2
397 ; PR32401 - https://bugs.llvm.org/show_bug.cgi?id=32401
399 define i1 @cmpeq_bitwise(i8 %a, i8 %b, i8 %c, i8 %d) {
400 ; CHECK-LABEL: @cmpeq_bitwise(
401 ; CHECK-NEXT: [[TMP1:%.*]] = icmp eq i8 [[A:%.*]], [[B:%.*]]
402 ; CHECK-NEXT: [[TMP2:%.*]] = icmp eq i8 [[C:%.*]], [[D:%.*]]
403 ; CHECK-NEXT: [[CMP:%.*]] = and i1 [[TMP1]], [[TMP2]]
404 ; CHECK-NEXT: ret i1 [[CMP]]
406 %xor1 = xor i8 %a, %b
407 %xor2 = xor i8 %c, %d
408 %or = or i8 %xor1, %xor2
409 %cmp = icmp eq i8 %or, 0
413 define <2 x i1> @cmpne_bitwise(<2 x i64> %a, <2 x i64> %b, <2 x i64> %c, <2 x i64> %d) {
414 ; CHECK-LABEL: @cmpne_bitwise(
415 ; CHECK-NEXT: [[TMP1:%.*]] = icmp ne <2 x i64> [[A:%.*]], [[B:%.*]]
416 ; CHECK-NEXT: [[TMP2:%.*]] = icmp ne <2 x i64> [[C:%.*]], [[D:%.*]]
417 ; CHECK-NEXT: [[CMP:%.*]] = or <2 x i1> [[TMP1]], [[TMP2]]
418 ; CHECK-NEXT: ret <2 x i1> [[CMP]]
420 %xor1 = xor <2 x i64> %a, %b
421 %xor2 = xor <2 x i64> %c, %d
422 %or = or <2 x i64> %xor1, %xor2
423 %cmp = icmp ne <2 x i64> %or, zeroinitializer
427 ; ((X & 12) != 0 & (X & 3) == 1) -> no change
428 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_0(i32 %x) {
429 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_0(
430 ; CHECK-NEXT: [[T1:%.*]] = and i32 [[X:%.*]], 12
431 ; CHECK-NEXT: [[T2:%.*]] = icmp ne i32 [[T1]], 0
432 ; CHECK-NEXT: [[T3:%.*]] = and i32 [[X]], 3
433 ; CHECK-NEXT: [[T4:%.*]] = icmp eq i32 [[T3]], 1
434 ; CHECK-NEXT: [[T5:%.*]] = and i1 [[T2]], [[T4]]
435 ; CHECK-NEXT: ret i1 [[T5]]
438 %t2 = icmp ne i32 %t1, 0
440 %t4 = icmp eq i32 %t3, 1
441 %t5 = and i1 %t2, %t4
445 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_0_logical(i32 %x) {
446 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_0_logical(
447 ; CHECK-NEXT: [[T1:%.*]] = and i32 [[X:%.*]], 12
448 ; CHECK-NEXT: [[T2:%.*]] = icmp ne i32 [[T1]], 0
449 ; CHECK-NEXT: [[T3:%.*]] = and i32 [[X]], 3
450 ; CHECK-NEXT: [[T4:%.*]] = icmp eq i32 [[T3]], 1
451 ; CHECK-NEXT: [[T5:%.*]] = and i1 [[T2]], [[T4]]
452 ; CHECK-NEXT: ret i1 [[T5]]
455 %t2 = icmp ne i32 %t1, 0
457 %t4 = icmp eq i32 %t3, 1
458 %t5 = select i1 %t2, i1 %t4, i1 false
462 ; ((X & 12) != 0 & (X & 7) == 1) -> (X & 15) == 9
463 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_1(i32 %x) {
464 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_1(
465 ; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[X:%.*]], 15
466 ; CHECK-NEXT: [[T5:%.*]] = icmp eq i32 [[TMP1]], 9
467 ; CHECK-NEXT: ret i1 [[T5]]
470 %t2 = icmp ne i32 %t1, 0
472 %t4 = icmp eq i32 %t3, 1
473 %t5 = and i1 %t2, %t4
477 define <2 x i1> @masked_icmps_mask_notallzeros_bmask_mixed_1_vector(<2 x i32> %x) {
478 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_1_vector(
479 ; CHECK-NEXT: [[TMP1:%.*]] = and <2 x i32> [[X:%.*]], splat (i32 15)
480 ; CHECK-NEXT: [[T5:%.*]] = icmp eq <2 x i32> [[TMP1]], splat (i32 9)
481 ; CHECK-NEXT: ret <2 x i1> [[T5]]
483 %t1 = and <2 x i32> %x, <i32 12, i32 12>
484 %t2 = icmp ne <2 x i32> %t1, zeroinitializer
485 %t3 = and <2 x i32> %x, <i32 7, i32 7>
486 %t4 = icmp eq <2 x i32> %t3, <i32 1, i32 1>
487 %t5 = and <2 x i1> %t2, %t4
491 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_1_logical(i32 %x) {
492 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_1_logical(
493 ; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[X:%.*]], 15
494 ; CHECK-NEXT: [[T5:%.*]] = icmp eq i32 [[TMP1]], 9
495 ; CHECK-NEXT: ret i1 [[T5]]
498 %t2 = icmp ne i32 %t1, 0
500 %t4 = icmp eq i32 %t3, 1
501 %t5 = select i1 %t2, i1 %t4, i1 false
505 ; ((X & 14) != 0 & (X & 3) == 1) -> no change
506 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_1b(i32 %x) {
507 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_1b(
508 ; CHECK-NEXT: [[T1:%.*]] = and i32 [[X:%.*]], 14
509 ; CHECK-NEXT: [[T2:%.*]] = icmp ne i32 [[T1]], 0
510 ; CHECK-NEXT: [[T3:%.*]] = and i32 [[X]], 3
511 ; CHECK-NEXT: [[T4:%.*]] = icmp eq i32 [[T3]], 1
512 ; CHECK-NEXT: [[T5:%.*]] = and i1 [[T2]], [[T4]]
513 ; CHECK-NEXT: ret i1 [[T5]]
516 %t2 = icmp ne i32 %t1, 0
518 %t4 = icmp eq i32 %t3, 1
519 %t5 = and i1 %t2, %t4
523 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_1b_logical(i32 %x) {
524 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_1b_logical(
525 ; CHECK-NEXT: [[T1:%.*]] = and i32 [[X:%.*]], 14
526 ; CHECK-NEXT: [[T2:%.*]] = icmp ne i32 [[T1]], 0
527 ; CHECK-NEXT: [[T3:%.*]] = and i32 [[X]], 3
528 ; CHECK-NEXT: [[T4:%.*]] = icmp eq i32 [[T3]], 1
529 ; CHECK-NEXT: [[T5:%.*]] = and i1 [[T2]], [[T4]]
530 ; CHECK-NEXT: ret i1 [[T5]]
533 %t2 = icmp ne i32 %t1, 0
535 %t4 = icmp eq i32 %t3, 1
536 %t5 = select i1 %t2, i1 %t4, i1 false
540 ; ((X & 3) != 0 & (X & 7) == 0) -> false
541 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_2(i32 %x) {
542 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_2(
543 ; CHECK-NEXT: ret i1 false
546 %t2 = icmp ne i32 %t1, 0
548 %t4 = icmp eq i32 %t3, 0
549 %t5 = and i1 %t2, %t4
553 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_2_logical(i32 %x) {
554 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_2_logical(
555 ; CHECK-NEXT: ret i1 false
558 %t2 = icmp ne i32 %t1, 0
560 %t4 = icmp eq i32 %t3, 0
561 %t5 = select i1 %t2, i1 %t4, i1 false
565 ; ((X & 15) != 0 & (X & 7) == 0) -> (X & 15) == 8
566 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_3(i32 %x) {
567 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_3(
568 ; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[X:%.*]], 15
569 ; CHECK-NEXT: [[T5:%.*]] = icmp eq i32 [[TMP1]], 8
570 ; CHECK-NEXT: ret i1 [[T5]]
573 %t2 = icmp ne i32 %t1, 0
575 %t4 = icmp eq i32 %t3, 0
576 %t5 = and i1 %t2, %t4
580 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_3_logical(i32 %x) {
581 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_3_logical(
582 ; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[X:%.*]], 15
583 ; CHECK-NEXT: [[T5:%.*]] = icmp eq i32 [[TMP1]], 8
584 ; CHECK-NEXT: ret i1 [[T5]]
587 %t2 = icmp ne i32 %t1, 0
589 %t4 = icmp eq i32 %t3, 0
590 %t5 = select i1 %t2, i1 %t4, i1 false
594 ; ((X & 15) != 0 & (X & 3) == 0) -> no change
595 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_3b(i32 %x) {
596 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_3b(
597 ; CHECK-NEXT: [[T1:%.*]] = and i32 [[X:%.*]], 15
598 ; CHECK-NEXT: [[T2:%.*]] = icmp ne i32 [[T1]], 0
599 ; CHECK-NEXT: [[T3:%.*]] = and i32 [[X]], 3
600 ; CHECK-NEXT: [[T4:%.*]] = icmp eq i32 [[T3]], 0
601 ; CHECK-NEXT: [[T5:%.*]] = and i1 [[T2]], [[T4]]
602 ; CHECK-NEXT: ret i1 [[T5]]
605 %t2 = icmp ne i32 %t1, 0
607 %t4 = icmp eq i32 %t3, 0
608 %t5 = and i1 %t2, %t4
612 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_3b_logical(i32 %x) {
613 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_3b_logical(
614 ; CHECK-NEXT: [[T1:%.*]] = and i32 [[X:%.*]], 15
615 ; CHECK-NEXT: [[T2:%.*]] = icmp ne i32 [[T1]], 0
616 ; CHECK-NEXT: [[T3:%.*]] = and i32 [[X]], 3
617 ; CHECK-NEXT: [[T4:%.*]] = icmp eq i32 [[T3]], 0
618 ; CHECK-NEXT: [[T5:%.*]] = and i1 [[T2]], [[T4]]
619 ; CHECK-NEXT: ret i1 [[T5]]
622 %t2 = icmp ne i32 %t1, 0
624 %t4 = icmp eq i32 %t3, 0
625 %t5 = select i1 %t2, i1 %t4, i1 false
629 ; ((X & 255) != 0 & (X & 15) == 8) -> (X & 15) == 8
630 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_4(i32 %x) {
631 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_4(
632 ; CHECK-NEXT: [[T3:%.*]] = and i32 [[X:%.*]], 15
633 ; CHECK-NEXT: [[T4:%.*]] = icmp eq i32 [[T3]], 8
634 ; CHECK-NEXT: ret i1 [[T4]]
636 %t1 = and i32 %x, 255
637 %t2 = icmp ne i32 %t1, 0
639 %t4 = icmp eq i32 %t3, 8
640 %t5 = and i1 %t2, %t4
644 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_4_logical(i32 %x) {
645 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_4_logical(
646 ; CHECK-NEXT: [[T3:%.*]] = and i32 [[X:%.*]], 15
647 ; CHECK-NEXT: [[T4:%.*]] = icmp eq i32 [[T3]], 8
648 ; CHECK-NEXT: ret i1 [[T4]]
650 %t1 = and i32 %x, 255
651 %t2 = icmp ne i32 %t1, 0
653 %t4 = icmp eq i32 %t3, 8
654 %t5 = select i1 %t2, i1 %t4, i1 false
658 ; ((X & 15) != 0 & (X & 15) == 8) -> (X & 15) == 8
659 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_5(i32 %x) {
660 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_5(
661 ; CHECK-NEXT: [[T3:%.*]] = and i32 [[X:%.*]], 15
662 ; CHECK-NEXT: [[T4:%.*]] = icmp eq i32 [[T3]], 8
663 ; CHECK-NEXT: ret i1 [[T4]]
666 %t2 = icmp ne i32 %t1, 0
668 %t4 = icmp eq i32 %t3, 8
669 %t5 = and i1 %t2, %t4
673 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_5_logical(i32 %x) {
674 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_5_logical(
675 ; CHECK-NEXT: [[T3:%.*]] = and i32 [[X:%.*]], 15
676 ; CHECK-NEXT: [[T4:%.*]] = icmp eq i32 [[T3]], 8
677 ; CHECK-NEXT: ret i1 [[T4]]
680 %t2 = icmp ne i32 %t1, 0
682 %t4 = icmp eq i32 %t3, 8
683 %t5 = select i1 %t2, i1 %t4, i1 false
687 ; ((X & 12) != 0 & (X & 15) == 8) -> (X & 15) == 8
688 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_6(i32 %x) {
689 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_6(
690 ; CHECK-NEXT: [[T3:%.*]] = and i32 [[X:%.*]], 15
691 ; CHECK-NEXT: [[T4:%.*]] = icmp eq i32 [[T3]], 8
692 ; CHECK-NEXT: ret i1 [[T4]]
695 %t2 = icmp ne i32 %t1, 0
697 %t4 = icmp eq i32 %t3, 8
698 %t5 = and i1 %t2, %t4
702 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_6_logical(i32 %x) {
703 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_6_logical(
704 ; CHECK-NEXT: [[T3:%.*]] = and i32 [[X:%.*]], 15
705 ; CHECK-NEXT: [[T4:%.*]] = icmp eq i32 [[T3]], 8
706 ; CHECK-NEXT: ret i1 [[T4]]
709 %t2 = icmp ne i32 %t1, 0
711 %t4 = icmp eq i32 %t3, 8
712 %t5 = select i1 %t2, i1 %t4, i1 false
716 ; ((X & 7) != 0 & (X & 15) == 8) -> false
717 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_7(i32 %x) {
718 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_7(
719 ; CHECK-NEXT: ret i1 false
722 %t2 = icmp ne i32 %t1, 0
724 %t4 = icmp eq i32 %t3, 8
725 %t5 = and i1 %t2, %t4
729 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_7_logical(i32 %x) {
730 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_7_logical(
731 ; CHECK-NEXT: ret i1 false
734 %t2 = icmp ne i32 %t1, 0
736 %t4 = icmp eq i32 %t3, 8
737 %t5 = select i1 %t2, i1 %t4, i1 false
741 ; ((X & 6) != 0 & (X & 15) == 8) -> false
742 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_7b(i32 %x) {
743 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_7b(
744 ; CHECK-NEXT: ret i1 false
747 %t2 = icmp ne i32 %t1, 0
749 %t4 = icmp eq i32 %t3, 8
750 %t5 = and i1 %t2, %t4
754 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_7b_logical(i32 %x) {
755 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_7b_logical(
756 ; CHECK-NEXT: ret i1 false
759 %t2 = icmp ne i32 %t1, 0
761 %t4 = icmp eq i32 %t3, 8
762 %t5 = select i1 %t2, i1 %t4, i1 false
766 ; ((X & 12) == 0 | (X & 3) != 1) -> !((X & 12) != 0 & (X & 3) == 1)) ->
768 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_negated_0(i32 %x) {
769 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_negated_0(
770 ; CHECK-NEXT: [[T1:%.*]] = and i32 [[X:%.*]], 12
771 ; CHECK-NEXT: [[T2:%.*]] = icmp eq i32 [[T1]], 0
772 ; CHECK-NEXT: [[T3:%.*]] = and i32 [[X]], 3
773 ; CHECK-NEXT: [[T4:%.*]] = icmp ne i32 [[T3]], 1
774 ; CHECK-NEXT: [[T5:%.*]] = or i1 [[T2]], [[T4]]
775 ; CHECK-NEXT: ret i1 [[T5]]
778 %t2 = icmp eq i32 %t1, 0
780 %t4 = icmp ne i32 %t3, 1
785 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_negated_0_logical(i32 %x) {
786 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_negated_0_logical(
787 ; CHECK-NEXT: [[T1:%.*]] = and i32 [[X:%.*]], 12
788 ; CHECK-NEXT: [[T2:%.*]] = icmp eq i32 [[T1]], 0
789 ; CHECK-NEXT: [[T3:%.*]] = and i32 [[X]], 3
790 ; CHECK-NEXT: [[T4:%.*]] = icmp ne i32 [[T3]], 1
791 ; CHECK-NEXT: [[T5:%.*]] = or i1 [[T2]], [[T4]]
792 ; CHECK-NEXT: ret i1 [[T5]]
795 %t2 = icmp eq i32 %t1, 0
797 %t4 = icmp ne i32 %t3, 1
798 %t5 = select i1 %t2, i1 true, i1 %t4
802 ; ((X & 12) == 0 | (X & 7) != 1) -> !((X & 12) != 0 & (X & 7) == 1) ->
803 ; !((X & 15) == 9) -> (X & 15) != 9
804 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_negated_1(i32 %x) {
805 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_negated_1(
806 ; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[X:%.*]], 15
807 ; CHECK-NEXT: [[T5:%.*]] = icmp ne i32 [[TMP1]], 9
808 ; CHECK-NEXT: ret i1 [[T5]]
811 %t2 = icmp eq i32 %t1, 0
813 %t4 = icmp ne i32 %t3, 1
818 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_negated_1_logical(i32 %x) {
819 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_negated_1_logical(
820 ; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[X:%.*]], 15
821 ; CHECK-NEXT: [[T5:%.*]] = icmp ne i32 [[TMP1]], 9
822 ; CHECK-NEXT: ret i1 [[T5]]
825 %t2 = icmp eq i32 %t1, 0
827 %t4 = icmp ne i32 %t3, 1
828 %t5 = select i1 %t2, i1 true, i1 %t4
832 ; ((X & 14) == 0 | (X & 3) != 1) -> !((X & 14) != 0 & (X & 3) == 1) ->
834 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_negated_1b(i32 %x) {
835 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_negated_1b(
836 ; CHECK-NEXT: [[T1:%.*]] = and i32 [[X:%.*]], 14
837 ; CHECK-NEXT: [[T2:%.*]] = icmp eq i32 [[T1]], 0
838 ; CHECK-NEXT: [[T3:%.*]] = and i32 [[X]], 3
839 ; CHECK-NEXT: [[T4:%.*]] = icmp ne i32 [[T3]], 1
840 ; CHECK-NEXT: [[T5:%.*]] = or i1 [[T2]], [[T4]]
841 ; CHECK-NEXT: ret i1 [[T5]]
844 %t2 = icmp eq i32 %t1, 0
846 %t4 = icmp ne i32 %t3, 1
851 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_negated_1b_logical(i32 %x) {
852 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_negated_1b_logical(
853 ; CHECK-NEXT: [[T1:%.*]] = and i32 [[X:%.*]], 14
854 ; CHECK-NEXT: [[T2:%.*]] = icmp eq i32 [[T1]], 0
855 ; CHECK-NEXT: [[T3:%.*]] = and i32 [[X]], 3
856 ; CHECK-NEXT: [[T4:%.*]] = icmp ne i32 [[T3]], 1
857 ; CHECK-NEXT: [[T5:%.*]] = or i1 [[T2]], [[T4]]
858 ; CHECK-NEXT: ret i1 [[T5]]
861 %t2 = icmp eq i32 %t1, 0
863 %t4 = icmp ne i32 %t3, 1
864 %t5 = select i1 %t2, i1 true, i1 %t4
868 ; ((X & 3) == 0 | (X & 7) != 0) -> !((X & 3) != 0 & (X & 7) == 0) ->
870 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_negated_2(i32 %x) {
871 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_negated_2(
872 ; CHECK-NEXT: ret i1 true
875 %t2 = icmp eq i32 %t1, 0
877 %t4 = icmp ne i32 %t3, 0
882 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_negated_2_logical(i32 %x) {
883 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_negated_2_logical(
884 ; CHECK-NEXT: ret i1 true
887 %t2 = icmp eq i32 %t1, 0
889 %t4 = icmp ne i32 %t3, 0
890 %t5 = select i1 %t2, i1 true, i1 %t4
894 ; ((X & 15) == 0 | (X & 7) != 0) -> !((X & 15) != 0 & (X & 7) == 0) ->
895 ; !((X & 15) == 8) -> (X & 15) != 8
896 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_negated_3(i32 %x) {
897 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_negated_3(
898 ; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[X:%.*]], 15
899 ; CHECK-NEXT: [[T5:%.*]] = icmp ne i32 [[TMP1]], 8
900 ; CHECK-NEXT: ret i1 [[T5]]
903 %t2 = icmp eq i32 %t1, 0
905 %t4 = icmp ne i32 %t3, 0
910 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_negated_3_logical(i32 %x) {
911 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_negated_3_logical(
912 ; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[X:%.*]], 15
913 ; CHECK-NEXT: [[T5:%.*]] = icmp ne i32 [[TMP1]], 8
914 ; CHECK-NEXT: ret i1 [[T5]]
917 %t2 = icmp eq i32 %t1, 0
919 %t4 = icmp ne i32 %t3, 0
920 %t5 = select i1 %t2, i1 true, i1 %t4
924 ; ((X & 15) == 0 | (X & 3) != 0) -> !((X & 15) != 0 & (X & 3) == 0) ->
926 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_negated_3b(i32 %x) {
927 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_negated_3b(
928 ; CHECK-NEXT: [[T1:%.*]] = and i32 [[X:%.*]], 15
929 ; CHECK-NEXT: [[T2:%.*]] = icmp eq i32 [[T1]], 0
930 ; CHECK-NEXT: [[T3:%.*]] = and i32 [[X]], 3
931 ; CHECK-NEXT: [[T4:%.*]] = icmp ne i32 [[T3]], 0
932 ; CHECK-NEXT: [[T5:%.*]] = or i1 [[T2]], [[T4]]
933 ; CHECK-NEXT: ret i1 [[T5]]
936 %t2 = icmp eq i32 %t1, 0
938 %t4 = icmp ne i32 %t3, 0
943 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_negated_3b_logical(i32 %x) {
944 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_negated_3b_logical(
945 ; CHECK-NEXT: [[T1:%.*]] = and i32 [[X:%.*]], 15
946 ; CHECK-NEXT: [[T2:%.*]] = icmp eq i32 [[T1]], 0
947 ; CHECK-NEXT: [[T3:%.*]] = and i32 [[X]], 3
948 ; CHECK-NEXT: [[T4:%.*]] = icmp ne i32 [[T3]], 0
949 ; CHECK-NEXT: [[T5:%.*]] = or i1 [[T2]], [[T4]]
950 ; CHECK-NEXT: ret i1 [[T5]]
953 %t2 = icmp eq i32 %t1, 0
955 %t4 = icmp ne i32 %t3, 0
956 %t5 = select i1 %t2, i1 true, i1 %t4
960 ; ((X & 255) == 0 | (X & 15) != 8) -> !(((X & 255) != 0 & (X & 15) == 8)) ->
961 ; !((X & 15) == 8) -> ((X & 15) != 8)
962 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_negated_4(i32 %x) {
963 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_negated_4(
964 ; CHECK-NEXT: [[T3:%.*]] = and i32 [[X:%.*]], 15
965 ; CHECK-NEXT: [[T4:%.*]] = icmp ne i32 [[T3]], 8
966 ; CHECK-NEXT: ret i1 [[T4]]
968 %t1 = and i32 %x, 255
969 %t2 = icmp eq i32 %t1, 0
971 %t4 = icmp ne i32 %t3, 8
976 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_negated_4_logical(i32 %x) {
977 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_negated_4_logical(
978 ; CHECK-NEXT: [[T3:%.*]] = and i32 [[X:%.*]], 15
979 ; CHECK-NEXT: [[T4:%.*]] = icmp ne i32 [[T3]], 8
980 ; CHECK-NEXT: ret i1 [[T4]]
982 %t1 = and i32 %x, 255
983 %t2 = icmp eq i32 %t1, 0
985 %t4 = icmp ne i32 %t3, 8
986 %t5 = select i1 %t2, i1 true, i1 %t4
990 ; ((X & 15) == 0 | (X & 15) != 8) -> !(((X & 15) != 0 & (X & 15) == 8)) ->
991 ; !((X & 15) == 8) -> ((X & 15) != 8)
992 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_negated_5(i32 %x) {
993 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_negated_5(
994 ; CHECK-NEXT: [[T3:%.*]] = and i32 [[X:%.*]], 15
995 ; CHECK-NEXT: [[T4:%.*]] = icmp ne i32 [[T3]], 8
996 ; CHECK-NEXT: ret i1 [[T4]]
999 %t2 = icmp eq i32 %t1, 0
1000 %t3 = and i32 %x, 15
1001 %t4 = icmp ne i32 %t3, 8
1002 %t5 = or i1 %t2, %t4
1006 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_negated_5_logical(i32 %x) {
1007 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_negated_5_logical(
1008 ; CHECK-NEXT: [[T3:%.*]] = and i32 [[X:%.*]], 15
1009 ; CHECK-NEXT: [[T4:%.*]] = icmp ne i32 [[T3]], 8
1010 ; CHECK-NEXT: ret i1 [[T4]]
1012 %t1 = and i32 %x, 15
1013 %t2 = icmp eq i32 %t1, 0
1014 %t3 = and i32 %x, 15
1015 %t4 = icmp ne i32 %t3, 8
1016 %t5 = select i1 %t2, i1 true, i1 %t4
1020 ; ((X & 12) == 0 | (X & 15) != 8) -> !(((X & 12) != 0 & (X & 15) == 8)) ->
1021 ; !((X & 15) == 8) -> ((X & 15) != 8
1022 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_negated_6(i32 %x) {
1023 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_negated_6(
1024 ; CHECK-NEXT: [[T3:%.*]] = and i32 [[X:%.*]], 15
1025 ; CHECK-NEXT: [[T4:%.*]] = icmp ne i32 [[T3]], 8
1026 ; CHECK-NEXT: ret i1 [[T4]]
1028 %t1 = and i32 %x, 12
1029 %t2 = icmp eq i32 %t1, 0
1030 %t3 = and i32 %x, 15
1031 %t4 = icmp ne i32 %t3, 8
1032 %t5 = or i1 %t2, %t4
1036 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_negated_6_logical(i32 %x) {
1037 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_negated_6_logical(
1038 ; CHECK-NEXT: [[T3:%.*]] = and i32 [[X:%.*]], 15
1039 ; CHECK-NEXT: [[T4:%.*]] = icmp ne i32 [[T3]], 8
1040 ; CHECK-NEXT: ret i1 [[T4]]
1042 %t1 = and i32 %x, 12
1043 %t2 = icmp eq i32 %t1, 0
1044 %t3 = and i32 %x, 15
1045 %t4 = icmp ne i32 %t3, 8
1046 %t5 = select i1 %t2, i1 true, i1 %t4
1050 ; ((X & 7) == 0 | (X & 15) != 8) -> !(((X & 7) != 0 & (X & 15) == 8)) ->
1052 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_negated_7(i32 %x) {
1053 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_negated_7(
1054 ; CHECK-NEXT: ret i1 true
1057 %t2 = icmp eq i32 %t1, 0
1058 %t3 = and i32 %x, 15
1059 %t4 = icmp ne i32 %t3, 8
1060 %t5 = or i1 %t2, %t4
1064 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_negated_7_logical(i32 %x) {
1065 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_negated_7_logical(
1066 ; CHECK-NEXT: ret i1 true
1069 %t2 = icmp eq i32 %t1, 0
1070 %t3 = and i32 %x, 15
1071 %t4 = icmp ne i32 %t3, 8
1072 %t5 = select i1 %t2, i1 true, i1 %t4
1076 ; ((X & 6) == 0 | (X & 15) != 8) -> !(((X & 6) != 0 & (X & 15) == 8)) ->
1078 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_negated_7b(i32 %x) {
1079 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_negated_7b(
1080 ; CHECK-NEXT: ret i1 true
1083 %t2 = icmp eq i32 %t1, 0
1084 %t3 = and i32 %x, 15
1085 %t4 = icmp ne i32 %t3, 8
1086 %t5 = or i1 %t2, %t4
1090 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_negated_7b_logical(i32 %x) {
1091 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_negated_7b_logical(
1092 ; CHECK-NEXT: ret i1 true
1095 %t2 = icmp eq i32 %t1, 0
1096 %t3 = and i32 %x, 15
1097 %t4 = icmp ne i32 %t3, 8
1098 %t5 = select i1 %t2, i1 true, i1 %t4
1103 ; ((X & 12) != 0 & (X & 3) == 1) -> no change
1104 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_swapped_0(i32 %x) {
1105 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_swapped_0(
1106 ; CHECK-NEXT: [[T1:%.*]] = and i32 [[X:%.*]], 12
1107 ; CHECK-NEXT: [[T2:%.*]] = icmp ne i32 [[T1]], 0
1108 ; CHECK-NEXT: [[T3:%.*]] = and i32 [[X]], 3
1109 ; CHECK-NEXT: [[T4:%.*]] = icmp eq i32 [[T3]], 1
1110 ; CHECK-NEXT: [[T5:%.*]] = and i1 [[T4]], [[T2]]
1111 ; CHECK-NEXT: ret i1 [[T5]]
1113 %t1 = and i32 %x, 12
1114 %t2 = icmp ne i32 %t1, 0
1116 %t4 = icmp eq i32 %t3, 1
1117 %t5 = and i1 %t4, %t2
1121 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_swapped_0_logical(i32 %x) {
1122 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_swapped_0_logical(
1123 ; CHECK-NEXT: [[T1:%.*]] = and i32 [[X:%.*]], 12
1124 ; CHECK-NEXT: [[T2:%.*]] = icmp ne i32 [[T1]], 0
1125 ; CHECK-NEXT: [[T3:%.*]] = and i32 [[X]], 3
1126 ; CHECK-NEXT: [[T4:%.*]] = icmp eq i32 [[T3]], 1
1127 ; CHECK-NEXT: [[T5:%.*]] = and i1 [[T4]], [[T2]]
1128 ; CHECK-NEXT: ret i1 [[T5]]
1130 %t1 = and i32 %x, 12
1131 %t2 = icmp ne i32 %t1, 0
1133 %t4 = icmp eq i32 %t3, 1
1134 %t5 = select i1 %t4, i1 %t2, i1 false
1138 ; ((X & 12) != 0 & (X & 7) == 1) -> (X & 15) == 9
1139 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_swapped_1(i32 %x) {
1140 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_swapped_1(
1141 ; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[X:%.*]], 15
1142 ; CHECK-NEXT: [[T5:%.*]] = icmp eq i32 [[TMP1]], 9
1143 ; CHECK-NEXT: ret i1 [[T5]]
1145 %t1 = and i32 %x, 12
1146 %t2 = icmp ne i32 %t1, 0
1148 %t4 = icmp eq i32 %t3, 1
1149 %t5 = and i1 %t4, %t2
1153 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_swapped_1_logical(i32 %x) {
1154 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_swapped_1_logical(
1155 ; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[X:%.*]], 15
1156 ; CHECK-NEXT: [[T5:%.*]] = icmp eq i32 [[TMP1]], 9
1157 ; CHECK-NEXT: ret i1 [[T5]]
1159 %t1 = and i32 %x, 12
1160 %t2 = icmp ne i32 %t1, 0
1162 %t4 = icmp eq i32 %t3, 1
1163 %t5 = select i1 %t4, i1 %t2, i1 false
1167 ; ((X & 14) != 0 & (X & 3) == 1) -> no change
1168 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_swapped_1b(i32 %x) {
1169 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_swapped_1b(
1170 ; CHECK-NEXT: [[T1:%.*]] = and i32 [[X:%.*]], 14
1171 ; CHECK-NEXT: [[T2:%.*]] = icmp ne i32 [[T1]], 0
1172 ; CHECK-NEXT: [[T3:%.*]] = and i32 [[X]], 3
1173 ; CHECK-NEXT: [[T4:%.*]] = icmp eq i32 [[T3]], 1
1174 ; CHECK-NEXT: [[T5:%.*]] = and i1 [[T4]], [[T2]]
1175 ; CHECK-NEXT: ret i1 [[T5]]
1177 %t1 = and i32 %x, 14
1178 %t2 = icmp ne i32 %t1, 0
1180 %t4 = icmp eq i32 %t3, 1
1181 %t5 = and i1 %t4, %t2
1185 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_swapped_1b_logical(i32 %x) {
1186 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_swapped_1b_logical(
1187 ; CHECK-NEXT: [[T1:%.*]] = and i32 [[X:%.*]], 14
1188 ; CHECK-NEXT: [[T2:%.*]] = icmp ne i32 [[T1]], 0
1189 ; CHECK-NEXT: [[T3:%.*]] = and i32 [[X]], 3
1190 ; CHECK-NEXT: [[T4:%.*]] = icmp eq i32 [[T3]], 1
1191 ; CHECK-NEXT: [[T5:%.*]] = and i1 [[T4]], [[T2]]
1192 ; CHECK-NEXT: ret i1 [[T5]]
1194 %t1 = and i32 %x, 14
1195 %t2 = icmp ne i32 %t1, 0
1197 %t4 = icmp eq i32 %t3, 1
1198 %t5 = select i1 %t4, i1 %t2, i1 false
1202 ; ((X & 3) != 0 & (X & 7) == 0) -> false
1203 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_swapped_2(i32 %x) {
1204 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_swapped_2(
1205 ; CHECK-NEXT: ret i1 false
1208 %t2 = icmp ne i32 %t1, 0
1210 %t4 = icmp eq i32 %t3, 0
1211 %t5 = and i1 %t4, %t2
1215 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_swapped_2_logical(i32 %x) {
1216 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_swapped_2_logical(
1217 ; CHECK-NEXT: ret i1 false
1220 %t2 = icmp ne i32 %t1, 0
1222 %t4 = icmp eq i32 %t3, 0
1223 %t5 = select i1 %t4, i1 %t2, i1 false
1227 ; ((X & 15) != 0 & (X & 7) == 0) -> (X & 15) == 8
1228 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_swapped_3(i32 %x) {
1229 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_swapped_3(
1230 ; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[X:%.*]], 15
1231 ; CHECK-NEXT: [[T5:%.*]] = icmp eq i32 [[TMP1]], 8
1232 ; CHECK-NEXT: ret i1 [[T5]]
1234 %t1 = and i32 %x, 15
1235 %t2 = icmp ne i32 %t1, 0
1237 %t4 = icmp eq i32 %t3, 0
1238 %t5 = and i1 %t4, %t2
1242 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_swapped_3_logical(i32 %x) {
1243 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_swapped_3_logical(
1244 ; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[X:%.*]], 15
1245 ; CHECK-NEXT: [[T5:%.*]] = icmp eq i32 [[TMP1]], 8
1246 ; CHECK-NEXT: ret i1 [[T5]]
1248 %t1 = and i32 %x, 15
1249 %t2 = icmp ne i32 %t1, 0
1251 %t4 = icmp eq i32 %t3, 0
1252 %t5 = select i1 %t4, i1 %t2, i1 false
1256 ; ((X & 15) != 0 & (X & 3) == 0) -> no change
1257 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_swapped_3b(i32 %x) {
1258 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_swapped_3b(
1259 ; CHECK-NEXT: [[T1:%.*]] = and i32 [[X:%.*]], 15
1260 ; CHECK-NEXT: [[T2:%.*]] = icmp ne i32 [[T1]], 0
1261 ; CHECK-NEXT: [[T3:%.*]] = and i32 [[X]], 3
1262 ; CHECK-NEXT: [[T4:%.*]] = icmp eq i32 [[T3]], 0
1263 ; CHECK-NEXT: [[T5:%.*]] = and i1 [[T4]], [[T2]]
1264 ; CHECK-NEXT: ret i1 [[T5]]
1266 %t1 = and i32 %x, 15
1267 %t2 = icmp ne i32 %t1, 0
1269 %t4 = icmp eq i32 %t3, 0
1270 %t5 = and i1 %t4, %t2
1274 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_swapped_3b_logical(i32 %x) {
1275 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_swapped_3b_logical(
1276 ; CHECK-NEXT: [[T1:%.*]] = and i32 [[X:%.*]], 15
1277 ; CHECK-NEXT: [[T2:%.*]] = icmp ne i32 [[T1]], 0
1278 ; CHECK-NEXT: [[T3:%.*]] = and i32 [[X]], 3
1279 ; CHECK-NEXT: [[T4:%.*]] = icmp eq i32 [[T3]], 0
1280 ; CHECK-NEXT: [[T5:%.*]] = and i1 [[T4]], [[T2]]
1281 ; CHECK-NEXT: ret i1 [[T5]]
1283 %t1 = and i32 %x, 15
1284 %t2 = icmp ne i32 %t1, 0
1286 %t4 = icmp eq i32 %t3, 0
1287 %t5 = select i1 %t4, i1 %t2, i1 false
1291 ; ((X & 255) != 0 & (X & 15) == 8) -> (X & 15) == 8
1292 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_swapped_4(i32 %x) {
1293 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_swapped_4(
1294 ; CHECK-NEXT: [[T3:%.*]] = and i32 [[X:%.*]], 15
1295 ; CHECK-NEXT: [[T4:%.*]] = icmp eq i32 [[T3]], 8
1296 ; CHECK-NEXT: ret i1 [[T4]]
1298 %t1 = and i32 %x, 255
1299 %t2 = icmp ne i32 %t1, 0
1300 %t3 = and i32 %x, 15
1301 %t4 = icmp eq i32 %t3, 8
1302 %t5 = and i1 %t4, %t2
1306 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_swapped_4_logical(i32 %x) {
1307 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_swapped_4_logical(
1308 ; CHECK-NEXT: [[T3:%.*]] = and i32 [[X:%.*]], 15
1309 ; CHECK-NEXT: [[T4:%.*]] = icmp eq i32 [[T3]], 8
1310 ; CHECK-NEXT: ret i1 [[T4]]
1312 %t1 = and i32 %x, 255
1313 %t2 = icmp ne i32 %t1, 0
1314 %t3 = and i32 %x, 15
1315 %t4 = icmp eq i32 %t3, 8
1316 %t5 = select i1 %t4, i1 %t2, i1 false
1320 ; ((X & 15) != 0 & (X & 15) == 8) -> (X & 15) == 8
1321 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_swapped_5(i32 %x) {
1322 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_swapped_5(
1323 ; CHECK-NEXT: [[T3:%.*]] = and i32 [[X:%.*]], 15
1324 ; CHECK-NEXT: [[T4:%.*]] = icmp eq i32 [[T3]], 8
1325 ; CHECK-NEXT: ret i1 [[T4]]
1327 %t1 = and i32 %x, 15
1328 %t2 = icmp ne i32 %t1, 0
1329 %t3 = and i32 %x, 15
1330 %t4 = icmp eq i32 %t3, 8
1331 %t5 = and i1 %t4, %t2
1335 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_swapped_5_logical(i32 %x) {
1336 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_swapped_5_logical(
1337 ; CHECK-NEXT: [[T3:%.*]] = and i32 [[X:%.*]], 15
1338 ; CHECK-NEXT: [[T4:%.*]] = icmp eq i32 [[T3]], 8
1339 ; CHECK-NEXT: ret i1 [[T4]]
1341 %t1 = and i32 %x, 15
1342 %t2 = icmp ne i32 %t1, 0
1343 %t3 = and i32 %x, 15
1344 %t4 = icmp eq i32 %t3, 8
1345 %t5 = select i1 %t4, i1 %t2, i1 false
1349 ; ((X & 12) != 0 & (X & 15) == 8) -> (X & 15) == 8
1350 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_swapped_6(i32 %x) {
1351 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_swapped_6(
1352 ; CHECK-NEXT: [[T3:%.*]] = and i32 [[X:%.*]], 15
1353 ; CHECK-NEXT: [[T4:%.*]] = icmp eq i32 [[T3]], 8
1354 ; CHECK-NEXT: ret i1 [[T4]]
1356 %t1 = and i32 %x, 12
1357 %t2 = icmp ne i32 %t1, 0
1358 %t3 = and i32 %x, 15
1359 %t4 = icmp eq i32 %t3, 8
1360 %t5 = and i1 %t4, %t2
1364 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_swapped_6_logical(i32 %x) {
1365 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_swapped_6_logical(
1366 ; CHECK-NEXT: [[T3:%.*]] = and i32 [[X:%.*]], 15
1367 ; CHECK-NEXT: [[T4:%.*]] = icmp eq i32 [[T3]], 8
1368 ; CHECK-NEXT: ret i1 [[T4]]
1370 %t1 = and i32 %x, 12
1371 %t2 = icmp ne i32 %t1, 0
1372 %t3 = and i32 %x, 15
1373 %t4 = icmp eq i32 %t3, 8
1374 %t5 = select i1 %t4, i1 %t2, i1 false
1378 ; ((X & 7) != 0 & (X & 15) == 8) -> false
1379 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_swapped_7(i32 %x) {
1380 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_swapped_7(
1381 ; CHECK-NEXT: ret i1 false
1384 %t2 = icmp ne i32 %t1, 0
1385 %t3 = and i32 %x, 15
1386 %t4 = icmp eq i32 %t3, 8
1387 %t5 = and i1 %t4, %t2
1391 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_swapped_7_logical(i32 %x) {
1392 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_swapped_7_logical(
1393 ; CHECK-NEXT: ret i1 false
1396 %t2 = icmp ne i32 %t1, 0
1397 %t3 = and i32 %x, 15
1398 %t4 = icmp eq i32 %t3, 8
1399 %t5 = select i1 %t4, i1 %t2, i1 false
1403 ; ((X & 6) != 0 & (X & 15) == 8) -> false
1404 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_swapped_7b(i32 %x) {
1405 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_swapped_7b(
1406 ; CHECK-NEXT: ret i1 false
1409 %t2 = icmp ne i32 %t1, 0
1410 %t3 = and i32 %x, 15
1411 %t4 = icmp eq i32 %t3, 8
1412 %t5 = and i1 %t4, %t2
1416 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_swapped_7b_logical(i32 %x) {
1417 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_swapped_7b_logical(
1418 ; CHECK-NEXT: ret i1 false
1421 %t2 = icmp ne i32 %t1, 0
1422 %t3 = and i32 %x, 15
1423 %t4 = icmp eq i32 %t3, 8
1424 %t5 = select i1 %t4, i1 %t2, i1 false
1428 ; ((X & 12) == 0 | (X & 3) != 1) -> !((X & 12) != 0 & (X & 3) == 1)) ->
1430 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_negated_swapped_0(i32 %x) {
1431 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_negated_swapped_0(
1432 ; CHECK-NEXT: [[T1:%.*]] = and i32 [[X:%.*]], 12
1433 ; CHECK-NEXT: [[T2:%.*]] = icmp eq i32 [[T1]], 0
1434 ; CHECK-NEXT: [[T3:%.*]] = and i32 [[X]], 3
1435 ; CHECK-NEXT: [[T4:%.*]] = icmp ne i32 [[T3]], 1
1436 ; CHECK-NEXT: [[T5:%.*]] = or i1 [[T4]], [[T2]]
1437 ; CHECK-NEXT: ret i1 [[T5]]
1439 %t1 = and i32 %x, 12
1440 %t2 = icmp eq i32 %t1, 0
1442 %t4 = icmp ne i32 %t3, 1
1443 %t5 = or i1 %t4, %t2
1447 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_negated_swapped_0_logical(i32 %x) {
1448 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_negated_swapped_0_logical(
1449 ; CHECK-NEXT: [[T1:%.*]] = and i32 [[X:%.*]], 12
1450 ; CHECK-NEXT: [[T2:%.*]] = icmp eq i32 [[T1]], 0
1451 ; CHECK-NEXT: [[T3:%.*]] = and i32 [[X]], 3
1452 ; CHECK-NEXT: [[T4:%.*]] = icmp ne i32 [[T3]], 1
1453 ; CHECK-NEXT: [[T5:%.*]] = or i1 [[T4]], [[T2]]
1454 ; CHECK-NEXT: ret i1 [[T5]]
1456 %t1 = and i32 %x, 12
1457 %t2 = icmp eq i32 %t1, 0
1459 %t4 = icmp ne i32 %t3, 1
1460 %t5 = select i1 %t4, i1 true, i1 %t2
1464 ; ((X & 12) == 0 | (X & 7) != 1) -> !((X & 12) != 0 & (X & 7) == 1) ->
1465 ; !((X & 15) == 9) -> (X & 15) != 9
1466 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_negated_swapped_1(i32 %x) {
1467 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_negated_swapped_1(
1468 ; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[X:%.*]], 15
1469 ; CHECK-NEXT: [[T5:%.*]] = icmp ne i32 [[TMP1]], 9
1470 ; CHECK-NEXT: ret i1 [[T5]]
1472 %t1 = and i32 %x, 12
1473 %t2 = icmp eq i32 %t1, 0
1475 %t4 = icmp ne i32 %t3, 1
1476 %t5 = or i1 %t4, %t2
1480 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_negated_swapped_1_logical(i32 %x) {
1481 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_negated_swapped_1_logical(
1482 ; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[X:%.*]], 15
1483 ; CHECK-NEXT: [[T5:%.*]] = icmp ne i32 [[TMP1]], 9
1484 ; CHECK-NEXT: ret i1 [[T5]]
1486 %t1 = and i32 %x, 12
1487 %t2 = icmp eq i32 %t1, 0
1489 %t4 = icmp ne i32 %t3, 1
1490 %t5 = select i1 %t4, i1 true, i1 %t2
1494 ; ((X & 14) == 0 | (X & 3) != 1) -> !((X & 14) != 0 & (X & 3) == 1) ->
1496 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_negated_swapped_1b(i32 %x) {
1497 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_negated_swapped_1b(
1498 ; CHECK-NEXT: [[T1:%.*]] = and i32 [[X:%.*]], 14
1499 ; CHECK-NEXT: [[T2:%.*]] = icmp eq i32 [[T1]], 0
1500 ; CHECK-NEXT: [[T3:%.*]] = and i32 [[X]], 3
1501 ; CHECK-NEXT: [[T4:%.*]] = icmp ne i32 [[T3]], 1
1502 ; CHECK-NEXT: [[T5:%.*]] = or i1 [[T4]], [[T2]]
1503 ; CHECK-NEXT: ret i1 [[T5]]
1505 %t1 = and i32 %x, 14
1506 %t2 = icmp eq i32 %t1, 0
1508 %t4 = icmp ne i32 %t3, 1
1509 %t5 = or i1 %t4, %t2
1513 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_negated_swapped_1b_logical(i32 %x) {
1514 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_negated_swapped_1b_logical(
1515 ; CHECK-NEXT: [[T1:%.*]] = and i32 [[X:%.*]], 14
1516 ; CHECK-NEXT: [[T2:%.*]] = icmp eq i32 [[T1]], 0
1517 ; CHECK-NEXT: [[T3:%.*]] = and i32 [[X]], 3
1518 ; CHECK-NEXT: [[T4:%.*]] = icmp ne i32 [[T3]], 1
1519 ; CHECK-NEXT: [[T5:%.*]] = or i1 [[T4]], [[T2]]
1520 ; CHECK-NEXT: ret i1 [[T5]]
1522 %t1 = and i32 %x, 14
1523 %t2 = icmp eq i32 %t1, 0
1525 %t4 = icmp ne i32 %t3, 1
1526 %t5 = select i1 %t4, i1 true, i1 %t2
1530 ; ((X & 3) == 0 | (X & 7) != 0) -> !((X & 3) != 0 & (X & 7) == 0) ->
1532 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_negated_swapped_2(i32 %x) {
1533 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_negated_swapped_2(
1534 ; CHECK-NEXT: ret i1 true
1537 %t2 = icmp eq i32 %t1, 0
1539 %t4 = icmp ne i32 %t3, 0
1540 %t5 = or i1 %t4, %t2
1544 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_negated_swapped_2_logical(i32 %x) {
1545 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_negated_swapped_2_logical(
1546 ; CHECK-NEXT: ret i1 true
1549 %t2 = icmp eq i32 %t1, 0
1551 %t4 = icmp ne i32 %t3, 0
1552 %t5 = select i1 %t4, i1 true, i1 %t2
1556 ; ((X & 15) == 0 | (X & 7) != 0) -> !((X & 15) != 0 & (X & 7) == 0) ->
1557 ; !((X & 15) == 8) -> (X & 15) != 8
1558 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_negated_swapped_3(i32 %x) {
1559 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_negated_swapped_3(
1560 ; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[X:%.*]], 15
1561 ; CHECK-NEXT: [[T5:%.*]] = icmp ne i32 [[TMP1]], 8
1562 ; CHECK-NEXT: ret i1 [[T5]]
1564 %t1 = and i32 %x, 15
1565 %t2 = icmp eq i32 %t1, 0
1567 %t4 = icmp ne i32 %t3, 0
1568 %t5 = or i1 %t4, %t2
1572 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_negated_swapped_3_logical(i32 %x) {
1573 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_negated_swapped_3_logical(
1574 ; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[X:%.*]], 15
1575 ; CHECK-NEXT: [[T5:%.*]] = icmp ne i32 [[TMP1]], 8
1576 ; CHECK-NEXT: ret i1 [[T5]]
1578 %t1 = and i32 %x, 15
1579 %t2 = icmp eq i32 %t1, 0
1581 %t4 = icmp ne i32 %t3, 0
1582 %t5 = select i1 %t4, i1 true, i1 %t2
1586 ; ((X & 15) == 0 | (X & 3) != 0) -> !((X & 15) != 0 & (X & 3) == 0) ->
1588 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_negated_swapped_3b(i32 %x) {
1589 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_negated_swapped_3b(
1590 ; CHECK-NEXT: [[T1:%.*]] = and i32 [[X:%.*]], 15
1591 ; CHECK-NEXT: [[T2:%.*]] = icmp eq i32 [[T1]], 0
1592 ; CHECK-NEXT: [[T3:%.*]] = and i32 [[X]], 3
1593 ; CHECK-NEXT: [[T4:%.*]] = icmp ne i32 [[T3]], 0
1594 ; CHECK-NEXT: [[T5:%.*]] = or i1 [[T4]], [[T2]]
1595 ; CHECK-NEXT: ret i1 [[T5]]
1597 %t1 = and i32 %x, 15
1598 %t2 = icmp eq i32 %t1, 0
1600 %t4 = icmp ne i32 %t3, 0
1601 %t5 = or i1 %t4, %t2
1605 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_negated_swapped_3b_logical(i32 %x) {
1606 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_negated_swapped_3b_logical(
1607 ; CHECK-NEXT: [[T1:%.*]] = and i32 [[X:%.*]], 15
1608 ; CHECK-NEXT: [[T2:%.*]] = icmp eq i32 [[T1]], 0
1609 ; CHECK-NEXT: [[T3:%.*]] = and i32 [[X]], 3
1610 ; CHECK-NEXT: [[T4:%.*]] = icmp ne i32 [[T3]], 0
1611 ; CHECK-NEXT: [[T5:%.*]] = or i1 [[T4]], [[T2]]
1612 ; CHECK-NEXT: ret i1 [[T5]]
1614 %t1 = and i32 %x, 15
1615 %t2 = icmp eq i32 %t1, 0
1617 %t4 = icmp ne i32 %t3, 0
1618 %t5 = select i1 %t4, i1 true, i1 %t2
1622 ; ((X & 255) == 0 | (X & 15) != 8) -> !(((X & 255) != 0 & (X & 15) == 8)) ->
1623 ; !((X & 15) == 8) -> ((X & 15) != 8)
1624 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_negated_swapped_4(i32 %x) {
1625 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_negated_swapped_4(
1626 ; CHECK-NEXT: [[T3:%.*]] = and i32 [[X:%.*]], 15
1627 ; CHECK-NEXT: [[T4:%.*]] = icmp ne i32 [[T3]], 8
1628 ; CHECK-NEXT: ret i1 [[T4]]
1630 %t1 = and i32 %x, 255
1631 %t2 = icmp eq i32 %t1, 0
1632 %t3 = and i32 %x, 15
1633 %t4 = icmp ne i32 %t3, 8
1634 %t5 = or i1 %t4, %t2
1638 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_negated_swapped_4_logical(i32 %x) {
1639 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_negated_swapped_4_logical(
1640 ; CHECK-NEXT: [[T3:%.*]] = and i32 [[X:%.*]], 15
1641 ; CHECK-NEXT: [[T4:%.*]] = icmp ne i32 [[T3]], 8
1642 ; CHECK-NEXT: ret i1 [[T4]]
1644 %t1 = and i32 %x, 255
1645 %t2 = icmp eq i32 %t1, 0
1646 %t3 = and i32 %x, 15
1647 %t4 = icmp ne i32 %t3, 8
1648 %t5 = select i1 %t4, i1 true, i1 %t2
1652 ; ((X & 15) == 0 | (X & 15) != 8) -> !(((X & 15) != 0 & (X & 15) == 8)) ->
1653 ; !((X & 15) == 8) -> ((X & 15) != 8)
1654 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_negated_swapped_5(i32 %x) {
1655 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_negated_swapped_5(
1656 ; CHECK-NEXT: [[T3:%.*]] = and i32 [[X:%.*]], 15
1657 ; CHECK-NEXT: [[T4:%.*]] = icmp ne i32 [[T3]], 8
1658 ; CHECK-NEXT: ret i1 [[T4]]
1660 %t1 = and i32 %x, 15
1661 %t2 = icmp eq i32 %t1, 0
1662 %t3 = and i32 %x, 15
1663 %t4 = icmp ne i32 %t3, 8
1664 %t5 = or i1 %t4, %t2
1668 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_negated_swapped_5_logical(i32 %x) {
1669 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_negated_swapped_5_logical(
1670 ; CHECK-NEXT: [[T3:%.*]] = and i32 [[X:%.*]], 15
1671 ; CHECK-NEXT: [[T4:%.*]] = icmp ne i32 [[T3]], 8
1672 ; CHECK-NEXT: ret i1 [[T4]]
1674 %t1 = and i32 %x, 15
1675 %t2 = icmp eq i32 %t1, 0
1676 %t3 = and i32 %x, 15
1677 %t4 = icmp ne i32 %t3, 8
1678 %t5 = select i1 %t4, i1 true, i1 %t2
1682 ; ((X & 12) == 0 | (X & 15) != 8) -> !(((X & 12) != 0 & (X & 15) == 8)) ->
1683 ; !((X & 15) == 8) -> ((X & 15) != 8
1684 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_negated_swapped_6(i32 %x) {
1685 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_negated_swapped_6(
1686 ; CHECK-NEXT: [[T3:%.*]] = and i32 [[X:%.*]], 15
1687 ; CHECK-NEXT: [[T4:%.*]] = icmp ne i32 [[T3]], 8
1688 ; CHECK-NEXT: ret i1 [[T4]]
1690 %t1 = and i32 %x, 12
1691 %t2 = icmp eq i32 %t1, 0
1692 %t3 = and i32 %x, 15
1693 %t4 = icmp ne i32 %t3, 8
1694 %t5 = or i1 %t4, %t2
1698 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_negated_swapped_6_logical(i32 %x) {
1699 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_negated_swapped_6_logical(
1700 ; CHECK-NEXT: [[T3:%.*]] = and i32 [[X:%.*]], 15
1701 ; CHECK-NEXT: [[T4:%.*]] = icmp ne i32 [[T3]], 8
1702 ; CHECK-NEXT: ret i1 [[T4]]
1704 %t1 = and i32 %x, 12
1705 %t2 = icmp eq i32 %t1, 0
1706 %t3 = and i32 %x, 15
1707 %t4 = icmp ne i32 %t3, 8
1708 %t5 = select i1 %t4, i1 true, i1 %t2
1712 ; ((X & 7) == 0 | (X & 15) != 8) -> !(((X & 7) != 0 & (X & 15) == 8)) ->
1714 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_negated_swapped_7(i32 %x) {
1715 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_negated_swapped_7(
1716 ; CHECK-NEXT: ret i1 true
1719 %t2 = icmp eq i32 %t1, 0
1720 %t3 = and i32 %x, 15
1721 %t4 = icmp ne i32 %t3, 8
1722 %t5 = or i1 %t4, %t2
1726 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_negated_swapped_7_logical(i32 %x) {
1727 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_negated_swapped_7_logical(
1728 ; CHECK-NEXT: ret i1 true
1731 %t2 = icmp eq i32 %t1, 0
1732 %t3 = and i32 %x, 15
1733 %t4 = icmp ne i32 %t3, 8
1734 %t5 = select i1 %t4, i1 true, i1 %t2
1738 ; ((X & 6) == 0 | (X & 15) != 8) -> !(((X & 6) != 0 & (X & 15) == 8)) ->
1740 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_negated_swapped_7b(i32 %x) {
1741 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_negated_swapped_7b(
1742 ; CHECK-NEXT: ret i1 true
1745 %t2 = icmp eq i32 %t1, 0
1746 %t3 = and i32 %x, 15
1747 %t4 = icmp ne i32 %t3, 8
1748 %t5 = or i1 %t4, %t2
1752 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_negated_swapped_7b_logical(i32 %x) {
1753 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_negated_swapped_7b_logical(
1754 ; CHECK-NEXT: ret i1 true
1757 %t2 = icmp eq i32 %t1, 0
1758 %t3 = and i32 %x, 15
1759 %t4 = icmp ne i32 %t3, 8
1760 %t5 = select i1 %t4, i1 true, i1 %t2
1765 define i1 @masked_icmps_bmask_notmixed_or(i32 %A) {
1766 ; CHECK-LABEL: @masked_icmps_bmask_notmixed_or(
1767 ; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[A:%.*]], 15
1768 ; CHECK-NEXT: [[RES:%.*]] = icmp eq i32 [[TMP1]], 3
1769 ; CHECK-NEXT: ret i1 [[RES]]
1771 %mask1 = and i32 %A, 15 ; 0x0f
1772 %tst1 = icmp eq i32 %mask1, 3 ; 0x03
1773 %mask2 = and i32 %A, 255 ; 0xff
1774 %tst2 = icmp eq i32 %mask2, 243; 0xf3
1775 %res = or i1 %tst1, %tst2
1779 define <2 x i1> @masked_icmps_bmask_notmixed_or_vec(<2 x i8> %A) {
1780 ; CHECK-LABEL: @masked_icmps_bmask_notmixed_or_vec(
1781 ; CHECK-NEXT: [[MASK1:%.*]] = and <2 x i8> [[A:%.*]], splat (i8 15)
1782 ; CHECK-NEXT: [[RES:%.*]] = icmp eq <2 x i8> [[MASK1]], splat (i8 3)
1783 ; CHECK-NEXT: ret <2 x i1> [[RES]]
1785 %mask1 = and <2 x i8> %A, <i8 15, i8 15> ; 0x0f
1786 %tst1 = icmp eq <2 x i8> %mask1, <i8 3, i8 3> ; 0x03
1787 %mask2 = and <2 x i8> %A, <i8 255, i8 255> ; 0xff
1788 %tst2 = icmp eq <2 x i8> %mask2, <i8 243, i8 243> ; 0xf3
1789 %res = or <2 x i1> %tst1, %tst2
1793 define <2 x i1> @masked_icmps_bmask_notmixed_or_vec_poison1(<2 x i8> %A) {
1794 ; CHECK-LABEL: @masked_icmps_bmask_notmixed_or_vec_poison1(
1795 ; CHECK-NEXT: [[MASK1:%.*]] = and <2 x i8> [[A:%.*]], splat (i8 15)
1796 ; CHECK-NEXT: [[TST1:%.*]] = icmp eq <2 x i8> [[MASK1]], <i8 3, i8 poison>
1797 ; CHECK-NEXT: [[TST2:%.*]] = icmp eq <2 x i8> [[A]], splat (i8 -13)
1798 ; CHECK-NEXT: [[RES:%.*]] = or <2 x i1> [[TST1]], [[TST2]]
1799 ; CHECK-NEXT: ret <2 x i1> [[RES]]
1801 %mask1 = and <2 x i8> %A, <i8 15, i8 15> ; 0x0f
1802 %tst1 = icmp eq <2 x i8> %mask1, <i8 3, i8 poison> ; 0x03
1803 %mask2 = and <2 x i8> %A, <i8 255, i8 255> ; 0xff
1804 %tst2 = icmp eq <2 x i8> %mask2, <i8 243, i8 243> ; 0xf3
1805 %res = or <2 x i1> %tst1, %tst2
1809 define <2 x i1> @masked_icmps_bmask_notmixed_or_vec_poison2(<2 x i8> %A) {
1810 ; CHECK-LABEL: @masked_icmps_bmask_notmixed_or_vec_poison2(
1811 ; CHECK-NEXT: [[MASK1:%.*]] = and <2 x i8> [[A:%.*]], splat (i8 15)
1812 ; CHECK-NEXT: [[TST1:%.*]] = icmp eq <2 x i8> [[MASK1]], splat (i8 3)
1813 ; CHECK-NEXT: [[TST2:%.*]] = icmp eq <2 x i8> [[A]], <i8 -13, i8 poison>
1814 ; CHECK-NEXT: [[RES:%.*]] = or <2 x i1> [[TST1]], [[TST2]]
1815 ; CHECK-NEXT: ret <2 x i1> [[RES]]
1817 %mask1 = and <2 x i8> %A, <i8 15, i8 15> ; 0x0f
1818 %tst1 = icmp eq <2 x i8> %mask1, <i8 3, i8 3> ; 0x03
1819 %mask2 = and <2 x i8> %A, <i8 255, i8 255> ; 0xff
1820 %tst2 = icmp eq <2 x i8> %mask2, <i8 243, i8 poison> ; 0xf3
1821 %res = or <2 x i1> %tst1, %tst2
1825 define i1 @masked_icmps_bmask_notmixed_or_contradict_notoptimized(i32 %A) {
1826 ; CHECK-LABEL: @masked_icmps_bmask_notmixed_or_contradict_notoptimized(
1827 ; CHECK-NEXT: [[MASK1:%.*]] = and i32 [[A:%.*]], 15
1828 ; CHECK-NEXT: [[TST1:%.*]] = icmp eq i32 [[MASK1]], 3
1829 ; CHECK-NEXT: [[MASK2:%.*]] = and i32 [[A]], 255
1830 ; CHECK-NEXT: [[TST2:%.*]] = icmp eq i32 [[MASK2]], 242
1831 ; CHECK-NEXT: [[RES:%.*]] = or i1 [[TST1]], [[TST2]]
1832 ; CHECK-NEXT: ret i1 [[RES]]
1834 %mask1 = and i32 %A, 15 ; 0x0f
1835 %tst1 = icmp eq i32 %mask1, 3 ; 0x03
1836 %mask2 = and i32 %A, 255 ; 0xff
1837 %tst2 = icmp eq i32 %mask2, 242; 0xf2
1838 %res = or i1 %tst1, %tst2
1842 define i1 @masked_icmps_bmask_notmixed_and(i32 %A) {
1843 ; CHECK-LABEL: @masked_icmps_bmask_notmixed_and(
1844 ; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[A:%.*]], 15
1845 ; CHECK-NEXT: [[RES:%.*]] = icmp ne i32 [[TMP1]], 3
1846 ; CHECK-NEXT: ret i1 [[RES]]
1848 %mask1 = and i32 %A, 15 ; 0x0f
1849 %tst1 = icmp ne i32 %mask1, 3 ; 0x03
1850 %mask2 = and i32 %A, 255 ; 0xff
1851 %tst2 = icmp ne i32 %mask2, 243 ; 0xf3
1852 %res = and i1 %tst1, %tst2
1856 define i1 @masked_icmps_bmask_notmixed_and_contradict_notoptimized(i32 %A) {
1857 ; CHECK-LABEL: @masked_icmps_bmask_notmixed_and_contradict_notoptimized(
1858 ; CHECK-NEXT: [[MASK1:%.*]] = and i32 [[A:%.*]], 15
1859 ; CHECK-NEXT: [[TST1:%.*]] = icmp ne i32 [[MASK1]], 3
1860 ; CHECK-NEXT: [[MASK2:%.*]] = and i32 [[A]], 255
1861 ; CHECK-NEXT: [[TST2:%.*]] = icmp ne i32 [[MASK2]], 242
1862 ; CHECK-NEXT: [[RES:%.*]] = and i1 [[TST1]], [[TST2]]
1863 ; CHECK-NEXT: ret i1 [[RES]]
1865 %mask1 = and i32 %A, 15 ; 0x0f
1866 %tst1 = icmp ne i32 %mask1, 3 ; 0x03
1867 %mask2 = and i32 %A, 255 ; 0xff
1868 %tst2 = icmp ne i32 %mask2, 242 ; 0xf2
1869 %res = and i1 %tst1, %tst2
1873 define i1 @masked_icmps_bmask_notmixed_and_expected_false(i32 %A) {
1874 ; CHECK-LABEL: @masked_icmps_bmask_notmixed_and_expected_false(
1875 ; CHECK-NEXT: [[MASK2:%.*]] = and i32 [[A:%.*]], 255
1876 ; CHECK-NEXT: [[TST2:%.*]] = icmp ne i32 [[MASK2]], 242
1877 ; CHECK-NEXT: ret i1 [[TST2]]
1879 %mask1 = and i32 %A, 3 ; 0x0f
1880 %tst1 = icmp ne i32 %mask1, 15 ; 0x03
1881 %mask2 = and i32 %A, 255 ; 0xff
1882 %tst2 = icmp ne i32 %mask2, 242 ; 0xf2
1883 %res = and i1 %tst1, %tst2
1887 define i1 @masked_icmps_bmask_notmixed_not_subset_notoptimized(i32 %A) {
1888 ; CHECK-LABEL: @masked_icmps_bmask_notmixed_not_subset_notoptimized(
1889 ; CHECK-NEXT: [[MASK1:%.*]] = and i32 [[A:%.*]], 254
1890 ; CHECK-NEXT: [[TST1:%.*]] = icmp ne i32 [[MASK1]], 252
1891 ; CHECK-NEXT: [[MASK2:%.*]] = and i32 [[A]], 253
1892 ; CHECK-NEXT: [[TST2:%.*]] = icmp ne i32 [[MASK2]], 252
1893 ; CHECK-NEXT: [[RES:%.*]] = and i1 [[TST1]], [[TST2]]
1894 ; CHECK-NEXT: ret i1 [[RES]]
1896 %mask1 = and i32 %A, 254 ; 0xfe
1897 %tst1 = icmp ne i32 %mask1, 252 ; 0xfc
1898 %mask2 = and i32 %A, 253 ; 0xfd
1899 %tst2 = icmp ne i32 %mask2, 252 ; 0xfc
1900 %res = and i1 %tst1, %tst2