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 | 127e29ea27dd2522f2964507850462ad2a432add (patch) | |
tree | c2816f560fab2fb2ba24a99f496dec568276d516 /sim/common | |
parent | 02823ac8f226fb84ab554bbd13a30db00f2051a8 (diff) | |
download | gdb-127e29ea27dd2522f2964507850462ad2a432add.tar.gz |
* 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')
-rw-r--r-- | sim/common/ChangeLog | 6 | ||||
-rw-r--r-- | sim/common/sim-fpu.c | 13 |
2 files changed, 18 insertions, 1 deletions
diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog index 7a43a29bfcd..c2ef9e0a8df 100644 --- a/sim/common/ChangeLog +++ b/sim/common/ChangeLog @@ -1,3 +1,9 @@ +2005-07-08 Ian Lance Taylor <ian@airs.com> + + * sim-fpu.c (pack_fpu): If SIM_QUIET_NAN_NEGATED is defined, use a + different fraction for a quiet NaN. + (unpack_fpu): Likewise. + 2005-07-08 Ben Elliston <bje@au.ibm.com> * callback.c: Remove ANSI_PROTOTYPES conditional code. diff --git a/sim/common/sim-fpu.c b/sim/common/sim-fpu.c index 845248adb59..c9678bdc093 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; |