PR c/64856
[official-gcc.git] / gcc / testsuite / gcc.dg / builtins-32.c
blob3d2a36190a578f35296770f31d5303ee675def72
1 /* Copyright (C) 2004 Free Software Foundation.
3 Check that constant folding of signbit, signbitf and signbitl math
4 functions doesn't break anything and produces the expected results.
6 Written by Roger Sayle, 28th January 2004. */
8 /* { dg-do run } */
9 /* { dg-options "-O2" } */
11 extern void abort(void);
13 extern int signbit(double);
14 extern int signbitf(float);
15 extern int signbitl(long double);
17 int test (double x)
19 return signbit(x);
22 int testf (float x)
24 return signbitf(x);
27 int testl (long double x)
29 return signbitl(x);
33 int main()
35 if (test (0.0) != 0)
36 abort ();
37 if (test (1.0) != 0)
38 abort ();
39 if (test (-2.0) == 0)
40 abort ();
42 if (testf (0.0f) != 0)
43 abort ();
44 if (testf (1.0f) != 0)
45 abort ();
46 if (testf (-2.0f) == 0)
47 abort ();
49 if (testl (0.0l) != 0)
50 abort ();
51 if (testl (1.0l) != 0)
52 abort ();
53 if (testl (-2.0l) == 0)
54 abort ();
56 return 0;