* gcc.target/powerpc/builtins-1-be.c <vclzb>: Rename duplicate test
[official-gcc.git] / gcc / testsuite / gcc.target / powerpc / float128-cmp.c
blobede510d8484f19173fc349efeee44e6dc9e2cffa
1 /* { dg-do run { target { powerpc*-*-linux* } } } */
2 /* { dg-require-effective-target ppc_float128_sw } */
3 /* { dg-options "-mvsx -O2" } */
5 #include <stddef.h>
6 #include <stdlib.h>
8 #ifndef TYPE
9 #define TYPE __float128
10 #define NAN __builtin_nanq ("")
11 #define SNAN __builtin_nansq ("")
12 #else
13 #define NAN __builtin_nan ("")
14 #define SNAN __builtin_nans ("")
15 #endif
17 extern void check (TYPE a,
18 TYPE b,
19 int eq,
20 int ne,
21 int lt,
22 int le,
23 int gt,
24 int ge,
25 int i_lt,
26 int i_le,
27 int i_gt,
28 int i_ge,
29 int i_lg,
30 int i_un) __attribute__((__noinline__));
32 void
33 check (TYPE a,
34 TYPE b,
35 int eq,
36 int ne,
37 int lt,
38 int le,
39 int gt,
40 int ge,
41 int i_lt,
42 int i_le,
43 int i_gt,
44 int i_ge,
45 int i_lg,
46 int i_un)
48 if (eq != (a == b))
49 abort ();
51 if (ne != (a != b))
52 abort ();
54 if (lt != (a < b))
55 abort ();
57 if (le != (a <= b))
58 abort ();
60 if (gt != (a > b))
61 abort ();
63 if (ge != (a >= b))
64 abort ();
66 if (i_lt != __builtin_isless (a, b))
67 abort ();
69 if (i_le != __builtin_islessequal (a, b))
70 abort ();
72 if (i_gt != __builtin_isgreater (a, b))
73 abort ();
75 if (i_ge != __builtin_isgreaterequal (a, b))
76 abort ();
78 if (i_lg != __builtin_islessgreater (a, b))
79 abort ();
81 if (i_un != __builtin_isunordered (a, b))
82 abort ();
85 int main (void)
87 TYPE one = (TYPE) +1.0;
88 TYPE two = (TYPE) +2.0;
89 TYPE pzero = (TYPE) +0.0;
90 TYPE mzero = (TYPE) -0.0;
91 TYPE nan = (TYPE) NAN;
92 TYPE snan = (TYPE) SNAN;
94 check (one, two, 0, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 0);
95 check (one, one, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0);
96 check (one, pzero, 0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0);
97 check (mzero, pzero, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0);
98 check (nan, one, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1);
99 check (one, nan, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1);
100 check (nan, nan, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1);
101 check (snan, one, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1);
102 check (one, snan, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1);
103 check (snan, nan, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1);
104 check (nan, snan, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1);
105 return 0;