| 1 |
/* { dg-do run { target { powerpc*-*-* } } } */ |
| 2 |
/* { dg-require-effective-target has_arch_ppc64 } */ |
| 3 |
/* { dg-require-effective-target p9vector_hw } */ |
| 4 |
/* { dg-options "-mdejagnu-cpu=power9" } */ |
| 5 |
|
| 6 |
#include <altivec.h> |
| 7 |
#include <stdbool.h> |
| 8 |
#include <stdlib.h> |
| 9 |
|
| 10 |
bool |
| 11 |
test_denormal (double *p) |
| 12 |
{ |
| 13 |
double source = *p; |
| 14 |
|
| 15 |
/* |
| 16 |
0x40 Test for NaN |
| 17 |
0x20 Test for +Infinity |
| 18 |
0x10 Test for -Infinity |
| 19 |
0x08 Test for +Zero |
| 20 |
0x04 Test for -Zero |
| 21 |
0x02 Test for +Denormal |
| 22 |
0x01 Test for -Denormal |
| 23 |
*/ |
| 24 |
return scalar_test_data_class (source, 3); |
| 25 |
} |
| 26 |
|
| 27 |
int |
| 28 |
main () |
| 29 |
{ |
| 30 |
/* A Denormal number has a biased exponent value of zero and a |
| 31 |
* non-zero fraction value. */ |
| 32 |
double denormal_plus = scalar_insert_exp (0x0008000000000000ULL, 0x0ULL); |
| 33 |
double denormal_minus = scalar_insert_exp (0x8008000000000000ULL, 0x0ULL); |
| 34 |
double not_denormal = scalar_insert_exp (0x8000000000000000ULL, 1023ULL); |
| 35 |
|
| 36 |
if (!test_denormal (&denormal_plus)) |
| 37 |
abort (); |
| 38 |
if (!test_denormal (&denormal_minus)) |
| 39 |
abort (); |
| 40 |
if (test_denormal (¬_denormal)) |
| 41 |
abort (); |
| 42 |
return 0; |
| 43 |
} |
| 44 |
|