• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc -mtriple=sparc-none-linux-gnu < %s | FileCheck %s
2
3; This test checks that LLVM can do basic stripping and reapplying of branches
4; to basic blocks.
5
6declare void @test_true()
7declare void @test_false()
8
9; !0 corresponds to a branch being taken, !1 to not being takne.
10!0 = !{!"branch_weights", i32 64, i32 4}
11!1 = !{!"branch_weights", i32 4, i32 64}
12
13define void @test_Bcc_fallthrough_taken(i32 %in) nounwind {
14; CHECK-LABEL: test_Bcc_fallthrough_taken:
15  %tst = icmp eq i32 %in, 42
16  br i1 %tst, label %true, label %false, !prof !0
17
18; CHECK: cmp {{%[goli][0-9]+}}, 42
19; CHECK: bne [[FALSE:.LBB[0-9]+_[0-9]+]]
20; CHECK-NEXT: nop
21; CHECK-NEXT: ! BB#
22; CHECK-NEXT: call test_true
23
24; CHECK: [[FALSE]]:
25; CHECK: call test_false
26
27true:
28  call void @test_true()
29  ret void
30
31false:
32  call void @test_false()
33  ret void
34}
35
36define void @test_Bcc_fallthrough_nottaken(i32 %in) nounwind {
37; CHECK-LABEL: test_Bcc_fallthrough_nottaken:
38  %tst = icmp eq i32 %in, 42
39  br i1 %tst, label %true, label %false, !prof !1
40
41; CHECK: cmp {{%[goli][0-9]+}}, 42
42
43; CHECK: be [[TRUE:.LBB[0-9]+_[0-9]+]]
44; CHECK-NEXT: nop
45; CHECK-NEXT: ! BB#
46; CHECK-NEXT: call test_false
47
48; CHECK: [[TRUE]]:
49; CHECK: call test_true
50
51true:
52  call void @test_true()
53  ret void
54
55false:
56  call void @test_false()
57  ret void
58}
59