Fix warning with -Wsign-compare -Wsystem-headers
[official-gcc.git] / gcc / testsuite / gcc.target / arc / ieee_eq.c
blob70aebad063bc37346b73e5de44ef34114cec34e8
1 /* { dg-do run } */
2 /* { dg-options "-O2" } */
4 #include <stdio.h>
5 #include <float.h>
7 #define TEST_EQ(TYPE,X,Y,RES) \
8 do { \
9 volatile TYPE a, b; \
10 a = (TYPE) X; \
11 b = (TYPE) Y; \
12 if ((a == b) != RES) \
13 { \
14 printf ("Runtime computation error @%d. %g " \
15 "!= %g\n", __LINE__, a, b); \
16 error = 1; \
17 } \
18 } while (0)
20 #ifndef __HS__
21 /* Special type of NaN found when using double FPX instructions. */
22 static const unsigned long long __nan = 0x7FF0000080000000ULL;
23 # define W (*(double *) &__nan)
24 #else
25 # define W __builtin_nan ("")
26 #endif
28 #define Q __builtin_nan ("")
29 #define H __builtin_inf ()
31 int main (void)
33 int error = 0;
35 TEST_EQ (double, 1, 1, 1);
36 TEST_EQ (double, 1, 2, 0);
37 TEST_EQ (double, W, W, 0);
38 TEST_EQ (double, Q, Q, 0);
39 TEST_EQ (double, __DBL_MAX__, __DBL_MAX__, 1);
40 TEST_EQ (double, __DBL_MIN__, __DBL_MIN__, 1);
41 TEST_EQ (double, H, H, 1);
43 if (error)
44 __builtin_abort ();
46 return 0;