1 /* Copyright (C) 2003 Free Software Foundation.
3 Check that constant folding of built-in math functions doesn't
6 Written by Roger Sayle, 2nd April 2003. */
8 /* { dg-do compile } */
9 /* { dg-options "-O2 -ffast-math" } */
11 extern double log(double);
12 extern double exp(double);
13 extern double sqrt(double);
14 extern double pow(double,double);
16 extern float logf(float);
17 extern float expf(float);
18 extern float sqrtf(float);
19 extern float powf(float,float);
21 extern long double logl(long double);
22 extern long double expl(long double);
23 extern long double sqrtl(long double);
24 extern long double powl(long double,long double);
27 double test1(double x
, double y
)
32 double test2(double x
, double y
)
34 return sqrt(pow(x
,y
));
37 double test3(double x
, double y
)
42 double test4(double x
, double y
)
44 return pow(sqrt(x
),y
);
47 double test5(double x
, double y
, double z
)
49 return pow(pow(x
,y
),z
);
53 float test1f(float x
, float y
)
55 return logf(powf(x
,y
));
58 float test2f(float x
, float y
)
60 return sqrtf(powf(x
,y
));
63 float test3f(float x
, float y
)
65 return powf(expf(x
),y
);
68 float test4f(float x
, float y
)
70 return powf(sqrtf(x
),y
);
73 float test5f(float x
, float y
, float z
)
75 return powf(powf(x
,y
),z
);
79 long double test1l(long double x
, long double y
)
81 return logl(powl(x
,y
));
84 long double test2l(long double x
, long double y
)
86 return sqrtl(powl(x
,y
));
89 long double test3l(long double x
, long double y
)
91 return powl(expl(x
),y
);
94 long double test4l(long double x
, long double y
)
96 return powl(sqrtl(x
),y
);
99 long double test5l(long double x
, long double y
, long double z
)
101 return powl(powl(x
,y
),z
);