1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=armv7a < %s | FileCheck %s --check-prefix=ARM
3 ; RUN: llc -mtriple=armv6m < %s | FileCheck %s --check-prefix=THUMB
4 ; RUN: llc -mtriple=armv7m < %s | FileCheck %s --check-prefix=THUMB2
6 define i1 @cmp_ne_zero_and_rr(i32 %a, i32 %b) {
7 ; ARM-LABEL: cmp_ne_zero_and_rr:
9 ; ARM-NEXT: ands r0, r0, r1
10 ; ARM-NEXT: movwne r0, #1
13 ; THUMB-LABEL: cmp_ne_zero_and_rr:
15 ; THUMB-NEXT: ands r0, r1
16 ; THUMB-NEXT: subs r1, r0, #1
17 ; THUMB-NEXT: sbcs r0, r1
20 ; THUMB2-LABEL: cmp_ne_zero_and_rr:
22 ; THUMB2-NEXT: ands r0, r1
24 ; THUMB2-NEXT: movne r0, #1
27 %res = icmp ne i32 %and, 0
31 define i1 @cmp_ne_zero_and_ri(i32 %a) {
32 ; ARM-LABEL: cmp_ne_zero_and_ri:
34 ; ARM-NEXT: ands r0, r0, #42
35 ; ARM-NEXT: movwne r0, #1
38 ; THUMB-LABEL: cmp_ne_zero_and_ri:
40 ; THUMB-NEXT: movs r1, #42
41 ; THUMB-NEXT: ands r0, r1
42 ; THUMB-NEXT: subs r1, r0, #1
43 ; THUMB-NEXT: sbcs r0, r1
46 ; THUMB2-LABEL: cmp_ne_zero_and_ri:
48 ; THUMB2-NEXT: ands r0, r0, #42
50 ; THUMB2-NEXT: movne r0, #1
53 %res = icmp ne i32 %and, 0
57 define i1 @cmp_ne_zero_and_rsr(i32 %a, i32 %b, i32 %c) {
58 ; ARM-LABEL: cmp_ne_zero_and_rsr:
60 ; ARM-NEXT: ands r0, r0, r1, lsl r2
61 ; ARM-NEXT: movwne r0, #1
64 ; THUMB-LABEL: cmp_ne_zero_and_rsr:
66 ; THUMB-NEXT: lsls r1, r2
67 ; THUMB-NEXT: ands r0, r1
68 ; THUMB-NEXT: subs r1, r0, #1
69 ; THUMB-NEXT: sbcs r0, r1
72 ; THUMB2-LABEL: cmp_ne_zero_and_rsr:
74 ; THUMB2-NEXT: lsls r1, r2
75 ; THUMB2-NEXT: ands r0, r1
77 ; THUMB2-NEXT: movne r0, #1
80 %and = and i32 %sh, %a
81 %res = icmp ne i32 %and, 0
85 define i1 @cmp_ne_zero_and_rsi(i32 %a, i32 %b) {
86 ; ARM-LABEL: cmp_ne_zero_and_rsi:
88 ; ARM-NEXT: ands r0, r0, r1, lsr #17
89 ; ARM-NEXT: movwne r0, #1
92 ; THUMB-LABEL: cmp_ne_zero_and_rsi:
94 ; THUMB-NEXT: lsrs r1, r1, #17
95 ; THUMB-NEXT: ands r0, r1
96 ; THUMB-NEXT: subs r1, r0, #1
97 ; THUMB-NEXT: sbcs r0, r1
100 ; THUMB2-LABEL: cmp_ne_zero_and_rsi:
102 ; THUMB2-NEXT: ands.w r0, r0, r1, lsr #17
104 ; THUMB2-NEXT: movne r0, #1
106 %sh = lshr i32 %b, 17
107 %and = and i32 %sh, %a
108 %res = icmp ne i32 %and, 0
112 define i1 @cmp_ne_zero_or_rr(i32 %a, i32 %b) {
113 ; ARM-LABEL: cmp_ne_zero_or_rr:
115 ; ARM-NEXT: orrs r0, r0, r1
116 ; ARM-NEXT: movwne r0, #1
119 ; THUMB-LABEL: cmp_ne_zero_or_rr:
121 ; THUMB-NEXT: orrs r0, r1
122 ; THUMB-NEXT: subs r1, r0, #1
123 ; THUMB-NEXT: sbcs r0, r1
126 ; THUMB2-LABEL: cmp_ne_zero_or_rr:
128 ; THUMB2-NEXT: orrs r0, r1
130 ; THUMB2-NEXT: movne r0, #1
133 %res = icmp ne i32 %or, 0
137 define i1 @cmp_ne_zero_or_ri(i32 %a) {
138 ; ARM-LABEL: cmp_ne_zero_or_ri:
140 ; ARM-NEXT: orrs r0, r0, #42
141 ; ARM-NEXT: movwne r0, #1
144 ; THUMB-LABEL: cmp_ne_zero_or_ri:
146 ; THUMB-NEXT: movs r1, #42
147 ; THUMB-NEXT: orrs r0, r1
148 ; THUMB-NEXT: subs r1, r0, #1
149 ; THUMB-NEXT: sbcs r0, r1
152 ; THUMB2-LABEL: cmp_ne_zero_or_ri:
154 ; THUMB2-NEXT: orrs r0, r0, #42
156 ; THUMB2-NEXT: movne r0, #1
159 %res = icmp ne i32 %or, 0
163 define i1 @cmp_ne_zero_or_rsr(i32 %a, i32 %b, i32 %c) {
164 ; ARM-LABEL: cmp_ne_zero_or_rsr:
166 ; ARM-NEXT: orrs r0, r0, r1, lsl r2
167 ; ARM-NEXT: movwne r0, #1
170 ; THUMB-LABEL: cmp_ne_zero_or_rsr:
172 ; THUMB-NEXT: lsls r1, r2
173 ; THUMB-NEXT: orrs r0, r1
174 ; THUMB-NEXT: subs r1, r0, #1
175 ; THUMB-NEXT: sbcs r0, r1
178 ; THUMB2-LABEL: cmp_ne_zero_or_rsr:
180 ; THUMB2-NEXT: lsls r1, r2
181 ; THUMB2-NEXT: orrs r0, r1
183 ; THUMB2-NEXT: movne r0, #1
187 %res = icmp ne i32 %or, 0
191 define i1 @cmp_ne_zero_or_rsi(i32 %a, i32 %b) {
192 ; ARM-LABEL: cmp_ne_zero_or_rsi:
194 ; ARM-NEXT: orrs r0, r0, r1, lsr #17
195 ; ARM-NEXT: movwne r0, #1
198 ; THUMB-LABEL: cmp_ne_zero_or_rsi:
200 ; THUMB-NEXT: lsrs r1, r1, #17
201 ; THUMB-NEXT: orrs r0, r1
202 ; THUMB-NEXT: subs r1, r0, #1
203 ; THUMB-NEXT: sbcs r0, r1
206 ; THUMB2-LABEL: cmp_ne_zero_or_rsi:
208 ; THUMB2-NEXT: orrs.w r0, r0, r1, lsr #17
210 ; THUMB2-NEXT: movne r0, #1
212 %sh = lshr i32 %b, 17
214 %res = icmp ne i32 %or, 0
218 define i1 @cmp_ne_zero_xor_rr(i32 %a, i32 %b) {
219 ; ARM-LABEL: cmp_ne_zero_xor_rr:
221 ; ARM-NEXT: eors r0, r0, r1
222 ; ARM-NEXT: movwne r0, #1
225 ; THUMB-LABEL: cmp_ne_zero_xor_rr:
227 ; THUMB-NEXT: eors r0, r1
228 ; THUMB-NEXT: subs r1, r0, #1
229 ; THUMB-NEXT: sbcs r0, r1
232 ; THUMB2-LABEL: cmp_ne_zero_xor_rr:
234 ; THUMB2-NEXT: eors r0, r1
236 ; THUMB2-NEXT: movne r0, #1
238 %xor = xor i32 %a, %b
239 %res = icmp ne i32 %xor, 0
243 define i1 @cmp_ne_zero_xor_ri(i32 %a) {
244 ; ARM-LABEL: cmp_ne_zero_xor_ri:
246 ; ARM-NEXT: subs r0, r0, #42
247 ; ARM-NEXT: movwne r0, #1
250 ; THUMB-LABEL: cmp_ne_zero_xor_ri:
252 ; THUMB-NEXT: subs r0, #42
253 ; THUMB-NEXT: subs r1, r0, #1
254 ; THUMB-NEXT: sbcs r0, r1
257 ; THUMB2-LABEL: cmp_ne_zero_xor_ri:
259 ; THUMB2-NEXT: subs r0, #42
261 ; THUMB2-NEXT: movne r0, #1
263 %xor = xor i32 %a, 42
264 %res = icmp ne i32 %xor, 0
268 define i1 @cmp_ne_zero_xor_rsr(i32 %a, i32 %b, i32 %c) {
269 ; ARM-LABEL: cmp_ne_zero_xor_rsr:
271 ; ARM-NEXT: eors r0, r0, r1, lsl r2
272 ; ARM-NEXT: movwne r0, #1
275 ; THUMB-LABEL: cmp_ne_zero_xor_rsr:
277 ; THUMB-NEXT: lsls r1, r2
278 ; THUMB-NEXT: eors r0, r1
279 ; THUMB-NEXT: subs r1, r0, #1
280 ; THUMB-NEXT: sbcs r0, r1
283 ; THUMB2-LABEL: cmp_ne_zero_xor_rsr:
285 ; THUMB2-NEXT: lsls r1, r2
286 ; THUMB2-NEXT: eors r0, r1
288 ; THUMB2-NEXT: movne r0, #1
291 %xor = xor i32 %sh, %a
292 %res = icmp ne i32 %xor, 0
296 define i1 @cmp_ne_zero_xor_rsi(i32 %a, i32 %b) {
297 ; ARM-LABEL: cmp_ne_zero_xor_rsi:
299 ; ARM-NEXT: eors r0, r0, r1, lsr #17
300 ; ARM-NEXT: movwne r0, #1
303 ; THUMB-LABEL: cmp_ne_zero_xor_rsi:
305 ; THUMB-NEXT: lsrs r1, r1, #17
306 ; THUMB-NEXT: eors r0, r1
307 ; THUMB-NEXT: subs r1, r0, #1
308 ; THUMB-NEXT: sbcs r0, r1
311 ; THUMB2-LABEL: cmp_ne_zero_xor_rsi:
313 ; THUMB2-NEXT: eors.w r0, r0, r1, lsr #17
315 ; THUMB2-NEXT: movne r0, #1
317 %sh = lshr i32 %b, 17
318 %xor = xor i32 %sh, %a
319 %res = icmp ne i32 %xor, 0
323 define i1 @cmp_ne_zero_and_not_rr(i32 %a, i32 %b) {
324 ; ARM-LABEL: cmp_ne_zero_and_not_rr:
326 ; ARM-NEXT: bics r0, r0, r1
327 ; ARM-NEXT: movwne r0, #1
330 ; THUMB-LABEL: cmp_ne_zero_and_not_rr:
332 ; THUMB-NEXT: bics r0, r1
333 ; THUMB-NEXT: subs r1, r0, #1
334 ; THUMB-NEXT: sbcs r0, r1
337 ; THUMB2-LABEL: cmp_ne_zero_and_not_rr:
339 ; THUMB2-NEXT: bics r0, r1
341 ; THUMB2-NEXT: movne r0, #1
343 %not = xor i32 %b, -1
344 %and = and i32 %a, %not
345 %res = icmp ne i32 %and, 0
349 define i1 @cmp_ne_zero_and_not_ri(i32 %a) {
350 ; ARM-LABEL: cmp_ne_zero_and_not_ri:
352 ; ARM-NEXT: bics r0, r0, #42
353 ; ARM-NEXT: movwne r0, #1
356 ; THUMB-LABEL: cmp_ne_zero_and_not_ri:
358 ; THUMB-NEXT: movs r1, #42
359 ; THUMB-NEXT: bics r0, r1
360 ; THUMB-NEXT: subs r1, r0, #1
361 ; THUMB-NEXT: sbcs r0, r1
364 ; THUMB2-LABEL: cmp_ne_zero_and_not_ri:
366 ; THUMB2-NEXT: bics r0, r0, #42
368 ; THUMB2-NEXT: movne r0, #1
370 %not = xor i32 42, -1
371 %and = and i32 %a, %not
372 %res = icmp ne i32 %and, 0
376 define i1 @cmp_ne_zero_and_not_rsr(i32 %a, i32 %b, i32 %c) {
377 ; ARM-LABEL: cmp_ne_zero_and_not_rsr:
379 ; ARM-NEXT: bics r0, r0, r1, lsl r2
380 ; ARM-NEXT: movwne r0, #1
383 ; THUMB-LABEL: cmp_ne_zero_and_not_rsr:
385 ; THUMB-NEXT: lsls r1, r2
386 ; THUMB-NEXT: bics r0, r1
387 ; THUMB-NEXT: subs r1, r0, #1
388 ; THUMB-NEXT: sbcs r0, r1
391 ; THUMB2-LABEL: cmp_ne_zero_and_not_rsr:
393 ; THUMB2-NEXT: lsls r1, r2
394 ; THUMB2-NEXT: bics r0, r1
396 ; THUMB2-NEXT: movne r0, #1
399 %not = xor i32 %sh, -1
400 %and = and i32 %not, %a
401 %res = icmp ne i32 %and, 0
405 define i1 @cmp_ne_zero_and_not_rsi(i32 %a, i32 %b) {
406 ; ARM-LABEL: cmp_ne_zero_and_not_rsi:
408 ; ARM-NEXT: bics r0, r0, r1, lsr #17
409 ; ARM-NEXT: movwne r0, #1
412 ; THUMB-LABEL: cmp_ne_zero_and_not_rsi:
414 ; THUMB-NEXT: lsrs r1, r1, #17
415 ; THUMB-NEXT: bics r0, r1
416 ; THUMB-NEXT: subs r1, r0, #1
417 ; THUMB-NEXT: sbcs r0, r1
420 ; THUMB2-LABEL: cmp_ne_zero_and_not_rsi:
422 ; THUMB2-NEXT: bics.w r0, r0, r1, lsr #17
424 ; THUMB2-NEXT: movne r0, #1
426 %sh = lshr i32 %b, 17
427 %not = xor i32 %sh, -1
428 %and = and i32 %not, %a
429 %res = icmp ne i32 %and, 0
433 define i1 @cmp_ne_zero_shl_rr(i32 %a, i32 %b) {
434 ; ARM-LABEL: cmp_ne_zero_shl_rr:
436 ; ARM-NEXT: lsls r0, r0, r1
437 ; ARM-NEXT: movwne r0, #1
440 ; THUMB-LABEL: cmp_ne_zero_shl_rr:
442 ; THUMB-NEXT: lsls r0, r1
443 ; THUMB-NEXT: subs r1, r0, #1
444 ; THUMB-NEXT: sbcs r0, r1
447 ; THUMB2-LABEL: cmp_ne_zero_shl_rr:
449 ; THUMB2-NEXT: lsls r0, r1
451 ; THUMB2-NEXT: movne r0, #1
454 %cmp = icmp ne i32 %sh, 0
458 define i1 @cmp_ne_zero_shl_ri(i32 %a) {
459 ; ARM-LABEL: cmp_ne_zero_shl_ri:
461 ; ARM-NEXT: lsls r0, r0, #7
462 ; ARM-NEXT: movwne r0, #1
465 ; THUMB-LABEL: cmp_ne_zero_shl_ri:
467 ; THUMB-NEXT: lsls r0, r0, #7
468 ; THUMB-NEXT: subs r1, r0, #1
469 ; THUMB-NEXT: sbcs r0, r1
472 ; THUMB2-LABEL: cmp_ne_zero_shl_ri:
474 ; THUMB2-NEXT: lsls r0, r0, #7
476 ; THUMB2-NEXT: movne r0, #1
479 %cmp = icmp ne i32 %sh, 0
483 define i1 @cmp_ne_zero_lshr_rr(i32 %a, i32 %b) {
484 ; ARM-LABEL: cmp_ne_zero_lshr_rr:
486 ; ARM-NEXT: lsrs r0, r0, r1
487 ; ARM-NEXT: movwne r0, #1
490 ; THUMB-LABEL: cmp_ne_zero_lshr_rr:
492 ; THUMB-NEXT: lsrs r0, r1
493 ; THUMB-NEXT: subs r1, r0, #1
494 ; THUMB-NEXT: sbcs r0, r1
497 ; THUMB2-LABEL: cmp_ne_zero_lshr_rr:
499 ; THUMB2-NEXT: lsrs r0, r1
501 ; THUMB2-NEXT: movne r0, #1
503 %sh = lshr i32 %a, %b
504 %cmp = icmp ne i32 %sh, 0
508 define i1 @cmp_ne_zero_lshr_ri(i32 %a) {
509 ; ARM-LABEL: cmp_ne_zero_lshr_ri:
511 ; ARM-NEXT: lsrs r0, r0, #7
512 ; ARM-NEXT: movwne r0, #1
515 ; THUMB-LABEL: cmp_ne_zero_lshr_ri:
517 ; THUMB-NEXT: lsrs r0, r0, #7
518 ; THUMB-NEXT: subs r1, r0, #1
519 ; THUMB-NEXT: sbcs r0, r1
522 ; THUMB2-LABEL: cmp_ne_zero_lshr_ri:
524 ; THUMB2-NEXT: lsrs r0, r0, #7
526 ; THUMB2-NEXT: movne r0, #1
529 %cmp = icmp ne i32 %sh, 0
533 define i1 @cmp_ne_zero_ashr_rr(i32 %a, i32 %b) {
534 ; ARM-LABEL: cmp_ne_zero_ashr_rr:
536 ; ARM-NEXT: asrs r0, r0, r1
537 ; ARM-NEXT: movwne r0, #1
540 ; THUMB-LABEL: cmp_ne_zero_ashr_rr:
542 ; THUMB-NEXT: asrs r0, r1
543 ; THUMB-NEXT: subs r1, r0, #1
544 ; THUMB-NEXT: sbcs r0, r1
547 ; THUMB2-LABEL: cmp_ne_zero_ashr_rr:
549 ; THUMB2-NEXT: asrs r0, r1
550 ; THUMB2-NEXT: cmp r0, #0
552 ; THUMB2-NEXT: movne r0, #1
554 %sh = ashr i32 %a, %b
555 %cmp = icmp ne i32 %sh, 0
559 define i1 @cmp_ne_zero_ashr_ri(i32 %a) {
560 ; ARM-LABEL: cmp_ne_zero_ashr_ri:
562 ; ARM-NEXT: asrs r0, r0, #7
563 ; ARM-NEXT: movwne r0, #1
566 ; THUMB-LABEL: cmp_ne_zero_ashr_ri:
568 ; THUMB-NEXT: asrs r0, r0, #7
569 ; THUMB-NEXT: subs r1, r0, #1
570 ; THUMB-NEXT: sbcs r0, r1
573 ; THUMB2-LABEL: cmp_ne_zero_ashr_ri:
575 ; THUMB2-NEXT: asrs r0, r0, #7
576 ; THUMB2-NEXT: cmp r0, #0
578 ; THUMB2-NEXT: movne r0, #1
581 %cmp = icmp ne i32 %sh, 0
585 define i1 @cmp_eq_zero_and_rr(i32 %a, i32 %b) {
586 ; ARM-LABEL: cmp_eq_zero_and_rr:
588 ; ARM-NEXT: and r0, r0, r1
589 ; ARM-NEXT: clz r0, r0
590 ; ARM-NEXT: lsr r0, r0, #5
593 ; THUMB-LABEL: cmp_eq_zero_and_rr:
595 ; THUMB-NEXT: ands r0, r1
596 ; THUMB-NEXT: rsbs r1, r0, #0
597 ; THUMB-NEXT: adcs r0, r1
600 ; THUMB2-LABEL: cmp_eq_zero_and_rr:
602 ; THUMB2-NEXT: ands r0, r1
603 ; THUMB2-NEXT: clz r0, r0
604 ; THUMB2-NEXT: lsrs r0, r0, #5
606 %and = and i32 %a, %b
607 %res = icmp eq i32 %and, 0
611 define i1 @cmp_eq_zero_and_ri(i32 %a) {
612 ; ARM-LABEL: cmp_eq_zero_and_ri:
614 ; ARM-NEXT: and r0, r0, #42
615 ; ARM-NEXT: clz r0, r0
616 ; ARM-NEXT: lsr r0, r0, #5
619 ; THUMB-LABEL: cmp_eq_zero_and_ri:
621 ; THUMB-NEXT: movs r1, #42
622 ; THUMB-NEXT: ands r0, r1
623 ; THUMB-NEXT: rsbs r1, r0, #0
624 ; THUMB-NEXT: adcs r0, r1
627 ; THUMB2-LABEL: cmp_eq_zero_and_ri:
629 ; THUMB2-NEXT: and r0, r0, #42
630 ; THUMB2-NEXT: clz r0, r0
631 ; THUMB2-NEXT: lsrs r0, r0, #5
633 %and = and i32 %a, 42
634 %res = icmp eq i32 %and, 0
638 define i1 @cmp_eq_zero_and_rsr(i32 %a, i32 %b, i32 %c) {
639 ; ARM-LABEL: cmp_eq_zero_and_rsr:
641 ; ARM-NEXT: and r0, r0, r1, lsl r2
642 ; ARM-NEXT: clz r0, r0
643 ; ARM-NEXT: lsr r0, r0, #5
646 ; THUMB-LABEL: cmp_eq_zero_and_rsr:
648 ; THUMB-NEXT: lsls r1, r2
649 ; THUMB-NEXT: ands r0, r1
650 ; THUMB-NEXT: rsbs r1, r0, #0
651 ; THUMB-NEXT: adcs r0, r1
654 ; THUMB2-LABEL: cmp_eq_zero_and_rsr:
656 ; THUMB2-NEXT: lsls r1, r2
657 ; THUMB2-NEXT: ands r0, r1
658 ; THUMB2-NEXT: clz r0, r0
659 ; THUMB2-NEXT: lsrs r0, r0, #5
662 %and = and i32 %sh, %a
663 %res = icmp eq i32 %and, 0
667 define i1 @cmp_eq_zero_and_rsi(i32 %a, i32 %b) {
668 ; ARM-LABEL: cmp_eq_zero_and_rsi:
670 ; ARM-NEXT: and r0, r0, r1, lsr #17
671 ; ARM-NEXT: clz r0, r0
672 ; ARM-NEXT: lsr r0, r0, #5
675 ; THUMB-LABEL: cmp_eq_zero_and_rsi:
677 ; THUMB-NEXT: lsrs r1, r1, #17
678 ; THUMB-NEXT: ands r0, r1
679 ; THUMB-NEXT: rsbs r1, r0, #0
680 ; THUMB-NEXT: adcs r0, r1
683 ; THUMB2-LABEL: cmp_eq_zero_and_rsi:
685 ; THUMB2-NEXT: and.w r0, r0, r1, lsr #17
686 ; THUMB2-NEXT: clz r0, r0
687 ; THUMB2-NEXT: lsrs r0, r0, #5
689 %sh = lshr i32 %b, 17
690 %and = and i32 %sh, %a
691 %res = icmp eq i32 %and, 0
695 define i1 @cmp_eq_zero_or_rr(i32 %a, i32 %b) {
696 ; ARM-LABEL: cmp_eq_zero_or_rr:
698 ; ARM-NEXT: orr r0, r0, r1
699 ; ARM-NEXT: clz r0, r0
700 ; ARM-NEXT: lsr r0, r0, #5
703 ; THUMB-LABEL: cmp_eq_zero_or_rr:
705 ; THUMB-NEXT: orrs r0, r1
706 ; THUMB-NEXT: rsbs r1, r0, #0
707 ; THUMB-NEXT: adcs r0, r1
710 ; THUMB2-LABEL: cmp_eq_zero_or_rr:
712 ; THUMB2-NEXT: orrs r0, r1
713 ; THUMB2-NEXT: clz r0, r0
714 ; THUMB2-NEXT: lsrs r0, r0, #5
717 %res = icmp eq i32 %or, 0
721 define i1 @cmp_eq_zero_or_ri(i32 %a) {
722 ; ARM-LABEL: cmp_eq_zero_or_ri:
724 ; ARM-NEXT: mov r0, #0
727 ; THUMB-LABEL: cmp_eq_zero_or_ri:
729 ; THUMB-NEXT: movs r1, #42
730 ; THUMB-NEXT: orrs r0, r1
731 ; THUMB-NEXT: rsbs r1, r0, #0
732 ; THUMB-NEXT: adcs r0, r1
735 ; THUMB2-LABEL: cmp_eq_zero_or_ri:
737 ; THUMB2-NEXT: movs r0, #0
740 %res = icmp eq i32 %or, 0
744 define i1 @cmp_eq_zero_or_rsr(i32 %a, i32 %b, i32 %c) {
745 ; ARM-LABEL: cmp_eq_zero_or_rsr:
747 ; ARM-NEXT: orr r0, r0, r1, lsl r2
748 ; ARM-NEXT: clz r0, r0
749 ; ARM-NEXT: lsr r0, r0, #5
752 ; THUMB-LABEL: cmp_eq_zero_or_rsr:
754 ; THUMB-NEXT: lsls r1, r2
755 ; THUMB-NEXT: orrs r0, r1
756 ; THUMB-NEXT: rsbs r1, r0, #0
757 ; THUMB-NEXT: adcs r0, r1
760 ; THUMB2-LABEL: cmp_eq_zero_or_rsr:
762 ; THUMB2-NEXT: lsls r1, r2
763 ; THUMB2-NEXT: orrs r0, r1
764 ; THUMB2-NEXT: clz r0, r0
765 ; THUMB2-NEXT: lsrs r0, r0, #5
769 %res = icmp eq i32 %or, 0
773 define i1 @cmp_eq_zero_or_rsi(i32 %a, i32 %b) {
774 ; ARM-LABEL: cmp_eq_zero_or_rsi:
776 ; ARM-NEXT: orr r0, r0, r1, lsr #17
777 ; ARM-NEXT: clz r0, r0
778 ; ARM-NEXT: lsr r0, r0, #5
781 ; THUMB-LABEL: cmp_eq_zero_or_rsi:
783 ; THUMB-NEXT: lsrs r1, r1, #17
784 ; THUMB-NEXT: orrs r0, r1
785 ; THUMB-NEXT: rsbs r1, r0, #0
786 ; THUMB-NEXT: adcs r0, r1
789 ; THUMB2-LABEL: cmp_eq_zero_or_rsi:
791 ; THUMB2-NEXT: orr.w r0, r0, r1, lsr #17
792 ; THUMB2-NEXT: clz r0, r0
793 ; THUMB2-NEXT: lsrs r0, r0, #5
795 %sh = lshr i32 %b, 17
797 %res = icmp eq i32 %or, 0
801 define i1 @cmp_eq_zero_xor_rr(i32 %a, i32 %b) {
802 ; ARM-LABEL: cmp_eq_zero_xor_rr:
804 ; ARM-NEXT: eor r0, r0, r1
805 ; ARM-NEXT: clz r0, r0
806 ; ARM-NEXT: lsr r0, r0, #5
809 ; THUMB-LABEL: cmp_eq_zero_xor_rr:
811 ; THUMB-NEXT: eors r0, r1
812 ; THUMB-NEXT: rsbs r1, r0, #0
813 ; THUMB-NEXT: adcs r0, r1
816 ; THUMB2-LABEL: cmp_eq_zero_xor_rr:
818 ; THUMB2-NEXT: eors r0, r1
819 ; THUMB2-NEXT: clz r0, r0
820 ; THUMB2-NEXT: lsrs r0, r0, #5
822 %xor = xor i32 %a, %b
823 %res = icmp eq i32 %xor, 0
827 define i1 @cmp_eq_zero_xor_ri(i32 %a) {
828 ; ARM-LABEL: cmp_eq_zero_xor_ri:
830 ; ARM-NEXT: sub r0, r0, #42
831 ; ARM-NEXT: clz r0, r0
832 ; ARM-NEXT: lsr r0, r0, #5
835 ; THUMB-LABEL: cmp_eq_zero_xor_ri:
837 ; THUMB-NEXT: subs r0, #42
838 ; THUMB-NEXT: rsbs r1, r0, #0
839 ; THUMB-NEXT: adcs r0, r1
842 ; THUMB2-LABEL: cmp_eq_zero_xor_ri:
844 ; THUMB2-NEXT: subs r0, #42
845 ; THUMB2-NEXT: clz r0, r0
846 ; THUMB2-NEXT: lsrs r0, r0, #5
848 %xor = xor i32 %a, 42
849 %res = icmp eq i32 %xor, 0
853 define i1 @cmp_eq_zero_xor_rsr(i32 %a, i32 %b, i32 %c) {
854 ; ARM-LABEL: cmp_eq_zero_xor_rsr:
856 ; ARM-NEXT: eor r0, r0, r1, lsl r2
857 ; ARM-NEXT: clz r0, r0
858 ; ARM-NEXT: lsr r0, r0, #5
861 ; THUMB-LABEL: cmp_eq_zero_xor_rsr:
863 ; THUMB-NEXT: lsls r1, r2
864 ; THUMB-NEXT: eors r0, r1
865 ; THUMB-NEXT: rsbs r1, r0, #0
866 ; THUMB-NEXT: adcs r0, r1
869 ; THUMB2-LABEL: cmp_eq_zero_xor_rsr:
871 ; THUMB2-NEXT: lsls r1, r2
872 ; THUMB2-NEXT: eors r0, r1
873 ; THUMB2-NEXT: clz r0, r0
874 ; THUMB2-NEXT: lsrs r0, r0, #5
877 %xor = xor i32 %sh, %a
878 %res = icmp eq i32 %xor, 0
882 define i1 @cmp_eq_zero_xor_rsi(i32 %a, i32 %b) {
883 ; ARM-LABEL: cmp_eq_zero_xor_rsi:
885 ; ARM-NEXT: eor r0, r0, r1, lsr #17
886 ; ARM-NEXT: clz r0, r0
887 ; ARM-NEXT: lsr r0, r0, #5
890 ; THUMB-LABEL: cmp_eq_zero_xor_rsi:
892 ; THUMB-NEXT: lsrs r1, r1, #17
893 ; THUMB-NEXT: eors r0, r1
894 ; THUMB-NEXT: rsbs r1, r0, #0
895 ; THUMB-NEXT: adcs r0, r1
898 ; THUMB2-LABEL: cmp_eq_zero_xor_rsi:
900 ; THUMB2-NEXT: eor.w r0, r0, r1, lsr #17
901 ; THUMB2-NEXT: clz r0, r0
902 ; THUMB2-NEXT: lsrs r0, r0, #5
904 %sh = lshr i32 %b, 17
905 %xor = xor i32 %sh, %a
906 %res = icmp eq i32 %xor, 0
910 define i1 @cmp_eq_zero_and_not_rr(i32 %a, i32 %b) {
911 ; ARM-LABEL: cmp_eq_zero_and_not_rr:
913 ; ARM-NEXT: bic r0, r0, r1
914 ; ARM-NEXT: clz r0, r0
915 ; ARM-NEXT: lsr r0, r0, #5
918 ; THUMB-LABEL: cmp_eq_zero_and_not_rr:
920 ; THUMB-NEXT: bics r0, r1
921 ; THUMB-NEXT: rsbs r1, r0, #0
922 ; THUMB-NEXT: adcs r0, r1
925 ; THUMB2-LABEL: cmp_eq_zero_and_not_rr:
927 ; THUMB2-NEXT: bics r0, r1
928 ; THUMB2-NEXT: clz r0, r0
929 ; THUMB2-NEXT: lsrs r0, r0, #5
931 %not = xor i32 %b, -1
932 %and = and i32 %a, %not
933 %res = icmp eq i32 %and, 0
937 define i1 @cmp_eq_zero_and_not_ri(i32 %a) {
938 ; ARM-LABEL: cmp_eq_zero_and_not_ri:
940 ; ARM-NEXT: bic r0, r0, #42
941 ; ARM-NEXT: clz r0, r0
942 ; ARM-NEXT: lsr r0, r0, #5
945 ; THUMB-LABEL: cmp_eq_zero_and_not_ri:
947 ; THUMB-NEXT: movs r1, #42
948 ; THUMB-NEXT: bics r0, r1
949 ; THUMB-NEXT: rsbs r1, r0, #0
950 ; THUMB-NEXT: adcs r0, r1
953 ; THUMB2-LABEL: cmp_eq_zero_and_not_ri:
955 ; THUMB2-NEXT: bic r0, r0, #42
956 ; THUMB2-NEXT: clz r0, r0
957 ; THUMB2-NEXT: lsrs r0, r0, #5
959 %not = xor i32 42, -1
960 %and = and i32 %a, %not
961 %res = icmp eq i32 %and, 0
965 define i1 @cmp_eq_zero_and_not_rsr(i32 %a, i32 %b, i32 %c) {
966 ; ARM-LABEL: cmp_eq_zero_and_not_rsr:
968 ; ARM-NEXT: bic r0, r0, r1, lsl r2
969 ; ARM-NEXT: clz r0, r0
970 ; ARM-NEXT: lsr r0, r0, #5
973 ; THUMB-LABEL: cmp_eq_zero_and_not_rsr:
975 ; THUMB-NEXT: lsls r1, r2
976 ; THUMB-NEXT: bics r0, r1
977 ; THUMB-NEXT: rsbs r1, r0, #0
978 ; THUMB-NEXT: adcs r0, r1
981 ; THUMB2-LABEL: cmp_eq_zero_and_not_rsr:
983 ; THUMB2-NEXT: lsls r1, r2
984 ; THUMB2-NEXT: bics r0, r1
985 ; THUMB2-NEXT: clz r0, r0
986 ; THUMB2-NEXT: lsrs r0, r0, #5
989 %not = xor i32 %sh, -1
990 %and = and i32 %not, %a
991 %res = icmp eq i32 %and, 0
995 define i1 @cmp_eq_zero_and_not_rsi(i32 %a, i32 %b) {
996 ; ARM-LABEL: cmp_eq_zero_and_not_rsi:
998 ; ARM-NEXT: bic r0, r0, r1, lsr #17
999 ; ARM-NEXT: clz r0, r0
1000 ; ARM-NEXT: lsr r0, r0, #5
1003 ; THUMB-LABEL: cmp_eq_zero_and_not_rsi:
1005 ; THUMB-NEXT: lsrs r1, r1, #17
1006 ; THUMB-NEXT: bics r0, r1
1007 ; THUMB-NEXT: rsbs r1, r0, #0
1008 ; THUMB-NEXT: adcs r0, r1
1011 ; THUMB2-LABEL: cmp_eq_zero_and_not_rsi:
1013 ; THUMB2-NEXT: bic.w r0, r0, r1, lsr #17
1014 ; THUMB2-NEXT: clz r0, r0
1015 ; THUMB2-NEXT: lsrs r0, r0, #5
1016 ; THUMB2-NEXT: bx lr
1017 %sh = lshr i32 %b, 17
1018 %not = xor i32 %sh, -1
1019 %and = and i32 %not, %a
1020 %res = icmp eq i32 %and, 0
1024 define i1 @cmp_eq_zero_shl_rr(i32 %a, i32 %b) {
1025 ; ARM-LABEL: cmp_eq_zero_shl_rr:
1027 ; ARM-NEXT: lsl r0, r0, r1
1028 ; ARM-NEXT: clz r0, r0
1029 ; ARM-NEXT: lsr r0, r0, #5
1032 ; THUMB-LABEL: cmp_eq_zero_shl_rr:
1034 ; THUMB-NEXT: lsls r0, r1
1035 ; THUMB-NEXT: rsbs r1, r0, #0
1036 ; THUMB-NEXT: adcs r0, r1
1039 ; THUMB2-LABEL: cmp_eq_zero_shl_rr:
1041 ; THUMB2-NEXT: lsls r0, r1
1042 ; THUMB2-NEXT: clz r0, r0
1043 ; THUMB2-NEXT: lsrs r0, r0, #5
1044 ; THUMB2-NEXT: bx lr
1045 %sh = shl i32 %a, %b
1046 %cmp = icmp eq i32 %sh, 0
1050 define i1 @cmp_eq_zero_shl_ri(i32 %a) {
1051 ; ARM-LABEL: cmp_eq_zero_shl_ri:
1053 ; ARM-NEXT: lsl r0, r0, #7
1054 ; ARM-NEXT: clz r0, r0
1055 ; ARM-NEXT: lsr r0, r0, #5
1058 ; THUMB-LABEL: cmp_eq_zero_shl_ri:
1060 ; THUMB-NEXT: lsls r1, r0, #7
1061 ; THUMB-NEXT: rsbs r0, r1, #0
1062 ; THUMB-NEXT: adcs r0, r1
1065 ; THUMB2-LABEL: cmp_eq_zero_shl_ri:
1067 ; THUMB2-NEXT: lsls r0, r0, #7
1068 ; THUMB2-NEXT: clz r0, r0
1069 ; THUMB2-NEXT: lsrs r0, r0, #5
1070 ; THUMB2-NEXT: bx lr
1072 %cmp = icmp eq i32 %sh, 0
1076 define i1 @cmp_eq_zero_lshr_rr(i32 %a, i32 %b) {
1077 ; ARM-LABEL: cmp_eq_zero_lshr_rr:
1079 ; ARM-NEXT: lsr r0, r0, r1
1080 ; ARM-NEXT: clz r0, r0
1081 ; ARM-NEXT: lsr r0, r0, #5
1084 ; THUMB-LABEL: cmp_eq_zero_lshr_rr:
1086 ; THUMB-NEXT: lsrs r0, r1
1087 ; THUMB-NEXT: rsbs r1, r0, #0
1088 ; THUMB-NEXT: adcs r0, r1
1091 ; THUMB2-LABEL: cmp_eq_zero_lshr_rr:
1093 ; THUMB2-NEXT: lsrs r0, r1
1094 ; THUMB2-NEXT: clz r0, r0
1095 ; THUMB2-NEXT: lsrs r0, r0, #5
1096 ; THUMB2-NEXT: bx lr
1097 %sh = lshr i32 %a, %b
1098 %cmp = icmp eq i32 %sh, 0
1102 define i1 @cmp_eq_zero_lshr_ri(i32 %a) {
1103 ; ARM-LABEL: cmp_eq_zero_lshr_ri:
1105 ; ARM-NEXT: lsr r0, r0, #7
1106 ; ARM-NEXT: clz r0, r0
1107 ; ARM-NEXT: lsr r0, r0, #5
1110 ; THUMB-LABEL: cmp_eq_zero_lshr_ri:
1112 ; THUMB-NEXT: lsrs r1, r0, #7
1113 ; THUMB-NEXT: rsbs r0, r1, #0
1114 ; THUMB-NEXT: adcs r0, r1
1117 ; THUMB2-LABEL: cmp_eq_zero_lshr_ri:
1119 ; THUMB2-NEXT: lsrs r0, r0, #7
1120 ; THUMB2-NEXT: clz r0, r0
1121 ; THUMB2-NEXT: lsrs r0, r0, #5
1122 ; THUMB2-NEXT: bx lr
1123 %sh = lshr i32 %a, 7
1124 %cmp = icmp eq i32 %sh, 0
1128 define i1 @cmp_eq_zero_ashr_rr(i32 %a, i32 %b) {
1129 ; ARM-LABEL: cmp_eq_zero_ashr_rr:
1131 ; ARM-NEXT: asr r0, r0, r1
1132 ; ARM-NEXT: clz r0, r0
1133 ; ARM-NEXT: lsr r0, r0, #5
1136 ; THUMB-LABEL: cmp_eq_zero_ashr_rr:
1138 ; THUMB-NEXT: asrs r0, r1
1139 ; THUMB-NEXT: rsbs r1, r0, #0
1140 ; THUMB-NEXT: adcs r0, r1
1143 ; THUMB2-LABEL: cmp_eq_zero_ashr_rr:
1145 ; THUMB2-NEXT: asrs r0, r1
1146 ; THUMB2-NEXT: clz r0, r0
1147 ; THUMB2-NEXT: lsrs r0, r0, #5
1148 ; THUMB2-NEXT: bx lr
1149 %sh = ashr i32 %a, %b
1150 %cmp = icmp eq i32 %sh, 0
1154 define i1 @cmp_eq_zero_ashr_ri(i32 %a) {
1155 ; ARM-LABEL: cmp_eq_zero_ashr_ri:
1157 ; ARM-NEXT: asr r0, r0, #7
1158 ; ARM-NEXT: clz r0, r0
1159 ; ARM-NEXT: lsr r0, r0, #5
1162 ; THUMB-LABEL: cmp_eq_zero_ashr_ri:
1164 ; THUMB-NEXT: asrs r1, r0, #7
1165 ; THUMB-NEXT: rsbs r0, r1, #0
1166 ; THUMB-NEXT: adcs r0, r1
1169 ; THUMB2-LABEL: cmp_eq_zero_ashr_ri:
1171 ; THUMB2-NEXT: asrs r0, r0, #7
1172 ; THUMB2-NEXT: clz r0, r0
1173 ; THUMB2-NEXT: lsrs r0, r0, #5
1174 ; THUMB2-NEXT: bx lr
1175 %sh = ashr i32 %a, 7
1176 %cmp = icmp eq i32 %sh, 0
1180 declare void @consume(i32 %0);
1182 define void @br_on_binop_eq_zero(i32 %a, i32 %b) {
1183 ; ARM-LABEL: br_on_binop_eq_zero:
1185 ; ARM-NEXT: orrs r1, r0, r1
1187 ; ARM-NEXT: .LBB44_1: @ %true_br
1188 ; ARM-NEXT: push {r11, lr}
1189 ; ARM-NEXT: bl consume
1190 ; ARM-NEXT: pop {r11, lr}
1193 ; THUMB-LABEL: br_on_binop_eq_zero:
1195 ; THUMB-NEXT: push {r7, lr}
1196 ; THUMB-NEXT: orrs r1, r0
1197 ; THUMB-NEXT: beq .LBB44_2
1198 ; THUMB-NEXT: @ %bb.1: @ %exit
1199 ; THUMB-NEXT: pop {r7, pc}
1200 ; THUMB-NEXT: .LBB44_2: @ %true_br
1201 ; THUMB-NEXT: bl consume
1202 ; THUMB-NEXT: pop {r7, pc}
1204 ; THUMB2-LABEL: br_on_binop_eq_zero:
1206 ; THUMB2-NEXT: orrs r1, r0
1207 ; THUMB2-NEXT: it ne
1208 ; THUMB2-NEXT: bxne lr
1209 ; THUMB2-NEXT: .LBB44_1: @ %true_br
1210 ; THUMB2-NEXT: push {r7, lr}
1211 ; THUMB2-NEXT: bl consume
1212 ; THUMB2-NEXT: pop.w {r7, lr}
1213 ; THUMB2-NEXT: bx lr
1215 %cmp = icmp eq i32 %or, 0
1216 br i1 %cmp, label %true_br, label %exit
1218 call void @consume(i32 %a)
1224 define void @br_on_binop_ne_zero(i32 %a, i32 %b) {
1225 ; ARM-LABEL: br_on_binop_ne_zero:
1227 ; ARM-NEXT: orrs r1, r0, r1
1229 ; ARM-NEXT: .LBB45_1: @ %true_br
1230 ; ARM-NEXT: push {r11, lr}
1231 ; ARM-NEXT: bl consume
1232 ; ARM-NEXT: pop {r11, lr}
1235 ; THUMB-LABEL: br_on_binop_ne_zero:
1237 ; THUMB-NEXT: push {r7, lr}
1238 ; THUMB-NEXT: orrs r1, r0
1239 ; THUMB-NEXT: beq .LBB45_2
1240 ; THUMB-NEXT: @ %bb.1: @ %true_br
1241 ; THUMB-NEXT: bl consume
1242 ; THUMB-NEXT: .LBB45_2: @ %exit
1243 ; THUMB-NEXT: pop {r7, pc}
1245 ; THUMB2-LABEL: br_on_binop_ne_zero:
1247 ; THUMB2-NEXT: orrs r1, r0
1248 ; THUMB2-NEXT: it eq
1249 ; THUMB2-NEXT: bxeq lr
1250 ; THUMB2-NEXT: .LBB45_1: @ %true_br
1251 ; THUMB2-NEXT: push {r7, lr}
1252 ; THUMB2-NEXT: bl consume
1253 ; THUMB2-NEXT: pop.w {r7, lr}
1254 ; THUMB2-NEXT: bx lr
1256 %cmp = icmp ne i32 %or, 0
1257 br i1 %cmp, label %true_br, label %exit
1259 call void @consume(i32 %a)
1265 define void @br_on_binop_lt_zero(i32 %a, i32 %b) {
1266 ; ARM-LABEL: br_on_binop_lt_zero:
1268 ; ARM-NEXT: orr r1, r0, r1
1269 ; ARM-NEXT: cmp r1, #0
1271 ; ARM-NEXT: .LBB46_1: @ %true_br
1272 ; ARM-NEXT: push {r11, lr}
1273 ; ARM-NEXT: bl consume
1274 ; ARM-NEXT: pop {r11, lr}
1277 ; THUMB-LABEL: br_on_binop_lt_zero:
1279 ; THUMB-NEXT: push {r7, lr}
1280 ; THUMB-NEXT: orrs r1, r0
1281 ; THUMB-NEXT: cmp r1, #0
1282 ; THUMB-NEXT: bhs .LBB46_2
1283 ; THUMB-NEXT: @ %bb.1: @ %true_br
1284 ; THUMB-NEXT: bl consume
1285 ; THUMB-NEXT: .LBB46_2: @ %exit
1286 ; THUMB-NEXT: pop {r7, pc}
1288 ; THUMB2-LABEL: br_on_binop_lt_zero:
1290 ; THUMB2-NEXT: orrs r1, r0
1291 ; THUMB2-NEXT: cmp r1, #0
1292 ; THUMB2-NEXT: it hs
1293 ; THUMB2-NEXT: bxhs lr
1294 ; THUMB2-NEXT: .LBB46_1: @ %true_br
1295 ; THUMB2-NEXT: push {r7, lr}
1296 ; THUMB2-NEXT: bl consume
1297 ; THUMB2-NEXT: pop.w {r7, lr}
1298 ; THUMB2-NEXT: bx lr
1300 %cmp = icmp ult i32 %or, 0
1301 br i1 %cmp, label %true_br, label %exit
1303 call void @consume(i32 %a)
1309 define void @br_on_binop_eq_imm(i32 %a, i32 %b) {
1310 ; ARM-LABEL: br_on_binop_eq_imm:
1312 ; ARM-NEXT: orr r1, r0, r1
1313 ; ARM-NEXT: cmp r1, #42
1315 ; ARM-NEXT: .LBB47_1: @ %true_br
1316 ; ARM-NEXT: push {r11, lr}
1317 ; ARM-NEXT: bl consume
1318 ; ARM-NEXT: pop {r11, lr}
1321 ; THUMB-LABEL: br_on_binop_eq_imm:
1323 ; THUMB-NEXT: push {r7, lr}
1324 ; THUMB-NEXT: orrs r1, r0
1325 ; THUMB-NEXT: cmp r1, #42
1326 ; THUMB-NEXT: bne .LBB47_2
1327 ; THUMB-NEXT: @ %bb.1: @ %true_br
1328 ; THUMB-NEXT: bl consume
1329 ; THUMB-NEXT: .LBB47_2: @ %exit
1330 ; THUMB-NEXT: pop {r7, pc}
1332 ; THUMB2-LABEL: br_on_binop_eq_imm:
1334 ; THUMB2-NEXT: orrs r1, r0
1335 ; THUMB2-NEXT: cmp r1, #42
1336 ; THUMB2-NEXT: it ne
1337 ; THUMB2-NEXT: bxne lr
1338 ; THUMB2-NEXT: .LBB47_1: @ %true_br
1339 ; THUMB2-NEXT: push {r7, lr}
1340 ; THUMB2-NEXT: bl consume
1341 ; THUMB2-NEXT: pop.w {r7, lr}
1342 ; THUMB2-NEXT: bx lr
1344 %cmp = icmp eq i32 %or, 42
1345 br i1 %cmp, label %true_br, label %exit
1347 call void @consume(i32 %a)
1353 define void @br_on_binop_ne_imm(i32 %a, i32 %b) {
1354 ; ARM-LABEL: br_on_binop_ne_imm:
1356 ; ARM-NEXT: orr r1, r0, r1
1357 ; ARM-NEXT: cmp r1, #42
1359 ; ARM-NEXT: .LBB48_1: @ %true_br
1360 ; ARM-NEXT: push {r11, lr}
1361 ; ARM-NEXT: bl consume
1362 ; ARM-NEXT: pop {r11, lr}
1365 ; THUMB-LABEL: br_on_binop_ne_imm:
1367 ; THUMB-NEXT: push {r7, lr}
1368 ; THUMB-NEXT: orrs r1, r0
1369 ; THUMB-NEXT: cmp r1, #42
1370 ; THUMB-NEXT: beq .LBB48_2
1371 ; THUMB-NEXT: @ %bb.1: @ %true_br
1372 ; THUMB-NEXT: bl consume
1373 ; THUMB-NEXT: .LBB48_2: @ %exit
1374 ; THUMB-NEXT: pop {r7, pc}
1376 ; THUMB2-LABEL: br_on_binop_ne_imm:
1378 ; THUMB2-NEXT: orrs r1, r0
1379 ; THUMB2-NEXT: cmp r1, #42
1380 ; THUMB2-NEXT: it eq
1381 ; THUMB2-NEXT: bxeq lr
1382 ; THUMB2-NEXT: .LBB48_1: @ %true_br
1383 ; THUMB2-NEXT: push {r7, lr}
1384 ; THUMB2-NEXT: bl consume
1385 ; THUMB2-NEXT: pop.w {r7, lr}
1386 ; THUMB2-NEXT: bx lr
1388 %cmp = icmp ne i32 %or, 42
1389 br i1 %cmp, label %true_br, label %exit
1391 call void @consume(i32 %a)
1397 define void @br_on_binop_eq_reg(i32 %a, i32 %b, i32 %c) {
1398 ; ARM-LABEL: br_on_binop_eq_reg:
1400 ; ARM-NEXT: eor r1, r0, r1
1401 ; ARM-NEXT: cmp r1, r2
1403 ; ARM-NEXT: .LBB49_1: @ %true_br
1404 ; ARM-NEXT: push {r11, lr}
1405 ; ARM-NEXT: bl consume
1406 ; ARM-NEXT: pop {r11, lr}
1409 ; THUMB-LABEL: br_on_binop_eq_reg:
1411 ; THUMB-NEXT: push {r7, lr}
1412 ; THUMB-NEXT: eors r1, r0
1413 ; THUMB-NEXT: cmp r1, r2
1414 ; THUMB-NEXT: bne .LBB49_2
1415 ; THUMB-NEXT: @ %bb.1: @ %true_br
1416 ; THUMB-NEXT: bl consume
1417 ; THUMB-NEXT: .LBB49_2: @ %exit
1418 ; THUMB-NEXT: pop {r7, pc}
1420 ; THUMB2-LABEL: br_on_binop_eq_reg:
1422 ; THUMB2-NEXT: eors r1, r0
1423 ; THUMB2-NEXT: cmp r1, r2
1424 ; THUMB2-NEXT: it ne
1425 ; THUMB2-NEXT: bxne lr
1426 ; THUMB2-NEXT: .LBB49_1: @ %true_br
1427 ; THUMB2-NEXT: push {r7, lr}
1428 ; THUMB2-NEXT: bl consume
1429 ; THUMB2-NEXT: pop.w {r7, lr}
1430 ; THUMB2-NEXT: bx lr
1431 %xor = xor i32 %a, %b
1432 %cmp = icmp eq i32 %xor, %c
1433 br i1 %cmp, label %true_br, label %exit
1435 call void @consume(i32 %a)
1441 define void @br_on_binop_ne_reg(i32 %a, i32 %b, i32 %c) {
1442 ; ARM-LABEL: br_on_binop_ne_reg:
1444 ; ARM-NEXT: and r1, r0, r1
1445 ; ARM-NEXT: cmp r1, r2
1447 ; ARM-NEXT: .LBB50_1: @ %true_br
1448 ; ARM-NEXT: push {r11, lr}
1449 ; ARM-NEXT: bl consume
1450 ; ARM-NEXT: pop {r11, lr}
1453 ; THUMB-LABEL: br_on_binop_ne_reg:
1455 ; THUMB-NEXT: push {r7, lr}
1456 ; THUMB-NEXT: ands r1, r0
1457 ; THUMB-NEXT: cmp r1, r2
1458 ; THUMB-NEXT: beq .LBB50_2
1459 ; THUMB-NEXT: @ %bb.1: @ %true_br
1460 ; THUMB-NEXT: bl consume
1461 ; THUMB-NEXT: .LBB50_2: @ %exit
1462 ; THUMB-NEXT: pop {r7, pc}
1464 ; THUMB2-LABEL: br_on_binop_ne_reg:
1466 ; THUMB2-NEXT: ands r1, r0
1467 ; THUMB2-NEXT: cmp r1, r2
1468 ; THUMB2-NEXT: it eq
1469 ; THUMB2-NEXT: bxeq lr
1470 ; THUMB2-NEXT: .LBB50_1: @ %true_br
1471 ; THUMB2-NEXT: push {r7, lr}
1472 ; THUMB2-NEXT: bl consume
1473 ; THUMB2-NEXT: pop.w {r7, lr}
1474 ; THUMB2-NEXT: bx lr
1475 %and = and i32 %a, %b
1476 %cmp = icmp ne i32 %and, %c
1477 br i1 %cmp, label %true_br, label %exit
1479 call void @consume(i32 %a)
1485 define void @br_on_shift_eq_zero(i32 %a, i32 %b) {
1486 ; ARM-LABEL: br_on_shift_eq_zero:
1488 ; ARM-NEXT: lsls r1, r0, r1
1490 ; ARM-NEXT: .LBB51_1: @ %true_br
1491 ; ARM-NEXT: push {r11, lr}
1492 ; ARM-NEXT: bl consume
1493 ; ARM-NEXT: pop {r11, lr}
1496 ; THUMB-LABEL: br_on_shift_eq_zero:
1498 ; THUMB-NEXT: push {r7, lr}
1499 ; THUMB-NEXT: mov r2, r0
1500 ; THUMB-NEXT: lsls r2, r1
1501 ; THUMB-NEXT: beq .LBB51_2
1502 ; THUMB-NEXT: @ %bb.1: @ %exit
1503 ; THUMB-NEXT: pop {r7, pc}
1504 ; THUMB-NEXT: .LBB51_2: @ %true_br
1505 ; THUMB-NEXT: bl consume
1506 ; THUMB-NEXT: pop {r7, pc}
1508 ; THUMB2-LABEL: br_on_shift_eq_zero:
1510 ; THUMB2-NEXT: lsls.w r1, r0, r1
1511 ; THUMB2-NEXT: it ne
1512 ; THUMB2-NEXT: bxne lr
1513 ; THUMB2-NEXT: .LBB51_1: @ %true_br
1514 ; THUMB2-NEXT: push {r7, lr}
1515 ; THUMB2-NEXT: bl consume
1516 ; THUMB2-NEXT: pop.w {r7, lr}
1517 ; THUMB2-NEXT: bx lr
1518 %sh = shl i32 %a, %b
1519 %cmp = icmp eq i32 %sh, 0
1520 br i1 %cmp, label %true_br, label %exit
1522 call void @consume(i32 %a)
1528 define void @br_on_shift_ne_zero(i32 %a, i32 %b) {
1529 ; ARM-LABEL: br_on_shift_ne_zero:
1531 ; ARM-NEXT: lsrs r1, r0, r1
1533 ; ARM-NEXT: .LBB52_1: @ %true_br
1534 ; ARM-NEXT: push {r11, lr}
1535 ; ARM-NEXT: bl consume
1536 ; ARM-NEXT: pop {r11, lr}
1539 ; THUMB-LABEL: br_on_shift_ne_zero:
1541 ; THUMB-NEXT: push {r7, lr}
1542 ; THUMB-NEXT: mov r2, r0
1543 ; THUMB-NEXT: lsrs r2, r1
1544 ; THUMB-NEXT: beq .LBB52_2
1545 ; THUMB-NEXT: @ %bb.1: @ %true_br
1546 ; THUMB-NEXT: bl consume
1547 ; THUMB-NEXT: .LBB52_2: @ %exit
1548 ; THUMB-NEXT: pop {r7, pc}
1550 ; THUMB2-LABEL: br_on_shift_ne_zero:
1552 ; THUMB2-NEXT: lsrs.w r1, r0, r1
1553 ; THUMB2-NEXT: it eq
1554 ; THUMB2-NEXT: bxeq lr
1555 ; THUMB2-NEXT: .LBB52_1: @ %true_br
1556 ; THUMB2-NEXT: push {r7, lr}
1557 ; THUMB2-NEXT: bl consume
1558 ; THUMB2-NEXT: pop.w {r7, lr}
1559 ; THUMB2-NEXT: bx lr
1560 %sh = lshr i32 %a, %b
1561 %cmp = icmp ne i32 %sh, 0
1562 br i1 %cmp, label %true_br, label %exit
1564 call void @consume(i32 %a)
1570 define void @br_on_shift_lt_zero(i32 %a, i32 %b) {
1571 ; ARM-LABEL: br_on_shift_lt_zero:
1573 ; ARM-NEXT: asr r1, r0, r1
1574 ; ARM-NEXT: cmp r1, #0
1576 ; ARM-NEXT: .LBB53_1: @ %true_br
1577 ; ARM-NEXT: push {r11, lr}
1578 ; ARM-NEXT: bl consume
1579 ; ARM-NEXT: pop {r11, lr}
1582 ; THUMB-LABEL: br_on_shift_lt_zero:
1584 ; THUMB-NEXT: push {r7, lr}
1585 ; THUMB-NEXT: mov r2, r0
1586 ; THUMB-NEXT: asrs r2, r1
1587 ; THUMB-NEXT: cmp r2, #0
1588 ; THUMB-NEXT: bhs .LBB53_2
1589 ; THUMB-NEXT: @ %bb.1: @ %true_br
1590 ; THUMB-NEXT: bl consume
1591 ; THUMB-NEXT: .LBB53_2: @ %exit
1592 ; THUMB-NEXT: pop {r7, pc}
1594 ; THUMB2-LABEL: br_on_shift_lt_zero:
1596 ; THUMB2-NEXT: asr.w r1, r0, r1
1597 ; THUMB2-NEXT: cmp r1, #0
1598 ; THUMB2-NEXT: it hs
1599 ; THUMB2-NEXT: bxhs lr
1600 ; THUMB2-NEXT: .LBB53_1: @ %true_br
1601 ; THUMB2-NEXT: push {r7, lr}
1602 ; THUMB2-NEXT: bl consume
1603 ; THUMB2-NEXT: pop.w {r7, lr}
1604 ; THUMB2-NEXT: bx lr
1605 %sh = ashr i32 %a, %b
1606 %cmp = icmp ult i32 %sh, 0
1607 br i1 %cmp, label %true_br, label %exit
1609 call void @consume(i32 %a)
1615 define void @br_on_shift_eq_imm(i32 %a, i32 %b) {
1616 ; ARM-LABEL: br_on_shift_eq_imm:
1618 ; ARM-NEXT: mov r2, #42
1619 ; ARM-NEXT: cmp r2, r0, lsl r1
1621 ; ARM-NEXT: .LBB54_1: @ %true_br
1622 ; ARM-NEXT: push {r11, lr}
1623 ; ARM-NEXT: bl consume
1624 ; ARM-NEXT: pop {r11, lr}
1627 ; THUMB-LABEL: br_on_shift_eq_imm:
1629 ; THUMB-NEXT: push {r7, lr}
1630 ; THUMB-NEXT: mov r2, r0
1631 ; THUMB-NEXT: lsls r2, r1
1632 ; THUMB-NEXT: cmp r2, #42
1633 ; THUMB-NEXT: bne .LBB54_2
1634 ; THUMB-NEXT: @ %bb.1: @ %true_br
1635 ; THUMB-NEXT: bl consume
1636 ; THUMB-NEXT: .LBB54_2: @ %exit
1637 ; THUMB-NEXT: pop {r7, pc}
1639 ; THUMB2-LABEL: br_on_shift_eq_imm:
1641 ; THUMB2-NEXT: lsl.w r1, r0, r1
1642 ; THUMB2-NEXT: cmp r1, #42
1643 ; THUMB2-NEXT: it ne
1644 ; THUMB2-NEXT: bxne lr
1645 ; THUMB2-NEXT: .LBB54_1: @ %true_br
1646 ; THUMB2-NEXT: push {r7, lr}
1647 ; THUMB2-NEXT: bl consume
1648 ; THUMB2-NEXT: pop.w {r7, lr}
1649 ; THUMB2-NEXT: bx lr
1650 %sh = shl i32 %a, %b
1651 %cmp = icmp eq i32 %sh, 42
1652 br i1 %cmp, label %true_br, label %exit
1654 call void @consume(i32 %a)
1660 define void @br_on_shift_ne_imm(i32 %a, i32 %b) {
1661 ; ARM-LABEL: br_on_shift_ne_imm:
1663 ; ARM-NEXT: mov r2, #42
1664 ; ARM-NEXT: cmp r2, r0, lsr r1
1666 ; ARM-NEXT: .LBB55_1: @ %true_br
1667 ; ARM-NEXT: push {r11, lr}
1668 ; ARM-NEXT: bl consume
1669 ; ARM-NEXT: pop {r11, lr}
1672 ; THUMB-LABEL: br_on_shift_ne_imm:
1674 ; THUMB-NEXT: push {r7, lr}
1675 ; THUMB-NEXT: mov r2, r0
1676 ; THUMB-NEXT: lsrs r2, r1
1677 ; THUMB-NEXT: cmp r2, #42
1678 ; THUMB-NEXT: beq .LBB55_2
1679 ; THUMB-NEXT: @ %bb.1: @ %true_br
1680 ; THUMB-NEXT: bl consume
1681 ; THUMB-NEXT: .LBB55_2: @ %exit
1682 ; THUMB-NEXT: pop {r7, pc}
1684 ; THUMB2-LABEL: br_on_shift_ne_imm:
1686 ; THUMB2-NEXT: lsr.w r1, r0, r1
1687 ; THUMB2-NEXT: cmp r1, #42
1688 ; THUMB2-NEXT: it eq
1689 ; THUMB2-NEXT: bxeq lr
1690 ; THUMB2-NEXT: .LBB55_1: @ %true_br
1691 ; THUMB2-NEXT: push {r7, lr}
1692 ; THUMB2-NEXT: bl consume
1693 ; THUMB2-NEXT: pop.w {r7, lr}
1694 ; THUMB2-NEXT: bx lr
1695 %sh = lshr i32 %a, %b
1696 %cmp = icmp ne i32 %sh, 42
1697 br i1 %cmp, label %true_br, label %exit
1699 call void @consume(i32 %a)
1705 define void @br_on_shift_eq_reg(i32 %a, i32 %b, i32 %c) {
1706 ; ARM-LABEL: br_on_shift_eq_reg:
1708 ; ARM-NEXT: cmp r2, r0, asr r1
1710 ; ARM-NEXT: .LBB56_1: @ %true_br
1711 ; ARM-NEXT: push {r11, lr}
1712 ; ARM-NEXT: bl consume
1713 ; ARM-NEXT: pop {r11, lr}
1716 ; THUMB-LABEL: br_on_shift_eq_reg:
1718 ; THUMB-NEXT: push {r7, lr}
1719 ; THUMB-NEXT: mov r3, r0
1720 ; THUMB-NEXT: asrs r3, r1
1721 ; THUMB-NEXT: cmp r2, r3
1722 ; THUMB-NEXT: bne .LBB56_2
1723 ; THUMB-NEXT: @ %bb.1: @ %true_br
1724 ; THUMB-NEXT: bl consume
1725 ; THUMB-NEXT: .LBB56_2: @ %exit
1726 ; THUMB-NEXT: pop {r7, pc}
1728 ; THUMB2-LABEL: br_on_shift_eq_reg:
1730 ; THUMB2-NEXT: asr.w r1, r0, r1
1731 ; THUMB2-NEXT: cmp r2, r1
1732 ; THUMB2-NEXT: it ne
1733 ; THUMB2-NEXT: bxne lr
1734 ; THUMB2-NEXT: .LBB56_1: @ %true_br
1735 ; THUMB2-NEXT: push {r7, lr}
1736 ; THUMB2-NEXT: bl consume
1737 ; THUMB2-NEXT: pop.w {r7, lr}
1738 ; THUMB2-NEXT: bx lr
1739 %sh = ashr i32 %a, %b
1740 %cmp = icmp eq i32 %sh, %c
1741 br i1 %cmp, label %true_br, label %exit
1743 call void @consume(i32 %a)
1749 define void @br_on_shift_ne_reg(i32 %a, i32 %b, i32 %c) {
1750 ; ARM-LABEL: br_on_shift_ne_reg:
1752 ; ARM-NEXT: cmp r2, r0, lsl r1
1754 ; ARM-NEXT: .LBB57_1: @ %true_br
1755 ; ARM-NEXT: push {r11, lr}
1756 ; ARM-NEXT: bl consume
1757 ; ARM-NEXT: pop {r11, lr}
1760 ; THUMB-LABEL: br_on_shift_ne_reg:
1762 ; THUMB-NEXT: push {r7, lr}
1763 ; THUMB-NEXT: mov r3, r0
1764 ; THUMB-NEXT: lsls r3, r1
1765 ; THUMB-NEXT: cmp r2, r3
1766 ; THUMB-NEXT: beq .LBB57_2
1767 ; THUMB-NEXT: @ %bb.1: @ %true_br
1768 ; THUMB-NEXT: bl consume
1769 ; THUMB-NEXT: .LBB57_2: @ %exit
1770 ; THUMB-NEXT: pop {r7, pc}
1772 ; THUMB2-LABEL: br_on_shift_ne_reg:
1774 ; THUMB2-NEXT: lsl.w r1, r0, r1
1775 ; THUMB2-NEXT: cmp r2, r1
1776 ; THUMB2-NEXT: it eq
1777 ; THUMB2-NEXT: bxeq lr
1778 ; THUMB2-NEXT: .LBB57_1: @ %true_br
1779 ; THUMB2-NEXT: push {r7, lr}
1780 ; THUMB2-NEXT: bl consume
1781 ; THUMB2-NEXT: pop.w {r7, lr}
1782 ; THUMB2-NEXT: bx lr
1783 %sh = shl i32 %a, %b
1784 %cmp = icmp ne i32 %sh, %c
1785 br i1 %cmp, label %true_br, label %exit
1787 call void @consume(i32 %a)