1 ; RUN: llc -mtriple=arm64-none-linux-gnu -verify-machineinstrs < %s | FileCheck %s
3 @varfloat = global float 0.0
4 @vardouble = global double 0.0
5 @varfp128 = global fp128 zeroinitializer
7 declare float @llvm.cos.f32(float)
8 declare double @llvm.cos.f64(double)
9 declare fp128 @llvm.cos.f128(fp128)
11 define void @test_cos(float %float, double %double, fp128 %fp128) {
12 ; CHECK-LABEL: test_cos:
14 %cosfloat = call float @llvm.cos.f32(float %float)
15 store float %cosfloat, float* @varfloat
18 %cosdouble = call double @llvm.cos.f64(double %double)
19 store double %cosdouble, double* @vardouble
22 %cosfp128 = call fp128 @llvm.cos.f128(fp128 %fp128)
23 store fp128 %cosfp128, fp128* @varfp128
29 declare float @llvm.exp.f32(float)
30 declare double @llvm.exp.f64(double)
31 declare fp128 @llvm.exp.f128(fp128)
33 define void @test_exp(float %float, double %double, fp128 %fp128) {
34 ; CHECK-LABEL: test_exp:
36 %expfloat = call float @llvm.exp.f32(float %float)
37 store float %expfloat, float* @varfloat
40 %expdouble = call double @llvm.exp.f64(double %double)
41 store double %expdouble, double* @vardouble
44 %expfp128 = call fp128 @llvm.exp.f128(fp128 %fp128)
45 store fp128 %expfp128, fp128* @varfp128
51 declare float @llvm.exp2.f32(float)
52 declare double @llvm.exp2.f64(double)
53 declare fp128 @llvm.exp2.f128(fp128)
55 define void @test_exp2(float %float, double %double, fp128 %fp128) {
56 ; CHECK-LABEL: test_exp2:
58 %exp2float = call float @llvm.exp2.f32(float %float)
59 store float %exp2float, float* @varfloat
62 %exp2double = call double @llvm.exp2.f64(double %double)
63 store double %exp2double, double* @vardouble
66 %exp2fp128 = call fp128 @llvm.exp2.f128(fp128 %fp128)
67 store fp128 %exp2fp128, fp128* @varfp128
73 declare float @llvm.log.f32(float)
74 declare double @llvm.log.f64(double)
75 declare fp128 @llvm.log.f128(fp128)
77 define void @test_log(float %float, double %double, fp128 %fp128) {
78 ; CHECK-LABEL: test_log:
80 %logfloat = call float @llvm.log.f32(float %float)
81 store float %logfloat, float* @varfloat
84 %logdouble = call double @llvm.log.f64(double %double)
85 store double %logdouble, double* @vardouble
88 %logfp128 = call fp128 @llvm.log.f128(fp128 %fp128)
89 store fp128 %logfp128, fp128* @varfp128
95 declare float @llvm.log2.f32(float)
96 declare double @llvm.log2.f64(double)
97 declare fp128 @llvm.log2.f128(fp128)
99 define void @test_log2(float %float, double %double, fp128 %fp128) {
100 ; CHECK-LABEL: test_log2:
102 %log2float = call float @llvm.log2.f32(float %float)
103 store float %log2float, float* @varfloat
106 %log2double = call double @llvm.log2.f64(double %double)
107 store double %log2double, double* @vardouble
110 %log2fp128 = call fp128 @llvm.log2.f128(fp128 %fp128)
111 store fp128 %log2fp128, fp128* @varfp128
117 declare float @llvm.log10.f32(float)
118 declare double @llvm.log10.f64(double)
119 declare fp128 @llvm.log10.f128(fp128)
121 define void @test_log10(float %float, double %double, fp128 %fp128) {
122 ; CHECK-LABEL: test_log10:
124 %log10float = call float @llvm.log10.f32(float %float)
125 store float %log10float, float* @varfloat
128 %log10double = call double @llvm.log10.f64(double %double)
129 store double %log10double, double* @vardouble
132 %log10fp128 = call fp128 @llvm.log10.f128(fp128 %fp128)
133 store fp128 %log10fp128, fp128* @varfp128
139 declare float @llvm.sin.f32(float)
140 declare double @llvm.sin.f64(double)
141 declare fp128 @llvm.sin.f128(fp128)
143 define void @test_sin(float %float, double %double, fp128 %fp128) {
144 ; CHECK-LABEL: test_sin:
146 %sinfloat = call float @llvm.sin.f32(float %float)
147 store float %sinfloat, float* @varfloat
150 %sindouble = call double @llvm.sin.f64(double %double)
151 store double %sindouble, double* @vardouble
154 %sinfp128 = call fp128 @llvm.sin.f128(fp128 %fp128)
155 store fp128 %sinfp128, fp128* @varfp128
161 declare float @llvm.pow.f32(float, float)
162 declare double @llvm.pow.f64(double, double)
163 declare fp128 @llvm.pow.f128(fp128, fp128)
165 define void @test_pow(float %float, double %double, fp128 %fp128) {
166 ; CHECK-LABEL: test_pow:
168 %powfloat = call float @llvm.pow.f32(float %float, float %float)
169 store float %powfloat, float* @varfloat
172 %powdouble = call double @llvm.pow.f64(double %double, double %double)
173 store double %powdouble, double* @vardouble
176 %powfp128 = call fp128 @llvm.pow.f128(fp128 %fp128, fp128 %fp128)
177 store fp128 %powfp128, fp128* @varfp128
183 declare float @llvm.powi.f32(float, i32)
184 declare double @llvm.powi.f64(double, i32)
185 declare fp128 @llvm.powi.f128(fp128, i32)
187 define void @test_powi(float %float, double %double, i32 %exponent, fp128 %fp128) {
188 ; CHECK-LABEL: test_powi:
190 %powifloat = call float @llvm.powi.f32(float %float, i32 %exponent)
191 store float %powifloat, float* @varfloat
192 ; CHECK: bl __powisf2
194 %powidouble = call double @llvm.powi.f64(double %double, i32 %exponent)
195 store double %powidouble, double* @vardouble
196 ; CHECK: bl __powidf2
198 %powifp128 = call fp128 @llvm.powi.f128(fp128 %fp128, i32 %exponent)
199 store fp128 %powifp128, fp128* @varfp128
200 ; CHECK: bl __powitf2
205 define void @test_frem(float %float, double %double, fp128 %fp128) {
206 ; CHECK-LABEL: test_frem:
208 %fremfloat = frem float %float, %float
209 store float %fremfloat, float* @varfloat
212 %fremdouble = frem double %double, %double
213 store double %fremdouble, double* @vardouble
216 %fremfp128 = frem fp128 %fp128, %fp128
217 store fp128 %fremfp128, fp128* @varfp128
223 declare fp128 @llvm.fma.f128(fp128, fp128, fp128)
225 define void @test_fma(fp128 %fp128) {
226 ; CHECK-LABEL: test_fma:
228 %fmafp128 = call fp128 @llvm.fma.f128(fp128 %fp128, fp128 %fp128, fp128 %fp128)
229 store fp128 %fmafp128, fp128* @varfp128
235 declare fp128 @llvm.fmuladd.f128(fp128, fp128, fp128)
237 define void @test_fmuladd(fp128 %fp128) {
238 ; CHECK-LABEL: test_fmuladd:
240 %fmuladdfp128 = call fp128 @llvm.fmuladd.f128(fp128 %fp128, fp128 %fp128, fp128 %fp128)
241 store fp128 %fmuladdfp128, fp128* @varfp128
249 define i32 @test_fptosi32(fp128 %a) {
250 ; CHECK-LABEL: test_fptosi32:
251 ; CHECK: bl __fixtfsi
252 %conv.i = fptosi fp128 %a to i32
253 %b = add nsw i32 %conv.i, 48
257 define i64 @test_fptosi64(fp128 %a) {
258 ; CHECK-LABEL: test_fptosi64:
259 ; CHECK: bl __fixtfdi
260 %conv.i = fptosi fp128 %a to i64
261 %b = add nsw i64 %conv.i, 48
265 define i128 @test_fptosi128(fp128 %a) {
266 ; CHECK-LABEL: test_fptosi128:
267 ; CHECK: bl __fixtfti
268 %conv.i = fptosi fp128 %a to i128
269 %b = add nsw i128 %conv.i, 48
273 define i32 @test_fptoui32(fp128 %a) {
274 ; CHECK-LABEL: test_fptoui32:
275 ; CHECK: bl __fixunstfsi
276 %conv.i = fptoui fp128 %a to i32
277 %b = add nsw i32 %conv.i, 48
281 define i64 @test_fptoui64(fp128 %a) {
282 ; CHECK-LABEL: test_fptoui64:
283 ; CHECK: bl __fixunstfdi
284 %conv.i = fptoui fp128 %a to i64
285 %b = add nsw i64 %conv.i, 48
289 define i128 @test_fptoui128(fp128 %a) {
290 ; CHECK-LABEL: test_fptoui128:
291 ; CHECK: bl __fixunstfti
292 %conv.i = fptoui fp128 %a to i128
293 %b = add nsw i128 %conv.i, 48