PR middle-end/27945
[official-gcc.git] / gcc / testsuite / gcc.dg / builtins-41.c
blob5b96551fb116a01d73cbb61b92d94f2d3c17a06e
1 /* Copyright (C) 2004 Free Software Foundation.
3 Check that constant folding of copysign, copysignf and copysignl math
4 functions doesn't break anything and produces the expected results.
6 Written by Roger Sayle, 6th June 2004. */
8 /* { dg-do link } */
9 /* { dg-options "-O2" } */
11 extern void link_error(void);
13 extern double copysign(double, double);
14 extern float copysignf(float, float);
15 extern long double copysignl(long double, long double);
17 int main()
19 if (copysign (2.0, 1.0) != 2.0)
20 link_error ();
21 if (copysign (2.0, -1.0) != -2.0)
22 link_error ();
23 if (copysign (-2.0, 1.0) != 2.0)
24 link_error ();
25 if (copysign (-2.0, -1.0) != -2.0)
26 link_error ();
28 if (copysign (2.0, 1.0) != 2.0)
29 link_error ();
30 if (copysign (2.0, -1.0) != -2.0)
31 link_error ();
32 if (copysign (-2.0, 1.0) != 2.0)
33 link_error ();
34 if (copysign (-2.0, -1.0) != -2.0)
35 link_error ();
37 if (copysignf (2.0f, 1.0f) != 2.0f)
38 link_error ();
39 if (copysignf (2.0f, -1.0f) != -2.0f)
40 link_error ();
41 if (copysignf (-2.0f, 1.0f) != 2.0f)
42 link_error ();
43 if (copysignf (-2.0f, -1.0f) != -2.0f)
44 link_error ();
46 if (copysignl (2.0l, 1.0l) != 2.0l)
47 link_error ();
48 if (copysignl (2.0l, -1.0l) != -2.0l)
49 link_error ();
50 if (copysignl (-2.0l, 1.0l) != 2.0l)
51 link_error ();
52 if (copysignl (-2.0l, -1.0l) != -2.0l)
53 link_error ();
55 return 0;