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)
68 return sqrtf(expf(x));
73 return logf(sqrtf(x));
76 float test5f(float x, float y)
78 return sqrtf(x)*sqrtf(y);
81 float test6f(float x, float y)
83 return expf(x)*expf(y);
86 float test7f(float x, float y)
93 return fabsf(sqrtf(x));
98 return fabsf(expf(x));
101 long double test1l(long double x)
103 return logl(expl(x));
106 long double test2l(long double x)
108 return expl(logl(x));
111 long double test3l(long double x)
113 return sqrtl(expl(x));
116 long double test4l(long double x)
118 return logl(sqrtl(x));
121 long double test5l(long double x, long double y)
123 return sqrtl(x)*sqrtl(y);
126 long double test6l(long double x, long double y)
128 return expl(x)*expl(y);
131 long double test7l(long double x, long double y)
136 long double test8l(long double x)
138 return fabsl(sqrtl(x));
141 long double test9l(long double x)
143 return fabsl(expl(x));