OSDN Git Service

* gcc.dg/format/asm_fprintf-1.c: New test.
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / builtins-8.c
1 /* Copyright (C) 2003  Free Software Foundation.
2
3    Verify that built-in math function constant folding of functions
4    with one constant argument is correctly performed by the compiler.
5
6    Written by Roger Sayle, 30th March 2003.  */
7
8 /* { dg-do run } */
9 /* { dg-options "-O2 -ffast-math" } */
10
11 extern void abort(void);
12
13 void test(double x)
14 {
15   if (pow(x,-1.0) != 1.0/x)
16     abort ();
17
18   if (pow(x,2.0) != x*x)
19     abort ();
20
21   if (pow(x,-2.0) != 1.0/(x*x))
22     abort ();
23
24   if (pow(x,0.5) != sqrt(x))
25     abort ();
26 }
27
28 int main()
29 {
30   test (1.0);
31   test (2.0);
32   return 0;
33 }
34