xref: /llvm-project/llvm/test/CodeGen/AArch64/callbr-asm-label.ll (revision 5ddce70ef0e5a641d7fea95e31fc5e2439cb98cb)
1; RUN: llc < %s -mtriple=aarch64-linux-gnu | FileCheck %s
2
3@X = common local_unnamed_addr global i32 0, align 4
4
5define i32 @test1() {
6; CHECK-LABEL: test1:
7; CHECK:         .word b
8; CHECK-NEXT:    .word .LBB0_2
9; CHECK: // %bb.1:
10; CHECK: .LBB0_2: // Block address taken
11entry:
12  callbr void asm sideeffect "1:\0A\09.word b, ${0:l}\0A\09", "!i"()
13          to label %cleanup [label %indirect]
14
15indirect:
16  br label %cleanup
17
18cleanup:
19  %retval.0 = phi i32 [ 1, %indirect ], [ 0, %entry ]
20  ret i32 %retval.0
21}
22
23define void @test2() {
24; CHECK-LABEL: test2:
25entry:
26  %0 = load i32, ptr @X, align 4
27  %and = and i32 %0, 1
28  %tobool = icmp eq i32 %and, 0
29  br i1 %tobool, label %if.end10, label %if.then
30
31if.then:
32; CHECK:       .word b
33; CHECK-NEXT:  .word .LBB1_3
34; CHECK:       .LBB1_3: // Block address taken
35  callbr void asm sideeffect "1:\0A\09.word b, ${0:l}\0A\09", "!i"()
36          to label %if.then4 [label %if.end6]
37
38if.then4:
39  %call5 = tail call i32 @g()
40  br label %if.end6
41
42if.end6:
43  %.pre = load i32, ptr @X, align 4
44  %.pre13 = and i32 %.pre, 1
45  %phitmp = icmp eq i32 %.pre13, 0
46  br i1 %phitmp, label %if.end10, label %if.then9
47
48if.then9:
49; CHECK: .LBB1_5: // Block address taken
50  callbr void asm sideeffect "", "!i"()
51          to label %if.end10 [label %l_yes]
52
53if.end10:
54  br label %l_yes
55
56l_yes:
57  ret void
58}
59
60declare i32 @g(...)
61