This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc 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]

Enhance soft-fp for TFmode<->[DI,SI,TI,XF]mode conversions


Hello!

This patch enhances soft-fp for TFmode<->[DI,SI,TI,XF]mode conversions. It was tested for x86_64 target with gcc testsuite.

Regarding attached patch:

In addition to TFmode conversions to [DI,SI,TI]mode, attached patch
fixes a couple of inconsistencies in XFmode handling:

a) It is wrong to increase exponent for XFmode denormal operands during
RAW_UNPACK operation, as this causes other code to wrongly detect
denormals as normal operands. Implicit" bit (which is in fact explicit for XFmode) is correctly handled through the code due to _FP_FRACBITS_E definition. Also, there is no need to generate DENORMAL exception for XFmode operands during unpack.


b) Some compile time errors were fixed on the way.

Regarding the truncation:

The TFmode-XFmode truncation is performed in semi-raw mode, where we keep 3 LSB bits in addition to FP_FRACBITS_E. In case where EXPBIAS of target and source operands are the same, the mantissa is shifted right with sticky LSB. When the result is packed, UNDERFLOW and INEXACT exceptions are generated by generic code. DENORM exception is always set as we have denormal input operand (this is also the case without my patch).

2007-04-14 Uros Bizjak <ubizjak@gmail.com>

        * soft-fp/floattisf.c: New file.
        * soft-fp/floattidf.c: New file.
        * soft-fp/floattitf.c: New file.
        * soft-fp/floatuntisf.c: New file.
        * soft-fp/floatuntidf.c: New file.
        * soft-fp/floatuntitf.c: New file.
        * soft-fp/fixsfti.c: New file.
        * soft-fp/fixdfti.c: New file.
        * soft-fp/fixtfti.c: New file.
        * soft-fp/fixunssfti.c: New file.
        * soft-fp/fixunsdfti.c: New file.
        * soft-fp/fixunstfti.c: New file.
        * soft-fp/extendxftf.c: New file.
        * soft-fp/trunctfxf.c: New file.

        * soft-fp/floatunsidf.c (__floatunsidf): Use DFtype instead of
        double in the function declaration.
        * soft-fp/floatundidf.c (__floatundidf): Use DFtype instead of
        double in the function declaration.
        * soft-fp/floatunsisf.c (__floatunsisf): Use SFtype instead of
        float in the function declaration.
        * soft-fp/floatunsisf.c (__floatunsisf): Use SFtype instead of
        float in the function declaration.

        * soft-fp/extended.h (FP_UNPACK_RAW_E): Do not increase X##_e for
        denormal operands.  Do not generate FP_EX_DENORM exception.
        (FP_UNPACK_RAW_EP): Ditto.
        (FP_UNPACK_SEMIRAW_E): Use FP_UNPACK_RAW_E instead of
        undefined _FP_UNPACK_RAW_E.
        (FP_UNPACK_SEMIRAW_EP): Use FP_UNPACK_RAW_EP instead of
        undefined _FP_UNPACK_RAW_EP.
        (FP_PACK_SEMIRAW_E): Use FP_PACK_RAW_E instead of
        undefined _FP_PACK_RAW_E.
        (FP_PACK_SEMIRAW_EP): Use FP_PACK_RAW_EP instead of
        undefined _FP_PACK_RAW_EP.

        * op-2.h (_FP_FRAC_COPY_2_2): Define as alias to _FP_FRAC_COPY_2.
        * op-4.h (_FP_FRAC_COPY_2_2): Define as alias to _FP_FRAC_COPY_4.

2007-04-16  Uros Bizjak  <ubizjak@gmail.com>
            Jakub Jelinek  <jakub@redhat.com>

        * soft-fp/op-common.h (FP_EXTEND): Do not abort when
        _FP_EXPBIAS_##dfs == _FP_EXPBIAS_##sfs.  Handle denormals for
        this case.
        * soft-fp/op-common.h (FP_EXTEND): Ditto.

Uros.

