1 ; RUN: llc < %s -mtriple=x86_64-apple-macosx10.9.0 -mcpu=core2 | FileCheck %s --check-prefix=OSX_SINCOS
2 ; RUN: llc < %s -mtriple=x86_64-apple-macosx10.8.0 -mcpu=core2 | FileCheck %s --check-prefix=OSX_NOOPT
3 ; RUN: llc < %s -mtriple=x86_64-pc-linux-gnu -mcpu=core2 -enable-unsafe-fp-math | FileCheck %s --check-prefix=GNU_SINCOS
5 ; Combine sin / cos into a single call.
8 define float @test1(float %x) nounwind {
11 ; GNU_SINCOS: callq sincosf
12 ; GNU_SINCOS: movss 4(%rsp), %xmm0
13 ; GNU_SINCOS: addss (%rsp), %xmm0
16 ; OSX_SINCOS: callq ___sincosf_stret
17 ; OSX_SINCOS: addss %xmm1, %xmm0
20 ; OSX_NOOPT: callq _cosf
21 ; OSX_NOOPT: callq _sinf
22 %call = tail call float @sinf(float %x) nounwind readnone
23 %call1 = tail call float @cosf(float %x) nounwind readnone
24 %add = fadd float %call, %call1
28 define double @test2(double %x) nounwind {
31 ; GNU_SINCOS: callq sincos
32 ; GNU_SINCOS: movsd 16(%rsp), %xmm0
33 ; GNU_SINCOS: addsd 8(%rsp), %xmm0
36 ; OSX_SINCOS: callq ___sincos_stret
37 ; OSX_SINCOS: addsd %xmm1, %xmm0
40 ; OSX_NOOPT: callq _cos
41 ; OSX_NOOPT: callq _sin
42 %call = tail call double @sin(double %x) nounwind readnone
43 %call1 = tail call double @cos(double %x) nounwind readnone
44 %add = fadd double %call, %call1
48 define x86_fp80 @test3(x86_fp80 %x) nounwind {
51 ; GNU_SINCOS: callq sinl
52 ; GNU_SINCOS: callq cosl
54 %call = tail call x86_fp80 @sinl(x86_fp80 %x) nounwind
55 %call1 = tail call x86_fp80 @cosl(x86_fp80 %x) nounwind
56 %add = fadd x86_fp80 %call, %call1
60 declare float @sinf(float) readonly
61 declare double @sin(double) readonly
62 declare float @cosf(float) readonly
63 declare double @cos(double) readonly
65 declare x86_fp80 @sinl(x86_fp80)
66 declare x86_fp80 @cosl(x86_fp80)