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.
9 define float @test1(float %x) nounwind {
11 ; GNU_SINCOS-LABEL: test1:
12 ; GNU_SINCOS: callq sincosf
13 ; GNU_SINCOS: movss 4(%rsp), %xmm0
14 ; GNU_SINCOS: addss (%rsp), %xmm0
16 ; OSX_SINCOS-LABEL: test1:
17 ; OSX_SINCOS: callq ___sincosf_stret
18 ; OSX_SINCOS: pshufd $1, %xmm0, %xmm1
19 ; OSX_SINCOS: addss %xmm0, %xmm1
22 ; OSX_NOOPT: callq _sinf
23 ; OSX_NOOPT: callq _cosf
24 %call = tail call float @sinf(float %x) nounwind readnone
25 %call1 = tail call float @cosf(float %x) nounwind readnone
26 %add = fadd float %call, %call1
30 define double @test2(double %x) nounwind {
32 ; GNU_SINCOS-LABEL: test2:
33 ; GNU_SINCOS: callq sincos
34 ; GNU_SINCOS: movsd 16(%rsp), %xmm0
35 ; GNU_SINCOS: addsd 8(%rsp), %xmm0
37 ; OSX_SINCOS-LABEL: test2:
38 ; OSX_SINCOS: callq ___sincos_stret
39 ; OSX_SINCOS: addsd %xmm1, %xmm0
42 ; OSX_NOOPT: callq _sin
43 ; OSX_NOOPT: callq _cos
44 %call = tail call double @sin(double %x) nounwind readnone
45 %call1 = tail call double @cos(double %x) nounwind readnone
46 %add = fadd double %call, %call1
50 define x86_fp80 @test3(x86_fp80 %x) nounwind {
52 ; GNU_SINCOS-LABEL: test3:
53 ; GNU_SINCOS: callq sinl
54 ; GNU_SINCOS: callq cosl
56 %call = tail call x86_fp80 @sinl(x86_fp80 %x) nounwind
57 %call1 = tail call x86_fp80 @cosl(x86_fp80 %x) nounwind
58 %add = fadd x86_fp80 %call, %call1
62 declare float @sinf(float) readonly
63 declare double @sin(double) readonly
64 declare float @cosf(float) readonly
65 declare double @cos(double) readonly
67 declare x86_fp80 @sinl(x86_fp80)
68 declare x86_fp80 @cosl(x86_fp80)