Add a triple to switch.ll test.
[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 ; rdar://13599493
8
9 define float @test1(float %x) nounwind {
10 entry:
11 ; GNU_SINCOS-LABEL: test1:
12 ; GNU_SINCOS: callq sincosf
13 ; GNU_SINCOS: movss 4(%rsp), %xmm0
14 ; GNU_SINCOS: addss (%rsp), %xmm0
15
16 ; OSX_SINCOS-LABEL: test1:
17 ; OSX_SINCOS: callq ___sincosf_stret
18 ; OSX_SINCOS: movshdup {{.*}} xmm1 = xmm0[1,1,3,3]
19 ; OSX_SINCOS: addss %xmm1, %xmm0
20
21 ; OSX_NOOPT: test1
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
27   ret float %add
28 }
29
30 define double @test2(double %x) nounwind {
31 entry:
32 ; GNU_SINCOS-LABEL: test2:
33 ; GNU_SINCOS: callq sincos
34 ; GNU_SINCOS: movsd 16(%rsp), %xmm0
35 ; GNU_SINCOS: addsd 8(%rsp), %xmm0
36
37 ; OSX_SINCOS-LABEL: test2:
38 ; OSX_SINCOS: callq ___sincos_stret
39 ; OSX_SINCOS: addsd %xmm1, %xmm0
40
41 ; OSX_NOOPT: test2
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
47   ret double %add
48 }
49
50 define x86_fp80 @test3(x86_fp80 %x) nounwind {
51 entry:
52 ; GNU_SINCOS-LABEL: test3:
53 ; GNU_SINCOS: callq sinl
54 ; GNU_SINCOS: callq cosl
55 ; GNU_SINCOS: ret
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
59   ret x86_fp80 %add
60 }
61
62 declare float  @sinf(float) readonly
63 declare double @sin(double) readonly
64 declare float @cosf(float) readonly
65 declare double @cos(double) readonly
66
67 declare x86_fp80 @sinl(x86_fp80)
68 declare x86_fp80 @cosl(x86_fp80)