aboutsummaryrefslogtreecommitdiff
path: root/sim/common
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>2005-07-08 18:41:54 +0000
committerIan Lance Taylor <ian@airs.com>2005-07-08 18:41:54 +0000
commit09b96ea041546cc645313936516c4ee727e6ea39 (patch)
tree2cc46f318dd65de4fe213ba9736163f706478a7b /sim/common
parent3403418e496fa5c0ba46836c83d5045bc152cd11 (diff)
downloadgdb-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')
-rw-r--r--sim/common/ChangeLog6
-rw-r--r--sim/common/sim-fpu.c13
2 files changed, 18 insertions, 1 deletions
diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog
index 7a43a29..c2ef9e0 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 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;