diff options
author | Ian Lance Taylor <ian@airs.com> | 2005-07-08 18:41:54 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@airs.com> | 2005-07-08 18:41:54 +0000 |
commit | 09b96ea041546cc645313936516c4ee727e6ea39 (patch) | |
tree | 2cc46f318dd65de4fe213ba9736163f706478a7b /sim/common/sim-fpu.c | |
parent | 3403418e496fa5c0ba46836c83d5045bc152cd11 (diff) | |
download | gdb-09b96ea041546cc645313936516c4ee727e6ea39.zip gdb-09b96ea041546cc645313936516c4ee727e6ea39.tar.gz gdb-09b96ea041546cc645313936516c4ee727e6ea39.tar.bz2 |
* sim-fpu.c (pack_fpu): If SIM_QUIET_NAN_NEGATED is defined, use a
different fraction for a quiet NaN.
(unpack_fpu): Likewise.
Diffstat (limited to 'sim/common/sim-fpu.c')
-rw-r--r-- | sim/common/sim-fpu.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/sim/common/sim-fpu.c b/sim/common/sim-fpu.c index 845248a..c9678bd 100644 --- a/sim/common/sim-fpu.c +++ b/sim/common/sim-fpu.c @@ -201,7 +201,11 @@ pack_fpu (const sim_fpu *src, /* force fraction to correct class */ fraction = src->fraction; fraction >>= NR_GUARDS; +#ifdef SIM_QUIET_NAN_NEGATED + fraction |= QUIET_NAN - 1; +#else fraction |= QUIET_NAN; +#endif break; case sim_fpu_class_snan: sign = src->sign; @@ -362,10 +366,17 @@ unpack_fpu (sim_fpu *dst, unsigned64 packed, int is_double) } else { + int qnan; + /* Non zero fraction, means NaN */ dst->sign = sign; dst->fraction = (fraction << NR_GUARDS); - if (fraction >= QUIET_NAN) +#ifdef SIM_QUIET_NAN_NEGATED + qnan = (fraction & QUIET_NAN) == 0; +#else + qnan = fraction >= QUIET_NAN; +#endif + if (qnan) dst->class = sim_fpu_class_qnan; else dst->class = sim_fpu_class_snan; |