OSDN Git Service

29cdf20663def652fe3dbfc3a573057f6740bfc0
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / builtins-54.c
1 /* { dg-do link } */
2 /* { dg-options "-O2 -ffast-math" } */
3
4 double cabs(__complex__ double);
5 float cabsf(__complex__ float);
6 long double cabsl(__complex__ long double);
7
8 void link_error (void);
9
10 void test(__complex__ double x)
11 {
12   if (cabs(x) != cabs(-x))
13     link_error();
14
15   if (cabs(x) != cabs(~x))
16     link_error();
17 }
18
19 void testf(__complex__ float x)
20 {
21   if (cabsf(x) != cabsf(-x))
22     link_error();
23
24   if (cabsf(x) != cabsf(~x))
25     link_error();
26 }
27
28 void testl(__complex__ long double x)
29 {
30   if (cabsl(x) != cabsl(-x))
31     link_error();
32
33   if (cabsl(x) != cabsl(~x))
34     link_error();
35 }
36
37 int main()
38 {
39   test(0.0);
40   testf(0.0);
41   testl(0.0);
42   return 0;
43 }
44