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 double test1(double x)
16 double test2(double x)
21 double test3(double x)
26 double test4(double x)
31 double test5(double x, double y)
33 return sqrt(x)*sqrt(y);
36 double test6(double x, double y)
41 double test7(double x, double y)
46 double test8(double x)
51 double test9(double x)
56 double test10(double x)
61 double test11(double x)
66 double test12(double x)
71 double test13(double x)
73 return fabs(pow(2.0,x));
88 return sqrtf(expf(x));
93 return logf(sqrtf(x));
96 float test5f(float x, float y)
98 return sqrtf(x)*sqrtf(y);
101 float test6f(float x, float y)
103 return expf(x)*expf(y);
106 float test7f(float x, float y)
111 float test8f(float x)
113 return fabsf(sqrtf(x));
116 float test9f(float x)
118 return fabsf(expf(x));
121 float test10f(float x)
123 return tanf(atanf(x));
126 float test11f(float x)
128 return fabsf(fabsf(x));
131 float test12f(float x)
133 return fabsf(atanf(x));
136 float test13f(float x)
138 return fabsf(powf(2.0f,x));
141 long double test1l(long double x)
143 return logl(expl(x));
146 long double test2l(long double x)
148 return expl(logl(x));
151 long double test3l(long double x)
153 return sqrtl(expl(x));
156 long double test4l(long double x)
158 return logl(sqrtl(x));
161 long double test5l(long double x, long double y)
163 return sqrtl(x)*sqrtl(y);
166 long double test6l(long double x, long double y)
168 return expl(x)*expl(y);
171 long double test7l(long double x, long double y)
176 long double test8l(long double x)
178 return fabsl(sqrtl(x));
181 long double test9l(long double x)
183 return fabsl(expl(x));
186 long double test10l(long double x)
188 return tanl(atanl(x));
191 long double test11l(long double x)
193 return fabsl(fabsl(x));
196 long double test12l(long double x)
198 return fabsl(atanl(x));
201 long double test13l(long double x)
203 return fabsl(powl(2.0l,x));