1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=thumbv6-linux-gnueabi < %s | FileCheck %s
4 ; After various DAGCombine optimizations, we end up with an sbcs with
5 ; multiple uses of the cpsr def, and we therefore clone the subs/sbcs.
6 ; Make sure this doesn't crash.
8 ; The output here might change at some point in the future, and no
9 ; longer clone the operations; if that happens, there probably isn't any
10 ; straightforward way to fix the test.
11 define i64 @f(i64 %x2, i32 %z) {
14 ; CHECK-NEXT: .save {r4, r5, r7, lr}
15 ; CHECK-NEXT: push {r4, r5, r7, lr}
16 ; CHECK-NEXT: movs r2, #0
17 ; CHECK-NEXT: subs r3, r0, #1
18 ; CHECK-NEXT: mov r3, r1
19 ; CHECK-NEXT: sbcs r3, r2
20 ; CHECK-NEXT: mov r3, r2
21 ; CHECK-NEXT: adcs r3, r2
22 ; CHECK-NEXT: movs r4, #30
23 ; CHECK-NEXT: subs r5, r0, #1
24 ; CHECK-NEXT: mov r5, r1
25 ; CHECK-NEXT: sbcs r5, r2
26 ; CHECK-NEXT: adcs r4, r2
27 ; CHECK-NEXT: lsls r2, r1, #1
28 ; CHECK-NEXT: lsls r2, r4
29 ; CHECK-NEXT: movs r4, #1
30 ; CHECK-NEXT: eors r4, r3
31 ; CHECK-NEXT: lsrs r0, r4
32 ; CHECK-NEXT: orrs r0, r2
33 ; CHECK-NEXT: lsrs r1, r4
34 ; CHECK-NEXT: pop {r4, r5, r7, pc}
35 %x3 = add nsw i64 %x2, -1
36 %x8 = icmp ne i64 %x2, 0
37 %x9 = xor i1 %x8, true
38 %x10 = zext i1 %x9 to i64
39 %x11 = lshr i64 %x2, %x10