Fix broken MinGW build of gcc.c
[official-gcc.git] / gcc / testsuite / gcc.dg / builtins-55.c
blob0db7976a4801c4356a8297eb1504f25c571179b9
1 /* { dg-do link } */
2 /* { dg-options "-O2 -ffast-math" } */
3 /* { dg-add-options c99_runtime } */
5 #include "builtins-config.h"
7 void link_error (void);
9 extern long lround(double);
10 extern long lrint(double);
12 extern long long llround(double);
13 extern long long llrint(double);
15 extern long lroundf(float);
16 extern long lrintf(float);
18 extern long long llroundf(float);
19 extern long long llrintf(float);
21 extern long lroundl(long double);
22 extern long lrintl(long double);
24 extern long long llroundl(long double);
25 extern long long llrintl(long double);
28 void test(double x)
30 #ifdef HAVE_C99_RUNTIME
31 if (sizeof(long) != sizeof(long long))
32 return;
34 if (__builtin_lceil(x) != __builtin_llceil(x))
35 link_error();
36 if (__builtin_lfloor(x) != __builtin_llfloor(x))
37 link_error();
38 if (lround(x) != llround(x))
39 link_error();
40 if (lrint(x) != llrint(x))
41 link_error();
42 #endif
45 void testf(float x)
47 #ifdef HAVE_C99_RUNTIME
48 if (sizeof(long) != sizeof(long long))
49 return;
51 if (__builtin_lceilf(x) != __builtin_llceilf(x))
52 link_error();
53 if (__builtin_lfloorf(x) != __builtin_llfloorf(x))
54 link_error();
55 if (lroundf(x) != llroundf(x))
56 link_error();
57 if (lrintf(x) != llrintf(x))
58 link_error();
59 #endif
62 void testl(long double x)
64 #ifdef HAVE_C99_RUNTIME
65 if (sizeof(long) != sizeof(long long))
66 return;
68 if (__builtin_lceill(x) != __builtin_llceill(x))
69 link_error();
70 if (__builtin_lfloorl(x) != __builtin_llfloorl(x))
71 link_error();
72 if (lroundl(x) != llroundl(x))
73 link_error();
74 if (lrintl(x) != llrintl(x))
75 link_error();
76 #endif
79 int main()
81 test(0.0);
82 testf(0.0);
83 testl(0.0);
84 return 0;