Print warnings if NaNs are found and the target CPU does not support them
authorNick Clifton <nickc@redhat.com>
Fri, 2 Mar 2001 18:43:13 +0000 (18:43 +0000)
committerNick Clifton <nickc@redhat.com>
Fri, 2 Mar 2001 18:43:13 +0000 (18:43 +0000)
gas/ChangeLog
gas/config/atof-ieee.c

index 879405e0168357ac02fb2c5031df8e719b1b8000..bdb563f5094c6045aefece47bf18a44ac6758f3f 100644 (file)
@@ -1,3 +1,10 @@
+2001-03-02  Richard Sandiford  <rsandifo@redhat.com>
+
+       * config/atof-ieee.c (TC_LARGEST_EXPONENT_IS_NORMAL): New macro.
+       (gen_to_words): Print warnings if NaNs are found and the target CPU
+       does not support them.  Allow largest exponent to be used in normal
+       numbers if TC_LARGEST_EXPONENT_IS_NORMAL evaluates to true.
+
 2001-02-28  Andreas Jaeger  <aj@suse.de>, Bo Thorsen  <bo@suse.de>
 
        * config/tc-i386.c (tc_gen_reloc): Remove ugly hack which is not needed
index 2a916cd82323897c419a70d3ba96eb8ca8d3f8ee..8eed2f7296ab77b640948f635a14d31ee915dfeb 100644 (file)
@@ -1,5 +1,5 @@
 /* atof_ieee.c - turn a Flonum into an IEEE floating point number
-   Copyright (C) 1987, 92, 93, 94, 95, 96, 97, 98, 99, 2000
+   Copyright (C) 1987, 92, 93, 94, 95, 96, 97, 98, 99, 2000, 2001
    Free Software Foundation, Inc.
 
    This file is part of GAS, the GNU Assembler.
    Software Foundation, 59 Temple Place - Suite 330, Boston, MA
    02111-1307, USA.  */
 
+/* Some float formats are based on the IEEE standard, but use the
+   largest exponent for normal numbers instead of NaNs and infinites.
+   The macro TC_LARGEST_EXPONENT_IS_NORMAL should evaluate to true
+   if the target machine uses such a format.  The macro can depend on
+   command line flags if necessary.  There is no need to define the
+   macro if it would always be 0.  */
+
 #include "as.h"
 
 /* Flonums returned here.  */
@@ -40,6 +47,10 @@ extern const char EXP_CHARS[];
 /* Length in LittleNums of guard bits.  */
 #define GUARD (2)
 
+#ifndef TC_LARGEST_EXPONENT_IS_NORMAL
+#define TC_LARGEST_EXPONENT_IS_NORMAL 0
+#endif
+
 static const unsigned long mask[] =
 {
   0x00000000,
@@ -291,6 +302,8 @@ gen_to_words (words, precision, exponent_bits)
   /* NaN:  Do the right thing.  */
   if (generic_floating_point_number.sign == 0)
     {
+      if (TC_LARGEST_EXPONENT_IS_NORMAL)
+       as_warn ("NaNs are not supported by this target\n");
       if (precision == F_PRECISION)
        {
          words[0] = 0x7fff;
@@ -328,6 +341,9 @@ gen_to_words (words, precision, exponent_bits)
     }
   else if (generic_floating_point_number.sign == 'P')
     {
+      if (TC_LARGEST_EXPONENT_IS_NORMAL)
+       as_warn ("Infinities are not supported by this target\n");
+
       /* +INF:  Do the right thing.  */
       if (precision == F_PRECISION)
        {
@@ -366,6 +382,9 @@ gen_to_words (words, precision, exponent_bits)
     }
   else if (generic_floating_point_number.sign == 'N')
     {
+      if (TC_LARGEST_EXPONENT_IS_NORMAL)
+       as_warn ("Infinities are not supported by this target\n");
+
       /* Negative INF.  */
       if (precision == F_PRECISION)
        {
@@ -578,7 +597,9 @@ gen_to_words (words, precision, exponent_bits)
 
       return return_value;
     }
-  else if ((unsigned long) exponent_4 >= mask[exponent_bits])
+  else if ((unsigned long) exponent_4 > mask[exponent_bits]
+          || (! TC_LARGEST_EXPONENT_IS_NORMAL
+              && (unsigned long) exponent_4 == mask[exponent_bits]))
     {
       /* Exponent overflow.  Lose immediately.  */
 
This page took 0.031615 seconds and 4 git commands to generate.