1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 2
2 ; RUN: llc -o - %s | FileCheck %s
4 target triple = "arm64-apple-ios"
6 %struct.s = type {double, double }
8 declare void @fn(ptr, ptr)
10 ; %l.a and %l.b read memory allocated in the caller and should not block
12 define void @test_regular_pointers(ptr %a, ptr %b) {
13 ; CHECK-LABEL: test_regular_pointers:
14 ; CHECK: ; %bb.0: ; %entry
15 ; CHECK-NEXT: ldr d0, [x0]
16 ; CHECK-NEXT: ldr d1, [x1, #8]
17 ; CHECK-NEXT: mov x8, #1 ; =0x1
18 ; CHECK-NEXT: movk x8, #2047, lsl #16
19 ; CHECK-NEXT: fadd d0, d0, d1
20 ; CHECK-NEXT: fmov d1, x8
21 ; CHECK-NEXT: fcmp d0, d1
22 ; CHECK-NEXT: str d0, [x1]
23 ; CHECK-NEXT: b.mi LBB0_2
24 ; CHECK-NEXT: b.gt LBB0_2
25 ; CHECK-NEXT: ; %bb.1: ; %then
26 ; CHECK-NEXT: stp x20, x19, [sp, #-32]! ; 16-byte Folded Spill
27 ; CHECK-NEXT: stp x29, x30, [sp, #16] ; 16-byte Folded Spill
28 ; CHECK-NEXT: .cfi_def_cfa_offset 32
29 ; CHECK-NEXT: .cfi_offset w30, -8
30 ; CHECK-NEXT: .cfi_offset w29, -16
31 ; CHECK-NEXT: .cfi_offset w19, -24
32 ; CHECK-NEXT: .cfi_offset w20, -32
33 ; CHECK-NEXT: mov x19, x1
35 ; CHECK-NEXT: ldp x29, x30, [sp, #16] ; 16-byte Folded Reload
36 ; CHECK-NEXT: str xzr, [x19]
37 ; CHECK-NEXT: ldp x20, x19, [sp], #32 ; 16-byte Folded Reload
38 ; CHECK-NEXT: LBB0_2: ; %exit
41 %l.a = load double, ptr %a, align 8
42 %gep.b = getelementptr inbounds %struct.s, ptr %b, i64 0, i32 1
43 %l.b = load double, ptr %gep.b, align 8
44 %add = fadd double %l.a, %l.b
45 store double %add, ptr %b, align 8
46 %c = fcmp ueq double %add, 0x7FF0001
47 br i1 %c, label %then, label %exit
50 tail call void @fn(ptr %a, ptr %b)
51 store double 0.000000e+00, ptr %b, align 8
58 ; %l.b may read memory from the callee's stack due to byval.
59 define void @test_byval_pointers(ptr %a, ptr byval(%struct.s) %b) {
60 ; CHECK-LABEL: test_byval_pointers:
61 ; CHECK: ; %bb.0: ; %entry
62 ; CHECK-NEXT: stp x20, x19, [sp, #-32]! ; 16-byte Folded Spill
63 ; CHECK-NEXT: stp x29, x30, [sp, #16] ; 16-byte Folded Spill
64 ; CHECK-NEXT: .cfi_def_cfa_offset 32
65 ; CHECK-NEXT: .cfi_offset w30, -8
66 ; CHECK-NEXT: .cfi_offset w29, -16
67 ; CHECK-NEXT: .cfi_offset w19, -24
68 ; CHECK-NEXT: .cfi_offset w20, -32
69 ; CHECK-NEXT: ldr d0, [sp, #40]
70 ; CHECK-NEXT: ldr d1, [x0]
71 ; CHECK-NEXT: mov x8, #1 ; =0x1
72 ; CHECK-NEXT: movk x8, #2047, lsl #16
73 ; CHECK-NEXT: fadd d0, d1, d0
74 ; CHECK-NEXT: fmov d1, x8
75 ; CHECK-NEXT: fcmp d0, d1
76 ; CHECK-NEXT: str d0, [sp, #32]
77 ; CHECK-NEXT: b.mi LBB1_2
78 ; CHECK-NEXT: b.gt LBB1_2
79 ; CHECK-NEXT: ; %bb.1: ; %then
80 ; CHECK-NEXT: add x1, sp, #32
81 ; CHECK-NEXT: add x19, sp, #32
83 ; CHECK-NEXT: str xzr, [x19]
84 ; CHECK-NEXT: LBB1_2: ; %exit
85 ; CHECK-NEXT: ldp x29, x30, [sp, #16] ; 16-byte Folded Reload
86 ; CHECK-NEXT: ldp x20, x19, [sp], #32 ; 16-byte Folded Reload
89 %l.a = load double, ptr %a, align 8
90 %gep.b = getelementptr inbounds %struct.s, ptr %b, i64 0, i32 1
91 %l.b = load double, ptr %gep.b, align 8
92 %add = fadd double %l.a, %l.b
93 store double %add, ptr %b, align 8
94 %c = fcmp ueq double %add, 0x7FF0001
95 br i1 %c, label %then, label %exit
98 tail call void @fn(ptr %a, ptr %b)
99 store double 0.000000e+00, ptr %b, align 8
106 ; %l.b may read memory from the callee's stack due to inalloca.
107 define void @test_inalloca_pointers(ptr %a, ptr inalloca(%struct.s) %b) {
108 ; CHECK-LABEL: test_inalloca_pointers:
109 ; CHECK: ; %bb.0: ; %entry
110 ; CHECK-NEXT: stp x20, x19, [sp, #-32]! ; 16-byte Folded Spill
111 ; CHECK-NEXT: stp x29, x30, [sp, #16] ; 16-byte Folded Spill
112 ; CHECK-NEXT: .cfi_def_cfa_offset 32
113 ; CHECK-NEXT: .cfi_offset w30, -8
114 ; CHECK-NEXT: .cfi_offset w29, -16
115 ; CHECK-NEXT: .cfi_offset w19, -24
116 ; CHECK-NEXT: .cfi_offset w20, -32
117 ; CHECK-NEXT: ldr d0, [sp, #40]
118 ; CHECK-NEXT: ldr d1, [x0]
119 ; CHECK-NEXT: mov x8, #1 ; =0x1
120 ; CHECK-NEXT: movk x8, #2047, lsl #16
121 ; CHECK-NEXT: fadd d0, d1, d0
122 ; CHECK-NEXT: fmov d1, x8
123 ; CHECK-NEXT: fcmp d0, d1
124 ; CHECK-NEXT: str d0, [sp, #32]
125 ; CHECK-NEXT: b.mi LBB2_2
126 ; CHECK-NEXT: b.gt LBB2_2
127 ; CHECK-NEXT: ; %bb.1: ; %then
128 ; CHECK-NEXT: add x1, sp, #32
129 ; CHECK-NEXT: add x19, sp, #32
131 ; CHECK-NEXT: str xzr, [x19]
132 ; CHECK-NEXT: LBB2_2: ; %exit
133 ; CHECK-NEXT: ldp x29, x30, [sp, #16] ; 16-byte Folded Reload
134 ; CHECK-NEXT: ldp x20, x19, [sp], #32 ; 16-byte Folded Reload
137 %l.a = load double, ptr %a, align 8
138 %gep.b = getelementptr inbounds %struct.s, ptr %b, i64 0, i32 1
139 %l.b = load double, ptr %gep.b, align 8
140 %add = fadd double %l.a, %l.b
141 store double %add, ptr %b, align 8
142 %c = fcmp ueq double %add, 0x7FF0001
143 br i1 %c, label %then, label %exit
146 tail call void @fn(ptr %a, ptr %b)
147 store double 0.000000e+00, ptr %b, align 8
154 ; %l.b may read memory from the callee's stack due to preallocated.
155 define void @test_preallocated_pointers(ptr %a, ptr preallocated(%struct.s) %b) {
156 ; CHECK-LABEL: test_preallocated_pointers:
157 ; CHECK: ; %bb.0: ; %entry
158 ; CHECK-NEXT: stp x20, x19, [sp, #-32]! ; 16-byte Folded Spill
159 ; CHECK-NEXT: stp x29, x30, [sp, #16] ; 16-byte Folded Spill
160 ; CHECK-NEXT: .cfi_def_cfa_offset 32
161 ; CHECK-NEXT: .cfi_offset w30, -8
162 ; CHECK-NEXT: .cfi_offset w29, -16
163 ; CHECK-NEXT: .cfi_offset w19, -24
164 ; CHECK-NEXT: .cfi_offset w20, -32
165 ; CHECK-NEXT: ldr d0, [sp, #40]
166 ; CHECK-NEXT: ldr d1, [x0]
167 ; CHECK-NEXT: mov x8, #1 ; =0x1
168 ; CHECK-NEXT: movk x8, #2047, lsl #16
169 ; CHECK-NEXT: fadd d0, d1, d0
170 ; CHECK-NEXT: fmov d1, x8
171 ; CHECK-NEXT: fcmp d0, d1
172 ; CHECK-NEXT: str d0, [sp, #32]
173 ; CHECK-NEXT: b.mi LBB3_2
174 ; CHECK-NEXT: b.gt LBB3_2
175 ; CHECK-NEXT: ; %bb.1: ; %then
176 ; CHECK-NEXT: add x1, sp, #32
177 ; CHECK-NEXT: add x19, sp, #32
179 ; CHECK-NEXT: str xzr, [x19]
180 ; CHECK-NEXT: LBB3_2: ; %exit
181 ; CHECK-NEXT: ldp x29, x30, [sp, #16] ; 16-byte Folded Reload
182 ; CHECK-NEXT: ldp x20, x19, [sp], #32 ; 16-byte Folded Reload
185 %l.a = load double, ptr %a, align 8
186 %gep.b = getelementptr inbounds %struct.s, ptr %b, i64 0, i32 1
187 %l.b = load double, ptr %gep.b, align 8
188 %add = fadd double %l.a, %l.b
189 store double %add, ptr %b, align 8
190 %c = fcmp ueq double %add, 0x7FF0001
191 br i1 %c, label %then, label %exit
194 tail call void @fn(ptr %a, ptr %b)
195 store double 0.000000e+00, ptr %b, align 8