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 extern int signbitl(long double);
16 
test(double x)17 int test (double x)
18 {
19   return signbit(x);
20 }
21 
testf(float x)22 int testf (float x)
23 {
24   return signbitf(x);
25 }
26 
testl(long double x)27 int testl (long double x)
28 {
29   return signbitl(x);
30 }
31 
32 
main()33 int main()
34 {
35   if (test (0.0) != 0)
36     abort ();
37   if (test (1.0) != 0)
38     abort ();
39   if (test (-2.0) == 0)
40     abort ();
41 
42   if (testf (0.0f) != 0)
43     abort ();
44   if (testf (1.0f) != 0)
45     abort ();
46   if (testf (-2.0f) == 0)
47     abort ();
48 
49   if (testl (0.0l) != 0)
50     abort ();
51   if (testl (1.0l) != 0)
52     abort ();
53   if (testl (-2.0l) == 0)
54     abort ();
55 
56   return 0;
57 }
58 
59