OSDN Git Service

2004-05-20 H.J. Lu <hongjiu.lu@intel.com>
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / builtins-21.c
1 /* Copyright (C) 2003  Free Software Foundation.
2
3    Verify that built-in math function constant folding doesn't
4    cause any problems for the compiler.
5
6    Written by Roger Sayle, 7th June 2003.  */
7
8 /* { dg-do compile } */
9 /* { dg-options "-O2 -ffast-math" } */
10
11 double test1(double x)
12 {
13   return fabs(x*x);
14 }
15
16 double test2(double x)
17 {
18   return fabs(sqrt(x)+2.0);
19 }
20
21 double test3(double x)
22 {
23   return fabs(3.0*exp(x));
24 }
25
26 float test1f(float x)
27 {
28   return fabsf(x*x);
29 }
30
31 float test2f(float x)
32 {
33   return fabsf(sqrtf(x)+2.0f);
34 }
35
36 float test3f(float x)
37 {
38   return fabsf(3.0f*expf(x));
39 }
40
41 long double test1l(long double x)
42 {
43   return fabsl(x*x);
44 }
45
46 long double test2l(long double x)
47 {
48   return fabsl(sqrtl(x)+2.0l);
49 }
50
51 long double test3l(long double x)
52 {
53   return fabsl(3.0l*expl(x));
54 }
55