Index: floatunsidf.c
===================================================================
--- floatunsidf.c	(revision 123850)
+++ floatunsidf.c	(working copy)
@@ -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: floattisf.c
===================================================================
--- floattisf.c	(revision 0)
+++ floattisf.c	(revision 0)
@@ -0,0 +1,45 @@
+/* Software floating-point emulation.
+   Convert a 128bit signed integer to IEEE single
+   Copyright (C) 2007 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Uros Bizjak (ubizjak@gmail.com).
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   In addition to the permissions in the GNU Lesser General Public
+   License, the Free Software Foundation gives you unlimited
+   permission to link the compiled version of this file into
+   combinations with other programs, and to distribute those
+   combinations without any restriction coming from the use of this
+   file.  (The Lesser General Public License restrictions do apply in
+   other respects; for example, they cover modification of the file,
+   and distribution when not linked into a combine executable.)
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+   MA 02110-1301, USA.  */
+
+#include "soft-fp.h"
+#include "single.h"
+
+SFtype __floattisf(TItype i)
+{
+  FP_DECL_EX;
+  FP_DECL_S(A);
+  SFtype a;
+
+  FP_FROM_INT_S(A, i, TI_BITS, UTItype);
+  FP_PACK_RAW_S(a, A);
+  FP_HANDLE_EXCEPTIONS;
+
+  return a;
+}
Index: floatundidf.c
===================================================================
--- floatundidf.c	(revision 123850)
+++ floatundidf.c	(working copy)
@@ -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: extended.h
===================================================================
--- extended.h	(revision 123850)
+++ extended.h	(working copy)
@@ -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)
@@ -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: trunctfxf2.c
===================================================================
--- trunctfxf2.c	(revision 0)
+++ trunctfxf2.c	(revision 0)
@@ -0,0 +1,53 @@
+/* Software floating-point emulation.
+   Truncate IEEE quad into IEEE extended
+   Copyright (C) 2007 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Uros Bizjak (ubizjak@gmail.com).
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   In addition to the permissions in the GNU Lesser General Public
+   License, the Free Software Foundation gives you unlimited
+   permission to link the compiled version of this file into
+   combinations with other programs, and to distribute those
+   combinations without any restriction coming from the use of this
+   file.  (The Lesser General Public License restrictions do apply in
+   other respects; for example, they cover modification of the file,
+   and distribution when not linked into a combine executable.)
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+   MA 02110-1301, USA.  */
+
+#include "soft-fp.h"
+#include "extended.h"
+#include "quad.h"
+
+XFtype __trunctfxf2(TFtype a)
+{
+  FP_DECL_EX;
+  FP_DECL_Q(A);
+  FP_DECL_E(R);
+  XFtype r;
+
+  FP_INIT_ROUNDMODE;
+  FP_UNPACK_SEMIRAW_Q(A, a);
+#if (2 * _FP_W_TYPE_SIZE) < _FP_FRACBITS_Q
+  FP_TRUNC(E,Q,4,4,R,A);
+#else
+  FP_TRUNC(E,Q,2,2,R,A);
+#endif
+  FP_PACK_SEMIRAW_E(r, R);
+  FP_HANDLE_EXCEPTIONS;
+
+  return r;
+}
Index: floatuntidf.c
===================================================================
--- floatuntidf.c	(revision 0)
+++ floatuntidf.c	(revision 0)
@@ -0,0 +1,45 @@
+/* Software floating-point emulation.
+   Convert a 128bit unsigned integer to IEEE double
+   Copyright (C) 1997,1999, 2006 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Uros Bizjak (ubizjak@gmail.com).
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   In addition to the permissions in the GNU Lesser General Public
+   License, the Free Software Foundation gives you unlimited
+   permission to link the compiled version of this file into
+   combinations with other programs, and to distribute those
+   combinations without any restriction coming from the use of this
+   file.  (The Lesser General Public License restrictions do apply in
+   other respects; for example, they cover modification of the file,
+   and distribution when not linked into a combine executable.)
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+   MA 02110-1301, USA.  */
+
+#include "soft-fp.h"
+#include "double.h"
+
+DFtype __floatuntidf(UTItype i)
+{
+  FP_DECL_EX;
+  FP_DECL_D(A);
+  DFtype a;
+
+  FP_FROM_INT_D(A, i, TI_BITS, UTItype);
+  FP_PACK_RAW_D(a, A);
+  FP_HANDLE_EXCEPTIONS;
+
+  return a;
+}
Index: floatunsisf.c
===================================================================
--- floatunsisf.c	(revision 123850)
+++ floatunsisf.c	(working copy)
@@ -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: floatuntitf.c
===================================================================
--- floatuntitf.c	(revision 0)
+++ floatuntitf.c	(revision 0)
@@ -0,0 +1,45 @@
+/* Software floating-point emulation.
+   Convert a 128bit unsigned integer to IEEE quad
+   Copyright (C) 2007 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Uros Bizjak (ubizjak@gmail.com).
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   In addition to the permissions in the GNU Lesser General Public
+   License, the Free Software Foundation gives you unlimited
+   permission to link the compiled version of this file into
+   combinations with other programs, and to distribute those
+   combinations without any restriction coming from the use of this
+   file.  (The Lesser General Public License restrictions do apply in
+   other respects; for example, they cover modification of the file,
+   and distribution when not linked into a combine executable.)
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+   MA 02110-1301, USA.  */
+
+#include "soft-fp.h"
+#include "quad.h"
+
+TFtype __floatuntitf(UTItype i)
+{
+  FP_DECL_EX;
+  FP_DECL_Q(A);
+  TFtype a;
+
+  FP_FROM_INT_Q(A, i, TI_BITS, UTItype);
+  FP_PACK_RAW_Q(a, A);
+  FP_HANDLE_EXCEPTIONS;
+
+  return a;
+}
Index: fixunssfti.c
===================================================================
--- fixunssfti.c	(revision 0)
+++ fixunssfti.c	(revision 0)
@@ -0,0 +1,45 @@
+/* Software floating-point emulation.
+   Convert IEEE single to 128bit unsigned integer
+   Copyright (C) 2007 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Uros Bizjak (ubizjak@gmail.com).
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   In addition to the permissions in the GNU Lesser General Public
+   License, the Free Software Foundation gives you unlimited
+   permission to link the compiled version of this file into
+   combinations with other programs, and to distribute those
+   combinations without any restriction coming from the use of this
+   file.  (The Lesser General Public License restrictions do apply in
+   other respects; for example, they cover modification of the file,
+   and distribution when not linked into a combine executable.)
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+   MA 02110-1301, USA.  */
+
+#include "soft-fp.h"
+#include "single.h"
+
+UTItype __fixunssfti(SFtype a)
+{
+  FP_DECL_EX;
+  FP_DECL_S(A);
+  UTItype r;
+
+  FP_UNPACK_RAW_S(A, a);
+  FP_TO_INT_S(r, A, TI_BITS, 0);
+  FP_HANDLE_EXCEPTIONS;
+
+  return r;
+}
Index: op-common.h
===================================================================
--- op-common.h	(revision 123850)
+++ 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))					     \
@@ -1234,11 +1244,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_SET_EXCEPTION(FP_EX_INEXACT);			     \
+		}							     \
 	    }								     \
 	}								     \
       else								     \
