1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple thumbv7s-apple-darwin -asm-verbose=false | FileCheck %s
3 ; RUN: llc < %s -mtriple thumbv7s-apple-darwin -asm-verbose=false -stop-after=if-converter | FileCheck --check-prefix=CHECK-PROB %s
6 declare ptr @bar(i32, ptr, ptr)
8 ; Verify that we don't try to iteratively re-ifconvert a block with a
9 ; (predicated) indirectbr terminator.
10 ; If we do, we would ignore its fallthrough successor.
12 ; CHECK-PROB: bb.0{{[0-9a-zA-Z.]*}}:
13 ; CHECK-PROB: successors: %bb.1(0x40000000), %bb.3(0x20000000), %bb.4(0x20000000)
14 ; CHECK-PROB: bb.2{{[0-9a-zA-Z.]*}}:
15 ; CHECK-PROB: successors: %bb.3(0x40000000), %bb.4(0x40000000)
17 define i32 @test(i32 %a, i32 %a2, ptr %p, ptr %p2) "frame-pointer"="all" {
19 ; CHECK: push {r4, r5, r6, r7, lr}
20 ; CHECK-NEXT: add r7, sp, #12
21 ; CHECK-NEXT: push.w {r8, r10, r11}
22 ; CHECK-NEXT: str r3, [sp, #-4]!
23 ; CHECK-NEXT: mov r11, r2
24 ; CHECK-NEXT: mov r4, r1
25 ; CHECK-NEXT: mov r5, r0
26 ; CHECK-NEXT: ldr r6, LCPI0_0
28 ; CHECK-NEXT: add r6, pc
29 ; CHECK-NEXT: ldr.w r8, LCPI0_1
31 ; CHECK-NEXT: add r8, pc
32 ; CHECK-NEXT: movs r0, #1
33 ; CHECK-NEXT: mov r1, r6
34 ; CHECK-NEXT: mov r2, r8
36 ; CHECK-NEXT: mov r10, r0
37 ; CHECK-NEXT: movs r0, #2
38 ; CHECK-NEXT: mov r1, r6
39 ; CHECK-NEXT: mov r2, r8
41 ; CHECK-NEXT: movs r0, #3
42 ; CHECK-NEXT: mov r1, r6
43 ; CHECK-NEXT: mov r2, r8
45 ; CHECK-NEXT: cmp r5, #21
46 ; CHECK-NEXT: itttt eq
47 ; CHECK-NEXT: moveq r1, r0
48 ; CHECK-NEXT: streq.w r5, [r11]
49 ; CHECK-NEXT: movweq r0, #1234
50 ; CHECK-NEXT: moveq pc, r1
52 ; CHECK-NEXT: cmp r4, #42
53 ; CHECK-NEXT: beq LBB0_4
54 ; CHECK-NEXT: ldr r0, [sp]
55 ; CHECK-NEXT: str r5, [r0]
56 ; CHECK-NEXT: movw r0, #1234
57 ; CHECK-NEXT: mov pc, r10
60 ; CHECK-NEXT: movw r0, #4567
61 ; CHECK-NEXT: b LBB0_5
63 ; CHECK-NEXT: movw r0, #1234
67 ; CHECK-NEXT: add sp, #4
68 ; CHECK-NEXT: pop.w {r8, r10, r11}
69 ; CHECK-NEXT: pop {r4, r5, r6, r7, pc}
70 ; CHECK-NEXT: .p2align 2
72 %dst1 = call ptr @bar(i32 1, ptr blockaddress(@test, %bb1), ptr blockaddress(@test, %bb2))
73 %dst2 = call ptr @bar(i32 2, ptr blockaddress(@test, %bb1), ptr blockaddress(@test, %bb2))
74 %dst3 = call ptr @bar(i32 3, ptr blockaddress(@test, %bb1), ptr blockaddress(@test, %bb2))
75 %cc1 = icmp eq i32 %a, 21
76 br i1 %cc1, label %cc1t, label %cc1f
80 indirectbr ptr %dst3, [label %bb1, label %bb2]
83 %cc2 = icmp ne i32 %a2, 42
84 br i1 %cc2, label %cc2t, label %bb1
87 indirectbr ptr %dst1, [label %bb1, label %bb2]
90 %ret_bb1 = call i32 @foo(i32 1234)
93 %ret_bb2 = call i32 @foo(i32 4567)