1 ; Test that combined sin/cos library call is emitted when appropriate
3 ; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s --check-prefix=CHECK-OPT
4 ; RUN: llc < %s -mtriple=s390x-linux-gnu -enable-unsafe-fp-math | FileCheck %s --check-prefix=CHECK-OPT
6 define float @f1(float %x) {
8 ; CHECK-OPT: brasl %r14, sincosf@PLT
9 ; CHECK-OPT: le %f0, 164(%r15)
10 ; CHECK-OPT: aeb %f0, 160(%r15)
11 %tmp1 = call float @sinf(float %x) readnone
12 %tmp2 = call float @cosf(float %x) readnone
13 %add = fadd float %tmp1, %tmp2
17 define float @f1_errno(float %x) {
18 ; CHECK-OPT-LABEL: f1_errno:
19 ; CHECK-OPT: brasl %r14, sinf@PLT
20 ; CHECK-OPT: ler %f9, %f0
21 ; CHECK-OPT: brasl %r14, cosf@PLT
22 ; CHECK-OPT: aebr %f0, %f9
23 %tmp1 = call float @sinf(float %x)
24 %tmp2 = call float @cosf(float %x)
25 %add = fadd float %tmp1, %tmp2
29 define double @f2(double %x) {
30 ; CHECK-OPT-LABEL: f2:
31 ; CHECK-OPT: brasl %r14, sincos@PLT
32 ; CHECK-OPT: ld %f0, 168(%r15)
33 ; CHECK-OPT: adb %f0, 160(%r15)
34 %tmp1 = call double @sin(double %x) readnone
35 %tmp2 = call double @cos(double %x) readnone
36 %add = fadd double %tmp1, %tmp2
40 define double @f2_errno(double %x) {
41 ; CHECK-OPT-LABEL: f2_errno:
42 ; CHECK-OPT: brasl %r14, sin@PLT
43 ; CHECK-OPT: ldr %f9, %f0
44 ; CHECK-OPT: brasl %r14, cos@PLT
45 ; CHECK-OPT: adbr %f0, %f9
46 %tmp1 = call double @sin(double %x)
47 %tmp2 = call double @cos(double %x)
48 %add = fadd double %tmp1, %tmp2
52 define fp128 @f3(fp128 %x) {
53 ; CHECK-OPT-LABEL: f3:
54 ; CHECK-OPT: brasl %r14, sincosl@PLT
56 %tmp1 = call fp128 @sinl(fp128 %x) readnone
57 %tmp2 = call fp128 @cosl(fp128 %x) readnone
58 %add = fadd fp128 %tmp1, %tmp2
62 define fp128 @f3_errno(fp128 %x) {
63 ; CHECK-OPT-LABEL: f3_errno:
64 ; CHECK-OPT: brasl %r14, sinl@PLT
65 ; CHECK-OPT: brasl %r14, cosl@PLT
67 %tmp1 = call fp128 @sinl(fp128 %x)
68 %tmp2 = call fp128 @cosl(fp128 %x)
69 %add = fadd fp128 %tmp1, %tmp2
73 declare float @sinf(float)
74 declare double @sin(double)
75 declare fp128 @sinl(fp128)
76 declare float @cosf(float)
77 declare double @cos(double)
78 declare fp128 @cosl(fp128)