| 1 |
/* { dg-do run } */ |
| 2 |
/* { dg-require-effective-target ppc_float128_hw } */ |
| 3 |
/* { dg-options "-O2 -mdejagnu-cpu=power9 " } */ |
| 4 |
|
| 5 |
#define NAN_Q __builtin_nanq ("") |
| 6 |
#define SNAN_Q __builtin_nansq ("") |
| 7 |
#define NAN __builtin_nan ("") |
| 8 |
#define SNAN __builtin_nans ("") |
| 9 |
|
| 10 |
#ifdef DEBUG |
| 11 |
#include <stdio.h> |
| 12 |
#endif |
| 13 |
|
| 14 |
void abort (void); |
| 15 |
|
| 16 |
int main(void) |
| 17 |
{ |
| 18 |
int result; |
| 19 |
double a_dble, b_dble; |
| 20 |
__ieee128 a_ieee128, b_ieee128; |
| 21 |
|
| 22 |
a_dble = 3.10; |
| 23 |
b_dble = 3.10; |
| 24 |
|
| 25 |
if (__builtin_vec_scalar_cmp_exp_eq(a_dble, b_dble)) |
| 26 |
#ifdef DEBUG |
| 27 |
printf("Double EQ result is true, expecting true\n"); |
| 28 |
#else |
| 29 |
; |
| 30 |
#endif |
| 31 |
else |
| 32 |
#ifdef DEBUG |
| 33 |
printf("ERROR: Double EQ result is false, expecting true\n"); |
| 34 |
#else |
| 35 |
abort(); |
| 36 |
#endif |
| 37 |
|
| 38 |
a_dble = 3.10; |
| 39 |
b_dble = 31.0; |
| 40 |
|
| 41 |
if (__builtin_vec_scalar_cmp_exp_eq(a_dble, b_dble)) |
| 42 |
#ifdef DEBUG |
| 43 |
printf("ERROR: Double EQ result is true, expecting false\n"); |
| 44 |
#else |
| 45 |
abort(); |
| 46 |
#endif |
| 47 |
else |
| 48 |
#ifdef DEBUG |
| 49 |
printf("Double EQ result is false, expecting false\n"); |
| 50 |
#else |
| 51 |
; |
| 52 |
#endif |
| 53 |
|
| 54 |
a_dble = 3.10; |
| 55 |
b_dble = 3.10; |
| 56 |
|
| 57 |
if (__builtin_vec_scalar_cmp_exp_lt(a_dble, b_dble)) |
| 58 |
#ifdef DEBUG |
| 59 |
printf("ERROR: Double LT result is true, expecting false\n"); |
| 60 |
#else |
| 61 |
abort(); |
| 62 |
#endif |
| 63 |
else |
| 64 |
#ifdef DEBUG |
| 65 |
printf("Double LT result is false, expecting false\n"); |
| 66 |
#else |
| 67 |
; |
| 68 |
#endif |
| 69 |
|
| 70 |
a_dble = 0.31; |
| 71 |
b_dble = 3.10; |
| 72 |
|
| 73 |
if (__builtin_vec_scalar_cmp_exp_lt(a_dble, b_dble)) |
| 74 |
#ifdef DEBUG |
| 75 |
printf("Double LT result is true, expecting true\n"); |
| 76 |
#else |
| 77 |
; |
| 78 |
#endif |
| 79 |
else |
| 80 |
#ifdef DEBUG |
| 81 |
printf("ERROR: Double LT result is false, expecting true\n"); |
| 82 |
#else |
| 83 |
abort(); |
| 84 |
#endif |
| 85 |
|
| 86 |
a_dble = 0.31; |
| 87 |
b_dble = 3.10; |
| 88 |
|
| 89 |
if (__builtin_vec_scalar_cmp_exp_gt(a_dble, b_dble)) |
| 90 |
#ifdef DEBUG |
| 91 |
printf("ERROR: Double GT result is true, expecting false\n"); |
| 92 |
#else |
| 93 |
abort(); |
| 94 |
#endif |
| 95 |
else |
| 96 |
#ifdef DEBUG |
| 97 |
printf("Double GT result is false, expecting false\n"); |
| 98 |
#else |
| 99 |
; |
| 100 |
#endif |
| 101 |
|
| 102 |
a_dble = 3.10; |
| 103 |
b_dble = 0.31; |
| 104 |
|
| 105 |
if (__builtin_vec_scalar_cmp_exp_gt(a_dble, b_dble)) |
| 106 |
#ifdef DEBUG |
| 107 |
printf("Double GT result is true, expecting true\n"); |
| 108 |
#else |
| 109 |
; |
| 110 |
#endif |
| 111 |
else |
| 112 |
#ifdef DEBUG |
| 113 |
printf("ERROR: Double GT result is false, expecting true\n"); |
| 114 |
#else |
| 115 |
abort(); |
| 116 |
#endif |
| 117 |
|
| 118 |
a_dble = NAN; |
| 119 |
b_dble = NAN; |
| 120 |
|
| 121 |
if (__builtin_vec_scalar_cmp_exp_unordered(a_dble, b_dble)) |
| 122 |
#ifdef DEBUG |
| 123 |
printf("Double unordered result is true, expecting true\n"); |
| 124 |
#else |
| 125 |
; |
| 126 |
#endif |
| 127 |
else |
| 128 |
#ifdef DEBUG |
| 129 |
printf("ERROR: Double unordered result is false, expecting true\n"); |
| 130 |
#else |
| 131 |
abort(); |
| 132 |
#endif |
| 133 |
|
| 134 |
a_dble = 3.10; |
| 135 |
b_dble = 3.10; |
| 136 |
|
| 137 |
if (__builtin_vec_scalar_cmp_exp_unordered(a_dble, b_dble)) |
| 138 |
#ifdef DEBUG |
| 139 |
printf("ERROR: Double unordered result is true, expecting false\n"); |
| 140 |
#else |
| 141 |
abort(); |
| 142 |
#endif |
| 143 |
else |
| 144 |
#ifdef DEBUG |
| 145 |
printf("Double unordered result is false, expecting false\n"); |
| 146 |
#else |
| 147 |
; |
| 148 |
#endif |
| 149 |
|
| 150 |
/* IEEE 128 */ |
| 151 |
a_ieee128 = 3.10; |
| 152 |
b_ieee128 = 3.10; |
| 153 |
|
| 154 |
if (__builtin_vec_scalar_cmp_exp_eq(a_ieee128, b_ieee128)) |
| 155 |
#ifdef DEBUG |
| 156 |
printf("IEEE 128 EQ result is true, expecting true\n"); |
| 157 |
#else |
| 158 |
; |
| 159 |
#endif |
| 160 |
else |
| 161 |
#ifdef DEBUG |
| 162 |
printf("ERROR: IEEE 128 EQ result is false, expecting true\n"); |
| 163 |
#else |
| 164 |
abort(); |
| 165 |
#endif |
| 166 |
|
| 167 |
a_ieee128 = 3.10; |
| 168 |
b_ieee128 = 31.0; |
| 169 |
|
| 170 |
if (__builtin_vec_scalar_cmp_exp_eq(a_ieee128, b_ieee128)) |
| 171 |
#ifdef DEBUG |
| 172 |
printf("ERROR: IEEE 128 EQ result is true, expecting false\n"); |
| 173 |
#else |
| 174 |
abort(); |
| 175 |
#endif |
| 176 |
else |
| 177 |
#ifdef DEBUG |
| 178 |
printf("IEEE 128 EQ result is false, expecting false\n"); |
| 179 |
#else |
| 180 |
; |
| 181 |
#endif |
| 182 |
|
| 183 |
a_ieee128 = 3.10; |
| 184 |
b_ieee128 = 3.10; |
| 185 |
|
| 186 |
if (__builtin_vec_scalar_cmp_exp_lt(a_ieee128, b_ieee128)) |
| 187 |
#ifdef DEBUG |
| 188 |
printf("ERROR: IEEE 128 LT result is true, expecting false\n"); |
| 189 |
#else |
| 190 |
abort(); |
| 191 |
#endif |
| 192 |
else |
| 193 |
#ifdef DEBUG |
| 194 |
printf("IEEE 128 LT result is false, expecting false\n"); |
| 195 |
#else |
| 196 |
; |
| 197 |
#endif |
| 198 |
|
| 199 |
a_ieee128 = 0.31; |
| 200 |
b_ieee128 = 3.10; |
| 201 |
|
| 202 |
if (__builtin_vec_scalar_cmp_exp_lt(a_ieee128, b_ieee128)) |
| 203 |
#ifdef DEBUG |
| 204 |
printf("IEEE 128 LT result is true, expecting true\n"); |
| 205 |
#else |
| 206 |
; |
| 207 |
#endif |
| 208 |
else |
| 209 |
#ifdef DEBUG |
| 210 |
printf("ERROR: IEEE 128 LT result is false, expecting true\n"); |
| 211 |
#else |
| 212 |
abort(); |
| 213 |
#endif |
| 214 |
|
| 215 |
a_ieee128 = 0.31; |
| 216 |
b_ieee128 = 3.10; |
| 217 |
|
| 218 |
if (__builtin_vec_scalar_cmp_exp_gt(a_ieee128, b_ieee128)) |
| 219 |
#ifdef DEBUG |
| 220 |
printf("ERROR: IEEE 128 GT result is true, expecting false\n"); |
| 221 |
#else |
| 222 |
abort(); |
| 223 |
#endif |
| 224 |
else |
| 225 |
#ifdef DEBUG |
| 226 |
printf("IEEE 128 GT result is false, expecting false\n"); |
| 227 |
#else |
| 228 |
; |
| 229 |
#endif |
| 230 |
|
| 231 |
a_ieee128 = 3.10; |
| 232 |
b_ieee128 = 0.31; |
| 233 |
|
| 234 |
if (__builtin_vec_scalar_cmp_exp_gt(a_ieee128, b_ieee128)) |
| 235 |
#ifdef DEBUG |
| 236 |
printf("IEEE 128 GT result is true, expecting true\n"); |
| 237 |
#else |
| 238 |
; |
| 239 |
#endif |
| 240 |
else |
| 241 |
#ifdef DEBUG |
| 242 |
printf("ERROR: IEEE 128 GT result is false, expecting true\n"); |
| 243 |
#else |
| 244 |
abort(); |
| 245 |
#endif |
| 246 |
|
| 247 |
a_ieee128 = NAN_Q; |
| 248 |
b_ieee128 = NAN_Q; |
| 249 |
|
| 250 |
if (__builtin_vec_scalar_cmp_exp_unordered(a_ieee128, b_ieee128)) |
| 251 |
#ifdef DEBUG |
| 252 |
printf("IEEE unordered result is true, expecting true\n"); |
| 253 |
#else |
| 254 |
; |
| 255 |
#endif |
| 256 |
else |
| 257 |
#ifdef DEBUG |
| 258 |
printf("ERROR: IEEE unordered result is false, expecting true\n"); |
| 259 |
#else |
| 260 |
abort(); |
| 261 |
#endif |
| 262 |
|
| 263 |
a_ieee128 = 3.10; |
| 264 |
b_ieee128 = 3.10; |
| 265 |
|
| 266 |
if (__builtin_vec_scalar_cmp_exp_unordered(a_ieee128, b_ieee128)) |
| 267 |
#ifdef DEBUG |
| 268 |
printf("ERROR: IEEE unordered result is true, expecting false\n"); |
| 269 |
#else |
| 270 |
abort(); |
| 271 |
#endif |
| 272 |
else |
| 273 |
#ifdef DEBUG |
| 274 |
printf("IEEE unordered result is false, expecting false\n"); |
| 275 |
#else |
| 276 |
; |
| 277 |
#endif |
| 278 |
} |