1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -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 i1 @masked_or_allzeroes(i32 %A) {
19 ; CHECK-LABEL: @masked_or_allzeroes(
20 ; CHECK-NEXT: [[MASK1:%.*]] = and i32 [[A:%.*]], 7
21 ; CHECK-NEXT: [[TST1:%.*]] = icmp eq i32 [[MASK1]], 0
22 ; CHECK-NEXT: ret i1 [[TST1]]
24 %mask1 = and i32 %A, 7
25 %tst1 = icmp eq i32 %mask1, 0
26 %mask2 = and i32 %A, 39
27 %tst2 = icmp eq i32 %mask2, 0
28 %res = or i1 %tst1, %tst2
32 define i1 @masked_and_notallones(i32 %A) {
33 ; CHECK-LABEL: @masked_and_notallones(
34 ; CHECK-NEXT: [[MASK1:%.*]] = and i32 [[A:%.*]], 7
35 ; CHECK-NEXT: [[TST1:%.*]] = icmp ne i32 [[MASK1]], 7
36 ; CHECK-NEXT: ret i1 [[TST1]]
38 %mask1 = and i32 %A, 7
39 %tst1 = icmp ne i32 %mask1, 7
40 %mask2 = and i32 %A, 39
41 %tst2 = icmp ne i32 %mask2, 39
42 %res = and i1 %tst1, %tst2
46 define i1 @masked_or_allones(i32 %A) {
47 ; CHECK-LABEL: @masked_or_allones(
48 ; CHECK-NEXT: [[MASK1:%.*]] = and i32 [[A:%.*]], 7
49 ; CHECK-NEXT: [[TST1:%.*]] = icmp eq i32 [[MASK1]], 7
50 ; CHECK-NEXT: ret i1 [[TST1]]
52 %mask1 = and i32 %A, 7
53 %tst1 = icmp eq i32 %mask1, 7
54 %mask2 = and i32 %A, 39
55 %tst2 = icmp eq i32 %mask2, 39
56 %res = or i1 %tst1, %tst2
60 define i1 @masked_and_notA(i32 %A) {
61 ; CHECK-LABEL: @masked_and_notA(
62 ; CHECK-NEXT: [[MASK2:%.*]] = and i32 [[A:%.*]], 78
63 ; CHECK-NEXT: [[TST2:%.*]] = icmp ne i32 [[MASK2]], [[A]]
64 ; CHECK-NEXT: ret i1 [[TST2]]
66 %mask1 = and i32 %A, 14
67 %tst1 = icmp ne i32 %mask1, %A
68 %mask2 = and i32 %A, 78
69 %tst2 = icmp ne i32 %mask2, %A
70 %res = and i1 %tst1, %tst2
74 define i1 @masked_and_notA_slightly_optimized(i32 %A) {
75 ; CHECK-LABEL: @masked_and_notA_slightly_optimized(
76 ; CHECK-NEXT: [[TMP0:%.*]] = icmp ugt i32 [[A:%.*]], 7
77 ; CHECK-NEXT: [[MASK2:%.*]] = and i32 [[A]], 39
78 ; CHECK-NEXT: [[TST2:%.*]] = icmp ne i32 [[MASK2]], [[A]]
79 ; CHECK-NEXT: [[RES:%.*]] = and i1 [[TMP0]], [[TST2]]
80 ; CHECK-NEXT: ret i1 [[RES]]
82 %tmp0 = icmp uge i32 %A, 8
83 %mask2 = and i32 %A, 39
84 %tst2 = icmp ne i32 %mask2, %A
85 %res = and i1 %tmp0, %tst2
89 define i1 @masked_or_A(i32 %A) {
90 ; CHECK-LABEL: @masked_or_A(
91 ; CHECK-NEXT: [[MASK2:%.*]] = and i32 [[A:%.*]], 78
92 ; CHECK-NEXT: [[TST2:%.*]] = icmp eq i32 [[MASK2]], [[A]]
93 ; CHECK-NEXT: ret i1 [[TST2]]
95 %mask1 = and i32 %A, 14
96 %tst1 = icmp eq i32 %mask1, %A
97 %mask2 = and i32 %A, 78
98 %tst2 = icmp eq i32 %mask2, %A
99 %res = or i1 %tst1, %tst2
103 define i1 @masked_or_A_slightly_optimized(i32 %A) {
104 ; CHECK-LABEL: @masked_or_A_slightly_optimized(
105 ; CHECK-NEXT: [[TMP0:%.*]] = icmp ult i32 [[A:%.*]], 8
106 ; CHECK-NEXT: [[MASK2:%.*]] = and i32 [[A]], 39
107 ; CHECK-NEXT: [[TST2:%.*]] = icmp eq i32 [[MASK2]], [[A]]
108 ; CHECK-NEXT: [[RES:%.*]] = or i1 [[TMP0]], [[TST2]]
109 ; CHECK-NEXT: ret i1 [[RES]]
111 %tmp0 = icmp ult i32 %A, 8
112 %mask2 = and i32 %A, 39
113 %tst2 = icmp eq i32 %mask2, %A
114 %res = or i1 %tmp0, %tst2
118 define i1 @masked_or_allzeroes_notoptimised(i32 %A) {
119 ; CHECK-LABEL: @masked_or_allzeroes_notoptimised(
120 ; CHECK-NEXT: [[MASK1:%.*]] = and i32 [[A:%.*]], 15
121 ; CHECK-NEXT: [[TST1:%.*]] = icmp eq i32 [[MASK1]], 0
122 ; CHECK-NEXT: [[MASK2:%.*]] = and i32 [[A]], 39
123 ; CHECK-NEXT: [[TST2:%.*]] = icmp eq i32 [[MASK2]], 0
124 ; CHECK-NEXT: [[RES:%.*]] = or i1 [[TST1]], [[TST2]]
125 ; CHECK-NEXT: ret i1 [[RES]]
127 %mask1 = and i32 %A, 15
128 %tst1 = icmp eq i32 %mask1, 0
129 %mask2 = and i32 %A, 39
130 %tst2 = icmp eq i32 %mask2, 0
131 %res = or i1 %tst1, %tst2
135 define i1 @nomask_lhs(i32 %in) {
136 ; CHECK-LABEL: @nomask_lhs(
137 ; CHECK-NEXT: [[MASKED:%.*]] = and i32 [[IN:%.*]], 1
138 ; CHECK-NEXT: [[TST2:%.*]] = icmp eq i32 [[MASKED]], 0
139 ; CHECK-NEXT: ret i1 [[TST2]]
141 %tst1 = icmp eq i32 %in, 0
142 %masked = and i32 %in, 1
143 %tst2 = icmp eq i32 %masked, 0
144 %val = or i1 %tst1, %tst2
148 define i1 @nomask_rhs(i32 %in) {
149 ; CHECK-LABEL: @nomask_rhs(
150 ; CHECK-NEXT: [[MASKED:%.*]] = and i32 [[IN:%.*]], 1
151 ; CHECK-NEXT: [[TST1:%.*]] = icmp eq i32 [[MASKED]], 0
152 ; CHECK-NEXT: ret i1 [[TST1]]
154 %masked = and i32 %in, 1
155 %tst1 = icmp eq i32 %masked, 0
156 %tst2 = icmp eq i32 %in, 0
157 %val = or i1 %tst1, %tst2
161 ; TODO: This test simplifies to a constant, so the functionality and test could be in InstSimplify.
163 define i1 @fold_mask_cmps_to_false(i32 %x) {
164 ; CHECK-LABEL: @fold_mask_cmps_to_false(
165 ; CHECK-NEXT: ret i1 false
167 %tmp1 = and i32 %x, 2147483647
168 %tmp2 = icmp eq i32 %tmp1, 0
169 %tmp3 = icmp eq i32 %x, 2147483647
170 %tmp4 = and i1 %tmp3, %tmp2
174 ; TODO: This test simplifies to a constant, so the functionality and test could be in InstSimplify.
176 define i1 @fold_mask_cmps_to_true(i32 %x) {
177 ; CHECK-LABEL: @fold_mask_cmps_to_true(
178 ; CHECK-NEXT: ret i1 true
180 %tmp1 = and i32 %x, 2147483647
181 %tmp2 = icmp ne i32 %tmp1, 0
182 %tmp3 = icmp ne i32 %x, 2147483647
183 %tmp4 = or i1 %tmp3, %tmp2
187 ; PR32401 - https://bugs.llvm.org/show_bug.cgi?id=32401
189 define i1 @cmpeq_bitwise(i8 %a, i8 %b, i8 %c, i8 %d) {
190 ; CHECK-LABEL: @cmpeq_bitwise(
191 ; CHECK-NEXT: [[TMP1:%.*]] = icmp eq i8 [[A:%.*]], [[B:%.*]]
192 ; CHECK-NEXT: [[TMP2:%.*]] = icmp eq i8 [[C:%.*]], [[D:%.*]]
193 ; CHECK-NEXT: [[CMP:%.*]] = and i1 [[TMP1]], [[TMP2]]
194 ; CHECK-NEXT: ret i1 [[CMP]]
196 %xor1 = xor i8 %a, %b
197 %xor2 = xor i8 %c, %d
198 %or = or i8 %xor1, %xor2
199 %cmp = icmp eq i8 %or, 0
203 define <2 x i1> @cmpne_bitwise(<2 x i64> %a, <2 x i64> %b, <2 x i64> %c, <2 x i64> %d) {
204 ; CHECK-LABEL: @cmpne_bitwise(
205 ; CHECK-NEXT: [[TMP1:%.*]] = icmp ne <2 x i64> [[A:%.*]], [[B:%.*]]
206 ; CHECK-NEXT: [[TMP2:%.*]] = icmp ne <2 x i64> [[C:%.*]], [[D:%.*]]
207 ; CHECK-NEXT: [[CMP:%.*]] = or <2 x i1> [[TMP1]], [[TMP2]]
208 ; CHECK-NEXT: ret <2 x i1> [[CMP]]
210 %xor1 = xor <2 x i64> %a, %b
211 %xor2 = xor <2 x i64> %c, %d
212 %or = or <2 x i64> %xor1, %xor2
213 %cmp = icmp ne <2 x i64> %or, zeroinitializer
217 ; ((X & 12) != 0 & (X & 3) == 1) -> no change
218 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_0(i32 %x) {
219 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_0(
220 ; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[X:%.*]], 12
221 ; CHECK-NEXT: [[TMP2:%.*]] = icmp ne i32 [[TMP1]], 0
222 ; CHECK-NEXT: [[TMP3:%.*]] = and i32 [[X]], 3
223 ; CHECK-NEXT: [[TMP4:%.*]] = icmp eq i32 [[TMP3]], 1
224 ; CHECK-NEXT: [[TMP5:%.*]] = and i1 [[TMP2]], [[TMP4]]
225 ; CHECK-NEXT: ret i1 [[TMP5]]
227 %tmp1 = and i32 %x, 12
228 %tmp2 = icmp ne i32 %tmp1, 0
229 %tmp3 = and i32 %x, 3
230 %tmp4 = icmp eq i32 %tmp3, 1
231 %tmp5 = and i1 %tmp2, %tmp4
235 ; ((X & 12) != 0 & (X & 7) == 1) -> (X & 15) == 9
236 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_1(i32 %x) {
237 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_1(
238 ; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[X:%.*]], 15
239 ; CHECK-NEXT: [[TMP2:%.*]] = icmp eq i32 [[TMP1]], 9
240 ; CHECK-NEXT: ret i1 [[TMP2]]
242 %tmp1 = and i32 %x, 12
243 %tmp2 = icmp ne i32 %tmp1, 0
244 %tmp3 = and i32 %x, 7
245 %tmp4 = icmp eq i32 %tmp3, 1
246 %tmp5 = and i1 %tmp2, %tmp4
250 ; ((X & 14) != 0 & (X & 3) == 1) -> no change
251 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_1b(i32 %x) {
252 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_1b(
253 ; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[X:%.*]], 14
254 ; CHECK-NEXT: [[TMP2:%.*]] = icmp ne i32 [[TMP1]], 0
255 ; CHECK-NEXT: [[TMP3:%.*]] = and i32 [[X]], 3
256 ; CHECK-NEXT: [[TMP4:%.*]] = icmp eq i32 [[TMP3]], 1
257 ; CHECK-NEXT: [[TMP5:%.*]] = and i1 [[TMP2]], [[TMP4]]
258 ; CHECK-NEXT: ret i1 [[TMP5]]
260 %tmp1 = and i32 %x, 14
261 %tmp2 = icmp ne i32 %tmp1, 0
262 %tmp3 = and i32 %x, 3
263 %tmp4 = icmp eq i32 %tmp3, 1
264 %tmp5 = and i1 %tmp2, %tmp4
268 ; ((X & 3) != 0 & (X & 7) == 0) -> false
269 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_2(i32 %x) {
270 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_2(
271 ; CHECK-NEXT: ret i1 false
273 %tmp1 = and i32 %x, 3
274 %tmp2 = icmp ne i32 %tmp1, 0
275 %tmp3 = and i32 %x, 7
276 %tmp4 = icmp eq i32 %tmp3, 0
277 %tmp5 = and i1 %tmp2, %tmp4
281 ; ((X & 15) != 0 & (X & 7) == 0) -> (X & 15) == 8
282 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_3(i32 %x) {
283 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_3(
284 ; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[X:%.*]], 15
285 ; CHECK-NEXT: [[TMP2:%.*]] = icmp eq i32 [[TMP1]], 8
286 ; CHECK-NEXT: ret i1 [[TMP2]]
288 %tmp1 = and i32 %x, 15
289 %tmp2 = icmp ne i32 %tmp1, 0
290 %tmp3 = and i32 %x, 7
291 %tmp4 = icmp eq i32 %tmp3, 0
292 %tmp5 = and i1 %tmp2, %tmp4
296 ; ((X & 15) != 0 & (X & 3) == 0) -> no change
297 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_3b(i32 %x) {
298 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_3b(
299 ; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[X:%.*]], 15
300 ; CHECK-NEXT: [[TMP2:%.*]] = icmp ne i32 [[TMP1]], 0
301 ; CHECK-NEXT: [[TMP3:%.*]] = and i32 [[X]], 3
302 ; CHECK-NEXT: [[TMP4:%.*]] = icmp eq i32 [[TMP3]], 0
303 ; CHECK-NEXT: [[TMP5:%.*]] = and i1 [[TMP2]], [[TMP4]]
304 ; CHECK-NEXT: ret i1 [[TMP5]]
306 %tmp1 = and i32 %x, 15
307 %tmp2 = icmp ne i32 %tmp1, 0
308 %tmp3 = and i32 %x, 3
309 %tmp4 = icmp eq i32 %tmp3, 0
310 %tmp5 = and i1 %tmp2, %tmp4
314 ; ((X & 255) != 0 & (X & 15) == 8) -> (X & 15) == 8
315 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_4(i32 %x) {
316 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_4(
317 ; CHECK-NEXT: [[TMP3:%.*]] = and i32 [[X:%.*]], 15
318 ; CHECK-NEXT: [[TMP4:%.*]] = icmp eq i32 [[TMP3]], 8
319 ; CHECK-NEXT: ret i1 [[TMP4]]
321 %tmp1 = and i32 %x, 255
322 %tmp2 = icmp ne i32 %tmp1, 0
323 %tmp3 = and i32 %x, 15
324 %tmp4 = icmp eq i32 %tmp3, 8
325 %tmp5 = and i1 %tmp2, %tmp4
329 ; ((X & 15) != 0 & (X & 15) == 8) -> (X & 15) == 8
330 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_5(i32 %x) {
331 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_5(
332 ; CHECK-NEXT: [[TMP3:%.*]] = and i32 [[X:%.*]], 15
333 ; CHECK-NEXT: [[TMP4:%.*]] = icmp eq i32 [[TMP3]], 8
334 ; CHECK-NEXT: ret i1 [[TMP4]]
336 %tmp1 = and i32 %x, 15
337 %tmp2 = icmp ne i32 %tmp1, 0
338 %tmp3 = and i32 %x, 15
339 %tmp4 = icmp eq i32 %tmp3, 8
340 %tmp5 = and i1 %tmp2, %tmp4
344 ; ((X & 12) != 0 & (X & 15) == 8) -> (X & 15) == 8
345 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_6(i32 %x) {
346 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_6(
347 ; CHECK-NEXT: [[TMP3:%.*]] = and i32 [[X:%.*]], 15
348 ; CHECK-NEXT: [[TMP4:%.*]] = icmp eq i32 [[TMP3]], 8
349 ; CHECK-NEXT: ret i1 [[TMP4]]
351 %tmp1 = and i32 %x, 12
352 %tmp2 = icmp ne i32 %tmp1, 0
353 %tmp3 = and i32 %x, 15
354 %tmp4 = icmp eq i32 %tmp3, 8
355 %tmp5 = and i1 %tmp2, %tmp4
359 ; ((X & 7) != 0 & (X & 15) == 8) -> false
360 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_7(i32 %x) {
361 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_7(
362 ; CHECK-NEXT: ret i1 false
364 %tmp1 = and i32 %x, 7
365 %tmp2 = icmp ne i32 %tmp1, 0
366 %tmp3 = and i32 %x, 15
367 %tmp4 = icmp eq i32 %tmp3, 8
368 %tmp5 = and i1 %tmp2, %tmp4
372 ; ((X & 6) != 0 & (X & 15) == 8) -> false
373 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_7b(i32 %x) {
374 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_7b(
375 ; CHECK-NEXT: ret i1 false
377 %tmp1 = and i32 %x, 6
378 %tmp2 = icmp ne i32 %tmp1, 0
379 %tmp3 = and i32 %x, 15
380 %tmp4 = icmp eq i32 %tmp3, 8
381 %tmp5 = and i1 %tmp2, %tmp4
385 ; ((X & 12) == 0 | (X & 3) != 1) -> !((X & 12) != 0 & (X & 3) == 1)) ->
387 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_negated_0(i32 %x) {
388 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_negated_0(
389 ; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[X:%.*]], 12
390 ; CHECK-NEXT: [[TMP2:%.*]] = icmp eq i32 [[TMP1]], 0
391 ; CHECK-NEXT: [[TMP3:%.*]] = and i32 [[X]], 3
392 ; CHECK-NEXT: [[TMP4:%.*]] = icmp ne i32 [[TMP3]], 1
393 ; CHECK-NEXT: [[TMP5:%.*]] = or i1 [[TMP2]], [[TMP4]]
394 ; CHECK-NEXT: ret i1 [[TMP5]]
396 %tmp1 = and i32 %x, 12
397 %tmp2 = icmp eq i32 %tmp1, 0
398 %tmp3 = and i32 %x, 3
399 %tmp4 = icmp ne i32 %tmp3, 1
400 %tmp5 = or i1 %tmp2, %tmp4
404 ; ((X & 12) == 0 | (X & 7) != 1) -> !((X & 12) != 0 & (X & 7) == 1) ->
405 ; !((X & 15) == 9) -> (X & 15) != 9
406 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_negated_1(i32 %x) {
407 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_negated_1(
408 ; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[X:%.*]], 15
409 ; CHECK-NEXT: [[TMP2:%.*]] = icmp ne i32 [[TMP1]], 9
410 ; CHECK-NEXT: ret i1 [[TMP2]]
412 %tmp1 = and i32 %x, 12
413 %tmp2 = icmp eq i32 %tmp1, 0
414 %tmp3 = and i32 %x, 7
415 %tmp4 = icmp ne i32 %tmp3, 1
416 %tmp5 = or i1 %tmp2, %tmp4
420 ; ((X & 14) == 0 | (X & 3) != 1) -> !((X & 14) != 0 & (X & 3) == 1) ->
422 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_negated_1b(i32 %x) {
423 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_negated_1b(
424 ; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[X:%.*]], 14
425 ; CHECK-NEXT: [[TMP2:%.*]] = icmp eq i32 [[TMP1]], 0
426 ; CHECK-NEXT: [[TMP3:%.*]] = and i32 [[X]], 3
427 ; CHECK-NEXT: [[TMP4:%.*]] = icmp ne i32 [[TMP3]], 1
428 ; CHECK-NEXT: [[TMP5:%.*]] = or i1 [[TMP2]], [[TMP4]]
429 ; CHECK-NEXT: ret i1 [[TMP5]]
431 %tmp1 = and i32 %x, 14
432 %tmp2 = icmp eq i32 %tmp1, 0
433 %tmp3 = and i32 %x, 3
434 %tmp4 = icmp ne i32 %tmp3, 1
435 %tmp5 = or i1 %tmp2, %tmp4
439 ; ((X & 3) == 0 | (X & 7) != 0) -> !((X & 3) != 0 & (X & 7) == 0) ->
441 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_negated_2(i32 %x) {
442 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_negated_2(
443 ; CHECK-NEXT: ret i1 true
445 %tmp1 = and i32 %x, 3
446 %tmp2 = icmp eq i32 %tmp1, 0
447 %tmp3 = and i32 %x, 7
448 %tmp4 = icmp ne i32 %tmp3, 0
449 %tmp5 = or i1 %tmp2, %tmp4
453 ; ((X & 15) == 0 | (X & 7) != 0) -> !((X & 15) != 0 & (X & 7) == 0) ->
454 ; !((X & 15) == 8) -> (X & 15) != 8
455 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_negated_3(i32 %x) {
456 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_negated_3(
457 ; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[X:%.*]], 15
458 ; CHECK-NEXT: [[TMP2:%.*]] = icmp ne i32 [[TMP1]], 8
459 ; CHECK-NEXT: ret i1 [[TMP2]]
461 %tmp1 = and i32 %x, 15
462 %tmp2 = icmp eq i32 %tmp1, 0
463 %tmp3 = and i32 %x, 7
464 %tmp4 = icmp ne i32 %tmp3, 0
465 %tmp5 = or i1 %tmp2, %tmp4
469 ; ((X & 15) == 0 | (X & 3) != 0) -> !((X & 15) != 0 & (X & 3) == 0) ->
471 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_negated_3b(i32 %x) {
472 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_negated_3b(
473 ; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[X:%.*]], 15
474 ; CHECK-NEXT: [[TMP2:%.*]] = icmp eq i32 [[TMP1]], 0
475 ; CHECK-NEXT: [[TMP3:%.*]] = and i32 [[X]], 3
476 ; CHECK-NEXT: [[TMP4:%.*]] = icmp ne i32 [[TMP3]], 0
477 ; CHECK-NEXT: [[TMP5:%.*]] = or i1 [[TMP2]], [[TMP4]]
478 ; CHECK-NEXT: ret i1 [[TMP5]]
480 %tmp1 = and i32 %x, 15
481 %tmp2 = icmp eq i32 %tmp1, 0
482 %tmp3 = and i32 %x, 3
483 %tmp4 = icmp ne i32 %tmp3, 0
484 %tmp5 = or i1 %tmp2, %tmp4
488 ; ((X & 255) == 0 | (X & 15) != 8) -> !(((X & 255) != 0 & (X & 15) == 8)) ->
489 ; !((X & 15) == 8) -> ((X & 15) != 8)
490 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_negated_4(i32 %x) {
491 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_negated_4(
492 ; CHECK-NEXT: [[TMP3:%.*]] = and i32 [[X:%.*]], 15
493 ; CHECK-NEXT: [[TMP4:%.*]] = icmp ne i32 [[TMP3]], 8
494 ; CHECK-NEXT: ret i1 [[TMP4]]
496 %tmp1 = and i32 %x, 255
497 %tmp2 = icmp eq i32 %tmp1, 0
498 %tmp3 = and i32 %x, 15
499 %tmp4 = icmp ne i32 %tmp3, 8
500 %tmp5 = or i1 %tmp2, %tmp4
504 ; ((X & 15) == 0 | (X & 15) != 8) -> !(((X & 15) != 0 & (X & 15) == 8)) ->
505 ; !((X & 15) == 8) -> ((X & 15) != 8)
506 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_negated_5(i32 %x) {
507 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_negated_5(
508 ; CHECK-NEXT: [[TMP3:%.*]] = and i32 [[X:%.*]], 15
509 ; CHECK-NEXT: [[TMP4:%.*]] = icmp ne i32 [[TMP3]], 8
510 ; CHECK-NEXT: ret i1 [[TMP4]]
512 %tmp1 = and i32 %x, 15
513 %tmp2 = icmp eq i32 %tmp1, 0
514 %tmp3 = and i32 %x, 15
515 %tmp4 = icmp ne i32 %tmp3, 8
516 %tmp5 = or i1 %tmp2, %tmp4
520 ; ((X & 12) == 0 | (X & 15) != 8) -> !(((X & 12) != 0 & (X & 15) == 8)) ->
521 ; !((X & 15) == 8) -> ((X & 15) != 8
522 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_negated_6(i32 %x) {
523 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_negated_6(
524 ; CHECK-NEXT: [[TMP3:%.*]] = and i32 [[X:%.*]], 15
525 ; CHECK-NEXT: [[TMP4:%.*]] = icmp ne i32 [[TMP3]], 8
526 ; CHECK-NEXT: ret i1 [[TMP4]]
528 %tmp1 = and i32 %x, 12
529 %tmp2 = icmp eq i32 %tmp1, 0
530 %tmp3 = and i32 %x, 15
531 %tmp4 = icmp ne i32 %tmp3, 8
532 %tmp5 = or i1 %tmp2, %tmp4
536 ; ((X & 7) == 0 | (X & 15) != 8) -> !(((X & 7) != 0 & (X & 15) == 8)) ->
538 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_negated_7(i32 %x) {
539 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_negated_7(
540 ; CHECK-NEXT: ret i1 true
542 %tmp1 = and i32 %x, 7
543 %tmp2 = icmp eq i32 %tmp1, 0
544 %tmp3 = and i32 %x, 15
545 %tmp4 = icmp ne i32 %tmp3, 8
546 %tmp5 = or i1 %tmp2, %tmp4
550 ; ((X & 6) == 0 | (X & 15) != 8) -> !(((X & 6) != 0 & (X & 15) == 8)) ->
552 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_negated_7b(i32 %x) {
553 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_negated_7b(
554 ; CHECK-NEXT: ret i1 true
556 %tmp1 = and i32 %x, 6
557 %tmp2 = icmp eq i32 %tmp1, 0
558 %tmp3 = and i32 %x, 15
559 %tmp4 = icmp ne i32 %tmp3, 8
560 %tmp5 = or i1 %tmp2, %tmp4
565 ; ((X & 12) != 0 & (X & 3) == 1) -> no change
566 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_swapped_0(i32 %x) {
567 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_swapped_0(
568 ; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[X:%.*]], 12
569 ; CHECK-NEXT: [[TMP2:%.*]] = icmp ne i32 [[TMP1]], 0
570 ; CHECK-NEXT: [[TMP3:%.*]] = and i32 [[X]], 3
571 ; CHECK-NEXT: [[TMP4:%.*]] = icmp eq i32 [[TMP3]], 1
572 ; CHECK-NEXT: [[TMP5:%.*]] = and i1 [[TMP4]], [[TMP2]]
573 ; CHECK-NEXT: ret i1 [[TMP5]]
575 %tmp1 = and i32 %x, 12
576 %tmp2 = icmp ne i32 %tmp1, 0
577 %tmp3 = and i32 %x, 3
578 %tmp4 = icmp eq i32 %tmp3, 1
579 %tmp5 = and i1 %tmp4, %tmp2
583 ; ((X & 12) != 0 & (X & 7) == 1) -> (X & 15) == 9
584 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_swapped_1(i32 %x) {
585 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_swapped_1(
586 ; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[X:%.*]], 15
587 ; CHECK-NEXT: [[TMP2:%.*]] = icmp eq i32 [[TMP1]], 9
588 ; CHECK-NEXT: ret i1 [[TMP2]]
590 %tmp1 = and i32 %x, 12
591 %tmp2 = icmp ne i32 %tmp1, 0
592 %tmp3 = and i32 %x, 7
593 %tmp4 = icmp eq i32 %tmp3, 1
594 %tmp5 = and i1 %tmp4, %tmp2
598 ; ((X & 14) != 0 & (X & 3) == 1) -> no change
599 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_swapped_1b(i32 %x) {
600 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_swapped_1b(
601 ; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[X:%.*]], 14
602 ; CHECK-NEXT: [[TMP2:%.*]] = icmp ne i32 [[TMP1]], 0
603 ; CHECK-NEXT: [[TMP3:%.*]] = and i32 [[X]], 3
604 ; CHECK-NEXT: [[TMP4:%.*]] = icmp eq i32 [[TMP3]], 1
605 ; CHECK-NEXT: [[TMP5:%.*]] = and i1 [[TMP4]], [[TMP2]]
606 ; CHECK-NEXT: ret i1 [[TMP5]]
608 %tmp1 = and i32 %x, 14
609 %tmp2 = icmp ne i32 %tmp1, 0
610 %tmp3 = and i32 %x, 3
611 %tmp4 = icmp eq i32 %tmp3, 1
612 %tmp5 = and i1 %tmp4, %tmp2
616 ; ((X & 3) != 0 & (X & 7) == 0) -> false
617 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_swapped_2(i32 %x) {
618 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_swapped_2(
619 ; CHECK-NEXT: ret i1 false
621 %tmp1 = and i32 %x, 3
622 %tmp2 = icmp ne i32 %tmp1, 0
623 %tmp3 = and i32 %x, 7
624 %tmp4 = icmp eq i32 %tmp3, 0
625 %tmp5 = and i1 %tmp4, %tmp2
629 ; ((X & 15) != 0 & (X & 7) == 0) -> (X & 15) == 8
630 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_swapped_3(i32 %x) {
631 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_swapped_3(
632 ; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[X:%.*]], 15
633 ; CHECK-NEXT: [[TMP2:%.*]] = icmp eq i32 [[TMP1]], 8
634 ; CHECK-NEXT: ret i1 [[TMP2]]
636 %tmp1 = and i32 %x, 15
637 %tmp2 = icmp ne i32 %tmp1, 0
638 %tmp3 = and i32 %x, 7
639 %tmp4 = icmp eq i32 %tmp3, 0
640 %tmp5 = and i1 %tmp4, %tmp2
644 ; ((X & 15) != 0 & (X & 3) == 0) -> no change
645 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_swapped_3b(i32 %x) {
646 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_swapped_3b(
647 ; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[X:%.*]], 15
648 ; CHECK-NEXT: [[TMP2:%.*]] = icmp ne i32 [[TMP1]], 0
649 ; CHECK-NEXT: [[TMP3:%.*]] = and i32 [[X]], 3
650 ; CHECK-NEXT: [[TMP4:%.*]] = icmp eq i32 [[TMP3]], 0
651 ; CHECK-NEXT: [[TMP5:%.*]] = and i1 [[TMP4]], [[TMP2]]
652 ; CHECK-NEXT: ret i1 [[TMP5]]
654 %tmp1 = and i32 %x, 15
655 %tmp2 = icmp ne i32 %tmp1, 0
656 %tmp3 = and i32 %x, 3
657 %tmp4 = icmp eq i32 %tmp3, 0
658 %tmp5 = and i1 %tmp4, %tmp2
662 ; ((X & 255) != 0 & (X & 15) == 8) -> (X & 15) == 8
663 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_swapped_4(i32 %x) {
664 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_swapped_4(
665 ; CHECK-NEXT: [[TMP3:%.*]] = and i32 [[X:%.*]], 15
666 ; CHECK-NEXT: [[TMP4:%.*]] = icmp eq i32 [[TMP3]], 8
667 ; CHECK-NEXT: ret i1 [[TMP4]]
669 %tmp1 = and i32 %x, 255
670 %tmp2 = icmp ne i32 %tmp1, 0
671 %tmp3 = and i32 %x, 15
672 %tmp4 = icmp eq i32 %tmp3, 8
673 %tmp5 = and i1 %tmp4, %tmp2
677 ; ((X & 15) != 0 & (X & 15) == 8) -> (X & 15) == 8
678 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_swapped_5(i32 %x) {
679 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_swapped_5(
680 ; CHECK-NEXT: [[TMP3:%.*]] = and i32 [[X:%.*]], 15
681 ; CHECK-NEXT: [[TMP4:%.*]] = icmp eq i32 [[TMP3]], 8
682 ; CHECK-NEXT: ret i1 [[TMP4]]
684 %tmp1 = and i32 %x, 15
685 %tmp2 = icmp ne i32 %tmp1, 0
686 %tmp3 = and i32 %x, 15
687 %tmp4 = icmp eq i32 %tmp3, 8
688 %tmp5 = and i1 %tmp4, %tmp2
692 ; ((X & 12) != 0 & (X & 15) == 8) -> (X & 15) == 8
693 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_swapped_6(i32 %x) {
694 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_swapped_6(
695 ; CHECK-NEXT: [[TMP3:%.*]] = and i32 [[X:%.*]], 15
696 ; CHECK-NEXT: [[TMP4:%.*]] = icmp eq i32 [[TMP3]], 8
697 ; CHECK-NEXT: ret i1 [[TMP4]]
699 %tmp1 = and i32 %x, 12
700 %tmp2 = icmp ne i32 %tmp1, 0
701 %tmp3 = and i32 %x, 15
702 %tmp4 = icmp eq i32 %tmp3, 8
703 %tmp5 = and i1 %tmp4, %tmp2
707 ; ((X & 7) != 0 & (X & 15) == 8) -> false
708 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_swapped_7(i32 %x) {
709 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_swapped_7(
710 ; CHECK-NEXT: ret i1 false
712 %tmp1 = and i32 %x, 7
713 %tmp2 = icmp ne i32 %tmp1, 0
714 %tmp3 = and i32 %x, 15
715 %tmp4 = icmp eq i32 %tmp3, 8
716 %tmp5 = and i1 %tmp4, %tmp2
720 ; ((X & 6) != 0 & (X & 15) == 8) -> false
721 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_swapped_7b(i32 %x) {
722 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_swapped_7b(
723 ; CHECK-NEXT: ret i1 false
725 %tmp1 = and i32 %x, 6
726 %tmp2 = icmp ne i32 %tmp1, 0
727 %tmp3 = and i32 %x, 15
728 %tmp4 = icmp eq i32 %tmp3, 8
729 %tmp5 = and i1 %tmp4, %tmp2
733 ; ((X & 12) == 0 | (X & 3) != 1) -> !((X & 12) != 0 & (X & 3) == 1)) ->
735 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_negated_swapped_0(i32 %x) {
736 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_negated_swapped_0(
737 ; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[X:%.*]], 12
738 ; CHECK-NEXT: [[TMP2:%.*]] = icmp eq i32 [[TMP1]], 0
739 ; CHECK-NEXT: [[TMP3:%.*]] = and i32 [[X]], 3
740 ; CHECK-NEXT: [[TMP4:%.*]] = icmp ne i32 [[TMP3]], 1
741 ; CHECK-NEXT: [[TMP5:%.*]] = or i1 [[TMP4]], [[TMP2]]
742 ; CHECK-NEXT: ret i1 [[TMP5]]
744 %tmp1 = and i32 %x, 12
745 %tmp2 = icmp eq i32 %tmp1, 0
746 %tmp3 = and i32 %x, 3
747 %tmp4 = icmp ne i32 %tmp3, 1
748 %tmp5 = or i1 %tmp4, %tmp2
752 ; ((X & 12) == 0 | (X & 7) != 1) -> !((X & 12) != 0 & (X & 7) == 1) ->
753 ; !((X & 15) == 9) -> (X & 15) != 9
754 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_negated_swapped_1(i32 %x) {
755 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_negated_swapped_1(
756 ; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[X:%.*]], 15
757 ; CHECK-NEXT: [[TMP2:%.*]] = icmp ne i32 [[TMP1]], 9
758 ; CHECK-NEXT: ret i1 [[TMP2]]
760 %tmp1 = and i32 %x, 12
761 %tmp2 = icmp eq i32 %tmp1, 0
762 %tmp3 = and i32 %x, 7
763 %tmp4 = icmp ne i32 %tmp3, 1
764 %tmp5 = or i1 %tmp4, %tmp2
768 ; ((X & 14) == 0 | (X & 3) != 1) -> !((X & 14) != 0 & (X & 3) == 1) ->
770 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_negated_swapped_1b(i32 %x) {
771 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_negated_swapped_1b(
772 ; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[X:%.*]], 14
773 ; CHECK-NEXT: [[TMP2:%.*]] = icmp eq i32 [[TMP1]], 0
774 ; CHECK-NEXT: [[TMP3:%.*]] = and i32 [[X]], 3
775 ; CHECK-NEXT: [[TMP4:%.*]] = icmp ne i32 [[TMP3]], 1
776 ; CHECK-NEXT: [[TMP5:%.*]] = or i1 [[TMP4]], [[TMP2]]
777 ; CHECK-NEXT: ret i1 [[TMP5]]
779 %tmp1 = and i32 %x, 14
780 %tmp2 = icmp eq i32 %tmp1, 0
781 %tmp3 = and i32 %x, 3
782 %tmp4 = icmp ne i32 %tmp3, 1
783 %tmp5 = or i1 %tmp4, %tmp2
787 ; ((X & 3) == 0 | (X & 7) != 0) -> !((X & 3) != 0 & (X & 7) == 0) ->
789 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_negated_swapped_2(i32 %x) {
790 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_negated_swapped_2(
791 ; CHECK-NEXT: ret i1 true
793 %tmp1 = and i32 %x, 3
794 %tmp2 = icmp eq i32 %tmp1, 0
795 %tmp3 = and i32 %x, 7
796 %tmp4 = icmp ne i32 %tmp3, 0
797 %tmp5 = or i1 %tmp4, %tmp2
801 ; ((X & 15) == 0 | (X & 7) != 0) -> !((X & 15) != 0 & (X & 7) == 0) ->
802 ; !((X & 15) == 8) -> (X & 15) != 8
803 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_negated_swapped_3(i32 %x) {
804 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_negated_swapped_3(
805 ; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[X:%.*]], 15
806 ; CHECK-NEXT: [[TMP2:%.*]] = icmp ne i32 [[TMP1]], 8
807 ; CHECK-NEXT: ret i1 [[TMP2]]
809 %tmp1 = and i32 %x, 15
810 %tmp2 = icmp eq i32 %tmp1, 0
811 %tmp3 = and i32 %x, 7
812 %tmp4 = icmp ne i32 %tmp3, 0
813 %tmp5 = or i1 %tmp4, %tmp2
817 ; ((X & 15) == 0 | (X & 3) != 0) -> !((X & 15) != 0 & (X & 3) == 0) ->
819 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_negated_swapped_3b(i32 %x) {
820 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_negated_swapped_3b(
821 ; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[X:%.*]], 15
822 ; CHECK-NEXT: [[TMP2:%.*]] = icmp eq i32 [[TMP1]], 0
823 ; CHECK-NEXT: [[TMP3:%.*]] = and i32 [[X]], 3
824 ; CHECK-NEXT: [[TMP4:%.*]] = icmp ne i32 [[TMP3]], 0
825 ; CHECK-NEXT: [[TMP5:%.*]] = or i1 [[TMP4]], [[TMP2]]
826 ; CHECK-NEXT: ret i1 [[TMP5]]
828 %tmp1 = and i32 %x, 15
829 %tmp2 = icmp eq i32 %tmp1, 0
830 %tmp3 = and i32 %x, 3
831 %tmp4 = icmp ne i32 %tmp3, 0
832 %tmp5 = or i1 %tmp4, %tmp2
836 ; ((X & 255) == 0 | (X & 15) != 8) -> !(((X & 255) != 0 & (X & 15) == 8)) ->
837 ; !((X & 15) == 8) -> ((X & 15) != 8)
838 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_negated_swapped_4(i32 %x) {
839 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_negated_swapped_4(
840 ; CHECK-NEXT: [[TMP3:%.*]] = and i32 [[X:%.*]], 15
841 ; CHECK-NEXT: [[TMP4:%.*]] = icmp ne i32 [[TMP3]], 8
842 ; CHECK-NEXT: ret i1 [[TMP4]]
844 %tmp1 = and i32 %x, 255
845 %tmp2 = icmp eq i32 %tmp1, 0
846 %tmp3 = and i32 %x, 15
847 %tmp4 = icmp ne i32 %tmp3, 8
848 %tmp5 = or i1 %tmp4, %tmp2
852 ; ((X & 15) == 0 | (X & 15) != 8) -> !(((X & 15) != 0 & (X & 15) == 8)) ->
853 ; !((X & 15) == 8) -> ((X & 15) != 8)
854 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_negated_swapped_5(i32 %x) {
855 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_negated_swapped_5(
856 ; CHECK-NEXT: [[TMP3:%.*]] = and i32 [[X:%.*]], 15
857 ; CHECK-NEXT: [[TMP4:%.*]] = icmp ne i32 [[TMP3]], 8
858 ; CHECK-NEXT: ret i1 [[TMP4]]
860 %tmp1 = and i32 %x, 15
861 %tmp2 = icmp eq i32 %tmp1, 0
862 %tmp3 = and i32 %x, 15
863 %tmp4 = icmp ne i32 %tmp3, 8
864 %tmp5 = or i1 %tmp4, %tmp2
868 ; ((X & 12) == 0 | (X & 15) != 8) -> !(((X & 12) != 0 & (X & 15) == 8)) ->
869 ; !((X & 15) == 8) -> ((X & 15) != 8
870 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_negated_swapped_6(i32 %x) {
871 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_negated_swapped_6(
872 ; CHECK-NEXT: [[TMP3:%.*]] = and i32 [[X:%.*]], 15
873 ; CHECK-NEXT: [[TMP4:%.*]] = icmp ne i32 [[TMP3]], 8
874 ; CHECK-NEXT: ret i1 [[TMP4]]
876 %tmp1 = and i32 %x, 12
877 %tmp2 = icmp eq i32 %tmp1, 0
878 %tmp3 = and i32 %x, 15
879 %tmp4 = icmp ne i32 %tmp3, 8
880 %tmp5 = or i1 %tmp4, %tmp2
884 ; ((X & 7) == 0 | (X & 15) != 8) -> !(((X & 7) != 0 & (X & 15) == 8)) ->
886 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_negated_swapped_7(i32 %x) {
887 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_negated_swapped_7(
888 ; CHECK-NEXT: ret i1 true
890 %tmp1 = and i32 %x, 7
891 %tmp2 = icmp eq i32 %tmp1, 0
892 %tmp3 = and i32 %x, 15
893 %tmp4 = icmp ne i32 %tmp3, 8
894 %tmp5 = or i1 %tmp4, %tmp2
898 ; ((X & 6) == 0 | (X & 15) != 8) -> !(((X & 6) != 0 & (X & 15) == 8)) ->
900 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_negated_swapped_7b(i32 %x) {
901 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_negated_swapped_7b(
902 ; CHECK-NEXT: ret i1 true
904 %tmp1 = and i32 %x, 6
905 %tmp2 = icmp eq i32 %tmp1, 0
906 %tmp3 = and i32 %x, 15
907 %tmp4 = icmp ne i32 %tmp3, 8
908 %tmp5 = or i1 %tmp4, %tmp2