1 ; RUN: llc -mtriple=aarch64-apple-darwin -fast-isel -fast-isel-abort=1 -verify-machineinstrs < %s | FileCheck %s
4 ; CHECK: cbnz w0, {{LBB[0-9]+_2}}
5 ; CHECK: cbz w1, {{LBB[0-9]+_1}}
6 define i64 @test_or(i32 %a, i32 %b) {
10 %or.cond = or i1 %0, %1
11 br i1 %or.cond, label %bb3, label %bb4, !prof !0
21 ; CHECK-LABEL: test_and
22 ; CHECK: cbz w0, {{LBB[0-9]+_2}}
23 ; CHECK: cbnz w1, {{LBB[0-9]+_3}}
24 define i64 @test_and(i32 %a, i32 %b) {
26 %0 = icmp ne i32 %a, 0
27 %1 = icmp ne i32 %b, 0
28 %or.cond = and i1 %0, %1
29 br i1 %or.cond, label %bb4, label %bb3, !prof !1
39 ; If the branch is unpredictable, don't add another branch.
41 ; CHECK-LABEL: test_or_unpredictable
43 ; CHECK-NEXT: cset w8, eq
44 ; CHECK-NEXT: cmp w1, #0
45 ; CHECK-NEXT: cset w9, eq
46 ; CHECK-NEXT: orr w8, w8, w9
47 ; CHECK-NEXT: tbnz w8, #0,
48 define i64 @test_or_unpredictable(i32 %a, i32 %b) {
50 %0 = icmp eq i32 %a, 0
51 %1 = icmp eq i32 %b, 0
52 %or.cond = or i1 %0, %1
53 br i1 %or.cond, label %bb3, label %bb4, !unpredictable !2
63 ; CHECK-LABEL: test_and_unpredictable
65 ; CHECK-NEXT: cset w8, ne
66 ; CHECK-NEXT: cmp w1, #0
67 ; CHECK-NEXT: cset w9, ne
68 ; CHECK-NEXT: and w8, w8, w9
69 ; CHECK-NEXT: tbz w8, #0,
70 define i64 @test_and_unpredictable(i32 %a, i32 %b) {
72 %0 = icmp ne i32 %a, 0
73 %1 = icmp ne i32 %b, 0
74 %or.cond = and i1 %0, %1
75 br i1 %or.cond, label %bb4, label %bb3, !unpredictable !2
87 !0 = !{!"branch_weights", i32 5128, i32 32}
88 !1 = !{!"branch_weights", i32 1024, i32 4136}