* soft-fp updated
@ 2007-01-16 0:03 Joseph S. Myers
2007-01-16 16:05 ` David Edelsohn
0 siblings, 1 reply; 4+ messages in thread
From: Joseph S. Myers @ 2007-01-16 0:03 UTC (permalink / raw)
To: gcc-patches; +Cc: David Edelsohn
I've updated soft-fp on mainline and 4.2 branch from glibc CVS where these
changes needed for PowerPC soft-float long double have now been committed.
Hopefully now the rest of the soft-float long double patches can be
committed to mainline and 4.2 branch, and then my E500 long double patch
can be reviewed for mainline.
Index: ChangeLog
===================================================================
--- ChangeLog (revision 120805)
+++ ChangeLog (working copy)
@@ -1,3 +1,8 @@
+2007-01-15 Joseph S. Myers <joseph@codesourcery.com>
+
+ * config/soft-fp/op-common.h, config/soft-fp/op-4.h: Update from
+ glibc CVS.
+
2007-01-15 Tom Tromey <tromey@redhat.com>
* doc/sourcebuild.texi (libgcj Tests): Don't mention jacks.
Index: config/soft-fp/op-common.h
===================================================================
--- config/soft-fp/op-common.h (revision 120805)
+++ config/soft-fp/op-common.h (working copy)
@@ -1,5 +1,5 @@
/* Software floating-point emulation. Common operations.
- 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),
@@ -99,10 +99,10 @@
else \
{ \
X##_e = _FP_EXPMAX_##fs - 1; \
- FP_SET_EXCEPTION(FP_EX_OVERFLOW); \
- FP_SET_EXCEPTION(FP_EX_INEXACT); \
_FP_FRAC_SET_##wc(X, _FP_MAXFRAC_##wc); \
} \
+ FP_SET_EXCEPTION(FP_EX_INEXACT); \
+ FP_SET_EXCEPTION(FP_EX_OVERFLOW); \
} while (0)
/* Check for a semi-raw value being a signaling NaN and raise the
@@ -1252,6 +1252,9 @@
_FP_FRAC_SRL_##swc(S, (_FP_WFRACBITS_##sfs \
- _FP_WFRACBITS_##dfs)); \
_FP_FRAC_COPY_##dwc##_##swc(D, S); \
+ /* Semi-raw NaN must have all workbits cleared. */ \
+ _FP_FRAC_LOW_##dwc(D) \
+ &= ~(_FP_W_TYPE) ((1 << _FP_WORKBITS) - 1); \
_FP_FRAC_HIGH_##dfs(D) |= _FP_QNANBIT_SH_##dfs; \
} \
} \
Index: config/soft-fp/op-4.h
===================================================================
--- config/soft-fp/op-4.h (revision 120805)
+++ config/soft-fp/op-4.h (working copy)
@@ -564,7 +564,7 @@
r1 = x1 - y1; \
_c2 = r1 > x1; \
r1 -= _c1; \
- _c2 |= r1 > _c1; \
+ _c2 |= _c1 && (y1 == x1); \
r2 = x2 - y2 - _c2; \
} while (0)
#endif
@@ -578,11 +578,11 @@
r1 = x1 - y1; \
_c2 = r1 > x1; \
r1 -= _c1; \
- _c2 |= r1 > _c1; \
+ _c2 |= _c1 && (y1 == x1); \
r2 = x2 - y2; \
_c3 = r2 > x2; \
r2 -= _c2; \
- _c3 |= r2 > _c2; \
+ _c3 |= _c2 && (y2 == x2); \
r3 = x3 - y3 - _c3; \
} while (0)
#endif
--
Joseph S. Myers
joseph@codesourcery.com
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: soft-fp updated
2007-01-16 0:03 soft-fp updated Joseph S. Myers
@ 2007-01-16 16:05 ` David Edelsohn
0 siblings, 0 replies; 4+ messages in thread
From: David Edelsohn @ 2007-01-16 16:05 UTC (permalink / raw)
To: Joseph S. Myers; +Cc: gcc-patches
With the soft-fp fixes imported from Glibc, I have committed the
long double 128 soft-fp support for PowerPC.
Assuming no problems on mainline, I will backport to GCC 4.2.
David
* config/rs6000/darwin-ldouble.c: Build file for SOFT_FLOAT.
(strong_alias): Define.
(__gcc_qmul): Provide non-FMA for soft-float.
(__gcc_qdiv): Same.
(__gcc_qneg): New.
(__gcc_qeq): New.
(__gcc_qle): New.
(__gcc_qge): New.
(__gcc_qunord): New.
(__gcc_stoq): New.
(__gcc_dtoq): New.
(__gcc_qtos): New.
(__gcc_qtod): New.
(__gcc_qtoi): New.
(__gcc_qtou): New.
(__gcc_itoq): New.
(__gcc_utoq): New.
(fmsub): New.
* config/rs6000/rs6000.c (rs6000_init_libfuncs): Initialize
soft-float functions.
* config/rs6000/libgcc-ppc-glibc.ver: Version soft-float symbols.
* config/rs6000/sysv4.h (SUBTARGET_OVERRIDE_OPTIONS): Do not warn
about long double soft float.
Index: darwin-ldouble.c
===================================================================
--- darwin-ldouble.c (revision 120219)
+++ darwin-ldouble.c (working copy)
@@ -49,7 +49,8 @@
This code currently assumes big-endian. */
-#if (!defined (__NO_FPRS__) && !defined (__LITTLE_ENDIAN__) \
+#if ((!defined (__NO_FPRS__) || defined (_SOFT_FLOAT)) \
+ && !defined (__LITTLE_ENDIAN__) \
&& (defined (__MACH__) || defined (__powerpc__) || defined (_AIX)))
#define fabs(x) __builtin_fabs(x)
@@ -60,14 +61,19 @@
#define nonfinite(a) unlikely (! isless (fabs (a), inf ()))
+/* Define ALIASNAME as a strong alias for NAME. */
+# define strong_alias(name, aliasname) _strong_alias(name, aliasname)
+# define _strong_alias(name, aliasname) \
+ extern __typeof (name) aliasname __attribute__ ((alias (#name)));
+
/* All these routines actually take two long doubles as parameters,
but GCC currently generates poor code when a union is used to turn
a long double into a pair of doubles. */
-extern long double __gcc_qadd (double, double, double, double);
-extern long double __gcc_qsub (double, double, double, double);
-extern long double __gcc_qmul (double, double, double, double);
-extern long double __gcc_qdiv (double, double, double, double);
+long double __gcc_qadd (double, double, double, double);
+long double __gcc_qsub (double, double, double, double);
+long double __gcc_qmul (double, double, double, double);
+long double __gcc_qdiv (double, double, double, double);
#if defined __ELF__ && defined SHARED \
&& (defined __powerpc64__ || !(defined __linux__ || defined __gnu_hurd__))
@@ -139,6 +145,10 @@
return __gcc_qadd (a, b, -c, -d);
}
+#ifdef _SOFT_FLOAT
+static double fmsub (double, double, double);
+#endif
+
long double
__gcc_qmul (double a, double b, double c, double d)
{
@@ -154,7 +164,11 @@
/* Sum terms of two highest orders. */
/* Use fused multiply-add to get low part of a * c. */
+#ifndef _SOFT_FLOAT
asm ("fmsub %0,%1,%2,%3" : "=f"(tau) : "f"(a), "f"(c), "f"(t));
+#else
+ tau = fmsub (a, c, t);
+#endif
v = a*d;
w = b*c;
tau += v + w; /* Add in other second-order terms. */
@@ -187,7 +201,11 @@
numerically necessary. */
/* Use fused multiply-add to get low part of c * t. */
+#ifndef _SOFT_FLOAT
asm ("fmsub %0,%1,%2,%3" : "=f"(sigma) : "f"(c), "f"(t), "f"(s));
+#else
+ sigma = fmsub (c, t, s);
+#endif
v = a - s;
tau = ((v-sigma)+w)/c; /* Correction to t. */
@@ -201,4 +219,220 @@
return z.ldval;
}
+#ifdef _SOFT_FLOAT
+
+long double __gcc_qneg (double, double);
+int __gcc_qeq (double, double, double, double);
+int __gcc_qne (double, double, double, double);
+int __gcc_qge (double, double, double, double);
+int __gcc_qle (double, double, double, double);
+int __gcc_qunord (double, double, double, double);
+long double __gcc_stoq (float);
+long double __gcc_dtoq (double);
+float __gcc_qtos (double, double);
+double __gcc_qtod (double, double);
+int __gcc_qtoi (double, double);
+unsigned int __gcc_qtou (double, double);
+long double __gcc_itoq (int);
+long double __gcc_utoq (unsigned int);
+
+extern int __eqdf2 (double, double);
+extern int __ledf2 (double, double);
+extern int __gedf2 (double, double);
+extern int __unorddf2 (double, double);
+
+/* Negate 'long double' value and return the result. */
+long double
+__gcc_qneg (double a, double aa)
+{
+ longDblUnion x;
+
+ x.dval[0] = -a;
+ x.dval[1] = -aa;
+ return x.ldval;
+}
+
+/* Compare two 'long double' values for equality. */
+int
+__gcc_qeq (double a, double aa, double c, double cc)
+{
+ if (__eqdf2 (a, c) == 0)
+ return __eqdf2 (aa, cc);
+ return 1;
+}
+
+strong_alias (__gcc_qeq, __gcc_qne);
+
+/* Compare two 'long double' values for less than or equal. */
+int
+__gcc_qle (double a, double aa, double c, double cc)
+{
+ if (__eqdf2 (a, c) == 0)
+ return __ledf2 (aa, cc);
+ return __ledf2 (a, c);
+}
+
+strong_alias (__gcc_qle, __gcc_qlt);
+
+/* Compare two 'long double' values for greater than or equal. */
+int
+__gcc_qge (double a, double aa, double c, double cc)
+{
+ if (__eqdf2 (a, c) == 0)
+ return __gedf2 (aa, cc);
+ return __gedf2 (a, c);
+}
+
+strong_alias (__gcc_qge, __gcc_qgt);
+
+/* Compare two 'long double' values for unordered. */
+int
+__gcc_qunord (double a, double aa, double c, double cc)
+{
+ if (__eqdf2 (a, c) == 0)
+ return __unorddf2 (aa, cc);
+ return __unorddf2 (a, c);
+}
+
+/* Convert single to long double. */
+long double
+__gcc_stoq (float a)
+{
+ longDblUnion x;
+
+ x.dval[0] = (double) a;
+ x.dval[1] = 0.0;
+
+ return x.ldval;
+}
+
+/* Convert double to long double. */
+long double
+__gcc_dtoq (double a)
+{
+ longDblUnion x;
+
+ x.dval[0] = a;
+ x.dval[1] = 0.0;
+
+ return x.ldval;
+}
+
+/* Convert long double to single. */
+float
+__gcc_qtos (double a, double aa __attribute__ ((__unused__)))
+{
+ return (float) a;
+}
+
+/* Convert long double to double. */
+double
+__gcc_qtod (double a, double aa __attribute__ ((__unused__)))
+{
+ return a;
+}
+
+/* Convert long double to int. */
+int
+__gcc_qtoi (double a, double aa)
+{
+ double z = a + aa;
+ return (int) z;
+}
+
+/* Convert long double to unsigned int. */
+unsigned int
+__gcc_qtou (double a, double aa)
+{
+ double z = a + aa;
+ return (unsigned int) z;
+}
+
+/* Convert int to long double. */
+long double
+__gcc_itoq (int a)
+{
+ return __gcc_dtoq ((double) a);
+}
+
+/* Convert unsigned int to long double. */
+long double
+__gcc_utoq (unsigned int a)
+{
+ return __gcc_dtoq ((double) a);
+}
+
+#include "config/soft-fp/soft-fp.h"
+#include "config/soft-fp/double.h"
+#include "config/soft-fp/quad.h"
+
+/* Compute floating point multiply-subtract with higher (quad) precision. */
+static double
+fmsub (double a, double b, double c)
+{
+ FP_DECL_EX;
+ FP_DECL_D(A);
+ FP_DECL_D(B);
+ FP_DECL_D(C);
+ FP_DECL_Q(X);
+ FP_DECL_Q(Y);
+ FP_DECL_Q(Z);
+ FP_DECL_Q(U);
+ FP_DECL_Q(V);
+ FP_DECL_D(R);
+ double r;
+ long double u, v, x, y, z;
+
+ FP_INIT_ROUNDMODE;
+ FP_UNPACK_RAW_D (A, a);
+ FP_UNPACK_RAW_D (B, b);
+ FP_UNPACK_RAW_D (C, c);
+
+ /* Extend double to quad. */
+#if (2 * _FP_W_TYPE_SIZE) < _FP_FRACBITS_Q
+ FP_EXTEND(Q,D,4,2,X,A);
+ FP_EXTEND(Q,D,4,2,Y,B);
+ FP_EXTEND(Q,D,4,2,Z,C);
+#else
+ FP_EXTEND(Q,D,2,1,X,A);
+ FP_EXTEND(Q,D,2,1,Y,B);
+ FP_EXTEND(Q,D,2,1,Z,C);
+#endif
+ FP_PACK_RAW_Q(x,X);
+ FP_PACK_RAW_Q(y,Y);
+ FP_PACK_RAW_Q(z,Z);
+ FP_HANDLE_EXCEPTIONS;
+
+ /* Multiply. */
+ FP_INIT_ROUNDMODE;
+ FP_UNPACK_Q(X,x);
+ FP_UNPACK_Q(Y,y);
+ FP_MUL_Q(U,X,Y);
+ FP_PACK_Q(u,U);
+ FP_HANDLE_EXCEPTIONS;
+
+ /* Subtract. */
+ FP_INIT_ROUNDMODE;
+ FP_UNPACK_SEMIRAW_Q(U,u);
+ FP_UNPACK_SEMIRAW_Q(Z,z);
+ FP_SUB_Q(V,U,Z);
+ FP_PACK_SEMIRAW_Q(v,V);
+ FP_HANDLE_EXCEPTIONS;
+
+ /* Truncate quad to double. */
+ FP_INIT_ROUNDMODE;
+ FP_UNPACK_SEMIRAW_Q(V,v);
+#if (2 * _FP_W_TYPE_SIZE) < _FP_FRACBITS_Q
+ FP_TRUNC(D,Q,2,4,R,V);
+#else
+ FP_TRUNC(D,Q,1,2,R,V);
+#endif
+ FP_PACK_SEMIRAW_D(r,R);
+ FP_HANDLE_EXCEPTIONS;
+
+ return r;
+}
+
+#endif
+
#endif
Index: rs6000.c
===================================================================
--- rs6000.c (revision 120219)
+++ rs6000.c (working copy)
@@ -9402,9 +9402,6 @@
static void
rs6000_init_libfuncs (void)
{
- if (!TARGET_HARD_FLOAT)
- return;
-
if (DEFAULT_ABI != ABI_V4 && TARGET_XCOFF
&& !TARGET_POWER2 && !TARGET_POWERPC)
{
@@ -9423,6 +9420,27 @@
set_optab_libfunc (sub_optab, TFmode, "__gcc_qsub");
set_optab_libfunc (smul_optab, TFmode, "__gcc_qmul");
set_optab_libfunc (sdiv_optab, TFmode, "__gcc_qdiv");
+
+ if (TARGET_SOFT_FLOAT)
+ {
+ set_optab_libfunc (neg_optab, TFmode, "__gcc_qneg");
+ set_optab_libfunc (eq_optab, TFmode, "__gcc_qeq");
+ set_optab_libfunc (ne_optab, TFmode, "__gcc_qne");
+ set_optab_libfunc (gt_optab, TFmode, "__gcc_qgt");
+ set_optab_libfunc (ge_optab, TFmode, "__gcc_qge");
+ set_optab_libfunc (lt_optab, TFmode, "__gcc_qlt");
+ set_optab_libfunc (le_optab, TFmode, "__gcc_qle");
+ set_optab_libfunc (unord_optab, TFmode, "__gcc_qunord");
+
+ set_conv_libfunc (sext_optab, TFmode, SFmode, "__gcc_stoq");
+ set_conv_libfunc (sext_optab, TFmode, DFmode, "__gcc_dtoq");
+ set_conv_libfunc (trunc_optab, SFmode, TFmode, "__gcc_qtos");
+ set_conv_libfunc (trunc_optab, DFmode, TFmode, "__gcc_qtod");
+ set_conv_libfunc (sfix_optab, SImode, TFmode, "__gcc_qtoi");
+ set_conv_libfunc (ufix_optab, SImode, TFmode, "__gcc_qtou");
+ set_conv_libfunc (sfloat_optab, TFmode, SImode, "__gcc_itoq");
+ set_conv_libfunc (ufloat_optab, TFmode, SImode, "__gcc_utoq");
+ }
}
else
{
Index: libgcc-ppc-glibc.ver
===================================================================
--- libgcc-ppc-glibc.ver (revision 120219)
+++ libgcc-ppc-glibc.ver (working copy)
@@ -21,11 +21,32 @@
%else
GCC_3.4.4 {
%endif
+%else
+GCC_4.2.0 {
+%endif
# long double support
__gcc_qadd
__gcc_qsub
__gcc_qmul
__gcc_qdiv
-}
+
+%ifdef _SOFT_FLOAT
+ __gcc_qneg
+ __gcc_qeq
+ __gcc_qne
+ __gcc_ggt
+ __gcc_qge
+ __gcc_qlt
+ __gcc_qle
+ __gcc_qunord
+ __gcc_stoq
+ __gcc_dtoq
+ __gcc_qtos
+ __gcc_qtod
+ __gcc_qtoi
+ __gcc_qtou
+ __gcc_itoq
+ __gcc_utoq
%endif
+}
Index: sysv4.h
===================================================================
--- sysv4.h (revision 120219)
+++ sysv4.h (working copy)
@@ -215,10 +215,6 @@
error ("-msecure-plt not supported by your assembler"); \
} \
\
- if (TARGET_SOFT_FLOAT && TARGET_LONG_DOUBLE_128 \
- && rs6000_explicit_options.long_double) \
- warning (0, "-msoft-float and -mlong-double-128 not supported"); \
- \
/* Treat -fPIC the same as -mrelocatable. */ \
if (flag_pic > 1 && DEFAULT_ABI != ABI_AIX) \
{ \
^ permalink raw reply [flat|nested] 4+ messages in thread
* soft-fp updated
@ 2007-05-03 19:07 Joseph S. Myers
2007-05-18 21:26 ` Joseph S. Myers
0 siblings, 1 reply; 4+ messages in thread
From: Joseph S. Myers @ 2007-05-03 19:07 UTC (permalink / raw)
To: gcc-patches
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
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2007-05-18 21:26 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-01-16 0:03 soft-fp updated Joseph S. Myers
2007-01-16 16:05 ` David Edelsohn
2007-05-03 19:07 Joseph S. Myers
2007-05-18 21:26 ` Joseph S. Myers
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).