PR inline-asm/84742
[official-gcc.git] / gcc / testsuite / gcc.c-torture / execute / ieee / fp-cmp-5.c
blob9c70072f4e00eef48c59b3a323ff84dc6931d735
1 /* Like fp-cmp-4.c, but test that the setcc patterns are correct. */
3 static int
4 test_isunordered(double x, double y)
6 return __builtin_isunordered(x, y);
9 static int
10 test_not_isunordered(double x, double y)
12 return !__builtin_isunordered(x, y);
15 static int
16 test_isless(double x, double y)
18 return __builtin_isless(x, y);
21 static int
22 test_not_isless(double x, double y)
24 return !__builtin_isless(x, y);
27 static int
28 test_islessequal(double x, double y)
30 return __builtin_islessequal(x, y);
33 static int
34 test_not_islessequal(double x, double y)
36 return !__builtin_islessequal(x, y);
39 static int
40 test_isgreater(double x, double y)
42 return __builtin_isgreater(x, y);
45 static int
46 test_not_isgreater(double x, double y)
48 return !__builtin_isgreater(x, y);
51 static int
52 test_isgreaterequal(double x, double y)
54 return __builtin_isgreaterequal(x, y);
57 static int
58 test_not_isgreaterequal(double x, double y)
60 return !__builtin_isgreaterequal(x, y);
63 static int
64 test_islessgreater(double x, double y)
66 return __builtin_islessgreater(x, y);
69 static int
70 test_not_islessgreater(double x, double y)
72 return !__builtin_islessgreater(x, y);
75 static void
76 one_test(double x, double y, int expected,
77 int (*pos) (double, double), int (*neg) (double, double))
79 if ((*pos)(x, y) != expected)
80 abort ();
81 if ((*neg)(x, y) != !expected)
82 abort ();
85 #define NAN (0.0 / 0.0)
87 int
88 main()
90 struct try
92 double x, y;
93 int result[6];
96 static struct try const data[] =
98 { NAN, NAN, { 1, 0, 0, 0, 0, 0 } },
99 { 0.0, NAN, { 1, 0, 0, 0, 0, 0 } },
100 { NAN, 0.0, { 1, 0, 0, 0, 0, 0 } },
101 { 0.0, 0.0, { 0, 0, 1, 0, 1, 0 } },
102 { 1.0, 2.0, { 0, 1, 1, 0, 0, 1 } },
103 { 2.0, 1.0, { 0, 0, 0, 1, 1, 1 } },
106 struct test
108 int (*pos)(double, double);
109 int (*neg)(double, double);
112 static struct test const tests[] =
114 { test_isunordered, test_not_isunordered },
115 { test_isless, test_not_isless },
116 { test_islessequal, test_not_islessequal },
117 { test_isgreater, test_not_isgreater },
118 { test_isgreaterequal, test_not_isgreaterequal },
119 { test_islessgreater, test_not_islessgreater }
122 const int n = sizeof(data) / sizeof(data[0]);
123 int i, j;
125 for (i = 0; i < n; ++i)
126 for (j = 0; j < 6; ++j)
127 one_test (data[i].x, data[i].y, data[i].result[j],
128 tests[j].pos, tests[j].neg);
130 exit (0);