Index: fixsfti.c
===================================================================
--- fixsfti.c	(revision 0)
+++ fixsfti.c	(revision 0)
@@ -0,0 +1,45 @@
+/* Software floating-point emulation.
+   Convert IEEE single to 128bit signed integer
+   Copyright (C) 2007 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Uros Bizjak (ubizjak@gmail.com).
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   In addition to the permissions in the GNU Lesser General Public
+   License, the Free Software Foundation gives you unlimited
+   permission to link the compiled version of this file into
+   combinations with other programs, and to distribute those
+   combinations without any restriction coming from the use of this
+   file.  (The Lesser General Public License restrictions do apply in
+   other respects; for example, they cover modification of the file,
+   and distribution when not linked into a combine executable.)
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+   MA 02110-1301, USA.  */
+
+#include "soft-fp.h"
+#include "single.h"
+
+TItype __fixsfti(SFtype a)
+{
+  FP_DECL_EX;
+  FP_DECL_S(A);
+  UTItype r;
+
+  FP_UNPACK_RAW_S(A, a);
+  FP_TO_INT_S(r, A, TI_BITS, 1);
+  FP_HANDLE_EXCEPTIONS;
+
+  return r;
+}
Index: floatundisf.c
===================================================================
--- floatundisf.c	(revision 123850)
+++ floatundisf.c	(working copy)
@@ -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: op-2.h
===================================================================
--- op-2.h	(revision 123850)
+++ op-2.h	(working copy)
@@ -33,6 +33,7 @@
 
 #define _FP_FRAC_DECL_2(X)	_FP_W_TYPE X##_f0, X##_f1
 #define _FP_FRAC_COPY_2(D,S)	(D##_f0 = S##_f0, D##_f1 = S##_f1)
