Temporary revert of 175320.
[oota-llvm.git] / test / CodeGen / X86 / sincos-opt.ll
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
4
5 ; Combine sin / cos into a single call.
6 ; rdar://13087969
7
8 define float @test1(float %x) nounwind {
9 entry:
10 ; GNU_SINCOS: test1:
11 ; GNU_SINCOS: callq sincosf
12 ; GNU_SINCOS: movss 4(%rsp), %xmm0
13 ; GNU_SINCOS: addss (%rsp), %xmm0
14
15 ; OSX_SINCOS: test1:
16 ; OSX_SINCOS: callq ___sincosf_stret
17 ; OSX_SINCOS: addss %xmm1, %xmm0
18
19 ; OSX_NOOPT: test1
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
25   ret float %add
26 }
27
28 define double @test2(double %x) nounwind {
29 entry:
30 ; GNU_SINCOS: test2:
31 ; GNU_SINCOS: callq sincos
32 ; GNU_SINCOS: movsd 16(%rsp), %xmm0
33 ; GNU_SINCOS: addsd 8(%rsp), %xmm0
34
35 ; OSX_SINCOS: test2:
36 ; OSX_SINCOS: callq ___sincos_stret
37 ; OSX_SINCOS: addsd %xmm1, %xmm0
38
39 ; OSX_NOOPT: test2
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
45   ret double %add
46 }
47
48 define x86_fp80 @test3(x86_fp80 %x) nounwind {
49 entry:
50 ; GNU_SINCOS: test3:
51 ; GNU_SINCOS: callq sinl
52 ; GNU_SINCOS: callq cosl
53 ; GNU_SINCOS: ret
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
57   ret x86_fp80 %add
58 }
59
60 declare float  @sinf(float) readonly
61 declare double @sin(double) readonly
62 declare float @cosf(float) readonly
63 declare double @cos(double) readonly
64
65 declare x86_fp80 @sinl(x86_fp80)
66 declare x86_fp80 @cosl(x86_fp80)