public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Joseph S. Myers" <joseph@codesourcery.com>
To: gcc-patches@gcc.gnu.org
Subject: soft-fp updated
Date: Thu, 03 May 2007 19:07:00 -0000	[thread overview]
Message-ID: <Pine.LNX.4.64.0705031905390.5802@digraph.polyomino.org.uk> (raw)

I've updated soft-fp on trunk from glibc CVS.  I propose to update 4.2 
branch after 4.2.0 is released.

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 124386)
+++ ChangeLog	(working copy)
@@ -1,3 +1,12 @@
+2007-05-03  Joseph Myers  <joseph@codesourcery.com>
+
+	* config/soft-fp/double.h, config/soft-fp/extended.h,
+	config/soft-fp/floatundidf.c, config/soft-fp/floatundisf.c,
+	config/soft-fp/floatunsidf.c, config/soft-fp/floatunsisf.c,
+	config/soft-fp/op-2.h, config/soft-fp/op-4.h,
+	config/soft-fp/op-common.h, config/soft-fp/quad.h: Update from
+	glibc CVS.
+
 2007-05-03  Ian Lance Taylor  <iant@google.com>
 
 	* config/rs6000/rs6000.c (rs6000_override_options): Don't se
Index: config/soft-fp/quad.h
===================================================================
--- config/soft-fp/quad.h	(revision 124386)
+++ config/soft-fp/quad.h	(working copy)
@@ -1,6 +1,6 @@
 /* Software floating-point emulation.
    Definitions for IEEE Quad Precision.
-   Copyright (C) 1997,1998,1999,2006 Free Software Foundation, Inc.
+   Copyright (C) 1997,1998,1999,2006,2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson (rth@cygnus.com),
 		  Jakub Jelinek (jj@ultra.linux.cz),
@@ -176,15 +176,15 @@
   } longs;
   struct {
 #if __BYTE_ORDER == __BIG_ENDIAN
-    unsigned sign  : 1;
-    unsigned exp   : _FP_EXPBITS_Q;
-    unsigned long frac1 : _FP_FRACBITS_Q-(_FP_IMPLBIT_Q != 0)-_FP_W_TYPE_SIZE;
-    unsigned long frac0 : _FP_W_TYPE_SIZE;
+    unsigned sign    : 1;
+    unsigned exp     : _FP_EXPBITS_Q;
+    _FP_W_TYPE frac1 : _FP_FRACBITS_Q - (_FP_IMPLBIT_Q != 0) - _FP_W_TYPE_SIZE;
+    _FP_W_TYPE frac0 : _FP_W_TYPE_SIZE;
 #else
-    unsigned long frac0 : _FP_W_TYPE_SIZE;
-    unsigned long frac1 : _FP_FRACBITS_Q-(_FP_IMPLBIT_Q != 0)-_FP_W_TYPE_SIZE;
-    unsigned exp   : _FP_EXPBITS_Q;
-    unsigned sign  : 1;
+    _FP_W_TYPE frac0 : _FP_W_TYPE_SIZE;
+    _FP_W_TYPE frac1 : _FP_FRACBITS_Q - (_FP_IMPLBIT_Q != 0) - _FP_W_TYPE_SIZE;
+    unsigned exp     : _FP_EXPBITS_Q;
+    unsigned sign    : 1;
 #endif
   } bits;
 };
Index: config/soft-fp/floatunsidf.c
===================================================================
--- config/soft-fp/floatunsidf.c	(revision 124386)
+++ config/soft-fp/floatunsidf.c	(working copy)
@@ -1,6 +1,6 @@
 /* Software floating-point emulation.
    Convert a 32bit unsigned integer to IEEE double
-   Copyright (C) 1997,1999, 2006 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1999, 2006, 2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson (rth@cygnus.com) and
 		  Jakub Jelinek (jj@ultra.linux.cz).
@@ -32,8 +32,7 @@
 #include "soft-fp.h"
 #include "double.h"
 
-double
-__floatunsidf(USItype i)
+DFtype __floatunsidf(USItype i)
 {
   FP_DECL_EX;
   FP_DECL_D(A);
Index: config/soft-fp/floatundidf.c
===================================================================
--- config/soft-fp/floatundidf.c	(revision 124386)
+++ config/soft-fp/floatundidf.c	(working copy)
@@ -1,6 +1,6 @@
 /* Software floating-point emulation.
    Convert a 64bit unsigned integer to IEEE double
-   Copyright (C) 1997,1999, 2006 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1999, 2006, 2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson (rth@cygnus.com) and
 		  Jakub Jelinek (jj@ultra.linux.cz).
@@ -32,8 +32,7 @@
 #include "soft-fp.h"
 #include "double.h"
 
-double
-__floatundidf(UDItype i)
+DFtype __floatundidf(UDItype i)
 {
   FP_DECL_EX;
   FP_DECL_D(A);
Index: config/soft-fp/extended.h
===================================================================
--- config/soft-fp/extended.h	(revision 124386)
+++ config/soft-fp/extended.h	(working copy)
@@ -1,6 +1,6 @@
 /* Software floating-point emulation.
    Definitions for IEEE Extended Precision.
-   Copyright (C) 1999,2006 Free Software Foundation, Inc.
+   Copyright (C) 1999,2006,2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Jakub Jelinek (jj@ultra.linux.cz).
 
@@ -94,12 +94,6 @@
     X##_f[1] = _flo.bits.frac1;				\
     X##_e  = _flo.bits.exp;				\
     X##_s  = _flo.bits.sign;				\
-    if (!X##_e && (X##_f[1] || X##_f[0])		\
-        && !(X##_f[1] & _FP_IMPLBIT_E))			\
-      {							\
-        X##_e++;					\
-        FP_SET_EXCEPTION(FP_EX_DENORM);			\
-      }							\
   } while (0)
 
 #define FP_UNPACK_RAW_EP(X, val)			\
@@ -112,12 +106,6 @@
     X##_f[1] = _flo->bits.frac1;			\
     X##_e  = _flo->bits.exp;				\
     X##_s  = _flo->bits.sign;				\
-    if (!X##_e && (X##_f[1] || X##_f[0])		\
-        && !(X##_f[1] & _FP_IMPLBIT_E))			\
-      {							\
-        X##_e++;					\
-        FP_SET_EXCEPTION(FP_EX_DENORM);			\
-      }							\
   } while (0)
 
 #define FP_PACK_RAW_E(val, X)				\
@@ -164,13 +152,13 @@
 
 #define FP_UNPACK_SEMIRAW_E(X,val)	\
   do {					\
-    _FP_UNPACK_RAW_E(X,val);		\
+    FP_UNPACK_RAW_E(X,val);		\
     _FP_UNPACK_SEMIRAW(E,4,X);		\
   } while (0)
 
 #define FP_UNPACK_SEMIRAW_EP(X,val)	\
   do {					\
-    _FP_UNPACK_RAW_EP(X,val);		\
+    FP_UNPACK_RAW_EP(X,val);		\
     _FP_UNPACK_SEMIRAW(E,4,X);		\
   } while (0)
 
@@ -189,13 +177,13 @@
 #define FP_PACK_SEMIRAW_E(val,X)	\
   do {					\
     _FP_PACK_SEMIRAW(E,4,X);		\
-    _FP_PACK_RAW_E(val,X);		\
+    FP_PACK_RAW_E(val,X);		\
   } while (0)
 
 #define FP_PACK_SEMIRAW_EP(val,X)	\
   do {					\
     _FP_PACK_SEMIRAW(E,4,X);		\
-    _FP_PACK_RAW_EP(val,X);		\
+    FP_PACK_RAW_EP(val,X);		\
   } while (0)
 
 #define FP_ISSIGNAN_E(X)	_FP_ISSIGNAN(E,4,X)
@@ -277,14 +265,14 @@
   XFtype flt;
   struct {
 #if __BYTE_ORDER == __BIG_ENDIAN
-    unsigned long pad : (_FP_W_TYPE_SIZE - 1 - _FP_EXPBITS_E);
-    unsigned sign  : 1;
-    unsigned exp   : _FP_EXPBITS_E;
-    unsigned long frac : _FP_W_TYPE_SIZE;
+    _FP_W_TYPE pad  : (_FP_W_TYPE_SIZE - 1 - _FP_EXPBITS_E);
+    unsigned sign   : 1;
+    unsigned exp    : _FP_EXPBITS_E;
+    _FP_W_TYPE frac : _FP_W_TYPE_SIZE;
 #else
-    unsigned long frac : _FP_W_TYPE_SIZE;
-    unsigned exp   : _FP_EXPBITS_E;
-    unsigned sign  : 1;
+    _FP_W_TYPE frac : _FP_W_TYPE_SIZE;
+    unsigned exp    : _FP_EXPBITS_E;
+    unsigned sign   : 1;
 #endif
   } bits;
 };
@@ -299,11 +287,6 @@
     X##_f1 = 0;							\
     X##_e = _flo.bits.exp;					\
     X##_s = _flo.bits.sign;					\
-    if (!X##_e && X##_f0 && !(X##_f0 & _FP_IMPLBIT_E))		\
-      {								\
-        X##_e++;						\
-        FP_SET_EXCEPTION(FP_EX_DENORM);				\
-      }								\
   } while (0)
 
 #define FP_UNPACK_RAW_EP(X, val)				\
@@ -315,11 +298,6 @@
     X##_f1 = 0;							\
     X##_e = _flo->bits.exp;					\
     X##_s = _flo->bits.sign;					\
-    if (!X##_e && X##_f0 && !(X##_f0 & _FP_IMPLBIT_E))		\
-      {								\
-        X##_e++;						\
-        FP_SET_EXCEPTION(FP_EX_DENORM);				\
-      }								\
   } while (0)
 
 #define FP_PACK_RAW_E(val, X)					\
@@ -365,13 +343,13 @@
 
 #define FP_UNPACK_SEMIRAW_E(X,val)	\
   do {					\
-    _FP_UNPACK_RAW_E(X,val);		\
+    FP_UNPACK_RAW_E(X,val);		\
     _FP_UNPACK_SEMIRAW(E,2,X);		\
   } while (0)
 
 #define FP_UNPACK_SEMIRAW_EP(X,val)	\
   do {					\
-    _FP_UNPACK_RAW_EP(X,val);		\
+    FP_UNPACK_RAW_EP(X,val);		\
     _FP_UNPACK_SEMIRAW(E,2,X);		\
   } while (0)
 
@@ -390,13 +368,13 @@
 #define FP_PACK_SEMIRAW_E(val,X)	\
   do {					\
     _FP_PACK_SEMIRAW(E,2,X);		\
-    _FP_PACK_RAW_E(val,X);		\
+    FP_PACK_RAW_E(val,X);		\
   } while (0)
 
 #define FP_PACK_SEMIRAW_EP(val,X)	\
   do {					\
     _FP_PACK_SEMIRAW(E,2,X);		\
-    _FP_PACK_RAW_EP(val,X);		\
+    FP_PACK_RAW_EP(val,X);		\
   } while (0)
 
 #define FP_ISSIGNAN_E(X)	_FP_ISSIGNAN(E,2,X)
Index: config/soft-fp/floatunsisf.c
===================================================================
--- config/soft-fp/floatunsisf.c	(revision 124386)
+++ config/soft-fp/floatunsisf.c	(working copy)
@@ -1,6 +1,6 @@
 /* Software floating-point emulation.
    Convert a 32bit unsigned integer to IEEE single
-   Copyright (C) 1997,1999, 2006 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1999, 2006, 2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson (rth@cygnus.com) and
 		  Jakub Jelinek (jj@ultra.linux.cz).
@@ -32,8 +32,7 @@
 #include "soft-fp.h"
 #include "single.h"
 
-float
-__floatunsisf(USItype i)
+SFtype __floatunsisf(USItype i)
 {
   FP_DECL_EX;
   FP_DECL_S(A);
Index: config/soft-fp/op-common.h
===================================================================
--- config/soft-fp/op-common.h	(revision 124386)
+++ config/soft-fp/op-common.h	(working copy)
@@ -1153,7 +1153,8 @@
   if (_FP_FRACBITS_##dfs < _FP_FRACBITS_##sfs				 \
       || (_FP_EXPMAX_##dfs - _FP_EXPBIAS_##dfs				 \
 	  < _FP_EXPMAX_##sfs - _FP_EXPBIAS_##sfs)			 \
-      || _FP_EXPBIAS_##dfs < _FP_EXPBIAS_##sfs + _FP_FRACBITS_##sfs - 1) \
+      || (_FP_EXPBIAS_##dfs < _FP_EXPBIAS_##sfs + _FP_FRACBITS_##sfs - 1 \
+	  && _FP_EXPBIAS_##dfs != _FP_EXPBIAS_##sfs))			 \
     abort();								 \
   D##_s = S##_s;							 \
   _FP_FRAC_COPY_##dwc##_##swc(D, S);					 \
@@ -1168,6 +1169,14 @@
 	{								 \
 	  if (_FP_FRAC_ZEROP_##swc(S))					 \
 	    D##_e = 0;							 \
+	  else if (_FP_EXPBIAS_##dfs					 \
+		   < _FP_EXPBIAS_##sfs + _FP_FRACBITS_##sfs - 1)	 \
+	    {								 \
+	      FP_SET_EXCEPTION(FP_EX_DENORM);				 \
+	      _FP_FRAC_SLL_##dwc(D, (_FP_FRACBITS_##dfs			 \
+				     - _FP_FRACBITS_##sfs));		 \
+	      D##_e = 0;						 \
+	    }								 \
 	  else								 \
 	    {								 \
 	      int _lz;							 \
@@ -1199,7 +1208,8 @@
 #define FP_TRUNC(dfs,sfs,dwc,swc,D,S)					     \
 do {									     \
   if (_FP_FRACBITS_##sfs < _FP_FRACBITS_##dfs				     \
-      || _FP_EXPBIAS_##sfs < _FP_EXPBIAS_##dfs + _FP_FRACBITS_##dfs - 1)     \
+      || (_FP_EXPBIAS_##sfs < _FP_EXPBIAS_##dfs + _FP_FRACBITS_##dfs - 1     \
+	  && _FP_EXPBIAS_##sfs != _FP_EXPBIAS_##dfs))			     \
     abort();								     \
   D##_s = S##_s;							     \
   if (_FP_EXP_NORMAL(sfs, swc, S))					     \
@@ -1211,8 +1221,11 @@
 	{								     \
 	  if (D##_e <= 0)						     \
 	    {								     \
-	      if (D##_e <= 1 - _FP_FRACBITS_##dfs)			     \
-		_FP_FRAC_SET_##swc(S, _FP_ZEROFRAC_##swc);		     \
+	      if (D##_e < 1 - _FP_FRACBITS_##dfs)			     \
+		{							     \
+		  _FP_FRAC_SET_##swc(S, _FP_ZEROFRAC_##swc);		     \
+		  _FP_FRAC_LOW_##swc(S) |= 1;				     \
+		}							     \
 	      else							     \
 		{							     \
 		  _FP_FRAC_HIGH_##sfs(S) |= _FP_IMPLBIT_SH_##sfs;	     \
@@ -1234,11 +1247,24 @@
       if (S##_e == 0)							     \
 	{								     \
 	  D##_e = 0;							     \
-	  _FP_FRAC_SET_##dwc(D, _FP_ZEROFRAC_##dwc);			     \
-	  if (!_FP_FRAC_ZEROP_##swc(S))					     \
+	  if (_FP_FRAC_ZEROP_##swc(S))					     \
+	    _FP_FRAC_SET_##dwc(D, _FP_ZEROFRAC_##dwc);			     \
+	  else								     \
 	    {								     \
 	      FP_SET_EXCEPTION(FP_EX_DENORM);				     \
-	      FP_SET_EXCEPTION(FP_EX_INEXACT);				     \
+	      if (_FP_EXPBIAS_##sfs					     \
+		  < _FP_EXPBIAS_##dfs + _FP_FRACBITS_##dfs - 1)		     \
+		{							     \
+		  _FP_FRAC_SRS_##swc(S, (_FP_WFRACBITS_##sfs		     \
+					 - _FP_WFRACBITS_##dfs),	     \
+				     _FP_WFRACBITS_##sfs);		     \
+		  _FP_FRAC_COPY_##dwc##_##swc(D, S);			     \
+		}							     \
+	      else							     \
+		{							     \
+		  _FP_FRAC_SET_##dwc(D, _FP_ZEROFRAC_##dwc);		     \
+		  _FP_FRAC_LOW_##dwc(D) |= 1;				     \
+		}							     \
 	    }								     \
 	}								     \
       else								     \
Index: config/soft-fp/floatundisf.c
===================================================================
--- config/soft-fp/floatundisf.c	(revision 124386)
+++ config/soft-fp/floatundisf.c	(working copy)
@@ -1,6 +1,6 @@
 /* Software floating-point emulation.
    Convert a 64bit unsigned integer to IEEE single
-   Copyright (C) 1997,1999, 2006 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1999, 2006, 2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson (rth@cygnus.com) and
 		  Jakub Jelinek (jj@ultra.linux.cz).
@@ -32,8 +32,7 @@
 #include "soft-fp.h"
 #include "single.h"
 
-float
-__floatundisf(UDItype i)
+SFtype __floatundisf(UDItype i)
 {
   FP_DECL_EX;
   FP_DECL_S(A);
Index: config/soft-fp/op-2.h
===================================================================
--- config/soft-fp/op-2.h	(revision 124386)
+++ config/soft-fp/op-2.h	(working copy)
@@ -1,6 +1,6 @@
 /* Software floating-point emulation.
    Basic two-word fraction declaration and manipulation.
-   Copyright (C) 1997,1998,1999,2006 Free Software Foundation, Inc.
+   Copyright (C) 1997,1998,1999,2006,2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson (rth@cygnus.com),
 		  Jakub Jelinek (jj@ultra.linux.cz),
@@ -613,3 +613,5 @@
 #define _FP_FRAC_COPY_1_2(D, S)		(D##_f = S##_f0)
 
 #define _FP_FRAC_COPY_2_1(D, S)		((D##_f0 = S##_f), (D##_f1 = 0))
+
+#define _FP_FRAC_COPY_2_2(D,S)		_FP_FRAC_COPY_2(D,S)
Index: config/soft-fp/op-4.h
===================================================================
--- config/soft-fp/op-4.h	(revision 124386)
+++ config/soft-fp/op-4.h	(working copy)
@@ -1,6 +1,6 @@
 /* Software floating-point emulation.
    Basic four-word fraction declaration and manipulation.
-   Copyright (C) 1997,1998,1999,2006 Free Software Foundation, Inc.
+   Copyright (C) 1997,1998,1999,2006,2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson (rth@cygnus.com),
 		  Jakub Jelinek (jj@ultra.linux.cz),
@@ -684,3 +684,5 @@
   D##_f[1] = S##_f1;				\
   D##_f[2] = D##_f[3] = 0;			\
 } while (0)
+
+#define _FP_FRAC_COPY_4_4(D,S)	_FP_FRAC_COPY_4(D,S)
Index: config/soft-fp/double.h
===================================================================
--- config/soft-fp/double.h	(revision 124386)
+++ config/soft-fp/double.h	(working copy)
@@ -1,6 +1,6 @@
 /* Software floating-point emulation.
    Definitions for IEEE Double Precision
-   Copyright (C) 1997,1998,1999,2006 Free Software Foundation, Inc.
+   Copyright (C) 1997,1998,1999,2006,2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson (rth@cygnus.com),
 		  Jakub Jelinek (jj@ultra.linux.cz),
@@ -168,13 +168,13 @@
   DFtype flt;
   struct {
 #if __BYTE_ORDER == __BIG_ENDIAN
-    unsigned sign : 1;
-    unsigned exp  : _FP_EXPBITS_D;
-    unsigned long frac : _FP_FRACBITS_D - (_FP_IMPLBIT_D != 0);
+    unsigned sign   : 1;
+    unsigned exp    : _FP_EXPBITS_D;
+    _FP_W_TYPE frac : _FP_FRACBITS_D - (_FP_IMPLBIT_D != 0);
 #else
-    unsigned long frac : _FP_FRACBITS_D - (_FP_IMPLBIT_D != 0);
-    unsigned exp  : _FP_EXPBITS_D;
-    unsigned sign : 1;
+    _FP_W_TYPE frac : _FP_FRACBITS_D - (_FP_IMPLBIT_D != 0);
+    unsigned exp    : _FP_EXPBITS_D;
+    unsigned sign   : 1;
 #endif
   } bits __attribute__((packed));
 };

-- 
Joseph S. Myers
joseph@codesourcery.com

             reply	other threads:[~2007-05-03 19:07 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-03 19:07 Joseph S. Myers [this message]
2007-05-18 21:26 ` Joseph S. Myers
  -- strict thread matches above, loose matches on Subject: below --
2007-01-16  0:03 Joseph S. Myers
2007-01-16 16:05 ` David Edelsohn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.64.0705031905390.5802@digraph.polyomino.org.uk \
    --to=joseph@codesourcery.com \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).