* gcc.dg/20061124-1.c: Add exit() function prototype.
[official-gcc.git] / gcc / testsuite / gcc.dg / builtins-2.c
blobb1f31c84aa5791f1e6be616d7ac42b76d72babb9
1 /* Copyright (C) 2002 Free Software Foundation.
3 Verify that built-in math function constant folding doesn't
4 cause any problems for the compiler.
6 Written by Roger Sayle, 16th August 2002. */
8 /* { dg-do compile } */
9 /* { dg-options "-O2 -ffast-math" } */
11 extern double atan (double);
12 extern float atanf (float);
13 extern long double atanl (long double);
14 extern double exp (double);
15 extern float expf (float);
16 extern long double expl (long double);
17 extern double fabs (double);
18 extern float fabsf (float);
19 extern long double fabsl (long double);
20 extern double log (double);
21 extern float logf (float);
22 extern long double logl (long double);
23 extern double pow (double, double);
24 extern float powf (float, float);
25 extern long double powl (long double, long double);
26 extern double sqrt (double);
27 extern float sqrtf (float);
28 extern long double sqrtl (long double);
29 extern double tan (double);
30 extern float tanf (float);
31 extern long double tanl (long double);
33 double test1(double x)
35 return log(exp(x));
38 double test2(double x)
40 return exp(log(x));
43 double test3(double x)
45 return sqrt(exp(x));
48 double test4(double x)
50 return log(sqrt(x));
53 double test5(double x, double y)
55 return sqrt(x)*sqrt(y);
58 double test6(double x, double y)
60 return exp(x)*exp(y);
63 double test7(double x, double y)
65 return x/exp(y);
68 double test8(double x)
70 return fabs(sqrt(x));
73 double test9(double x)
75 return fabs(exp(x));
78 double test10(double x)
80 return tan(atan(x));
83 double test11(double x)
85 return fabs(fabs(x));
88 double test12(double x)
90 return fabs(atan(x));
93 double test13(double x)
95 return fabs(pow(2.0,x));
98 float test1f(float x)
100 return logf(expf(x));
103 float test2f(float x)
105 return expf(logf(x));
108 float test3f(float x)
110 return sqrtf(expf(x));
113 float test4f(float x)
115 return logf(sqrtf(x));
118 float test5f(float x, float y)
120 return sqrtf(x)*sqrtf(y);
123 float test6f(float x, float y)
125 return expf(x)*expf(y);
128 float test7f(float x, float y)
130 return x/expf(y);
133 float test8f(float x)
135 return fabsf(sqrtf(x));
138 float test9f(float x)
140 return fabsf(expf(x));
143 float test10f(float x)
145 return tanf(atanf(x));
148 float test11f(float x)
150 return fabsf(fabsf(x));
153 float test12f(float x)
155 return fabsf(atanf(x));
158 float test13f(float x)
160 return fabsf(powf(2.0f,x));
163 long double test1l(long double x)
165 return logl(expl(x));
168 long double test2l(long double x)
170 return expl(logl(x));
173 long double test3l(long double x)
175 return sqrtl(expl(x));
178 long double test4l(long double x)
180 return logl(sqrtl(x));
183 long double test5l(long double x, long double y)
185 return sqrtl(x)*sqrtl(y);
188 long double test6l(long double x, long double y)
190 return expl(x)*expl(y);
193 long double test7l(long double x, long double y)
195 return x/expl(y);
198 long double test8l(long double x)
200 return fabsl(sqrtl(x));
203 long double test9l(long double x)
205 return fabsl(expl(x));
208 long double test10l(long double x)
210 return tanl(atanl(x));
213 long double test11l(long double x)
215 return fabsl(fabsl(x));
218 long double test12l(long double x)
220 return fabsl(atanl(x));
223 long double test13l(long double x)
225 return fabsl(powl(2.0l,x));