aboutsummaryrefslogtreecommitdiff
path: root/gas
diff options
context:
space:
mode:
authorAndreas Schwab <schwab@linux-m68k.org>1999-05-14 01:53:28 +0000
committerAndreas Schwab <schwab@linux-m68k.org>1999-05-14 01:53:28 +0000
commit19b341776db9a4a7740943fb2da7ae209fd492dd (patch)
tree05de49c5c3c1c07b57727d629aeefb69f8f9d995 /gas
parentde24ad21069c5466d13b06963b1797241392cebd (diff)
downloadfsf-binutils-gdb-19b341776db9a4a7740943fb2da7ae209fd492dd.zip
fsf-binutils-gdb-19b341776db9a4a7740943fb2da7ae209fd492dd.tar.gz
fsf-binutils-gdb-19b341776db9a4a7740943fb2da7ae209fd492dd.tar.bz2
* config/atof-ieee.c (gen_to_words): Correctly round a
denormalized number. Fix off-by-one in range checking for exponent in a denormal.
Diffstat (limited to 'gas')
-rw-r--r--gas/ChangeLog6
-rw-r--r--gas/config/atof-ieee.c27
2 files changed, 29 insertions, 4 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index 7e62bdc..0e7b0e8 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,9 @@
+Fri May 14 10:52:13 1999 Andreas Schwab <schwab@issan.cs.uni-dortmund.de>
+
+ * config/atof-ieee.c (gen_to_words): Correctly round a
+ denormalized number. Fix off-by-one in range checking for
+ exponent in a denormal.
+
Thu May 13 09:46:59 1999 Joel Sherrill (joel@OARcorp.com)
* configure.in (i386-*-rtemself*, sh-*-rtemself*): New targets.
diff --git a/gas/config/atof-ieee.c b/gas/config/atof-ieee.c
index d586e3a..fbf0ffb 100644
--- a/gas/config/atof-ieee.c
+++ b/gas/config/atof-ieee.c
@@ -460,7 +460,7 @@ gen_to_words (words, precision, exponent_bits)
/* Bigger than one littlenum */
num_bits -= (LITTLENUM_NUMBER_OF_BITS - 1) - exponent_bits;
*lp++ = word1;
- if (num_bits + exponent_bits + 1 >= precision * LITTLENUM_NUMBER_OF_BITS)
+ if (num_bits + exponent_bits + 1 > precision * LITTLENUM_NUMBER_OF_BITS)
{
/* Exponent overflow */
make_invalid_floating_point_number (words);
@@ -501,7 +501,7 @@ gen_to_words (words, precision, exponent_bits)
if (next_bits (1))
{
--lp;
- if (prec_bits > LITTLENUM_NUMBER_OF_BITS)
+ if (prec_bits >= LITTLENUM_NUMBER_OF_BITS)
{
int n = 0;
int tmp_bits;
@@ -515,7 +515,19 @@ gen_to_words (words, precision, exponent_bits)
--n;
tmp_bits -= LITTLENUM_NUMBER_OF_BITS;
}
- if (tmp_bits > LITTLENUM_NUMBER_OF_BITS || (lp[n] & mask[tmp_bits]) != mask[tmp_bits])
+ if (tmp_bits > LITTLENUM_NUMBER_OF_BITS
+ || (lp[n] & mask[tmp_bits]) != mask[tmp_bits]
+ || (prec_bits != (precision * LITTLENUM_NUMBER_OF_BITS
+ - exponent_bits - 1)
+#ifdef TC_I386
+ /* An extended precision float with only the integer
+ bit set would be invalid. That must be converted
+ to the smallest normalized number. */
+ && !(precision == X_PRECISION
+ && prec_bits == (precision * LITTLENUM_NUMBER_OF_BITS
+ - exponent_bits - 2))
+#endif
+ ))
{
unsigned long carry;
@@ -539,11 +551,18 @@ gen_to_words (words, precision, exponent_bits)
<< ((LITTLENUM_NUMBER_OF_BITS - 1)
- exponent_bits));
*lp++ = word1;
+#ifdef TC_I386
+ /* Set the integer bit in the extended precision format.
+ This cannot happen on the m68k where the mantissa
+ just overflows into the integer bit above. */
+ if (precision == X_PRECISION)
+ *lp++ = 1 << (LITTLENUM_NUMBER_OF_BITS - 1);
+#endif
while (lp < words_end)
*lp++ = 0;
}
}
- else if ((*lp & mask[prec_bits]) != mask[prec_bits])
+ else
*lp += 1;
}