1 ; RUN: llc -O0 -fast-isel -fast-isel-abort=1 -mtriple=arm64-apple-darwin -mcpu=cyclone -verify-machineinstrs < %s | FileCheck %s
3 define void @branch1() nounwind uwtable ssp {
4 %x = alloca i32, align 4
5 store i32 0, ptr %x, align 4
6 %1 = load i32, ptr %x, align 4
8 br i1 %2, label %3, label %4
10 ; <label>:3 ; preds = %0
13 ; <label>:4 ; preds = %3, %0
17 define void @branch2() nounwind uwtable ssp {
18 %1 = alloca i32, align 4
19 %x = alloca i32, align 4
20 %y = alloca i32, align 4
21 %z = alloca i32, align 4
23 store i32 1, ptr %y, align 4
24 store i32 1, ptr %x, align 4
25 store i32 0, ptr %z, align 4
26 %2 = load i32, ptr %x, align 4
27 %3 = icmp ne i32 %2, 0
28 br i1 %3, label %4, label %5
30 ; <label>:4 ; preds = %0
34 ; <label>:5 ; preds = %0
35 %6 = load i32, ptr %y, align 4
36 %7 = icmp ne i32 %6, 0
37 br i1 %7, label %8, label %13
39 ; <label>:8 ; preds = %5
40 %9 = load i32, ptr %z, align 4
41 %10 = icmp ne i32 %9, 0
42 br i1 %10, label %11, label %12
44 ; <label>:11 ; preds = %8
48 ; <label>:12 ; preds = %8
52 ; <label>:13 ; preds = %5
55 ; <label>:14 ; preds = %4, %11, %12, %13
56 %15 = load i32, ptr %1
60 define void @true_() nounwind uwtable ssp {
63 br i1 true, label %1, label %2
73 define void @false_() nounwind uwtable ssp {
76 br i1 false, label %1, label %2
86 define zeroext i8 @trunc_(i8 zeroext %a, i16 zeroext %b, i32 %c, i64 %d) {
88 %a.addr = alloca i8, align 1
89 %b.addr = alloca i16, align 2
90 %c.addr = alloca i32, align 4
91 %d.addr = alloca i64, align 8
92 store i8 %a, ptr %a.addr, align 1
93 store i16 %b, ptr %b.addr, align 2
94 store i32 %c, ptr %c.addr, align 4
95 store i64 %d, ptr %d.addr, align 8
96 %0 = load i16, ptr %b.addr, align 2
97 ; CHECK: tbz {{w[0-9]+}}, #0, LBB4_2
98 %conv = trunc i16 %0 to i1
99 br i1 %conv, label %if.then, label %if.end
101 if.then: ; preds = %entry
105 if.end: ; preds = %if.then, %entry
106 %1 = load i32, ptr %c.addr, align 4
107 ; CHECK: tbz w{{[0-9]+}}, #0, LBB4_4
108 %conv1 = trunc i32 %1 to i1
109 br i1 %conv1, label %if.then3, label %if.end4
111 if.then3: ; preds = %if.end
115 if.end4: ; preds = %if.then3, %if.end
116 %2 = load i64, ptr %d.addr, align 8
117 ; CHECK: tbz w{{[0-9]+}}, #0, LBB4_6
118 %conv5 = trunc i64 %2 to i1
119 br i1 %conv5, label %if.then7, label %if.end8
121 if.then7: ; preds = %if.end4
125 if.end8: ; preds = %if.then7, %if.end4
126 %3 = load i8, ptr %a.addr, align 1
133 define i32 @trunc64(i64 %foo) nounwind {
135 ; CHECK: and x[[REG1:[0-9]+]], x0, #0x1
136 ; CHECK: tbz w[[REG1]], #0, LBB5_2
138 %b = trunc i64 %a to i1
139 br i1 %b, label %if.then, label %if.else