Modernize fabs.ll, add long double. Add tests
[oota-llvm.git] / test / CodeGen / X86 / sincos.ll
1 ; Make sure this testcase codegens to the sin and cos instructions, not calls
2 ; RUN: llvm-as < %s | \
3 ; RUN:   llc -march=x86 -mattr=-sse,-sse2,-sse3 -enable-unsafe-fp-math  | \
4 ; RUN:   grep sin\$ | count 3
5 ; RUN: llvm-as < %s | \
6 ; RUN:   llc -march=x86 -mattr=-sse,-sse2,-sse3 -enable-unsafe-fp-math  | \
7 ; RUN:   grep cos\$ | count 3
8
9 declare float  @sinf(float)
10
11 declare double @sin(double)
12
13 declare x86_fp80 @sinl(x86_fp80)
14
15 define float @test1(float %X) {
16         %Y = call float @sinf(float %X)
17         ret float %Y
18 }
19
20 define double @test2(double %X) {
21         %Y = call double @sin(double %X)
22         ret double %Y
23 }
24
25 define x86_fp80 @test3(x86_fp80 %X) {
26         %Y = call x86_fp80 @sinl(x86_fp80 %X)
27         ret x86_fp80 %Y
28 }
29
30 declare float @cosf(float)
31
32 declare double @cos(double)
33
34 declare x86_fp80 @cosl(x86_fp80)
35
36 define float @test4(float %X) {
37         %Y = call float @cosf(float %X)
38         ret float %Y
39 }
40
41 define double @test5(double %X) {
42         %Y = call double @cos(double %X)
43         ret double %Y
44 }
45
46 define x86_fp80 @test6(x86_fp80 %X) {
47         %Y = call x86_fp80 @cosl(x86_fp80 %X)
48         ret x86_fp80 %Y
49 }
50