1 ; RUN: llc -mtriple=aarch64-none-linux-gnu -verify-machineinstrs -o - %s | FileCheck %s
2 ; RUN: llc -mtriple=aarch64-linux-android -verify-machineinstrs -o - %s | FileCheck %s
4 @varfloat = global float 0.0
5 @vardouble = global double 0.0
6 @varfp128 = global fp128 zeroinitializer
8 declare float @llvm.cos.f32(float)
9 declare double @llvm.cos.f64(double)
10 declare fp128 @llvm.cos.f128(fp128)
12 define void @test_cos(float %float, double %double, fp128 %fp128) {
13 ; CHECK-LABEL: test_cos:
15 %cosfloat = call float @llvm.cos.f32(float %float)
16 store float %cosfloat, ptr @varfloat
19 %cosdouble = call double @llvm.cos.f64(double %double)
20 store double %cosdouble, ptr @vardouble
23 %cosfp128 = call fp128 @llvm.cos.f128(fp128 %fp128)
24 store fp128 %cosfp128, ptr @varfp128
30 declare float @llvm.exp.f32(float)
31 declare double @llvm.exp.f64(double)
32 declare fp128 @llvm.exp.f128(fp128)
34 define void @test_exp(float %float, double %double, fp128 %fp128) {
35 ; CHECK-LABEL: test_exp:
37 %expfloat = call float @llvm.exp.f32(float %float)
38 store float %expfloat, ptr @varfloat
41 %expdouble = call double @llvm.exp.f64(double %double)
42 store double %expdouble, ptr @vardouble
45 %expfp128 = call fp128 @llvm.exp.f128(fp128 %fp128)
46 store fp128 %expfp128, ptr @varfp128
52 declare float @llvm.exp2.f32(float)
53 declare double @llvm.exp2.f64(double)
54 declare fp128 @llvm.exp2.f128(fp128)
56 define void @test_exp2(float %float, double %double, fp128 %fp128) {
57 ; CHECK-LABEL: test_exp2:
59 %exp2float = call float @llvm.exp2.f32(float %float)
60 store float %exp2float, ptr @varfloat
63 %exp2double = call double @llvm.exp2.f64(double %double)
64 store double %exp2double, ptr @vardouble
67 %exp2fp128 = call fp128 @llvm.exp2.f128(fp128 %fp128)
68 store fp128 %exp2fp128, ptr @varfp128
74 declare float @llvm.log.f32(float)
75 declare double @llvm.log.f64(double)
76 declare fp128 @llvm.log.f128(fp128)
78 define void @test_log(float %float, double %double, fp128 %fp128) {
79 ; CHECK-LABEL: test_log:
81 %logfloat = call float @llvm.log.f32(float %float)
82 store float %logfloat, ptr @varfloat
85 %logdouble = call double @llvm.log.f64(double %double)
86 store double %logdouble, ptr @vardouble
89 %logfp128 = call fp128 @llvm.log.f128(fp128 %fp128)
90 store fp128 %logfp128, ptr @varfp128
96 declare float @llvm.log2.f32(float)
97 declare double @llvm.log2.f64(double)
98 declare fp128 @llvm.log2.f128(fp128)
100 define void @test_log2(float %float, double %double, fp128 %fp128) {
101 ; CHECK-LABEL: test_log2:
103 %log2float = call float @llvm.log2.f32(float %float)
104 store float %log2float, ptr @varfloat
107 %log2double = call double @llvm.log2.f64(double %double)
108 store double %log2double, ptr @vardouble
111 %log2fp128 = call fp128 @llvm.log2.f128(fp128 %fp128)
112 store fp128 %log2fp128, ptr @varfp128
118 declare float @llvm.log10.f32(float)
119 declare double @llvm.log10.f64(double)
120 declare fp128 @llvm.log10.f128(fp128)
122 define void @test_log10(float %float, double %double, fp128 %fp128) {
123 ; CHECK-LABEL: test_log10:
125 %log10float = call float @llvm.log10.f32(float %float)
126 store float %log10float, ptr @varfloat
129 %log10double = call double @llvm.log10.f64(double %double)
130 store double %log10double, ptr @vardouble
133 %log10fp128 = call fp128 @llvm.log10.f128(fp128 %fp128)
134 store fp128 %log10fp128, ptr @varfp128
140 declare float @llvm.sin.f32(float)
141 declare double @llvm.sin.f64(double)
142 declare fp128 @llvm.sin.f128(fp128)
144 define void @test_sin(float %float, double %double, fp128 %fp128) {
145 ; CHECK-LABEL: test_sin:
147 %sinfloat = call float @llvm.sin.f32(float %float)
148 store float %sinfloat, ptr @varfloat
151 %sindouble = call double @llvm.sin.f64(double %double)
152 store double %sindouble, ptr @vardouble
155 %sinfp128 = call fp128 @llvm.sin.f128(fp128 %fp128)
156 store fp128 %sinfp128, ptr @varfp128
162 declare float @llvm.tan.f32(float)
163 declare double @llvm.tan.f64(double)
164 declare fp128 @llvm.tan.f128(fp128)
166 define void @test_tan(float %float, double %double, fp128 %fp128) {
167 ; CHECK-LABEL: test_tan:
169 %tanfloat = call float @llvm.tan.f32(float %float)
170 store float %tanfloat, ptr @varfloat
173 %tandouble = call double @llvm.tan.f64(double %double)
174 store double %tandouble, ptr @vardouble
177 %tanfp128 = call fp128 @llvm.tan.f128(fp128 %fp128)
178 store fp128 %tanfp128, ptr @varfp128
183 declare float @llvm.acos.f32(float)
184 declare double @llvm.acos.f64(double)
185 declare fp128 @llvm.acos.f128(fp128)
187 define void @test_acos(float %float, double %double, fp128 %fp128) {
188 ; CHECK-LABEL: test_acos:
190 %acosfloat = call float @llvm.acos.f32(float %float)
191 store float %acosfloat, ptr @varfloat
194 %acosdouble = call double @llvm.acos.f64(double %double)
195 store double %acosdouble, ptr @vardouble
198 %acosfp128 = call fp128 @llvm.acos.f128(fp128 %fp128)
199 store fp128 %acosfp128, ptr @varfp128
204 declare float @llvm.asin.f32(float)
205 declare double @llvm.asin.f64(double)
206 declare fp128 @llvm.asin.f128(fp128)
208 define void @test_asin(float %float, double %double, fp128 %fp128) {
209 ; CHECK-LABEL: test_asin:
211 %asinfloat = call float @llvm.asin.f32(float %float)
212 store float %asinfloat, ptr @varfloat
215 %asindouble = call double @llvm.asin.f64(double %double)
216 store double %asindouble, ptr @vardouble
219 %asinfp128 = call fp128 @llvm.asin.f128(fp128 %fp128)
220 store fp128 %asinfp128, ptr @varfp128
225 declare float @llvm.atan.f32(float)
226 declare double @llvm.atan.f64(double)
227 declare fp128 @llvm.atan.f128(fp128)
229 define void @test_atan(float %float, double %double, fp128 %fp128) {
230 ; CHECK-LABEL: test_atan:
232 %atanfloat = call float @llvm.atan.f32(float %float)
233 store float %atanfloat, ptr @varfloat
236 %atandouble = call double @llvm.atan.f64(double %double)
237 store double %atandouble, ptr @vardouble
240 %atanfp128 = call fp128 @llvm.atan.f128(fp128 %fp128)
241 store fp128 %atanfp128, ptr @varfp128
246 declare float @llvm.atan2.f32(float, float)
247 declare double @llvm.atan2.f64(double, double)
248 declare fp128 @llvm.atan2.f128(fp128, fp128)
250 define void @test_atan2(float %float1, double %double1, fp128 %fp1281, float %float2, double %double2, fp128 %fp1282) {
251 ; CHECK-LABEL: test_atan2:
253 %atan2float = call float @llvm.atan2.f32(float %float1, float %float2)
254 store float %atan2float, ptr @varfloat
257 %atan2double = call double @llvm.atan2.f64(double %double1, double %double2)
258 store double %atan2double, ptr @vardouble
261 %atan2fp128 = call fp128 @llvm.atan2.f128(fp128 %fp1281, fp128 %fp1282)
262 store fp128 %atan2fp128, ptr @varfp128
267 declare float @llvm.cosh.f32(float)
268 declare double @llvm.cosh.f64(double)
269 declare fp128 @llvm.cosh.f128(fp128)
271 define void @test_cosh(float %float, double %double, fp128 %fp128) {
272 ; CHECK-LABEL: test_cosh:
274 %coshfloat = call float @llvm.cosh.f32(float %float)
275 store float %coshfloat, ptr @varfloat
278 %coshdouble = call double @llvm.cosh.f64(double %double)
279 store double %coshdouble, ptr @vardouble
282 %coshfp128 = call fp128 @llvm.cosh.f128(fp128 %fp128)
283 store fp128 %coshfp128, ptr @varfp128
288 declare float @llvm.sinh.f32(float)
289 declare double @llvm.sinh.f64(double)
290 declare fp128 @llvm.sinh.f128(fp128)
292 define void @test_sinh(float %float, double %double, fp128 %fp128) {
293 ; CHECK-LABEL: test_sinh:
295 %sinhfloat = call float @llvm.sinh.f32(float %float)
296 store float %sinhfloat, ptr @varfloat
299 %sinhdouble = call double @llvm.sinh.f64(double %double)
300 store double %sinhdouble, ptr @vardouble
303 %sinhfp128 = call fp128 @llvm.sinh.f128(fp128 %fp128)
304 store fp128 %sinhfp128, ptr @varfp128
309 declare float @llvm.tanh.f32(float)
310 declare double @llvm.tanh.f64(double)
311 declare fp128 @llvm.tanh.f128(fp128)
313 define void @test_tanh(float %float, double %double, fp128 %fp128) {
314 ; CHECK-LABEL: test_tanh:
316 %tanhfloat = call float @llvm.tanh.f32(float %float)
317 store float %tanhfloat, ptr @varfloat
320 %tanhdouble = call double @llvm.tanh.f64(double %double)
321 store double %tanhdouble, ptr @vardouble
324 %tanhfp128 = call fp128 @llvm.tanh.f128(fp128 %fp128)
325 store fp128 %tanhfp128, ptr @varfp128
330 declare float @llvm.pow.f32(float, float)
331 declare double @llvm.pow.f64(double, double)
332 declare fp128 @llvm.pow.f128(fp128, fp128)
334 define void @test_pow(float %float, double %double, fp128 %fp128) {
335 ; CHECK-LABEL: test_pow:
337 %powfloat = call float @llvm.pow.f32(float %float, float %float)
338 store float %powfloat, ptr @varfloat
341 %powdouble = call double @llvm.pow.f64(double %double, double %double)
342 store double %powdouble, ptr @vardouble
345 %powfp128 = call fp128 @llvm.pow.f128(fp128 %fp128, fp128 %fp128)
346 store fp128 %powfp128, ptr @varfp128
352 declare float @llvm.powi.f32.i32(float, i32)
353 declare double @llvm.powi.f64.i32(double, i32)
354 declare fp128 @llvm.powi.f128.i32(fp128, i32)
356 define void @test_powi(float %float, double %double, i32 %exponent, fp128 %fp128) {
357 ; CHECK-LABEL: test_powi:
359 %powifloat = call float @llvm.powi.f32.i32(float %float, i32 %exponent)
360 store float %powifloat, ptr @varfloat
361 ; CHECK: bl __powisf2
363 %powidouble = call double @llvm.powi.f64.i32(double %double, i32 %exponent)
364 store double %powidouble, ptr @vardouble
365 ; CHECK: bl __powidf2
367 %powifp128 = call fp128 @llvm.powi.f128.i32(fp128 %fp128, i32 %exponent)
368 store fp128 %powifp128, ptr @varfp128
369 ; CHECK: bl __powitf2
374 define void @test_frem(float %float, double %double, fp128 %fp128) {
375 ; CHECK-LABEL: test_frem:
377 %fremfloat = frem float %float, %float
378 store float %fremfloat, ptr @varfloat
381 %fremdouble = frem double %double, %double
382 store double %fremdouble, ptr @vardouble
385 %fremfp128 = frem fp128 %fp128, %fp128
386 store fp128 %fremfp128, ptr @varfp128
392 declare fp128 @llvm.fma.f128(fp128, fp128, fp128)
394 define void @test_fma(fp128 %fp128) {
395 ; CHECK-LABEL: test_fma:
397 %fmafp128 = call fp128 @llvm.fma.f128(fp128 %fp128, fp128 %fp128, fp128 %fp128)
398 store fp128 %fmafp128, ptr @varfp128
404 declare fp128 @llvm.fmuladd.f128(fp128, fp128, fp128)
406 define void @test_fmuladd(fp128 %fp128) {
407 ; CHECK-LABEL: test_fmuladd:
409 %fmuladdfp128 = call fp128 @llvm.fmuladd.f128(fp128 %fp128, fp128 %fp128, fp128 %fp128)
410 store fp128 %fmuladdfp128, ptr @varfp128
418 define i32 @test_fptosi32(fp128 %a) {
419 ; CHECK-LABEL: test_fptosi32:
420 ; CHECK: bl __fixtfsi
421 %conv.i = fptosi fp128 %a to i32
422 %b = add nsw i32 %conv.i, 48
426 define i64 @test_fptosi64(fp128 %a) {
427 ; CHECK-LABEL: test_fptosi64:
428 ; CHECK: bl __fixtfdi
429 %conv.i = fptosi fp128 %a to i64
430 %b = add nsw i64 %conv.i, 48
434 define i128 @test_fptosi128(fp128 %a) {
435 ; CHECK-LABEL: test_fptosi128:
436 ; CHECK: bl __fixtfti
437 %conv.i = fptosi fp128 %a to i128
438 %b = add nsw i128 %conv.i, 48
442 define i32 @test_fptoui32(fp128 %a) {
443 ; CHECK-LABEL: test_fptoui32:
444 ; CHECK: bl __fixunstfsi
445 %conv.i = fptoui fp128 %a to i32
446 %b = add nsw i32 %conv.i, 48
450 define i64 @test_fptoui64(fp128 %a) {
451 ; CHECK-LABEL: test_fptoui64:
452 ; CHECK: bl __fixunstfdi
453 %conv.i = fptoui fp128 %a to i64
454 %b = add nsw i64 %conv.i, 48
458 define i128 @test_fptoui128(fp128 %a) {
459 ; CHECK-LABEL: test_fptoui128:
460 ; CHECK: bl __fixunstfti
461 %conv.i = fptoui fp128 %a to i128
462 %b = add nsw i128 %conv.i, 48
466 define void @test_exp_finite(double %double) #0 {
467 %expdouble = call double @llvm.exp.f64(double %double)
468 store double %expdouble, ptr @vardouble
469 ; ANDROID-AARCH64-NOT: bl __exp_finite
475 define void @test_exp2_finite(double %double) #0 {
476 %expdouble = call double @llvm.exp2.f64(double %double)
477 store double %expdouble, ptr @vardouble
478 ; CHECK-NOT: bl __exp2_finite
484 define void @test_log_finite(double %double) #0 {
485 %logdouble = call double @llvm.log.f64(double %double)
486 store double %logdouble, ptr @vardouble
487 ; CHECK-NOT: bl __log_finite
492 define void @test_log2_finite(double %double) #0 {
493 %log2double = call double @llvm.log2.f64(double %double)
494 store double %log2double, ptr @vardouble
495 ; CHECK-NOT: bl __log2_finite
500 define void @test_log10_finite(double %double) #0 {
501 %log10double = call double @llvm.log10.f64(double %double)
502 store double %log10double, ptr @vardouble
503 ; CHECK-NOT: bl __log10_finite
508 define void @test_pow_finite(double %double) #0 {
509 %powdouble = call double @llvm.pow.f64(double %double, double %double)
510 store double %powdouble, ptr @vardouble
511 ; CHECK-NOT: bl __pow_finite
516 attributes #0 = { "no-infs-fp-math"="true" "no-nans-fp-math"="true" }