This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Add argument to TC_LARGEST_EXPONENT_IS_NORMAL


This patch adds a precision argument to TC_LARGEST_EXPONENT_IS_NORMAL
so that some formats can be true IEEE while others have the variant
format.  It also moves the macro's documentation into internals.texi.

Tested on mips64-elf, no regressions.  OK to apply?

Richard


	* doc/invoke.texi (TC_LARGEST_EXPONENT_IS_NORMAL): Document.
	* config/atof-ieee.c (TC_LARGEST_EXPONENT_IS_NORMAL): Add an
	argument for the precision.
        (gen_to_words): Update accordingly.

Index: doc/internals.texi
===================================================================
RCS file: /cvs/cvsfiles/devo/gas/doc/internals.texi,v
retrieving revision 1.45
diff -c -p -d -r1.45 internals.texi
*** doc/internals.texi	2001/12/17 02:44:28	1.45
--- doc/internals.texi	2002/04/10 19:21:42
*************** a pointer to a integer that should be fi
*** 1151,1156 ****
--- 1151,1166 ----
  gas/bignum.h).  The function should return NULL upon success or an error string
  upon failure.
  
+ @item TC_LARGEST_EXPONENT_IS_NORMAL
+ @cindex TC_LARGEST_EXPONENT_IS_NORMAL (@var{precision})
+ This macro is used only by @file{atof-ieee.c}.  It should evaluate to true
+ if floats of the given precision use the largest exponent for normal numbers
+ instead of NaNs and infinities.  @var{precision} is @samp{F_PRECISION} for
+ single precision, @samp{D_PRECISION} for double precision, or
+ @samp{X_PRECISION} for extended double precision.
+ 
+ The macro has a default definition which returns 0 for all cases.
+ 
  @item md_reloc_size
  @cindex md_reloc_size
  This variable is only used in the original version of gas (not
Index: config/atof-ieee.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gas/config/atof-ieee.c,v
retrieving revision 1.27
diff -c -p -d -r1.27 atof-ieee.c
*** config/atof-ieee.c	2001/03/15 04:23:31	1.27
--- config/atof-ieee.c	2002/04/10 19:21:42
***************
*** 19,31 ****
     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.  */
--- 19,24 ----
*************** extern const char EXP_CHARS[];
*** 47,54 ****
  /* 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[] =
--- 40,47 ----
  /* Length in LittleNums of guard bits.  */
  #define GUARD (2)
  
! #ifndef TC_LARGEST_EXPONENT_IS_NORMAL(PRECISION)
! #define TC_LARGEST_EXPONENT_IS_NORMAL(PRECISION) 0
  #endif
  
  static const unsigned long mask[] =
*************** gen_to_words (words, precision, exponent
*** 302,308 ****
    /* 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)
  	{
--- 295,301 ----
    /* NaN:  Do the right thing.  */
    if (generic_floating_point_number.sign == 0)
      {
!       if (TC_LARGEST_EXPONENT_IS_NORMAL (precision))
  	as_warn ("NaNs are not supported by this target\n");
        if (precision == F_PRECISION)
  	{
*************** gen_to_words (words, precision, exponent
*** 341,347 ****
      }
    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.  */
--- 334,340 ----
      }
    else if (generic_floating_point_number.sign == 'P')
      {
!       if (TC_LARGEST_EXPONENT_IS_NORMAL (precision))
  	as_warn ("Infinities are not supported by this target\n");
  
        /* +INF:  Do the right thing.  */
*************** gen_to_words (words, precision, exponent
*** 382,388 ****
      }
    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.  */
--- 375,381 ----
      }
    else if (generic_floating_point_number.sign == 'N')
      {
!       if (TC_LARGEST_EXPONENT_IS_NORMAL (precision))
  	as_warn ("Infinities are not supported by this target\n");
  
        /* Negative INF.  */
*************** gen_to_words (words, precision, exponent
*** 598,604 ****
        return return_value;
      }
    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.  */
--- 591,597 ----
        return return_value;
      }
    else if ((unsigned long) exponent_4 > mask[exponent_bits]
! 	   || (! TC_LARGEST_EXPONENT_IS_NORMAL (precision)
  	       && (unsigned long) exponent_4 == mask[exponent_bits]))
      {
        /* Exponent overflow.  Lose immediately.  */


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]