OSDN Git Service

2012-04-13 Richard Guenther <rguenther@suse.de>
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / builtins-24.c
1 /* Copyright (C) 2003 Free Software Foundation.
2
3    Check that the RTL expansion of floating point exponentiation by
4    a constant integer doesn't break anything and produces the expected
5    results.
6
7    Written by Roger Sayle, 20th June 2003.  */
8
9 /* { dg-do run } */
10 /* { dg-options "-O2 -ffast-math" } */
11
12 extern double pow(double,double);
13 extern void abort(void);
14
15 double foo (double x)
16 {
17   return pow (x, 6);
18 }
19
20 double bar (double x)
21 {
22   return pow (x, -4);
23 }
24
25 int main()
26 {
27   if (foo (2.0) != 64.0)
28     abort ();
29
30   if (bar (2.0) != 0.0625)
31     abort ();
32
33   return 0;
34 }
35