1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=aarch64-linux %s -o - | FileCheck %s
4 define i32 @f0(i32 %x) #0 {
6 ; CHECK: // %bb.0: // %entry
7 ; CHECK-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
8 ; CHECK-NEXT: .cfi_def_cfa_offset 16
9 ; CHECK-NEXT: .cfi_offset w30, -16
10 ; CHECK-NEXT: .cfi_remember_state
11 ; CHECK-NEXT: cbz w0, .LBB0_5
12 ; CHECK-NEXT: // %bb.1: // %entry
13 ; CHECK-NEXT: cmp w0, #2
14 ; CHECK-NEXT: b.eq .LBB0_4
15 ; CHECK-NEXT: // %bb.2: // %entry
16 ; CHECK-NEXT: cmp w0, #1
17 ; CHECK-NEXT: b.ne .LBB0_6
18 ; CHECK-NEXT: // %bb.3: // %if.then2
20 ; CHECK-NEXT: add w0, w0, #1
21 ; CHECK-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
22 ; CHECK-NEXT: .cfi_def_cfa_offset 0
23 ; CHECK-NEXT: .cfi_restore w30
25 ; CHECK-NEXT: .LBB0_4: // %if.then5
26 ; CHECK-NEXT: .cfi_restore_state
27 ; CHECK-NEXT: .cfi_remember_state
29 ; CHECK-NEXT: mov w8, #1 // =0x1
30 ; CHECK-NEXT: sub w0, w8, w0
31 ; CHECK-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
32 ; CHECK-NEXT: .cfi_def_cfa_offset 0
33 ; CHECK-NEXT: .cfi_restore w30
35 ; CHECK-NEXT: .LBB0_5:
36 ; CHECK-NEXT: .cfi_restore_state
37 ; CHECK-NEXT: .cfi_remember_state
38 ; CHECK-NEXT: mov w0, #1 // =0x1
39 ; CHECK-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
40 ; CHECK-NEXT: .cfi_def_cfa_offset 0
41 ; CHECK-NEXT: .cfi_restore w30
43 ; CHECK-NEXT: .LBB0_6: // %if.end7
44 ; CHECK-NEXT: .cfi_restore_state
45 ; CHECK-NEXT: mov w0, wzr
46 ; CHECK-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
47 ; CHECK-NEXT: .cfi_def_cfa_offset 0
48 ; CHECK-NEXT: .cfi_restore w30
51 switch i32 %x, label %if.end7 [
53 i32 1, label %if.then2
54 i32 2, label %if.then5
58 %call = tail call i32 @g1(i32 1)
59 %add = add nsw i32 %call, 1
63 %call6 = tail call i32 @g0(i32 2)
64 %sub = sub nsw i32 1, %call6
71 %retval.0 = phi i32 [ %add, %if.then2 ], [ %sub, %if.then5 ], [ 0, %if.end7 ], [ 1, %entry ]
79 define i32 @f1(i32 %x) #0 {
81 ; CHECK: // %bb.0: // %entry
82 ; CHECK-NEXT: cbz w0, .LBB1_2
83 ; CHECK-NEXT: // %bb.1: // %if.end
84 ; CHECK-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
85 ; CHECK-NEXT: .cfi_def_cfa_offset 16
86 ; CHECK-NEXT: .cfi_offset w30, -16
88 ; CHECK-NEXT: add w0, w0, #1
89 ; CHECK-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
90 ; CHECK-NEXT: .cfi_def_cfa_offset 0
91 ; CHECK-NEXT: .cfi_restore w30
92 ; CHECK-NEXT: .LBB1_2: // %return
95 %cmp = icmp eq i32 %x, 0
96 br i1 %cmp, label %return, label %if.end
99 %call = tail call i32 @g0(i32 %x)
100 %add = add nsw i32 %call, 1
104 %retval.0 = phi i32 [ %add, %if.end ], [ 0, %entry ]
108 define i32 @f2(i32 %x) #0 {
110 ; CHECK: // %bb.0: // %entry
111 ; CHECK-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
112 ; CHECK-NEXT: .cfi_def_cfa_offset 16
113 ; CHECK-NEXT: .cfi_offset w30, -16
114 ; CHECK-NEXT: .cfi_remember_state
115 ; CHECK-NEXT: cbz w0, .LBB2_2
116 ; CHECK-NEXT: // %bb.1: // %if.end
118 ; CHECK-NEXT: mov w8, #1 // =0x1
119 ; CHECK-NEXT: sub w0, w8, w0
120 ; CHECK-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
121 ; CHECK-NEXT: .cfi_def_cfa_offset 0
122 ; CHECK-NEXT: .cfi_restore w30
124 ; CHECK-NEXT: .LBB2_2: // %if.then
125 ; CHECK-NEXT: .cfi_restore_state
127 ; CHECK-NEXT: add w0, w0, #1
128 ; CHECK-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
129 ; CHECK-NEXT: .cfi_def_cfa_offset 0
130 ; CHECK-NEXT: .cfi_restore w30
133 %cmp = icmp eq i32 %x, 0
134 br i1 %cmp, label %if.then, label %if.end
137 %call = tail call i32 @g0(i32 0)
138 %add = add nsw i32 %call, 1
142 %call1 = tail call i32 @g1(i32 %x)
143 %sub = sub nsw i32 1, %call1
147 %retval.0 = phi i32 [ %add, %if.then ], [ %sub, %if.end ]
151 attributes #0 = { uwtable }