1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -O2 -mtriple=x86_64-linux-android -mattr=+mmx \
3 ; RUN: -enable-legalize-types-checking | FileCheck %s
4 ; RUN: llc < %s -O2 -mtriple=x86_64-linux-gnu -mattr=+mmx \
5 ; RUN: -enable-legalize-types-checking | FileCheck %s
7 ; Check all soft floating point library function calls.
9 @vf64 = common global double 0.000000e+00, align 8
10 @vf128 = common global fp128 0xL00000000000000000000000000000000, align 16
12 define void @Test128Add(fp128 %d1, fp128 %d2) {
13 ; CHECK-LABEL: Test128Add:
14 ; CHECK: # %bb.0: # %entry
15 ; CHECK-NEXT: pushq %rax
16 ; CHECK-NEXT: .cfi_def_cfa_offset 16
17 ; CHECK-NEXT: callq __addtf3
18 ; CHECK-NEXT: movaps %xmm0, {{.*}}(%rip)
19 ; CHECK-NEXT: popq %rax
20 ; CHECK-NEXT: .cfi_def_cfa_offset 8
23 %add = fadd fp128 %d1, %d2
24 store fp128 %add, fp128* @vf128, align 16
28 define void @Test128_1Add(fp128 %d1){
29 ; CHECK-LABEL: Test128_1Add:
30 ; CHECK: # %bb.0: # %entry
31 ; CHECK-NEXT: pushq %rax
32 ; CHECK-NEXT: .cfi_def_cfa_offset 16
33 ; CHECK-NEXT: movaps %xmm0, %xmm1
34 ; CHECK-NEXT: movaps {{.*}}(%rip), %xmm0
35 ; CHECK-NEXT: callq __addtf3
36 ; CHECK-NEXT: movaps %xmm0, {{.*}}(%rip)
37 ; CHECK-NEXT: popq %rax
38 ; CHECK-NEXT: .cfi_def_cfa_offset 8
41 %0 = load fp128, fp128* @vf128, align 16
42 %add = fadd fp128 %0, %d1
43 store fp128 %add, fp128* @vf128, align 16
47 define void @Test128Sub(fp128 %d1, fp128 %d2){
48 ; CHECK-LABEL: Test128Sub:
49 ; CHECK: # %bb.0: # %entry
50 ; CHECK-NEXT: pushq %rax
51 ; CHECK-NEXT: .cfi_def_cfa_offset 16
52 ; CHECK-NEXT: callq __subtf3
53 ; CHECK-NEXT: movaps %xmm0, {{.*}}(%rip)
54 ; CHECK-NEXT: popq %rax
55 ; CHECK-NEXT: .cfi_def_cfa_offset 8
58 %sub = fsub fp128 %d1, %d2
59 store fp128 %sub, fp128* @vf128, align 16
63 define void @Test128_1Sub(fp128 %d1){
64 ; CHECK-LABEL: Test128_1Sub:
65 ; CHECK: # %bb.0: # %entry
66 ; CHECK-NEXT: pushq %rax
67 ; CHECK-NEXT: .cfi_def_cfa_offset 16
68 ; CHECK-NEXT: movaps %xmm0, %xmm1
69 ; CHECK-NEXT: movaps {{.*}}(%rip), %xmm0
70 ; CHECK-NEXT: callq __subtf3
71 ; CHECK-NEXT: movaps %xmm0, {{.*}}(%rip)
72 ; CHECK-NEXT: popq %rax
73 ; CHECK-NEXT: .cfi_def_cfa_offset 8
76 %0 = load fp128, fp128* @vf128, align 16
77 %sub = fsub fp128 %0, %d1
78 store fp128 %sub, fp128* @vf128, align 16
82 define void @Test128Mul(fp128 %d1, fp128 %d2){
83 ; CHECK-LABEL: Test128Mul:
84 ; CHECK: # %bb.0: # %entry
85 ; CHECK-NEXT: pushq %rax
86 ; CHECK-NEXT: .cfi_def_cfa_offset 16
87 ; CHECK-NEXT: callq __multf3
88 ; CHECK-NEXT: movaps %xmm0, {{.*}}(%rip)
89 ; CHECK-NEXT: popq %rax
90 ; CHECK-NEXT: .cfi_def_cfa_offset 8
93 %mul = fmul fp128 %d1, %d2
94 store fp128 %mul, fp128* @vf128, align 16
98 define void @Test128_1Mul(fp128 %d1){
99 ; CHECK-LABEL: Test128_1Mul:
100 ; CHECK: # %bb.0: # %entry
101 ; CHECK-NEXT: pushq %rax
102 ; CHECK-NEXT: .cfi_def_cfa_offset 16
103 ; CHECK-NEXT: movaps %xmm0, %xmm1
104 ; CHECK-NEXT: movaps {{.*}}(%rip), %xmm0
105 ; CHECK-NEXT: callq __multf3
106 ; CHECK-NEXT: movaps %xmm0, {{.*}}(%rip)
107 ; CHECK-NEXT: popq %rax
108 ; CHECK-NEXT: .cfi_def_cfa_offset 8
111 %0 = load fp128, fp128* @vf128, align 16
112 %mul = fmul fp128 %0, %d1
113 store fp128 %mul, fp128* @vf128, align 16
117 define void @Test128Div(fp128 %d1, fp128 %d2){
118 ; CHECK-LABEL: Test128Div:
119 ; CHECK: # %bb.0: # %entry
120 ; CHECK-NEXT: pushq %rax
121 ; CHECK-NEXT: .cfi_def_cfa_offset 16
122 ; CHECK-NEXT: callq __divtf3
123 ; CHECK-NEXT: movaps %xmm0, {{.*}}(%rip)
124 ; CHECK-NEXT: popq %rax
125 ; CHECK-NEXT: .cfi_def_cfa_offset 8
128 %div = fdiv fp128 %d1, %d2
129 store fp128 %div, fp128* @vf128, align 16
133 define void @Test128_1Div(fp128 %d1){
134 ; CHECK-LABEL: Test128_1Div:
135 ; CHECK: # %bb.0: # %entry
136 ; CHECK-NEXT: pushq %rax
137 ; CHECK-NEXT: .cfi_def_cfa_offset 16
138 ; CHECK-NEXT: movaps %xmm0, %xmm1
139 ; CHECK-NEXT: movaps {{.*}}(%rip), %xmm0
140 ; CHECK-NEXT: callq __divtf3
141 ; CHECK-NEXT: movaps %xmm0, {{.*}}(%rip)
142 ; CHECK-NEXT: popq %rax
143 ; CHECK-NEXT: .cfi_def_cfa_offset 8
146 %0 = load fp128, fp128* @vf128, align 16
147 %div = fdiv fp128 %0, %d1
148 store fp128 %div, fp128* @vf128, align 16
152 define void @Test128Rem(fp128 %d1, fp128 %d2){
153 ; CHECK-LABEL: Test128Rem:
154 ; CHECK: # %bb.0: # %entry
155 ; CHECK-NEXT: pushq %rax
156 ; CHECK-NEXT: .cfi_def_cfa_offset 16
157 ; CHECK-NEXT: callq fmodl
158 ; CHECK-NEXT: movaps %xmm0, {{.*}}(%rip)
159 ; CHECK-NEXT: popq %rax
160 ; CHECK-NEXT: .cfi_def_cfa_offset 8
163 %div = frem fp128 %d1, %d2
164 store fp128 %div, fp128* @vf128, align 16
168 define void @Test128_1Rem(fp128 %d1){
169 ; CHECK-LABEL: Test128_1Rem:
170 ; CHECK: # %bb.0: # %entry
171 ; CHECK-NEXT: pushq %rax
172 ; CHECK-NEXT: .cfi_def_cfa_offset 16
173 ; CHECK-NEXT: movaps %xmm0, %xmm1
174 ; CHECK-NEXT: movaps {{.*}}(%rip), %xmm0
175 ; CHECK-NEXT: callq fmodl
176 ; CHECK-NEXT: movaps %xmm0, {{.*}}(%rip)
177 ; CHECK-NEXT: popq %rax
178 ; CHECK-NEXT: .cfi_def_cfa_offset 8
181 %0 = load fp128, fp128* @vf128, align 16
182 %div = frem fp128 %0, %d1
183 store fp128 %div, fp128* @vf128, align 16
187 define void @Test128Sqrt(fp128 %d1){
188 ; CHECK-LABEL: Test128Sqrt:
189 ; CHECK: # %bb.0: # %entry
190 ; CHECK-NEXT: pushq %rax
191 ; CHECK-NEXT: .cfi_def_cfa_offset 16
192 ; CHECK-NEXT: callq sqrtl
193 ; CHECK-NEXT: movaps %xmm0, {{.*}}(%rip)
194 ; CHECK-NEXT: popq %rax
195 ; CHECK-NEXT: .cfi_def_cfa_offset 8
198 %sqrt = call fp128 @llvm.sqrt.f128(fp128 %d1)
199 store fp128 %sqrt, fp128* @vf128, align 16
202 declare fp128 @llvm.sqrt.f128(fp128)
204 define void @Test128Sin(fp128 %d1){
205 ; CHECK-LABEL: Test128Sin:
206 ; CHECK: # %bb.0: # %entry
207 ; CHECK-NEXT: pushq %rax
208 ; CHECK-NEXT: .cfi_def_cfa_offset 16
209 ; CHECK-NEXT: callq sinl
210 ; CHECK-NEXT: movaps %xmm0, {{.*}}(%rip)
211 ; CHECK-NEXT: popq %rax
212 ; CHECK-NEXT: .cfi_def_cfa_offset 8
215 %sqrt = call fp128 @llvm.sin.f128(fp128 %d1)
216 store fp128 %sqrt, fp128* @vf128, align 16
219 declare fp128 @llvm.sin.f128(fp128)
221 define void @Test128Cos(fp128 %d1){
222 ; CHECK-LABEL: Test128Cos:
223 ; CHECK: # %bb.0: # %entry
224 ; CHECK-NEXT: pushq %rax
225 ; CHECK-NEXT: .cfi_def_cfa_offset 16
226 ; CHECK-NEXT: callq cosl
227 ; CHECK-NEXT: movaps %xmm0, {{.*}}(%rip)
228 ; CHECK-NEXT: popq %rax
229 ; CHECK-NEXT: .cfi_def_cfa_offset 8
232 %sqrt = call fp128 @llvm.cos.f128(fp128 %d1)
233 store fp128 %sqrt, fp128* @vf128, align 16
236 declare fp128 @llvm.cos.f128(fp128)
238 define void @Test128Ceil(fp128 %d1) nounwind {
239 ; CHECK-LABEL: Test128Ceil:
240 ; CHECK: # %bb.0: # %entry
241 ; CHECK-NEXT: pushq %rax
242 ; CHECK-NEXT: callq ceill
243 ; CHECK-NEXT: movaps %xmm0, {{.*}}(%rip)
244 ; CHECK-NEXT: popq %rax
247 %sqrt = call fp128 @llvm.ceil.f128(fp128 %d1)
248 store fp128 %sqrt, fp128* @vf128, align 16
251 declare fp128 @llvm.ceil.f128(fp128)
253 define void @Test128Floor(fp128 %d1) nounwind {
254 ; CHECK-LABEL: Test128Floor:
255 ; CHECK: # %bb.0: # %entry
256 ; CHECK-NEXT: pushq %rax
257 ; CHECK-NEXT: callq floorl
258 ; CHECK-NEXT: movaps %xmm0, {{.*}}(%rip)
259 ; CHECK-NEXT: popq %rax
262 %sqrt = call fp128 @llvm.floor.f128(fp128 %d1)
263 store fp128 %sqrt, fp128* @vf128, align 16
266 declare fp128 @llvm.floor.f128(fp128)
268 define void @Test128Trunc(fp128 %d1) nounwind {
269 ; CHECK-LABEL: Test128Trunc:
270 ; CHECK: # %bb.0: # %entry
271 ; CHECK-NEXT: pushq %rax
272 ; CHECK-NEXT: callq truncl
273 ; CHECK-NEXT: movaps %xmm0, {{.*}}(%rip)
274 ; CHECK-NEXT: popq %rax
277 %sqrt = call fp128 @llvm.trunc.f128(fp128 %d1)
278 store fp128 %sqrt, fp128* @vf128, align 16
281 declare fp128 @llvm.trunc.f128(fp128)
283 define void @Test128Nearbyint(fp128 %d1) nounwind {
284 ; CHECK-LABEL: Test128Nearbyint:
285 ; CHECK: # %bb.0: # %entry
286 ; CHECK-NEXT: pushq %rax
287 ; CHECK-NEXT: callq nearbyintl
288 ; CHECK-NEXT: movaps %xmm0, {{.*}}(%rip)
289 ; CHECK-NEXT: popq %rax
292 %sqrt = call fp128 @llvm.nearbyint.f128(fp128 %d1)
293 store fp128 %sqrt, fp128* @vf128, align 16
296 declare fp128 @llvm.nearbyint.f128(fp128)
298 define void @Test128Rint(fp128 %d1) nounwind {
299 ; CHECK-LABEL: Test128Rint:
300 ; CHECK: # %bb.0: # %entry
301 ; CHECK-NEXT: pushq %rax
302 ; CHECK-NEXT: callq rintl
303 ; CHECK-NEXT: movaps %xmm0, {{.*}}(%rip)
304 ; CHECK-NEXT: popq %rax
307 %sqrt = call fp128 @llvm.rint.f128(fp128 %d1)
308 store fp128 %sqrt, fp128* @vf128, align 16
311 declare fp128 @llvm.rint.f128(fp128)
313 define void @Test128Round(fp128 %d1) nounwind {
314 ; CHECK-LABEL: Test128Round:
315 ; CHECK: # %bb.0: # %entry
316 ; CHECK-NEXT: pushq %rax
317 ; CHECK-NEXT: callq roundl
318 ; CHECK-NEXT: movaps %xmm0, {{.*}}(%rip)
319 ; CHECK-NEXT: popq %rax
322 %sqrt = call fp128 @llvm.round.f128(fp128 %d1)
323 store fp128 %sqrt, fp128* @vf128, align 16
326 declare fp128 @llvm.round.f128(fp128)