1 ; Test that library calls are emitted for LLVM IR intrinsics
3 ; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s
5 define float @f1(float %x, i32 %y) {
7 ; CHECK: brasl %r14, __powisf2@PLT
8 %tmp = call float @llvm.powi.f32.i32(float %x, i32 %y)
12 define double @f2(double %x, i32 %y) {
14 ; CHECK: brasl %r14, __powidf2@PLT
15 %tmp = call double @llvm.powi.f64.i32(double %x, i32 %y)
19 define fp128 @f3(fp128 %x, i32 %y) {
21 ; CHECK: brasl %r14, __powitf2@PLT
22 %tmp = call fp128 @llvm.powi.f128.i32(fp128 %x, i32 %y)
26 define float @f4(float %x, float %y) {
28 ; CHECK: brasl %r14, powf@PLT
29 %tmp = call float @llvm.pow.f32(float %x, float %y)
33 define double @f5(double %x, double %y) {
35 ; CHECK: brasl %r14, pow@PLT
36 %tmp = call double @llvm.pow.f64(double %x, double %y)
40 define fp128 @f6(fp128 %x, fp128 %y) {
42 ; CHECK: brasl %r14, powl@PLT
43 %tmp = call fp128 @llvm.pow.f128(fp128 %x, fp128 %y)
47 define float @f7(float %x) {
49 ; CHECK: brasl %r14, sinf@PLT
50 %tmp = call float @llvm.sin.f32(float %x)
54 define double @f8(double %x) {
56 ; CHECK: brasl %r14, sin@PLT
57 %tmp = call double @llvm.sin.f64(double %x)
61 define fp128 @f9(fp128 %x) {
63 ; CHECK: brasl %r14, sinl@PLT
64 %tmp = call fp128 @llvm.sin.f128(fp128 %x)
68 define float @f10(float %x) {
70 ; CHECK: brasl %r14, cosf@PLT
71 %tmp = call float @llvm.cos.f32(float %x)
75 define double @f11(double %x) {
77 ; CHECK: brasl %r14, cos@PLT
78 %tmp = call double @llvm.cos.f64(double %x)
82 define fp128 @f12(fp128 %x) {
84 ; CHECK: brasl %r14, cosl@PLT
85 %tmp = call fp128 @llvm.cos.f128(fp128 %x)
89 define float @f13(float %x) {
91 ; CHECK: brasl %r14, expf@PLT
92 %tmp = call float @llvm.exp.f32(float %x)
96 define double @f14(double %x) {
98 ; CHECK: brasl %r14, exp@PLT
99 %tmp = call double @llvm.exp.f64(double %x)
103 define fp128 @f15(fp128 %x) {
105 ; CHECK: brasl %r14, expl@PLT
106 %tmp = call fp128 @llvm.exp.f128(fp128 %x)
110 define float @f16(float %x) {
112 ; CHECK: brasl %r14, exp2f@PLT
113 %tmp = call float @llvm.exp2.f32(float %x)
117 define double @f17(double %x) {
119 ; CHECK: brasl %r14, exp2@PLT
120 %tmp = call double @llvm.exp2.f64(double %x)
124 define fp128 @f18(fp128 %x) {
126 ; CHECK: brasl %r14, exp2l@PLT
127 %tmp = call fp128 @llvm.exp2.f128(fp128 %x)
131 define float @f19(float %x) {
133 ; CHECK: brasl %r14, logf@PLT
134 %tmp = call float @llvm.log.f32(float %x)
138 define double @f20(double %x) {
140 ; CHECK: brasl %r14, log@PLT
141 %tmp = call double @llvm.log.f64(double %x)
145 define fp128 @f21(fp128 %x) {
147 ; CHECK: brasl %r14, logl@PLT
148 %tmp = call fp128 @llvm.log.f128(fp128 %x)
152 define float @f22(float %x) {
154 ; CHECK: brasl %r14, log2f@PLT
155 %tmp = call float @llvm.log2.f32(float %x)
159 define double @f23(double %x) {
161 ; CHECK: brasl %r14, log2@PLT
162 %tmp = call double @llvm.log2.f64(double %x)
166 define fp128 @f24(fp128 %x) {
168 ; CHECK: brasl %r14, log2l@PLT
169 %tmp = call fp128 @llvm.log2.f128(fp128 %x)
173 define float @f25(float %x) {
175 ; CHECK: brasl %r14, log10f@PLT
176 %tmp = call float @llvm.log10.f32(float %x)
180 define double @f26(double %x) {
182 ; CHECK: brasl %r14, log10@PLT
183 %tmp = call double @llvm.log10.f64(double %x)
187 define fp128 @f27(fp128 %x) {
189 ; CHECK: brasl %r14, log10l@PLT
190 %tmp = call fp128 @llvm.log10.f128(fp128 %x)
194 define float @f28(float %x, float %y) {
196 ; CHECK: brasl %r14, fminf@PLT
197 %tmp = call float @llvm.minnum.f32(float %x, float %y)
201 define double @f29(double %x, double %y) {
203 ; CHECK: brasl %r14, fmin@PLT
204 %tmp = call double @llvm.minnum.f64(double %x, double %y)
208 define fp128 @f30(fp128 %x, fp128 %y) {
210 ; CHECK: brasl %r14, fminl@PLT
211 %tmp = call fp128 @llvm.minnum.f128(fp128 %x, fp128 %y)
215 define float @f31(float %x, float %y) {
217 ; CHECK: brasl %r14, fmaxf@PLT
218 %tmp = call float @llvm.maxnum.f32(float %x, float %y)
222 define double @f32(double %x, double %y) {
224 ; CHECK: brasl %r14, fmax@PLT
225 %tmp = call double @llvm.maxnum.f64(double %x, double %y)
229 define fp128 @f33(fp128 %x, fp128 %y) {
231 ; CHECK: brasl %r14, fmaxl@PLT
232 %tmp = call fp128 @llvm.maxnum.f128(fp128 %x, fp128 %y)
236 ; Verify that "nnan" minnum/maxnum calls are transformed to
237 ; compare+select sequences instead of libcalls.
238 define float @f34(float %x, float %y) {
240 ; CHECK: cebr %f0, %f2
242 ; CHECK: ler %f0, %f2
244 %tmp = call nnan float @llvm.minnum.f32(float %x, float %y)
248 define double @f35(double %x, double %y) {
250 ; CHECK: cdbr %f0, %f2
252 ; CHECK: ldr %f0, %f2
254 %tmp = call nnan double @llvm.minnum.f64(double %x, double %y)
258 define fp128 @f36(fp128 %x, fp128 %y) {
264 %tmp = call nnan fp128 @llvm.minnum.f128(fp128 %x, fp128 %y)
268 define float @f37(float %x, float %y) {
270 ; CHECK: cebr %f0, %f2
272 ; CHECK: ler %f0, %f2
274 %tmp = call nnan float @llvm.maxnum.f32(float %x, float %y)
278 define double @f38(double %x, double %y) {
280 ; CHECK: cdbr %f0, %f2
282 ; CHECK: ldr %f0, %f2
284 %tmp = call nnan double @llvm.maxnum.f64(double %x, double %y)
288 define fp128 @f39(fp128 %x, fp128 %y) {
294 %tmp = call nnan fp128 @llvm.maxnum.f128(fp128 %x, fp128 %y)
298 declare float @llvm.powi.f32.i32(float, i32)
299 declare double @llvm.powi.f64.i32(double, i32)
300 declare fp128 @llvm.powi.f128.i32(fp128, i32)
301 declare float @llvm.pow.f32(float, float)
302 declare double @llvm.pow.f64(double, double)
303 declare fp128 @llvm.pow.f128(fp128, fp128)
305 declare float @llvm.sin.f32(float)
306 declare double @llvm.sin.f64(double)
307 declare fp128 @llvm.sin.f128(fp128)
308 declare float @llvm.cos.f32(float)
309 declare double @llvm.cos.f64(double)
310 declare fp128 @llvm.cos.f128(fp128)
312 declare float @llvm.exp.f32(float)
313 declare double @llvm.exp.f64(double)
314 declare fp128 @llvm.exp.f128(fp128)
315 declare float @llvm.exp2.f32(float)
316 declare double @llvm.exp2.f64(double)
317 declare fp128 @llvm.exp2.f128(fp128)
319 declare float @llvm.log.f32(float)
320 declare double @llvm.log.f64(double)
321 declare fp128 @llvm.log.f128(fp128)
322 declare float @llvm.log2.f32(float)
323 declare double @llvm.log2.f64(double)
324 declare fp128 @llvm.log2.f128(fp128)
325 declare float @llvm.log10.f32(float)
326 declare double @llvm.log10.f64(double)
327 declare fp128 @llvm.log10.f128(fp128)
329 declare float @llvm.minnum.f32(float, float)
330 declare double @llvm.minnum.f64(double, double)
331 declare fp128 @llvm.minnum.f128(fp128, fp128)
332 declare float @llvm.maxnum.f32(float, float)
333 declare double @llvm.maxnum.f64(double, double)
334 declare fp128 @llvm.maxnum.f128(fp128, fp128)