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.pow.f32(float, float)
163 declare double @llvm.pow.f64(double, double)
164 declare fp128 @llvm.pow.f128(fp128, fp128)
166 define void @test_pow(float %float, double %double, fp128 %fp128) {
167 ; CHECK-LABEL: test_pow:
169 %powfloat = call float @llvm.pow.f32(float %float, float %float)
170 store float %powfloat, ptr @varfloat
173 %powdouble = call double @llvm.pow.f64(double %double, double %double)
174 store double %powdouble, ptr @vardouble
177 %powfp128 = call fp128 @llvm.pow.f128(fp128 %fp128, fp128 %fp128)
178 store fp128 %powfp128, ptr @varfp128
184 declare float @llvm.powi.f32.i32(float, i32)
185 declare double @llvm.powi.f64.i32(double, i32)
186 declare fp128 @llvm.powi.f128.i32(fp128, i32)
188 define void @test_powi(float %float, double %double, i32 %exponent, fp128 %fp128) {
189 ; CHECK-LABEL: test_powi:
191 %powifloat = call float @llvm.powi.f32.i32(float %float, i32 %exponent)
192 store float %powifloat, ptr @varfloat
193 ; CHECK: bl __powisf2
195 %powidouble = call double @llvm.powi.f64.i32(double %double, i32 %exponent)
196 store double %powidouble, ptr @vardouble
197 ; CHECK: bl __powidf2
199 %powifp128 = call fp128 @llvm.powi.f128.i32(fp128 %fp128, i32 %exponent)
200 store fp128 %powifp128, ptr @varfp128
201 ; CHECK: bl __powitf2
206 define void @test_frem(float %float, double %double, fp128 %fp128) {
207 ; CHECK-LABEL: test_frem:
209 %fremfloat = frem float %float, %float
210 store float %fremfloat, ptr @varfloat
213 %fremdouble = frem double %double, %double
214 store double %fremdouble, ptr @vardouble
217 %fremfp128 = frem fp128 %fp128, %fp128
218 store fp128 %fremfp128, ptr @varfp128
224 declare fp128 @llvm.fma.f128(fp128, fp128, fp128)
226 define void @test_fma(fp128 %fp128) {
227 ; CHECK-LABEL: test_fma:
229 %fmafp128 = call fp128 @llvm.fma.f128(fp128 %fp128, fp128 %fp128, fp128 %fp128)
230 store fp128 %fmafp128, ptr @varfp128
236 declare fp128 @llvm.fmuladd.f128(fp128, fp128, fp128)
238 define void @test_fmuladd(fp128 %fp128) {
239 ; CHECK-LABEL: test_fmuladd:
241 %fmuladdfp128 = call fp128 @llvm.fmuladd.f128(fp128 %fp128, fp128 %fp128, fp128 %fp128)
242 store fp128 %fmuladdfp128, ptr @varfp128
250 define i32 @test_fptosi32(fp128 %a) {
251 ; CHECK-LABEL: test_fptosi32:
252 ; CHECK: bl __fixtfsi
253 %conv.i = fptosi fp128 %a to i32
254 %b = add nsw i32 %conv.i, 48
258 define i64 @test_fptosi64(fp128 %a) {
259 ; CHECK-LABEL: test_fptosi64:
260 ; CHECK: bl __fixtfdi
261 %conv.i = fptosi fp128 %a to i64
262 %b = add nsw i64 %conv.i, 48
266 define i128 @test_fptosi128(fp128 %a) {
267 ; CHECK-LABEL: test_fptosi128:
268 ; CHECK: bl __fixtfti
269 %conv.i = fptosi fp128 %a to i128
270 %b = add nsw i128 %conv.i, 48
274 define i32 @test_fptoui32(fp128 %a) {
275 ; CHECK-LABEL: test_fptoui32:
276 ; CHECK: bl __fixunstfsi
277 %conv.i = fptoui fp128 %a to i32
278 %b = add nsw i32 %conv.i, 48
282 define i64 @test_fptoui64(fp128 %a) {
283 ; CHECK-LABEL: test_fptoui64:
284 ; CHECK: bl __fixunstfdi
285 %conv.i = fptoui fp128 %a to i64
286 %b = add nsw i64 %conv.i, 48
290 define i128 @test_fptoui128(fp128 %a) {
291 ; CHECK-LABEL: test_fptoui128:
292 ; CHECK: bl __fixunstfti
293 %conv.i = fptoui fp128 %a to i128
294 %b = add nsw i128 %conv.i, 48
298 define void @test_exp_finite(double %double) #0 {
299 %expdouble = call double @llvm.exp.f64(double %double)
300 store double %expdouble, ptr @vardouble
301 ; ANDROID-AARCH64-NOT: bl __exp_finite
307 define void @test_exp2_finite(double %double) #0 {
308 %expdouble = call double @llvm.exp2.f64(double %double)
309 store double %expdouble, ptr @vardouble
310 ; CHECK-NOT: bl __exp2_finite
316 define void @test_log_finite(double %double) #0 {
317 %logdouble = call double @llvm.log.f64(double %double)
318 store double %logdouble, ptr @vardouble
319 ; CHECK-NOT: bl __log_finite
324 define void @test_log2_finite(double %double) #0 {
325 %log2double = call double @llvm.log2.f64(double %double)
326 store double %log2double, ptr @vardouble
327 ; CHECK-NOT: bl __log2_finite
332 define void @test_log10_finite(double %double) #0 {
333 %log10double = call double @llvm.log10.f64(double %double)
334 store double %log10double, ptr @vardouble
335 ; CHECK-NOT: bl __log10_finite
340 define void @test_pow_finite(double %double) #0 {
341 %powdouble = call double @llvm.pow.f64(double %double, double %double)
342 store double %powdouble, ptr @vardouble
343 ; CHECK-NOT: bl __pow_finite
348 attributes #0 = { "no-infs-fp-math"="true" "no-nans-fp-math"="true" }