| 1 |
/* { dg-do run } */ |
| 2 |
/* { dg-require-effective-target float128_runtime } */ |
| 3 |
/* Force long double to be with IBM format here, to verify |
| 4 |
_Float128 constant still uses its own format (IEEE) for |
| 5 |
encoding rather than IBM format. */ |
| 6 |
/* { dg-options "-mfp-in-toc -mabi=ibmlongdouble" } */ |
| 7 |
/* { dg-add-options float128 } */ |
| 8 |
|
| 9 |
#define MPFR_FLOAT128_MAX 0x1.ffffffffffffffffffffffffffffp+16383f128 |
| 10 |
|
| 11 |
__attribute__ ((noipa)) |
| 12 |
_Float128 f128_max () |
| 13 |
{ |
| 14 |
return MPFR_FLOAT128_MAX; |
| 15 |
} |
| 16 |
|
| 17 |
typedef union |
| 18 |
{ |
| 19 |
int w[4]; |
| 20 |
_Float128 f128; |
| 21 |
} U; |
| 22 |
|
| 23 |
int main () |
| 24 |
{ |
| 25 |
|
| 26 |
U umax; |
| 27 |
umax.f128 = f128_max (); |
| 28 |
/* ieee float128 max: |
| 29 |
7ffeffff ffffffff ffffffff ffffffff. */ |
| 30 |
if (umax.w[1] != 0xffffffff || umax.w[2] != 0xffffffff) |
| 31 |
__builtin_abort (); |
| 32 |
#ifdef __LITTLE_ENDIAN__ |
| 33 |
if (umax.w[0] != 0xffffffff || umax.w[3] != 0x7ffeffff) |
| 34 |
__builtin_abort (); |
| 35 |
#else |
| 36 |
if (umax.w[3] != 0xffffffff || umax.w[0] != 0x7ffeffff) |
| 37 |
__builtin_abort (); |
| 38 |
#endif |
| 39 |
|
| 40 |
return 0; |
| 41 |
} |
| 42 |
|