OSDN Git Service

PR middle-end/20256
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / builtins-36.c
1 /* Copyright (C) 2004 Free Software Foundation.
2
3    Check sin, sinf, sinl, cos, cosf and cosl built-in functions
4    eventually compile to sincos, sincosf and sincosl.
5
6    Written by Uros Bizjak, 5th April 2004.  */
7
8 /* { dg-do compile } */
9 /* { dg-options "-O2 -ffast-math" } */
10
11 extern double sin(double);
12 extern float sinf(float);
13 extern long double sinl(long double);
14
15 extern double cos(double);
16 extern float cosf(float);
17 extern long double cosl(long double);
18
19
20 double test1(double x)
21 {
22         double y1, y2;
23
24         y1 = sin(x);
25         y2 = cos(x);
26
27         return y1 - y2;
28 }
29
30 float test1f(float x)
31 {
32         float y1, y2;
33
34         y1 = sinf(x);
35         y2 = cosf(x);
36
37         return y1 - y2;
38 }
39
40 long double test1l(long double x)
41 {
42         long double y1, y2;
43
44         y1 = sinl(x);
45         y2 = cosl(x);
46
47         return y1 - y2;
48 }
49
50 double test2(double x)
51 {
52         return sin(x);
53 }
54
55 float test2f(float x)
56 {
57         return sinf(x);
58 }
59
60 long double test2l(long double x)
61 {
62         return sinl(x);
63 }
64
65 double test3(double x)
66 {
67         return cos(x);
68 }
69
70 float test3f(float x)
71 {
72         return cosf(x);
73 }
74
75 long double test3l(long double x)
76 {
77         return cosl(x);
78 }
79