+#define _FP_FRAC_COPY_2_2(D,S)	_FP_FRAC_COPY_2(D,S)
 #define _FP_FRAC_SET_2(X,I)	__FP_FRAC_SET_2(X, I)
 #define _FP_FRAC_HIGH_2(X)	(X##_f1)
 #define _FP_FRAC_LOW_2(X)	(X##_f0)
Index: fixunsdfti.c
===================================================================
--- fixunsdfti.c	(revision 0)
+++ fixunsdfti.c	(revision 0)
@@ -0,0 +1,45 @@
+/* Software floating-point emulation.
+   Convert IEEE double to 128bit unsigned integer
+   Copyright (C) 2007 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Uros Bizjak (ubizjak@gmail.com).
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   In addition to the permissions in the GNU Lesser General Public
+   License, the Free Software Foundation gives you unlimited
+   permission to link the compiled version of this file into
+   combinations with other programs, and to distribute those
+   combinations without any restriction coming from the use of this
+   file.  (The Lesser General Public License restrictions do apply in
+   other respects; for example, they cover modification of the file,
+   and distribution when not linked into a combine executable.)
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+   MA 02110-1301, USA.  */
+
+#include "soft-fp.h"
+#include "double.h"
+
+UTItype __fixunsdfti(DFtype a)
+{
+  FP_DECL_EX;
+  FP_DECL_D(A);
+  UTItype r;
+
+  FP_UNPACK_RAW_D(A, a);
+  FP_TO_INT_D(r, A, TI_BITS, 0);
+  FP_HANDLE_EXCEPTIONS;
+
+  return r;
+}
Index: op-4.h
===================================================================
--- op-4.h	(revision 123850)
+++ op-4.h	(working copy)
@@ -35,6 +35,7 @@
 #define _FP_FRAC_COPY_4(D,S)			\
   (D##_f[0] = S##_f[0], D##_f[1] = S##_f[1],	\
    D##_f[2] = S##_f[2], D##_f[3] = S##_f[3])
+#define _FP_FRAC_COPY_4_4(D,S)	_FP_FRAC_COPY_4(D,S)
 #define _FP_FRAC_SET_4(X,I)	__FP_FRAC_SET_4(X, I)
 #define _FP_FRAC_HIGH_4(X)	(X##_f[3])
 #define _FP_FRAC_LOW_4(X)	(X##_f[0])
Index: fixdfti.c
===================================================================
--- fixdfti.c	(revision 0)
+++ fixdfti.c	(revision 0)
@@ -0,0 +1,45 @@
+/* Software floating-point emulation.
+   Convert IEEE double to 128bit signed integer
+   Copyright (C) 2007 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Uros Bizjak (ubizjak@gmail.com).
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   In addition to the permissions in the GNU Lesser General Public
+   License, the Free Software Foundation gives you unlimited
+   permission to link the compiled version of this file into
+   combinations with other programs, and to distribute those
+   combinations without any restriction coming from the use of this
+   file.  (The Lesser General Public License restrictions do apply in
+   other respects; for example, they cover modification of the file,
+   and distribution when not linked into a combine executable.)
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+   MA 02110-1301, USA.  */
+
+#include "soft-fp.h"
+#include "double.h"
+
+TItype __fixdfti(TFtype a)
+{
+  FP_DECL_EX;
+  FP_DECL_D(A);
+  UTItype r;
+
+  FP_UNPACK_RAW_D(A, a);
+  FP_TO_INT_D(r, A, TI_BITS, 1);
+  FP_HANDLE_EXCEPTIONS;
+
+  return r;
+}
Index: floatuntisf.c
===================================================================
--- floatuntisf.c	(revision 0)
+++ floatuntisf.c	(revision 0)
@@ -0,0 +1,45 @@
+/* Software floating-point emulation.
+   Convert a 128bit unsigned integer to IEEE single
+   Copyright (C) 2007 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Uros Bizjak (ubizjak@gmail.com).
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   In addition to the permissions in the GNU Lesser General Public
+   License, the Free Software Foundation gives you unlimited
+   permission to link the compiled version of this file into
+   combinations with other programs, and to distribute those
+   combinations without any restriction coming from the use of this
+   file.  (The Lesser General Public License restrictions do apply in
+   other respects; for example, they cover modification of the file,
+   and distribution when not linked into a combine executable.)
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+   MA 02110-1301, USA.  */
+
+#include "soft-fp.h"
+#include "single.h"
+
+SFtype __floatundisf(UTItype i)
+{
+  FP_DECL_EX;
+  FP_DECL_S(A);
+  SFtype a;
+
+  FP_FROM_INT_S(A, i, TI_BITS, UTItype);
+  FP_PACK_RAW_S(a, A);
+  FP_HANDLE_EXCEPTIONS;
+
+  return a;
+}
Index: extendxftf2.c
===================================================================
--- extendxftf2.c	(revision 0)
+++ extendxftf2.c	(revision 0)
@@ -0,0 +1,53 @@
+/* Software floating-point emulation.
+   Return a converted to IEEE quad
+   Copyright (C) 2007 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Uros Bizjak (ubizjak@gmail.com).
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   In addition to the permissions in the GNU Lesser General Public
+   License, the Free Software Foundation gives you unlimited
+   permission to link the compiled version of this file into
+   combinations with other programs, and to distribute those
+   combinations without any restriction coming from the use of this
+   file.  (The Lesser General Public License restrictions do apply in
+   other respects; for example, they cover modification of the file,
+   and distribution when not linked into a combine executable.)
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+   MA 02110-1301, USA.  */
+
+#include "soft-fp.h"
+#include "extended.h"
+#include "quad.h"
+
+TFtype __extendxftf2(XFtype a)
+{
+  FP_DECL_EX;
+  FP_DECL_E(A);
+  FP_DECL_Q(R);
+  TFtype r;
+
+  FP_INIT_ROUNDMODE;
+  FP_UNPACK_RAW_E(A, a);
+#if (2 * _FP_W_TYPE_SIZE) < _FP_FRACBITS_Q
+  FP_EXTEND(Q,E,4,4,R,A);
+#else
+  FP_EXTEND(Q,E,2,2,R,A);
+#endif
+  FP_PACK_RAW_Q(r, R);
+  FP_HANDLE_EXCEPTIONS;
+
+  return r;
+}
Index: fixunstfti.c
===================================================================
--- fixunstfti.c	(revision 0)
+++ fixunstfti.c	(revision 0)
@@ -0,0 +1,45 @@
+/* Software floating-point emulation.
+   Convert IEEE quad to 128bit unsigned integer
+   Copyright (C) 2007 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Uros Bizjak (ubizjak@gmail.com).
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   In addition to the permissions in the GNU Lesser General Public
+   License, the Free Software Foundation gives you unlimited
+   permission to link the compiled version of this file into
+   combinations with other programs, and to distribute those
+   combinations without any restriction coming from the use of this
+   file.  (The Lesser General Public License restrictions do apply in
+   other respects; for example, they cover modification of the file,
+   and distribution when not linked into a combine executable.)
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+   MA 02110-1301, USA.  */
+
+#include "soft-fp.h"
+#include "quad.h"
+
+UTItype __fixunstfti(TFtype a)
+{
+  FP_DECL_EX;
+  FP_DECL_Q(A);
+  UTItype r;
+
+  FP_UNPACK_RAW_Q(A, a);
+  FP_TO_INT_Q(r, A, TI_BITS, 0);
+  FP_HANDLE_EXCEPTIONS;
+
+  return r;
+}
Index: floattidf.c
===================================================================
--- floattidf.c	(revision 0)
+++ floattidf.c	(revision 0)
@@ -0,0 +1,45 @@
+/* Software floating-point emulation.
+   Convert a 128bit signed integer to IEEE double
+   Copyright (C) 2007 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Uros Bizjak (ubizjak@gmail.com).
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   In addition to the permissions in the GNU Lesser General Public
+   License, the Free Software Foundation gives you unlimited
+   permission to link the compiled version of this file into
+   combinations with other programs, and to distribute those
+   combinations without any restriction coming from the use of this
+   file.  (The Lesser General Public License restrictions do apply in
+   other respects; for example, they cover modification of the file,
+   and distribution when not linked into a combine executable.)
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+   MA 02110-1301, USA.  */
+
+#include "soft-fp.h"
+#include "double.h"
+
+DFtype __floattidf(TItype i)
+{
+  FP_DECL_EX;
+  FP_DECL_D(A);
+  DFtype a;
+
+  FP_FROM_INT_D(A, i, TI_BITS, UTItype);
+  FP_PACK_RAW_D(a, A);
+  FP_HANDLE_EXCEPTIONS;
+
+  return a;
+}
Index: fixtfti.c
===================================================================
--- fixtfti.c	(revision 0)
+++ fixtfti.c	(revision 0)
@@ -0,0 +1,45 @@
+/* Software floating-point emulation.
+   Convert IEEE quad to 128bit signed integer
+   Copyright (C) 2007 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Uros Bizjak (ubizjak@gmail.com).
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   In addition to the permissions in the GNU Lesser General Public
+   License, the Free Software Foundation gives you unlimited
+   permission to link the compiled version of this file into
+   combinations with other programs, and to distribute those
+   combinations without any restriction coming from the use of this
+   file.  (The Lesser General Public License restrictions do apply in
+   other respects; for example, they cover modification of the file,
+   and distribution when not linked into a combine executable.)
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+   MA 02110-1301, USA.  */
+
+#include "soft-fp.h"
+#include "quad.h"
+
+TItype __fixtfti(TFtype a)
+{
+  FP_DECL_EX;
+  FP_DECL_Q(A);
+  UTItype r;
+
+  FP_UNPACK_RAW_Q(A, a);
+  FP_TO_INT_Q(r, A, TI_BITS, 1);
+  FP_HANDLE_EXCEPTIONS;
+
+  return r;
+}
Index: floattitf.c
===================================================================
--- floattitf.c	(revision 0)
+++ floattitf.c	(revision 0)
@@ -0,0 +1,45 @@
+/* Software floating-point emulation.
+   Convert a 128bit signed integer to IEEE quad
+   Copyright (C) 2007 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Uros Bizjak (ubizjak@gmail.com).
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   In addition to the permissions in the GNU Lesser General Public
+   License, the Free Software Foundation gives you unlimited
+   permission to link the compiled version of this file into
+   combinations with other programs, and to distribute those
+   combinations without any restriction coming from the use of this
+   file.  (The Lesser General Public License restrictions do apply in
+   other respects; for example, they cover modification of the file,
+   and distribution when not linked into a combine executable.)
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+   MA 02110-1301, USA.  */
+
+#include "soft-fp.h"
+#include "quad.h"
+
+TFtype __floattitf(TItype i)
+{
+  FP_DECL_EX;
+  FP_DECL_Q(A);
+  TFtype a;
+
+  FP_FROM_INT_Q(A, i, TI_BITS, UTItype);
+  FP_PACK_RAW_Q(a, A);
+  FP_HANDLE_EXCEPTIONS;
+
+  return a;
+}


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