OSDN Git Service

2005-02-15 Eric Christopher <echristo@redhat.com>
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / builtins-32.c
1 /* Copyright (C) 2004 Free Software Foundation.
2
3    Check that constant folding of signbit, signbitf and signbitl math
4    functions doesn't break anything and produces the expected results.
5
6    Written by Roger Sayle, 28th January 2004.  */
7
8 /* { dg-do run } */
9 /* { dg-options "-O2" } */
10
11 extern void abort(void);
12
13 extern int signbit(double);
14 extern int signbitf(float);
15
16 int test (double x)
17 {
18   return signbit(x);
19 }
20
21 int testf (float x)
22 {
23   return signbitf(x);
24 }
25
26 int main()
27 {
28   if (test (1.0) != 0)
29     abort ();
30   if (test (-2.0) == 0)
31     abort ();
32
33   if (testf (1.0f) != 0)
34     abort ();
35   if (testf (-2.0f) == 0)
36     abort ();
37
38   return 0;
39 }
40