[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[commits] r640 - in /trunk/libc: ./ soft-fp/ sysdeps/ieee754/ldbl-128ibm/
- To: commits@xxxxxxxxxx
- Subject: [commits] r640 - in /trunk/libc: ./ soft-fp/ sysdeps/ieee754/ldbl-128ibm/
- From: joseph@xxxxxxxxxx
- Date: Thu, 09 Nov 2006 23:53:09 -0000
Author: joseph
Date: Thu Nov 9 15:53:08 2006
New Revision: 640
Log:
2006-11-09 Steven Munroe <sjmunroe@xxxxxxxxxx>
Joe Kerian <jkerian@xxxxxxxxxxxxx>
[BZ #2749]
* soft-fp/fenv_libc.h: New file.
* soft-fp/op-common.h (_FP_OVERFLOW_SEMIRAW): Always set inexact =
and overflow for infinity.
(_FP_PACK_SEMIRAW): Update comment. Do not round if NaN.
* soft-fp/op-4.h (__FP_FRAC_SUB_3, __FP_FRAC_SUB_4): Correct borrow
handling for high words.
* sysdeps/ieee754/ldbl-128ibm/s_copysignl.c: =
Include <math_ldbl_opt.h>.
Remove weak_alias. Use long_double_symbol macro.
(__copysignl): Use signbit() for comparison.
* sysdeps/ieee754/ldbl-128ibm/s_fabsl.c:
[BZ #2423, #2749]
* sysdeps/ieee754/ldbl-128ibm/s_ceill.c: Don't include <fenv_libc.h>.
(__ceill): Remove calls to fegetround(), fesetround().
* sysdeps/ieee754/ldbl-128ibm/s_floorl.c: Likewise.
* sysdeps/ieee754/ldbl-128ibm/s_roundl.c: Likewise.
* sysdeps/ieee754/ldbl-128ibm/s_truncl.c: Likewise.
Added:
trunk/libc/soft-fp/fenv_libc.h
Modified:
trunk/libc/ChangeLog.eglibc
trunk/libc/soft-fp/op-4.h
trunk/libc/soft-fp/op-common.h
trunk/libc/sysdeps/ieee754/ldbl-128ibm/s_ceill.c
trunk/libc/sysdeps/ieee754/ldbl-128ibm/s_copysignl.c
trunk/libc/sysdeps/ieee754/ldbl-128ibm/s_fabsl.c
trunk/libc/sysdeps/ieee754/ldbl-128ibm/s_floorl.c
trunk/libc/sysdeps/ieee754/ldbl-128ibm/s_roundl.c
trunk/libc/sysdeps/ieee754/ldbl-128ibm/s_truncl.c
Modified: trunk/libc/ChangeLog.eglibc
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/libc/ChangeLog.eglibc (original)
+++ trunk/libc/ChangeLog.eglibc Thu Nov 9 15:53:08 2006
@@ -1,3 +1,26 @@
+2006-11-09 Steven Munroe <sjmunroe@xxxxxxxxxx>
+ Joe Kerian <jkerian@xxxxxxxxxxxxx>
+
+ [BZ #2749]
+ * soft-fp/fenv_libc.h: New file.
+ * soft-fp/op-common.h (_FP_OVERFLOW_SEMIRAW): Always set inexact =
+ and overflow for infinity.
+ (_FP_PACK_SEMIRAW): Update comment. Do not round if NaN.
+ * soft-fp/op-4.h (__FP_FRAC_SUB_3, __FP_FRAC_SUB_4): Correct borrow
+ handling for high words.
+ * sysdeps/ieee754/ldbl-128ibm/s_copysignl.c: =
+ Include <math_ldbl_opt.h>.
+ Remove weak_alias. Use long_double_symbol macro.
+ (__copysignl): Use signbit() for comparison.
+ * sysdeps/ieee754/ldbl-128ibm/s_fabsl.c:
+
+ [BZ #2423, #2749]
+ * sysdeps/ieee754/ldbl-128ibm/s_ceill.c: Don't include <fenv_libc.h>.
+ (__ceill): Remove calls to fegetround(), fesetround().
+ * sysdeps/ieee754/ldbl-128ibm/s_floorl.c: Likewise.
+ * sysdeps/ieee754/ldbl-128ibm/s_roundl.c: Likewise.
+ * sysdeps/ieee754/ldbl-128ibm/s_truncl.c: Likewise.
+
2006-09-07 Richard Sandiford <richard@xxxxxxxxxxxxxxxx>
=
* sysdeps/unix/sysv/linux/getcwd.c: Include sys/param.h.
Added: trunk/libc/soft-fp/fenv_libc.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/libc/soft-fp/fenv_libc.h (added)
+++ trunk/libc/soft-fp/fenv_libc.h Thu Nov 9 15:53:08 2006
@@ -1,0 +1,29 @@
+/* Internal libc stuff for floating point environment routines.
+ Copyright (C) 2006 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ 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.
+
+ 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, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _FENV_LIBC_H
+#define _FENV_LIBC_H 1
+
+/* fenv_libc.h is used in libm implementations of ldbl-128ibm. So we
+ need this version in the soft-fp to at minimum include fenv.h to
+ get the fegetround definition. */
+
+#include <fenv.h>
+ =
+#endif /* fenv_libc.h */
Modified: trunk/libc/soft-fp/op-4.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/libc/soft-fp/op-4.h (original)
+++ trunk/libc/soft-fp/op-4.h Thu Nov 9 15:53:08 2006
@@ -564,7 +564,7 @@
r1 =3D x1 - y1; \
_c2 =3D r1 > x1; \
r1 -=3D _c1; \
- _c2 |=3D r1 > _c1; \
+ _c2 |=3D _c1 && (y1 =3D=3D x1); \
r2 =3D x2 - y2 - _c2; \
} while (0)
#endif
@@ -578,11 +578,11 @@
r1 =3D x1 - y1; \
_c2 =3D r1 > x1; \
r1 -=3D _c1; \
- _c2 |=3D r1 > _c1; \
+ _c2 |=3D _c1 && (y1 =3D=3D x1); \
r2 =3D x2 - y2; \
_c3 =3D r2 > x2; \
r2 -=3D _c2; \
- _c3 |=3D r2 > _c2; \
+ _c3 |=3D _c2 && (y2 =3D=3D x2); \
r3 =3D x3 - y3 - _c3; \
} while (0)
#endif
Modified: trunk/libc/soft-fp/op-common.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/libc/soft-fp/op-common.h (original)
+++ trunk/libc/soft-fp/op-common.h Thu Nov 9 15:53:08 2006
@@ -99,10 +99,10 @@
else \
{ \
X##_e =3D _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
@@ -131,10 +131,12 @@
=
/* Prepare to pack an fp value in semi-raw mode: the mantissa is
rounded and shifted right, with the rounding possibly increasing
- the exponent (including changing a finite value to infinity). */
+ the exponent (including changing a finite value to infinity).
+ Be sure not to round NaNs. */
#define _FP_PACK_SEMIRAW(fs, wc, X) \
do { \
- _FP_ROUND(wc, X); \
+ if(X##_e !=3D _FP_EXPMAX_##fs) \
+ _FP_ROUND(wc, X); \
if (_FP_FRAC_HIGH_##fs(X) \
& (_FP_OVERFLOW_##fs >> 1)) \
{ \
Modified: trunk/libc/sysdeps/ieee754/ldbl-128ibm/s_ceill.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/libc/sysdeps/ieee754/ldbl-128ibm/s_ceill.c (original)
+++ trunk/libc/sysdeps/ieee754/ldbl-128ibm/s_ceill.c Thu Nov 9 15:53:08 20=
06
@@ -19,7 +19,6 @@
02111-1307 USA. */
=
#include <math.h>
-#include <fenv_libc.h>
#include <math_ldbl_opt.h>
#include <float.h>
#include <ieee754.h>
@@ -44,11 +43,9 @@
__builtin_inf ()), 1))
{
double orig_xh;
- int save_round =3D fegetround ();
=
/* Long double arithmetic, including the canonicalisation below,
only works in round-to-nearest mode. */
- fesetround (FE_TONEAREST);
=
/* Convert the high double to integer. */
orig_xh =3D xh;
@@ -81,8 +78,6 @@
/* Ensure we return -0 rather than +0 when appropriate. */
if (orig_xh < 0.0)
xh =3D -__builtin_fabs (xh);
-
- fesetround (save_round);
}
=
return ldbl_pack (xh, xl);
Modified: trunk/libc/sysdeps/ieee754/ldbl-128ibm/s_copysignl.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/libc/sysdeps/ieee754/ldbl-128ibm/s_copysignl.c (original)
+++ trunk/libc/sysdeps/ieee754/ldbl-128ibm/s_copysignl.c Thu Nov 9 15:53:0=
8 2006
@@ -25,6 +25,7 @@
=
#include "math.h"
#include "math_private.h"
+#include <math_ldbl_opt.h>
=
#ifdef __STDC__
long double __copysignl(long double x, long double y)
@@ -33,13 +34,13 @@
long double x,y;
#endif
{
- if (y < 0.0)
- {
- if (x >=3D 0.0)
- x =3D -x;
- }
- else if (x < 0.0)
+ if( signbit(x) !=3D signbit(y) )
x =3D -x;
return x;
}
-weak_alias (__copysignl, copysignl)
+
+#ifdef IS_IN_libm
+long_double_symbol (libm, __copysignl, copysignl);
+#else
+long_double_symbol (libc, __copysignl, copysignl);
+#endif
Modified: trunk/libc/sysdeps/ieee754/ldbl-128ibm/s_fabsl.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/libc/sysdeps/ieee754/ldbl-128ibm/s_fabsl.c (original)
+++ trunk/libc/sysdeps/ieee754/ldbl-128ibm/s_fabsl.c Thu Nov 9 15:53:08 20=
06
@@ -37,7 +37,7 @@
GET_LDOUBLE_WORDS64(hx,lx,x);
lx =3D lx ^ ( hx & 0x8000000000000000LL );
hx =3D hx & 0x7fffffffffffffffLL;
- SET_LDOUBLE_WORDS64(hx,lx,x);
+ SET_LDOUBLE_WORDS64(x,hx,lx);
return x;
}
long_double_symbol (libm, __fabsl, fabsl);
Modified: trunk/libc/sysdeps/ieee754/ldbl-128ibm/s_floorl.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/libc/sysdeps/ieee754/ldbl-128ibm/s_floorl.c (original)
+++ trunk/libc/sysdeps/ieee754/ldbl-128ibm/s_floorl.c Thu Nov 9 15:53:08 2=
006
@@ -19,7 +19,6 @@
02111-1307 USA. */
=
#include <math.h>
-#include <fenv_libc.h>
#include <math_ldbl_opt.h>
#include <float.h>
#include <ieee754.h>
@@ -43,11 +42,8 @@
&& __builtin_isless (__builtin_fabs (xh),
__builtin_inf ()), 1))
{
- int save_round =3D fegetround ();
-
/* Long double arithmetic, including the canonicalisation below,
only works in round-to-nearest mode. */
- fesetround (FE_TONEAREST);
=
/* Convert the high double to integer. */
hi =3D ldbl_nearbyint (xh);
@@ -75,8 +71,6 @@
xh =3D hi;
xl =3D lo;
ldbl_canonicalize (&xh, &xl);
-
- fesetround (save_round);
}
=
return ldbl_pack (xh, xl);
Modified: trunk/libc/sysdeps/ieee754/ldbl-128ibm/s_roundl.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/libc/sysdeps/ieee754/ldbl-128ibm/s_roundl.c (original)
+++ trunk/libc/sysdeps/ieee754/ldbl-128ibm/s_roundl.c Thu Nov 9 15:53:08 2=
006
@@ -22,7 +22,6 @@
when it's coded in C. */
=
#include <math.h>
-#include <fenv_libc.h>
#include <math_ldbl_opt.h>
#include <float.h>
#include <ieee754.h>
@@ -47,11 +46,9 @@
__builtin_inf ()), 1))
{
double orig_xh;
- int save_round =3D fegetround ();
=
/* Long double arithmetic, including the canonicalisation below,
only works in round-to-nearest mode. */
- fesetround (FE_TONEAREST);
=
/* Convert the high double to integer. */
orig_xh =3D xh;
@@ -88,8 +85,6 @@
xh =3D hi;
xl =3D lo;
ldbl_canonicalize (&xh, &xl);
-
- fesetround (save_round);
}
=
return ldbl_pack (xh, xl);
Modified: trunk/libc/sysdeps/ieee754/ldbl-128ibm/s_truncl.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/libc/sysdeps/ieee754/ldbl-128ibm/s_truncl.c (original)
+++ trunk/libc/sysdeps/ieee754/ldbl-128ibm/s_truncl.c Thu Nov 9 15:53:08 2=
006
@@ -22,7 +22,6 @@
when it's coded in C. */
=
#include <math.h>
-#include <fenv_libc.h>
#include <math_ldbl_opt.h>
#include <float.h>
#include <ieee754.h>
@@ -47,11 +46,9 @@
__builtin_inf ()), 1))
{
double orig_xh;
- int save_round =3D fegetround ();
=
/* Long double arithmetic, including the canonicalisation below,
only works in round-to-nearest mode. */
- fesetround (FE_TONEAREST);
=
/* Convert the high double to integer. */
orig_xh =3D xh;
@@ -92,8 +89,6 @@
/* Ensure we return -0 rather than +0 when appropriate. */
if (orig_xh < 0.0)
xh =3D -__builtin_fabs (xh);
-
- fesetround (save_round);
}
=
return ldbl_pack (xh, xl);