[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commits] r24646 - in /fsf/trunk/libc: ./ include/ malloc/ manual/ math/ nss/ nss/nss_files/ ports/ ports/sysdeps/aarch64/fpu/ ports/s...
- To: commits@xxxxxxxxxx
- Subject: [Commits] r24646 - in /fsf/trunk/libc: ./ include/ malloc/ manual/ math/ nss/ nss/nss_files/ ports/ ports/sysdeps/aarch64/fpu/ ports/s...
- From: eglibc@xxxxxxxxxx
- Date: Fri, 29 Nov 2013 08:01:59 -0000
Author: eglibc
Date: Fri Nov 29 00:01:57 2013
New Revision: 24646
Log:
Import glibc-mainline for 2013-11-29
Added:
fsf/trunk/libc/sysdeps/powerpc/nofpu/atomic-feclearexcept.c
fsf/trunk/libc/sysdeps/powerpc/nofpu/atomic-feholdexcept.c
fsf/trunk/libc/sysdeps/powerpc/nofpu/atomic-feupdateenv.c
fsf/trunk/libc/sysdeps/powerpc/nofpu/flt-rounds.c
fsf/trunk/libc/sysdeps/powerpc/powerpc32/e500/nofpu/atomic-feclearexcept.c
fsf/trunk/libc/sysdeps/powerpc/powerpc32/e500/nofpu/atomic-feholdexcept.c
fsf/trunk/libc/sysdeps/powerpc/powerpc32/e500/nofpu/atomic-feupdateenv.c
fsf/trunk/libc/sysdeps/powerpc/powerpc32/e500/nofpu/flt-rounds.c
Removed:
fsf/trunk/libc/sysdeps/ieee754/ldbl-96/e_atan2l.c
fsf/trunk/libc/sysdeps/ieee754/ldbl-96/e_ilogbl.c
fsf/trunk/libc/sysdeps/ieee754/ldbl-96/e_remainderl.c
fsf/trunk/libc/sysdeps/ieee754/ldbl-96/s_ceill.c
fsf/trunk/libc/sysdeps/ieee754/ldbl-96/s_fabsl.c
fsf/trunk/libc/sysdeps/ieee754/ldbl-96/s_finitel.c
fsf/trunk/libc/sysdeps/ieee754/ldbl-96/s_floorl.c
fsf/trunk/libc/sysdeps/ieee754/ldbl-96/s_fpclassifyl.c
fsf/trunk/libc/sysdeps/ieee754/ldbl-96/s_isinfl.c
fsf/trunk/libc/sysdeps/ieee754/ldbl-96/s_isnanl.c
fsf/trunk/libc/sysdeps/ieee754/ldbl-96/s_logbl.c
fsf/trunk/libc/sysdeps/ieee754/ldbl-96/s_nearbyintl.c
fsf/trunk/libc/sysdeps/ieee754/ldbl-96/s_nextafterl.c
fsf/trunk/libc/sysdeps/ieee754/ldbl-96/s_rintl.c
fsf/trunk/libc/sysdeps/ieee754/ldbl-96/s_scalbnl.c
fsf/trunk/libc/sysdeps/ieee754/ldbl-96/s_truncl.c
Modified:
fsf/trunk/libc/ChangeLog
fsf/trunk/libc/NEWS
fsf/trunk/libc/include/fenv.h
fsf/trunk/libc/malloc/malloc.c
fsf/trunk/libc/manual/arith.texi
fsf/trunk/libc/manual/math.texi
fsf/trunk/libc/math/fegetround.c
fsf/trunk/libc/nss/Versions
fsf/trunk/libc/nss/nss_files/files-hosts.c
fsf/trunk/libc/ports/ChangeLog.aarch64
fsf/trunk/libc/ports/ChangeLog.alpha
fsf/trunk/libc/ports/ChangeLog.am33
fsf/trunk/libc/ports/ChangeLog.arm
fsf/trunk/libc/ports/ChangeLog.hppa
fsf/trunk/libc/ports/ChangeLog.ia64
fsf/trunk/libc/ports/ChangeLog.m68k
fsf/trunk/libc/ports/ChangeLog.microblaze
fsf/trunk/libc/ports/ChangeLog.mips
fsf/trunk/libc/ports/sysdeps/aarch64/fpu/fegetround.c
fsf/trunk/libc/ports/sysdeps/alpha/fpu/fegetround.c
fsf/trunk/libc/ports/sysdeps/am33/fpu/fegetround.c
fsf/trunk/libc/ports/sysdeps/arm/fegetround.c
fsf/trunk/libc/ports/sysdeps/hppa/fpu/fegetround.c
fsf/trunk/libc/ports/sysdeps/ia64/fpu/fegetround.c
fsf/trunk/libc/ports/sysdeps/m68k/fpu/fegetround.c
fsf/trunk/libc/ports/sysdeps/microblaze/fegetround.c
fsf/trunk/libc/ports/sysdeps/mips/fpu/fegetround.c
fsf/trunk/libc/sysdeps/i386/fpu/fegetround.c
fsf/trunk/libc/sysdeps/ieee754/dbl-64/e_sqrt.c
fsf/trunk/libc/sysdeps/powerpc/fpu/fegetround.c
fsf/trunk/libc/sysdeps/powerpc/nofpu/Makefile
fsf/trunk/libc/sysdeps/powerpc/nofpu/Versions
fsf/trunk/libc/sysdeps/powerpc/nofpu/fegetround.c
fsf/trunk/libc/sysdeps/powerpc/powerpc32/e500/nofpu/fegetround.c
fsf/trunk/libc/sysdeps/powerpc/powerpc32/e500/nofpu/fenv_libc.h
fsf/trunk/libc/sysdeps/powerpc/powerpc32/e500/nofpu/fraiseexcept-soft.c
fsf/trunk/libc/sysdeps/s390/fpu/fegetround.c
fsf/trunk/libc/sysdeps/sh/sh4/fpu/fegetround.c
fsf/trunk/libc/sysdeps/sparc/fpu/fegetround.c
fsf/trunk/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libc.abilist
fsf/trunk/libc/sysdeps/x86_64/fpu/fegetround.c
Modified: fsf/trunk/libc/ChangeLog
==============================================================================
--- fsf/trunk/libc/ChangeLog (original)
+++ fsf/trunk/libc/ChangeLog Fri Nov 29 00:01:57 2013
@@ -1,3 +1,89 @@
+2013-11-28 Joseph Myers <joseph@xxxxxxxxxxxxxxxx>
+
+ * manual/math.texi (Errors in Math Functions): Document accuracy
+ goals.
+
+ [BZ #15004]
+ * sysdeps/ieee754/ldbl-96/e_atan2l.c: Remove file.
+ * sysdeps/ieee754/ldbl-96/e_ilogbl.c: Likewise.
+ * sysdeps/ieee754/ldbl-96/e_remainderl.c: Likewise.
+ * sysdeps/ieee754/ldbl-96/s_ceill.c: Likewise.
+ * sysdeps/ieee754/ldbl-96/s_fabsl.c: Likewise.
+ * sysdeps/ieee754/ldbl-96/s_finitel.c: Likewise.
+ * sysdeps/ieee754/ldbl-96/s_floorl.c: Likewise.
+ * sysdeps/ieee754/ldbl-96/s_fpclassifyl.c: Likewise.
+ * sysdeps/ieee754/ldbl-96/s_isinfl.c: Likewise.
+ * sysdeps/ieee754/ldbl-96/s_isnanl.c: Likewise.
+ * sysdeps/ieee754/ldbl-96/s_logbl.c: Likewise.
+ * sysdeps/ieee754/ldbl-96/s_nearbyintl.c: Likewise.
+ * sysdeps/ieee754/ldbl-96/s_nextafterl.c: Likewise.
+ * sysdeps/ieee754/ldbl-96/s_rintl.c: Likewise.
+ * sysdeps/ieee754/ldbl-96/s_scalbnl.c: Likewise.
+ * sysdeps/ieee754/ldbl-96/s_truncl.c: Likewise.
+
+ * sysdeps/powerpc/nofpu/atomic-feclearexcept.c: New file.
+ * sysdeps/powerpc/nofpu/atomic-feholdexcept.c: Likewise.
+ * sysdeps/powerpc/nofpu/atomic-feupdateenv.c: Likewise.
+ * sysdeps/powerpc/nofpu/flt-rounds.c: Likewise.
+ * sysdeps/powerpc/powerpc32/e500/nofpu/atomic-feclearexcept.c:
+ Likewise.
+ * sysdeps/powerpc/powerpc32/e500/nofpu/atomic-feholdexcept.c:
+ Likewise.
+ * sysdeps/powerpc/powerpc32/e500/nofpu/atomic-feupdateenv.c:
+ Likewise.
+ * sysdeps/powerpc/powerpc32/e500/nofpu/flt-rounds.c: Likewise.
+ * sysdeps/powerpc/nofpu/Makefile [$(subdir) = soft-fp]
+ (sysdep_routines): Add atomic-feholdexcept, atomic-feclearexcept,
+ atomic-feupdateenv and flt-rounds.
+ * sysdeps/powerpc/nofpu/Versions (libc): Add
+ __atomic_feholdexcept, __atomic_feclearexcept,
+ __atomic_feupdateenv and __flt_rounds to GLIBC_2.19.
+ * sysdeps/powerpc/powerpc32/e500/nofpu/fenv_libc.h
+ (__feraiseexcept_soft): Declare and use libc_hidden_proto here.
+ * sysdeps/powerpc/powerpc32/e500/nofpu/fraiseexcept-soft.c
+ (__feraiseexcept_soft): Don't declare and use libc_hidden_proto
+ here.
+ * sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libc.abilist:
+ Update.
+
+ * manual/arith.texi (FP Exceptions): Document that exceptions may
+ not be raised when matherr is used.
+ (Math Error Reporting): Document overflow in directed rounding
+ modes. Document that errno may not be set when finite values are
+ returned on overflow. Document intent to set errno on underflow
+ only for underflow to zero.
+
+ [BZ #16271]
+ * sysdeps/ieee754/dbl-64/e_sqrt.c (__ieee754_sqrt): Set
+ round-to-nearest then adjust result for other rounding modes.
+ * include/fenv.h (fegetround): Use libm_hidden_proto.
+ * math/fegetround.c (fegetround): Use libm_hidden_def.
+ * sysdeps/i386/fpu/fegetround.c (fegetround): Likewise.
+ * sysdeps/powerpc/fpu/fegetround.c (fegetround): Likewise.
+ * sysdeps/powerpc/nofpu/fegetround.c (fegetround): Likewise.
+ * sysdeps/powerpc/powerpc32/e500/nofpu/fegetround.c (fegetround):
+ Likewise.
+ * sysdeps/s390/fpu/fegetround.c (fegetround): Likewise.
+ * sysdeps/sh/sh4/fpu/fegetround.c (fegetround): Likewise.
+ * sysdeps/sparc/fpu/fegetround.c (fegetround): Likewise.
+ * sysdeps/x86_64/fpu/fegetround.c (fegetround): Likewise.
+
+2013-11-28 Siddhesh Poyarekar <siddhesh@xxxxxxxxxx>
+
+ [BZ #16077]
+ * nss/Versions (libnss_files): Add
+ _nss_files_gethostbyname3_r.
+ * nss/nss_files/files-hosts.c (_nss_files_gethostbyname3_r):
+ New function.
+ (HOST_DB_LOOKUP): Remove macro.
+ (_nss_files_gethostbyname_r): Implement function without the
+ HOST_DB_LOOKUP macro.
+ (_nss_files_gethostbyname2_r): Likewise.
+
+2013-11-28 OndÃÂej BÃÂlka <neleai@xxxxxxxxx>
+
+ * malloc/malloc.c (__libc_calloc): Make memset a tail call.
+
2013-11-26 Uros Bizjak <ubizjak@xxxxxxxxx>
* soft-fp/op-4.h (_FP_FRAC_ASSEMBLE_4): Check rsize against
Modified: fsf/trunk/libc/NEWS
==============================================================================
--- fsf/trunk/libc/NEWS (original)
+++ fsf/trunk/libc/NEWS Fri Nov 29 00:01:57 2013
@@ -11,15 +11,15 @@
156, 387, 431, 832, 2801, 7003, 9954, 10253, 10278, 11087, 11157, 11214,
13028, 13982, 13985, 14029, 14143, 14155, 14547, 14699, 14752, 14876,
- 14910, 15048, 15218, 15277, 15308, 15362, 15374, 15400, 15427, 15483,
- 15522, 15531, 15532, 15601, 15608, 15609, 15610, 15632, 15640, 15670,
- 15672, 15680, 15681, 15723, 15734, 15735, 15736, 15748, 15749, 15754,
- 15760, 15763, 15764, 15797, 15799, 15825, 15844, 15847, 15849, 15855,
- 15856, 15857, 15859, 15867, 15886, 15887, 15890, 15892, 15893, 15895,
- 15897, 15905, 15909, 15917, 15919, 15921, 15923, 15939, 15948, 15963,
- 15966, 15985, 15988, 15997, 16032, 16034, 16036, 16037, 16041, 16055,
- 16071, 16072, 16074, 16078, 16103, 16112, 16143, 16144, 16146, 16150,
- 16151, 16153, 16167, 16172, 16245.
+ 14910, 15004, 15048, 15218, 15277, 15308, 15362, 15374, 15400, 15427,
+ 15483, 15522, 15531, 15532, 15601, 15608, 15609, 15610, 15632, 15640,
+ 15670, 15672, 15680, 15681, 15723, 15734, 15735, 15736, 15748, 15749,
+ 15754, 15760, 15763, 15764, 15797, 15799, 15825, 15844, 15847, 15849,
+ 15855, 15856, 15857, 15859, 15867, 15886, 15887, 15890, 15892, 15893,
+ 15895, 15897, 15905, 15909, 15917, 15919, 15921, 15923, 15939, 15948,
+ 15963, 15966, 15985, 15988, 15997, 16032, 16034, 16036, 16037, 16041,
+ 16055, 16071, 16072, 16074, 16077, 16078, 16103, 16112, 16143, 16144,
+ 16146, 16150, 16151, 16153, 16167, 16172, 16245, 16271.
* The public headers no longer use __unused nor __block. This change is to
support compiling programs that are derived from BSD sources and use
Modified: fsf/trunk/libc/include/fenv.h
==============================================================================
--- fsf/trunk/libc/include/fenv.h (original)
+++ fsf/trunk/libc/include/fenv.h Fri Nov 29 00:01:57 2013
@@ -16,6 +16,7 @@
libm_hidden_proto (feraiseexcept)
libm_hidden_proto (fegetenv)
+libm_hidden_proto (fegetround)
libm_hidden_proto (fesetenv)
libm_hidden_proto (fesetround)
libm_hidden_proto (feholdexcept)
Modified: fsf/trunk/libc/malloc/malloc.c
==============================================================================
--- fsf/trunk/libc/malloc/malloc.c (original)
+++ fsf/trunk/libc/malloc/malloc.c Fri Nov 29 00:01:57 2013
@@ -3181,7 +3181,7 @@
if (chunk_is_mmapped (p))
{
if (__builtin_expect (perturb_byte, 0))
- MALLOC_ZERO (mem, sz);
+ return MALLOC_ZERO (mem, sz);
return mem;
}
@@ -3203,7 +3203,7 @@
assert(nclears >= 3);
if (nclears > 9)
- MALLOC_ZERO(d, clearsize);
+ return MALLOC_ZERO(d, clearsize);
else {
*(d+0) = 0;
Modified: fsf/trunk/libc/manual/arith.texi
==============================================================================
--- fsf/trunk/libc/manual/arith.texi (original)
+++ fsf/trunk/libc/manual/arith.texi Fri Nov 29 00:01:57 2013
@@ -497,7 +497,8 @@
is called when certain exceptions occur inside math library functions.
However, the Unix98 standard deprecates this interface. We support it
for historical compatibility, but recommend that you do not use it in
-new programs.
+new programs. When this interface is used, exceptions may not be
+raised.
@noindent
The exceptions defined in @w{IEEE 754} are:
@@ -806,7 +807,8 @@
Many of the math functions are defined only over a subset of the real or
complex numbers. Even if they are mathematically defined, their result
may be larger or smaller than the range representable by their return
-type. These are known as @dfn{domain errors}, @dfn{overflows}, and
+type without loss of accuracy. These are known as @dfn{domain errors},
+@dfn{overflows}, and
@dfn{underflows}, respectively. Math functions do several things when
one of these errors occurs. In this manual we will refer to the
complete response as @dfn{signalling} a domain error, overflow, or
@@ -816,11 +818,20 @@
exception and returns NaN. It also sets @var{errno} to @code{EDOM};
this is for compatibility with old systems that do not support @w{IEEE
754} exception handling. Likewise, when overflow occurs, math
-functions raise the overflow exception and return @math{@infinity{}} or
-@math{-@infinity{}} as appropriate. They also set @var{errno} to
-@code{ERANGE}. When underflow occurs, the underflow exception is
-raised, and zero (appropriately signed) is returned. @var{errno} may be
-set to @code{ERANGE}, but this is not guaranteed.
+functions raise the overflow exception and, in the default rounding
+mode, return @math{@infinity{}} or @math{-@infinity{}} as appropriate
+(in other rounding modes, the largest finite value of the appropriate
+sign is returned when appropriate for that rounding mode). They also
+set @var{errno} to @code{ERANGE} if returning @math{@infinity{}} or
+@math{-@infinity{}}; @var{errno} may or may not be set to
+@code{ERANGE} when a finite value is returned on overflow. When
+underflow occurs, the underflow exception is raised, and zero
+(appropriately signed) or a subnormal value, as appropriate for the
+mathematical result of the function and the rounding mode, is
+returned. @var{errno} may be set to @code{ERANGE}, but this is not
+guaranteed; it is intended that @theglibc{} should set it when the
+underflow is to an appropriately signed zero, but not necessarily for
+other underflows.
Some of the math functions are defined mathematically to result in a
complex value over parts of their domains. The most familiar example of
Modified: fsf/trunk/libc/manual/math.texi
==============================================================================
--- fsf/trunk/libc/manual/math.texi (original)
+++ fsf/trunk/libc/manual/math.texi Fri Nov 29 00:01:57 2013
@@ -1227,10 +1227,80 @@
@noindent
where @math{p} is the number of bits in the mantissa of the
floating-point number representation. Ideally the error for all
-functions is always less than 0.5ulps. Using rounding bits this is also
-possible and normally implemented for the basic operations. To achieve
-the same for the complex math functions requires a lot more work and
-this has not yet been done.
+functions is always less than 0.5ulps in round-to-nearest mode. Using
+rounding bits this is also
+possible and normally implemented for the basic operations. Except
+for certain functions such as @code{sqrt}, @code{fma} and @code{rint}
+whose results are fully specified by reference to corresponding IEEE
+754 floating-point operations, and conversions between strings and
+floating point, @theglibc{} does not aim for correctly rounded results
+for functions in the math library, and does not aim for correctness in
+whether ``inexact'' exceptions are raised. Instead, the goals for
+accuracy of functions without fully specified results are as follows;
+some functions have bugs meaning they do not meet these goals in all
+cases. In future, @theglibc{} may provide some other correctly
+rounding functions under the names such as @code{crsin} proposed for
+an extension to ISO C.
+
+@itemize @bullet
+
+@item
+Each function with a floating-point result behaves as if it computes
+an infinite-precision result that is within a few ulp (in both real
+and complex parts, for functions with complex results) of the
+mathematically correct value of the function (interpreted together
+with ISO C or POSIX semantics for the function in question) at the
+exact value passed as the input. Exceptions are raised appropriately
+for this value and in accordance with IEEE 754 / ISO C / POSIX
+semantics, and it is then rounded according to the current rounding
+direction to the result that is returned to the user. @code{errno}
+may also be set (@pxref{Math Error Reporting}).
+
+@item
+For the IBM @code{long double} format, as used on PowerPC GNU/Linux,
+the accuracy goal is weaker for input values not exactly representable
+in 106 bits of precision; it is as if the input value is some value
+within 0.5ulp of the value actually passed, where ``ulp'' is
+interpreted in terms of a fixed-precision 106-bit mantissa, but not
+necessarily the exact value actually passed with discontiguous
+mantissa bits.
+
+@item
+Functions behave as if the infinite-precision result computed is zero,
+infinity or NaN if and only if that is the mathematically correct
+infinite-precision result. They behave as if the infinite-precision
+result computed always has the same sign as the mathematically correct
+result.
+
+@item
+If the mathematical result is more than a few ulp above the overflow
+threshold for the current rounding direction, the value returned is
+the appropriate overflow value for the current rounding direction,
+with the overflow exception raised.
+
+@item
+If the mathematical result has magnitude well below half the least
+subnormal magnitude, the returned value is either zero or the least
+subnormal (in each case, with the correct sign), according to the
+current rounding direction and with the underflow exception raised.
+
+@item
+Where the mathematical result underflows and is not exactly
+representable as a floating-point value, the underflow exception is
+raised (so there may be spurious underflow exceptions in cases where
+the underflowing result is exact, but not missing underflow exceptions
+in cases where it is inexact).
+
+@item
+@Theglibc{} does not aim for functions to satisfy other properties of
+the underlying mathematical function, such as monotonicity, where not
+implied by the above goals.
+
+@item
+All the above applies to both real and complex parts, for complex
+functions.
+
+@end itemize
Therefore many of the functions in the math library have errors. The
table lists the maximum error for each function which is exposed by one
Modified: fsf/trunk/libc/math/fegetround.c
==============================================================================
--- fsf/trunk/libc/math/fegetround.c (original)
+++ fsf/trunk/libc/math/fegetround.c Fri Nov 29 00:01:57 2013
@@ -28,4 +28,5 @@
return 0;
#endif
}
+libm_hidden_def (fegetround)
stub_warning (fegetround)
Modified: fsf/trunk/libc/nss/Versions
==============================================================================
--- fsf/trunk/libc/nss/Versions (original)
+++ fsf/trunk/libc/nss/Versions Fri Nov 29 00:01:57 2013
@@ -40,6 +40,7 @@
_nss_files_endhostent;
_nss_files_gethostbyaddr_r;
_nss_files_gethostbyname2_r;
+ _nss_files_gethostbyname3_r;
_nss_files_gethostbyname4_r;
_nss_files_gethostbyname_r;
_nss_files_gethostent_r;
Modified: fsf/trunk/libc/nss/nss_files/files-hosts.c
==============================================================================
--- fsf/trunk/libc/nss/nss_files/files-hosts.c (original)
+++ fsf/trunk/libc/nss/nss_files/files-hosts.c Fri Nov 29 00:01:57 2013
@@ -97,261 +97,11 @@
STRING_FIELD (result->h_name, isspace, 1);
})
-
-
-#define HOST_DB_LOOKUP(name, keysize, keypattern, break_if_match, proto...) \
-enum nss_status \
-_nss_files_get##name##_r (proto, \
- struct STRUCTURE *result, char *buffer, \
- size_t buflen, int *errnop H_ERRNO_PROTO) \
-{ \
- uintptr_t pad = -(uintptr_t) buffer % __alignof__ (struct hostent_data); \
- buffer += pad; \
- buflen = buflen > pad ? buflen - pad : 0; \
- \
- __libc_lock_lock (lock); \
- \
- /* Reset file pointer to beginning or open file. */ \
- enum nss_status status = internal_setent (keep_stream); \
- \
- if (status == NSS_STATUS_SUCCESS) \
- { \
- /* Tell getent function that we have repositioned the file pointer. */ \
- last_use = getby; \
- \
- while ((status = internal_getent (result, buffer, buflen, errnop \
- H_ERRNO_ARG EXTRA_ARGS_VALUE)) \
- == NSS_STATUS_SUCCESS) \
- { break_if_match } \
- \
- if (status == NSS_STATUS_SUCCESS \
- && _res_hconf.flags & HCONF_FLAG_MULTI) \
- { \
- /* We have to get all host entries from the file. */ \
- size_t tmp_buflen = MIN (buflen, 4096); \
- char tmp_buffer_stack[tmp_buflen] \
- __attribute__ ((__aligned__ (__alignof__ (struct hostent_data))));\
- char *tmp_buffer = tmp_buffer_stack; \
- struct hostent tmp_result_buf; \
- int naddrs = 1; \
- int naliases = 0; \
- char *bufferend; \
- bool tmp_buffer_malloced = false; \
- \
- while (result->h_aliases[naliases] != NULL) \
- ++naliases; \
- \
- bufferend = (char *) &result->h_aliases[naliases + 1]; \
- \
- again: \
- while ((status = internal_getent (&tmp_result_buf, tmp_buffer, \
- tmp_buflen, errnop H_ERRNO_ARG \
- EXTRA_ARGS_VALUE)) \
- == NSS_STATUS_SUCCESS) \
- { \
- int matches = 1; \
- struct hostent *old_result = result; \
- result = &tmp_result_buf; \
- /* The following piece is a bit clumsy but we want to use the \
- `break_if_match' value. The optimizer should do its \
- job. */ \
- do \
- { \
- break_if_match \
- result = old_result; \
- } \
- while ((matches = 0)); \
- \
- if (matches) \
- { \
- /* We could be very clever and try to recycle a few bytes \
- in the buffer instead of generating new arrays. But \
- we are not doing this here since it's more work than \
- it's worth. Simply let the user provide a bit bigger \
- buffer. */ \
- char **new_h_addr_list; \
- char **new_h_aliases; \
- int newaliases = 0; \
- size_t newstrlen = 0; \
- int cnt; \
- \
- /* Count the new aliases and the length of the strings. */ \
- while (tmp_result_buf.h_aliases[newaliases] != NULL) \
- { \
- char *cp = tmp_result_buf.h_aliases[newaliases]; \
- ++newaliases; \
- newstrlen += strlen (cp) + 1; \
- } \
- /* If the real name is different add it also to the \
- aliases. This means that there is a duplication \
- in the alias list but this is really the user's \
- problem. */ \
- if (strcmp (old_result->h_name, \
- tmp_result_buf.h_name) != 0) \
- { \
- ++newaliases; \
- newstrlen += strlen (tmp_result_buf.h_name) + 1; \
- } \
- \
- /* Make sure bufferend is aligned. */ \
- assert ((bufferend - (char *) 0) % sizeof (char *) == 0); \
- \
- /* Now we can check whether the buffer is large enough. \
- 16 is the maximal size of the IP address. */ \
- if (bufferend + 16 + (naddrs + 2) * sizeof (char *) \
- + roundup (newstrlen, sizeof (char *)) \
- + (naliases + newaliases + 1) * sizeof (char *) \
- >= buffer + buflen) \
- { \
- *errnop = ERANGE; \
- *herrnop = NETDB_INTERNAL; \
- status = NSS_STATUS_TRYAGAIN; \
- goto out; \
- } \
- \
- new_h_addr_list = \
- (char **) (bufferend \
- + roundup (newstrlen, sizeof (char *)) \
- + 16); \
- new_h_aliases = \
- (char **) ((char *) new_h_addr_list \
- + (naddrs + 2) * sizeof (char *)); \
- \
- /* Copy the old data in the new arrays. */ \
- for (cnt = 0; cnt < naddrs; ++cnt) \
- new_h_addr_list[cnt] = old_result->h_addr_list[cnt]; \
- \
- for (cnt = 0; cnt < naliases; ++cnt) \
- new_h_aliases[cnt] = old_result->h_aliases[cnt]; \
- \
- /* Store the new strings. */ \
- cnt = 0; \
- while (tmp_result_buf.h_aliases[cnt] != NULL) \
- { \
- new_h_aliases[naliases++] = bufferend; \
- bufferend = (__stpcpy (bufferend, \
- tmp_result_buf.h_aliases[cnt]) \
- + 1); \
- ++cnt; \
- } \
- \
- if (cnt < newaliases) \
- { \
- new_h_aliases[naliases++] = bufferend; \
- bufferend = __stpcpy (bufferend, \
- tmp_result_buf.h_name) + 1; \
- } \
- \
- /* Final NULL pointer. */ \
- new_h_aliases[naliases] = NULL; \
- \
- /* Round up the buffer end address. */ \
- bufferend += (sizeof (char *) \
- - ((bufferend - (char *) 0) \
- % sizeof (char *))) % sizeof (char *); \
- \
- /* Now the new address. */ \
- new_h_addr_list[naddrs++] = \
- memcpy (bufferend, tmp_result_buf.h_addr, \
- tmp_result_buf.h_length); \
- \
- /* Also here a final NULL pointer. */ \
- new_h_addr_list[naddrs] = NULL; \
- \
- /* Store the new array pointers. */ \
- old_result->h_aliases = new_h_aliases; \
- old_result->h_addr_list = new_h_addr_list; \
- \
- /* Compute the new buffer end. */ \
- bufferend = (char *) &new_h_aliases[naliases + 1]; \
- assert (bufferend <= buffer + buflen); \
- \
- result = old_result; \
- } \
- } \
- \
- if (status == NSS_STATUS_TRYAGAIN) \
- { \
- size_t newsize = 2 * tmp_buflen; \
- if (tmp_buffer_malloced) \
- { \
- char *newp = realloc (tmp_buffer, newsize); \
- if (newp != NULL) \
- { \
- assert ((((uintptr_t) newp) \
- & (__alignof__ (struct hostent_data) - 1)) \
- == 0); \
- tmp_buffer = newp; \
- tmp_buflen = newsize; \
- goto again; \
- } \
- } \
- else if (!__libc_use_alloca (buflen + newsize)) \
- { \
- tmp_buffer = malloc (newsize); \
- if (tmp_buffer != NULL) \
- { \
- assert ((((uintptr_t) tmp_buffer) \
- & (__alignof__ (struct hostent_data) - 1)) \
- == 0); \
- tmp_buffer_malloced = true; \
- tmp_buflen = newsize; \
- goto again; \
- } \
- } \
- else \
- { \
- tmp_buffer \
- = extend_alloca (tmp_buffer, tmp_buflen, \
- newsize \
- + __alignof__ (struct hostent_data)); \
- tmp_buffer = (char *) (((uintptr_t) tmp_buffer \
- + __alignof__ (struct hostent_data) \
- - 1) \
- & ~(__alignof__ (struct hostent_data)\
- - 1)); \
- goto again; \
- } \
- } \
- else \
- status = NSS_STATUS_SUCCESS; \
- out: \
- if (tmp_buffer_malloced) \
- free (tmp_buffer); \
- } \
- \
- \
- if (! keep_stream) \
- internal_endent (); \
- } \
- \
- __libc_lock_unlock (lock); \
- \
- return status; \
-}
-
-
#define EXTRA_ARGS_VALUE \
, ((_res.options & RES_USE_INET6) ? AF_INET6 : AF_INET), \
((_res.options & RES_USE_INET6) ? AI_V4MAPPED : 0)
#include "files-XXX.c"
-HOST_DB_LOOKUP (hostbyname, ,,
- {
- LOOKUP_NAME_CASE (h_name, h_aliases)
- }, const char *name)
#undef EXTRA_ARGS_VALUE
-
-
-/* XXX Is using _res to determine whether we want to convert IPv4 addresses
- to IPv6 addresses really the right thing to do? */
-#define EXTRA_ARGS_VALUE \
- , af, ((_res.options & RES_USE_INET6) ? AI_V4MAPPED : 0)
-HOST_DB_LOOKUP (hostbyname2, ,,
- {
- LOOKUP_NAME_CASE (h_name, h_aliases)
- }, const char *name, int af)
-#undef EXTRA_ARGS_VALUE
-
/* We only need to consider IPv4 mapped addresses if the input to the
gethostbyaddr() function is an IPv6 address. */
@@ -365,6 +115,263 @@
}, const void *addr, socklen_t len, int af)
#undef EXTRA_ARGS_VALUE
+enum nss_status
+_nss_files_gethostbyname3_r (const char *name, int af, struct hostent *result,
+ char *buffer, size_t buflen, int *errnop,
+ int *herrnop, int32_t *ttlp, char **canonp)
+{
+ uintptr_t pad = -(uintptr_t) buffer % __alignof__ (struct hostent_data);
+ buffer += pad;
+ buflen = buflen > pad ? buflen - pad : 0;
+
+ __libc_lock_lock (lock);
+
+ /* Reset file pointer to beginning or open file. */
+ enum nss_status status = internal_setent (keep_stream);
+
+ if (status == NSS_STATUS_SUCCESS)
+ {
+ /* XXX Is using _res to determine whether we want to convert IPv4
+ addresses to IPv6 addresses really the right thing to do? */
+ int flags = ((_res.options & RES_USE_INET6) ? AI_V4MAPPED : 0);
+
+ /* Tell getent function that we have repositioned the file pointer. */
+ last_use = getby;
+
+ while ((status = internal_getent (result, buffer, buflen, errnop,
+ herrnop, af, flags))
+ == NSS_STATUS_SUCCESS)
+ {
+ LOOKUP_NAME_CASE (h_name, h_aliases)
+ }
+
+ if (status == NSS_STATUS_SUCCESS
+ && _res_hconf.flags & HCONF_FLAG_MULTI)
+ {
+ /* We have to get all host entries from the file. */
+ size_t tmp_buflen = MIN (buflen, 4096);
+ char tmp_buffer_stack[tmp_buflen]
+ __attribute__ ((__aligned__ (__alignof__ (struct hostent_data))));
+ char *tmp_buffer = tmp_buffer_stack;
+ struct hostent tmp_result_buf;
+ int naddrs = 1;
+ int naliases = 0;
+ char *bufferend;
+ bool tmp_buffer_malloced = false;
+
+ while (result->h_aliases[naliases] != NULL)
+ ++naliases;
+
+ bufferend = (char *) &result->h_aliases[naliases + 1];
+
+ again:
+ while ((status = internal_getent (&tmp_result_buf, tmp_buffer,
+ tmp_buflen, errnop, herrnop, af,
+ flags))
+ == NSS_STATUS_SUCCESS)
+ {
+ int matches = 1;
+ struct hostent *old_result = result;
+ result = &tmp_result_buf;
+ /* The following piece is a bit clumsy but we want to use the
+ `LOOKUP_NAME_CASE' value. The optimizer should do its
+ job. */
+ do
+ {
+ LOOKUP_NAME_CASE (h_name, h_aliases)
+ result = old_result;
+ }
+ while ((matches = 0));
+
+ if (matches)
+ {
+ /* We could be very clever and try to recycle a few bytes
+ in the buffer instead of generating new arrays. But
+ we are not doing this here since it's more work than
+ it's worth. Simply let the user provide a bit bigger
+ buffer. */
+ char **new_h_addr_list;
+ char **new_h_aliases;
+ int newaliases = 0;
+ size_t newstrlen = 0;
+ int cnt;
+
+ /* Count the new aliases and the length of the strings. */
+ while (tmp_result_buf.h_aliases[newaliases] != NULL)
+ {
+ char *cp = tmp_result_buf.h_aliases[newaliases];
+ ++newaliases;
+ newstrlen += strlen (cp) + 1;
+ }
+ /* If the real name is different add it also to the
+ aliases. This means that there is a duplication
+ in the alias list but this is really the user's
+ problem. */
+ if (strcmp (old_result->h_name,
+ tmp_result_buf.h_name) != 0)
+ {
+ ++newaliases;
+ newstrlen += strlen (tmp_result_buf.h_name) + 1;
+ }
+
+ /* Make sure bufferend is aligned. */
+ assert ((bufferend - (char *) 0) % sizeof (char *) == 0);
+
+ /* Now we can check whether the buffer is large enough.
+ 16 is the maximal size of the IP address. */
+ if (bufferend + 16 + (naddrs + 2) * sizeof (char *)
+ + roundup (newstrlen, sizeof (char *))
+ + (naliases + newaliases + 1) * sizeof (char *)
+ >= buffer + buflen)
+ {
+ *errnop = ERANGE;
+ *herrnop = NETDB_INTERNAL;
+ status = NSS_STATUS_TRYAGAIN;
+ goto out;
+ }
+
+ new_h_addr_list =
+ (char **) (bufferend
+ + roundup (newstrlen, sizeof (char *))
+ + 16);
+ new_h_aliases =
+ (char **) ((char *) new_h_addr_list
+ + (naddrs + 2) * sizeof (char *));
+
+ /* Copy the old data in the new arrays. */
+ for (cnt = 0; cnt < naddrs; ++cnt)
+ new_h_addr_list[cnt] = old_result->h_addr_list[cnt];
+
+ for (cnt = 0; cnt < naliases; ++cnt)
+ new_h_aliases[cnt] = old_result->h_aliases[cnt];
+
+ /* Store the new strings. */
+ cnt = 0;
+ while (tmp_result_buf.h_aliases[cnt] != NULL)
+ {
+ new_h_aliases[naliases++] = bufferend;
+ bufferend = (__stpcpy (bufferend,
+ tmp_result_buf.h_aliases[cnt])
+ + 1);
+ ++cnt;
+ }
+
+ if (cnt < newaliases)
+ {
+ new_h_aliases[naliases++] = bufferend;
+ bufferend = __stpcpy (bufferend,
+ tmp_result_buf.h_name) + 1;
+ }
+
+ /* Final NULL pointer. */
+ new_h_aliases[naliases] = NULL;
+
+ /* Round up the buffer end address. */
+ bufferend += (sizeof (char *)
+ - ((bufferend - (char *) 0)
+ % sizeof (char *))) % sizeof (char *);
+
+ /* Now the new address. */
+ new_h_addr_list[naddrs++] =
+ memcpy (bufferend, tmp_result_buf.h_addr,
+ tmp_result_buf.h_length);
+
+ /* Also here a final NULL pointer. */
+ new_h_addr_list[naddrs] = NULL;
+
+ /* Store the new array pointers. */
+ old_result->h_aliases = new_h_aliases;
+ old_result->h_addr_list = new_h_addr_list;
+
+ /* Compute the new buffer end. */
+ bufferend = (char *) &new_h_aliases[naliases + 1];
+ assert (bufferend <= buffer + buflen);
+
+ result = old_result;
+ }
+ }
+
+ if (status == NSS_STATUS_TRYAGAIN)
+ {
+ size_t newsize = 2 * tmp_buflen;
+ if (tmp_buffer_malloced)
+ {
+ char *newp = realloc (tmp_buffer, newsize);
+ if (newp != NULL)
+ {
+ assert ((((uintptr_t) newp)
+ & (__alignof__ (struct hostent_data) - 1))
+ == 0);
+ tmp_buffer = newp;
+ tmp_buflen = newsize;
+ goto again;
+ }
+ }
+ else if (!__libc_use_alloca (buflen + newsize))
+ {
+ tmp_buffer = malloc (newsize);
+ if (tmp_buffer != NULL)
+ {
+ assert ((((uintptr_t) tmp_buffer)
+ & (__alignof__ (struct hostent_data) - 1))
+ == 0);
+ tmp_buffer_malloced = true;
+ tmp_buflen = newsize;
+ goto again;
+ }
+ }
+ else
+ {
+ tmp_buffer
+ = extend_alloca (tmp_buffer, tmp_buflen,
+ newsize
+ + __alignof__ (struct hostent_data));
+ tmp_buffer = (char *) (((uintptr_t) tmp_buffer
+ + __alignof__ (struct hostent_data)
+ - 1)
+ & ~(__alignof__ (struct hostent_data)
+ - 1));
+ goto again;
+ }
+ }
+ else
+ status = NSS_STATUS_SUCCESS;
+ out:
+ if (tmp_buffer_malloced)
+ free (tmp_buffer);
+ }
+
+ if (! keep_stream)
+ internal_endent ();
+ }
+
+ if (canonp && status == NSS_STATUS_SUCCESS)
+ *canonp = result->h_name;
+
+ __libc_lock_unlock (lock);
+
+ return status;
+}
+
+enum nss_status
+_nss_files_gethostbyname_r (const char *name, struct hostent *result,
+ char *buffer, size_t buflen, int *errnop,
+ int *herrnop)
+{
+ int af = ((_res.options & RES_USE_INET6) ? AF_INET6 : AF_INET);
+
+ return _nss_files_gethostbyname3_r (name, af, result, buffer, buflen,
+ errnop, herrnop, NULL, NULL);
+}
+
+enum nss_status
+_nss_files_gethostbyname2_r (const char *name, int af, struct hostent *result,
+ char *buffer, size_t buflen, int *errnop,
+ int *herrnop)
+{
+ return _nss_files_gethostbyname3_r (name, af, result, buffer, buflen,
+ errnop, herrnop, NULL, NULL);
+}
enum nss_status
_nss_files_gethostbyname4_r (const char *name, struct gaih_addrtuple **pat,
Modified: fsf/trunk/libc/ports/ChangeLog.aarch64
==============================================================================
--- fsf/trunk/libc/ports/ChangeLog.aarch64 (original)
+++ fsf/trunk/libc/ports/ChangeLog.aarch64 Fri Nov 29 00:01:57 2013
@@ -1,3 +1,8 @@
+2013-11-28 Joseph Myers <joseph@xxxxxxxxxxxxxxxx>
+
+ * sysdeps/aarch64/fpu/fegetround.c (fegetround): Use
+ libm_hidden_def.
+
2013-11-26 Will Newton <will.newton@xxxxxxxxxx>
* sysdeps/aarch64/dl-irel.h: Include ldsodefs.h.
Modified: fsf/trunk/libc/ports/ChangeLog.alpha
==============================================================================
--- fsf/trunk/libc/ports/ChangeLog.alpha (original)
+++ fsf/trunk/libc/ports/ChangeLog.alpha Fri Nov 29 00:01:57 2013
@@ -1,3 +1,8 @@
+2013-11-28 Joseph Myers <joseph@xxxxxxxxxxxxxxxx>
+
+ * sysdeps/alpha/fpu/fegetround.c (fegetround): Use
+ libm_hidden_def.
+
2013-11-26 OndÃÂej BÃÂlka <neleai@xxxxxxxxx>
* sysdeps/unix/sysv/linux/alpha/bits/ipc.h: Use __glibc_reserved instead __unused.
* sysdeps/unix/sysv/linux/alpha/bits/msq.h: Likewise.
Modified: fsf/trunk/libc/ports/ChangeLog.am33
==============================================================================
--- fsf/trunk/libc/ports/ChangeLog.am33 (original)
+++ fsf/trunk/libc/ports/ChangeLog.am33 Fri Nov 29 00:01:57 2013
@@ -1,3 +1,7 @@
+2013-11-28 Joseph Myers <joseph@xxxxxxxxxxxxxxxx>
+
+ * sysdeps/am33/fpu/fegetround.c (fegetround): Use libm_hidden_def.
+
2013-10-30 Mike Frysinger <vapier@xxxxxxxxxx>
* sysdeps/unix/sysv/linux/am33/configure.in: Moved to ...
Modified: fsf/trunk/libc/ports/ChangeLog.arm
==============================================================================
--- fsf/trunk/libc/ports/ChangeLog.arm (original)
+++ fsf/trunk/libc/ports/ChangeLog.arm Fri Nov 29 00:01:57 2013
@@ -1,3 +1,7 @@
+2013-11-28 Joseph Myers <joseph@xxxxxxxxxxxxxxxx>
+
+ * sysdeps/arm/fegetround.c (fegetround): Use libm_hidden_def.
+
2013-11-26 OndÃÂej BÃÂlka <neleai@xxxxxxxxx>
* sysdeps/unix/sysv/linux/arm/bits/shm.h: Use __glibc_reserved instead __unused.
Modified: fsf/trunk/libc/ports/ChangeLog.hppa
==============================================================================
--- fsf/trunk/libc/ports/ChangeLog.hppa (original)
+++ fsf/trunk/libc/ports/ChangeLog.hppa Fri Nov 29 00:01:57 2013
@@ -1,3 +1,7 @@
+2013-11-28 Joseph Myers <joseph@xxxxxxxxxxxxxxxx>
+
+ * sysdeps/hppa/fpu/fegetround.c (fegetround): Use libm_hidden_def.
+
2013-11-26 OndÃÂej BÃÂlka <neleai@xxxxxxxxx>
* sysdeps/unix/sysv/linux/hppa/bits/ipc.h: Use __glibc_reserved instead __unused.
* sysdeps/unix/sysv/linux/hppa/bits/msq.h: Likewise.
Modified: fsf/trunk/libc/ports/ChangeLog.ia64
==============================================================================
--- fsf/trunk/libc/ports/ChangeLog.ia64 (original)
+++ fsf/trunk/libc/ports/ChangeLog.ia64 Fri Nov 29 00:01:57 2013
@@ -1,3 +1,7 @@
+2013-11-28 Joseph Myers <joseph@xxxxxxxxxxxxxxxx>
+
+ * sysdeps/ia64/fpu/fegetround.c (fegetround): Use libm_hidden_def.
+
2013-11-26 OndÃÂej BÃÂlka <neleai@xxxxxxxxx>
* sysdeps/unix/sysv/linux/ia64/bits/ipc.h: Use __glibc_reserved instead __unused.
* sysdeps/unix/sysv/linux/ia64/bits/msq.h: Likewise.
Modified: fsf/trunk/libc/ports/ChangeLog.m68k
==============================================================================
--- fsf/trunk/libc/ports/ChangeLog.m68k (original)
+++ fsf/trunk/libc/ports/ChangeLog.m68k Fri Nov 29 00:01:57 2013
@@ -1,3 +1,7 @@
+2013-11-28 Joseph Myers <joseph@xxxxxxxxxxxxxxxx>
+
+ * sysdeps/m68k/fpu/fegetround.c (fegetround): Use libm_hidden_def.
+
2013-11-26 OndÃÂej BÃÂlka <neleai@xxxxxxxxx>
* sysdeps/unix/sysv/linux/m68k/bits/stat.h: Use __glibc_reserved instead __unused.
Modified: fsf/trunk/libc/ports/ChangeLog.microblaze
==============================================================================
--- fsf/trunk/libc/ports/ChangeLog.microblaze (original)
+++ fsf/trunk/libc/ports/ChangeLog.microblaze Fri Nov 29 00:01:57 2013
@@ -1,3 +1,8 @@
+2013-11-28 Joseph Myers <joseph@xxxxxxxxxxxxxxxx>
+
+ * sysdeps/microblaze/fegetround.c (fegetround): Use
+ libm_hidden_def.
+
2013-11-26 OndÃÂej BÃÂlka <neleai@xxxxxxxxx>
* sysdeps/unix/sysv/linux/microblaze/bits/stat.h: Use __glibc_reserved instead __unused.
* sysdeps/unix/sysv/linux/microblaze/kernel_stat.h: Likewise.
Modified: fsf/trunk/libc/ports/ChangeLog.mips
==============================================================================
--- fsf/trunk/libc/ports/ChangeLog.mips (original)
+++ fsf/trunk/libc/ports/ChangeLog.mips Fri Nov 29 00:01:57 2013
@@ -1,3 +1,7 @@
+2013-11-28 Joseph Myers <joseph@xxxxxxxxxxxxxxxx>
+
+ * sysdeps/mips/fpu/fegetround.c (fegetround): Use libm_hidden_def.
+
2013-11-27 Aurelien Jarno <aurelien@xxxxxxxxxxx>
* sysdeps/unix/sysv/linux/mips/bits/resource.h (RLIM64_INFINITY): Fix
Modified: fsf/trunk/libc/ports/sysdeps/aarch64/fpu/fegetround.c
==============================================================================
--- fsf/trunk/libc/ports/sysdeps/aarch64/fpu/fegetround.c (original)
+++ fsf/trunk/libc/ports/sysdeps/aarch64/fpu/fegetround.c Fri Nov 29 00:01:57 2013
@@ -26,3 +26,4 @@
_FPU_GETCW (fpcr);
return fpcr & FE_TOWARDZERO;
}
+libm_hidden_def (fegetround)
Modified: fsf/trunk/libc/ports/sysdeps/alpha/fpu/fegetround.c
==============================================================================
--- fsf/trunk/libc/ports/sysdeps/alpha/fpu/fegetround.c (original)
+++ fsf/trunk/libc/ports/sysdeps/alpha/fpu/fegetround.c Fri Nov 29 00:01:57 2013
@@ -28,3 +28,4 @@
return (fpcr >> FPCR_ROUND_SHIFT) & 3;
}
+libm_hidden_def (fegetround)
Modified: fsf/trunk/libc/ports/sysdeps/am33/fpu/fegetround.c
==============================================================================
--- fsf/trunk/libc/ports/sysdeps/am33/fpu/fegetround.c (original)
+++ fsf/trunk/libc/ports/sysdeps/am33/fpu/fegetround.c Fri Nov 29 00:01:57 2013
@@ -32,3 +32,4 @@
return (cw & ROUND_MASK);
}
+libm_hidden_def (fegetround)
Modified: fsf/trunk/libc/ports/sysdeps/arm/fegetround.c
==============================================================================
--- fsf/trunk/libc/ports/sysdeps/arm/fegetround.c (original)
+++ fsf/trunk/libc/ports/sysdeps/arm/fegetround.c Fri Nov 29 00:01:57 2013
@@ -37,3 +37,4 @@
/* The current soft-float implementation only handles TONEAREST. */
return FE_TONEAREST;
}
+libm_hidden_def (fegetround)
Modified: fsf/trunk/libc/ports/sysdeps/hppa/fpu/fegetround.c
==============================================================================
--- fsf/trunk/libc/ports/sysdeps/hppa/fpu/fegetround.c (original)
+++ fsf/trunk/libc/ports/sysdeps/hppa/fpu/fegetround.c Fri Nov 29 00:01:57 2013
@@ -24,3 +24,4 @@
{
return get_rounding_mode ();
}
+libm_hidden_def (fegetround)
Modified: fsf/trunk/libc/ports/sysdeps/ia64/fpu/fegetround.c
==============================================================================
--- fsf/trunk/libc/ports/sysdeps/ia64/fpu/fegetround.c (original)
+++ fsf/trunk/libc/ports/sysdeps/ia64/fpu/fegetround.c Fri Nov 29 00:01:57 2013
@@ -24,3 +24,4 @@
{
return get_rounding_mode ();
}
+libm_hidden_def (fegetround)
Modified: fsf/trunk/libc/ports/sysdeps/m68k/fpu/fegetround.c
==============================================================================
--- fsf/trunk/libc/ports/sysdeps/m68k/fpu/fegetround.c (original)
+++ fsf/trunk/libc/ports/sysdeps/m68k/fpu/fegetround.c Fri Nov 29 00:01:57 2013
@@ -28,3 +28,4 @@
return fpcr & FE_UPWARD;
}
+libm_hidden_def (fegetround)
Modified: fsf/trunk/libc/ports/sysdeps/microblaze/fegetround.c
==============================================================================
--- fsf/trunk/libc/ports/sysdeps/microblaze/fegetround.c (original)
+++ fsf/trunk/libc/ports/sysdeps/microblaze/fegetround.c Fri Nov 29 00:01:57 2013
@@ -22,3 +22,4 @@
{
return FE_TONEAREST;
}
+libm_hidden_def (fegetround)
Modified: fsf/trunk/libc/ports/sysdeps/mips/fpu/fegetround.c
==============================================================================
--- fsf/trunk/libc/ports/sysdeps/mips/fpu/fegetround.c (original)
+++ fsf/trunk/libc/ports/sysdeps/mips/fpu/fegetround.c Fri Nov 29 00:01:57 2013
@@ -30,3 +30,4 @@
return cw & _FPU_RC_MASK;
}
+libm_hidden_def (fegetround)
Modified: fsf/trunk/libc/sysdeps/i386/fpu/fegetround.c
==============================================================================
--- fsf/trunk/libc/sysdeps/i386/fpu/fegetround.c (original)
+++ fsf/trunk/libc/sysdeps/i386/fpu/fegetround.c Fri Nov 29 00:01:57 2013
@@ -28,3 +28,4 @@
return cw & 0xc00;
}
+libm_hidden_def (fegetround)
Modified: fsf/trunk/libc/sysdeps/ieee754/dbl-64/e_sqrt.c
==============================================================================
--- fsf/trunk/libc/sysdeps/ieee754/dbl-64/e_sqrt.c (original)
+++ fsf/trunk/libc/sysdeps/ieee754/dbl-64/e_sqrt.c Fri Nov 29 00:01:57 2013
@@ -66,8 +66,9 @@
/*----------------- 2^-1022 <= | x |< 2^1024 -----------------*/
if (k > 0x000fffff && k < 0x7ff00000)
{
+ int rm = fegetround ();
fenv_t env;
- libc_feholdexcept (&env);
+ libc_feholdexcept_setround (&env, FE_TONEAREST);
double ret;
y = 1.0 - t * (t * s);
t = t * (rt0 + y * (rt1 + y * (rt2 + y * rt3)));
@@ -82,15 +83,44 @@
{
res1 = res + 1.5 * ((y - res) + del);
EMULV (res, res1, z, zz, p, hx, tx, hy, ty); /* (z+zz)=res*res1 */
- ret = ((((z - s) + zz) < 0) ? max (res, res1) :
- min (res, res1)) * c.x;
+ res = ((((z - s) + zz) < 0) ? max (res, res1) :
+ min (res, res1));
+ ret = res * c.x;
}
math_force_eval (ret);
libc_fesetenv (&env);
- if (x / ret != ret)
+ double dret = x / ret;
+ if (dret != ret)
{
double force_inexact = 1.0 / 3.0;
math_force_eval (force_inexact);
+ /* The square root is inexact, ret is the round-to-nearest
+ value which may need adjusting for other rounding
+ modes. */
+ switch (rm)
+ {
+#ifdef FE_UPWARD
+ case FE_UPWARD:
+ if (dret > ret)
+ ret = (res + 0x1p-1022) * c.x;
+ break;
+#endif
+
+#ifdef FE_DOWNWARD
+ case FE_DOWNWARD:
+#endif
+#ifdef FE_TOWARDZERO
+ case FE_TOWARDZERO:
+#endif
+#if defined FE_DOWNWARD || defined FE_TOWARDZERO
+ if (dret < ret)
+ ret = (res - 0x1p-1022) * c.x;
+ break;
+#endif
+
+ default:
+ break;
+ }
}
/* Otherwise (x / ret == ret), either the square root was exact or
the division was inexact. */
Removed: fsf/trunk/libc/sysdeps/ieee754/ldbl-96/e_atan2l.c
==============================================================================
--- fsf/trunk/libc/sysdeps/ieee754/ldbl-96/e_atan2l.c (original)
+++ fsf/trunk/libc/sysdeps/ieee754/ldbl-96/e_atan2l.c (removed)
@@ -1,125 +1,0 @@
-/* e_atan2l.c -- long double version of e_atan2.c.
- * Conversion to long double by Ulrich Drepper,
- * Cygnus Support, drepper@xxxxxxxxxxx
- */
-
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-/* __ieee754_atan2l(y,x)
- * Method :
- * 1. Reduce y to positive by atan2(y,x)=-atan2(-y,x).
- * 2. Reduce x to positive by (if x and y are unexceptional):
- * ARG (x+iy) = arctan(y/x) ... if x > 0,
- * ARG (x+iy) = pi - arctan[y/(-x)] ... if x < 0,
- *
- * Special cases:
- *
- * ATAN2((anything), NaN ) is NaN;
- * ATAN2(NAN , (anything) ) is NaN;
- * ATAN2(+-0, +(anything but NaN)) is +-0 ;
- * ATAN2(+-0, -(anything but NaN)) is +-pi ;
- * ATAN2(+-(anything but 0 and NaN), 0) is +-pi/2;
- * ATAN2(+-(anything but INF and NaN), +INF) is +-0 ;
- * ATAN2(+-(anything but INF and NaN), -INF) is +-pi;
- * ATAN2(+-INF,+INF ) is +-pi/4 ;
- * ATAN2(+-INF,-INF ) is +-3pi/4;
- * ATAN2(+-INF, (anything but,0,NaN, and INF)) is +-pi/2;
- *
- * Constants:
- * The hexadecimal values are the intended ones for the following
- * constants. The decimal values may be used, provided that the
- * compiler will convert from decimal to binary accurately enough
- * to produce the hexadecimal values shown.
- */
-
-#include <math.h>
-#include <math_private.h>
-
-static const long double
-tiny = 1.0e-4900L,
-zero = 0.0,
-pi_o_4 = 7.85398163397448309628202E-01L, /* 0x3FFE, 0xC90FDAA2, 0x2168C235 */
-pi_o_2 = 1.5707963267948966192564E+00L, /* 0x3FFF, 0xC90FDAA2, 0x2168C235 */
-pi = 3.14159265358979323851281E+00L, /* 0x4000, 0xC90FDAA2, 0x2168C235 */
-pi_lo = -5.01655761266833202345176e-20L;/* 0xBFBE, 0xECE675D1, 0xFC8F8CBB */
-
-long double
-__ieee754_atan2l (long double y, long double x)
-{
- long double z;
- int32_t k,m,hx,hy,ix,iy;
- u_int32_t sx,sy,lx,ly;
-
- GET_LDOUBLE_WORDS(sx,hx,lx,x);
- ix = sx&0x7fff;
- lx |= hx & 0x7fffffff;
- GET_LDOUBLE_WORDS(sy,hy,ly,y);
- iy = sy&0x7fff;
- ly |= hy & 0x7fffffff;
- if(((2*ix|((lx|-lx)>>31))>0xfffe)||
- ((2*iy|((ly|-ly)>>31))>0xfffe)) /* x or y is NaN */
- return x+y;
- if(((sx-0x3fff)|lx)==0) return __atanl(y); /* x=1.0 */
- m = ((sy>>15)&1)|((sx>>14)&2); /* 2*sign(x)+sign(y) */
-
- /* when y = 0 */
- if((iy|ly)==0) {
- switch(m) {
- case 0:
- case 1: return y; /* atan(+-0,+anything)=+-0 */
- case 2: return pi+tiny;/* atan(+0,-anything) = pi */
- case 3: return -pi-tiny;/* atan(-0,-anything) =-pi */
- }
- }
- /* when x = 0 */
- if((ix|lx)==0) return (sy>=0x8000)? -pi_o_2-tiny: pi_o_2+tiny;
-
- /* when x is INF */
- if(ix==0x7fff) {
- if(iy==0x7fff) {
- switch(m) {
- case 0: return pi_o_4+tiny;/* atan(+INF,+INF) */
- case 1: return -pi_o_4-tiny;/* atan(-INF,+INF) */
- case 2: return 3.0*pi_o_4+tiny;/*atan(+INF,-INF)*/
- case 3: return -3.0*pi_o_4-tiny;/*atan(-INF,-INF)*/
- }
- } else {
- switch(m) {
- case 0: return zero ; /* atan(+...,+INF) */
- case 1: return -zero ; /* atan(-...,+INF) */
- case 2: return pi+tiny ; /* atan(+...,-INF) */
- case 3: return -pi-tiny ; /* atan(-...,-INF) */
- }
- }
- }
- /* when y is INF */
- if(iy==0x7fff) return (sy>=0x8000)? -pi_o_2-tiny: pi_o_2+tiny;
-
- /* compute y/x */
- k = sy-sx;
- if(k > 70) z=pi_o_2+0.5*pi_lo; /* |y/x| > 2**70 */
- else if(sx>=0x8000&&k<-70) z=0.0; /* |y|/x < -2**70 */
- else z=__atanl(fabsl(y/x)); /* safe to do y/x */
- switch (m) {
- case 0: return z ; /* atan(+,+) */
- case 1: {
- u_int32_t sz;
- GET_LDOUBLE_EXP(sz,z);
- SET_LDOUBLE_EXP(z,sz ^ 0x8000);
- }
- return z ; /* atan(-,+) */
- case 2: return pi-(z-pi_lo);/* atan(+,-) */
- default: /* case 3 */
- return (z-pi_lo)-pi;/* atan(-,-) */
- }
-}
-strong_alias (__ieee754_atan2l, __atan2l_finite)
Removed: fsf/trunk/libc/sysdeps/ieee754/ldbl-96/e_ilogbl.c
==============================================================================
--- fsf/trunk/libc/sysdeps/ieee754/ldbl-96/e_ilogbl.c (original)
+++ fsf/trunk/libc/sysdeps/ieee754/ldbl-96/e_ilogbl.c (removed)
@@ -1,59 +1,0 @@
-/* s_ilogbl.c -- long double version of s_ilogb.c.
- * Conversion to long double by Ulrich Drepper,
- * Cygnus Support, drepper@xxxxxxxxxxx
- */
-
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: $";
-#endif
-
-/* ilogbl(long double x)
- * return the binary exponent of non-zero x
- * ilogbl(0) = FP_ILOGB0
- * ilogbl(NaN) = FP_ILOGBNAN (no signal is raised)
- * ilogbl(+-Inf) = INT_MAX (no signal is raised)
- */
-
-#include <limits.h>
-#include <math.h>
-#include <math_private.h>
-
-int __ieee754_ilogbl (long double x)
-{
- int32_t es,hx,lx,ix;
-
- GET_LDOUBLE_EXP(es,x);
- es &= 0x7fff;
- if(es==0) {
- GET_LDOUBLE_WORDS(es,hx,lx,x);
- if((hx|lx)==0)
- return FP_ILOGB0; /* ilogbl(0) = FP_ILOGB0 */
- else /* subnormal x */
- if(hx==0) {
- for (ix = -16415; lx>0; lx<<=1) ix -=1;
- } else {
- for (ix = -16383; hx>0; hx<<=1) ix -=1;
- }
- return ix;
- }
- else if (es<0x7fff) return es-0x3fff;
- else if (FP_ILOGBNAN != INT_MAX)
- {
- GET_LDOUBLE_WORDS(es,hx,lx,x);
- if (((hx & 0x7fffffff)|lx) == 0)
- /* ISO C99 requires ilogbl(+-Inf) == INT_MAX. */
- return INT_MAX;
- }
- return FP_ILOGBNAN;
-}
Removed: fsf/trunk/libc/sysdeps/ieee754/ldbl-96/e_remainderl.c
==============================================================================
--- fsf/trunk/libc/sysdeps/ieee754/ldbl-96/e_remainderl.c (original)
+++ fsf/trunk/libc/sysdeps/ieee754/ldbl-96/e_remainderl.c (removed)
@@ -1,72 +1,0 @@
-/* e_remainderl.c -- long double version of e_remainder.c.
- * Conversion to long double by Ulrich Drepper,
- * Cygnus Support, drepper@xxxxxxxxxxx
- */
-
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-/* __ieee754_remainderl(x,p)
- * Return :
- * returns x REM p = x - [x/p]*p as if in infinite
- * precise arithmetic, where [x/p] is the (infinite bit)
- * integer nearest x/p (in half way case choose the even one).
- * Method :
- * Based on fmod() return x-[x/p]chopped*p exactlp.
- */
-
-#include <math.h>
-#include <math_private.h>
-
-static const long double zero = 0.0;
-
-
-long double
-__ieee754_remainderl(long double x, long double p)
-{
- u_int32_t sx,sex,sep,x0,x1,p0,p1;
- long double p_half;
-
- GET_LDOUBLE_WORDS(sex,x0,x1,x);
- GET_LDOUBLE_WORDS(sep,p0,p1,p);
- sx = sex&0x8000;
- sep &= 0x7fff;
- sex &= 0x7fff;
-
- /* purge off exception values */
- if((sep|p0|p1)==0) return (x*p)/(x*p); /* p = 0 */
- if((sex==0x7fff)|| /* x not finite */
- ((sep==0x7fff)&& /* p is NaN */
- ((p0|p1)!=0)))
- return (x*p)/(x*p);
-
-
- if (sep<0x7ffe) x = __ieee754_fmodl(x,p+p); /* now x < 2p */
- if (((sex-sep)|(x0-p0)|(x1-p1))==0) return zero*x;
- x = fabsl(x);
- p = fabsl(p);
- if (sep<0x0002) {
- if(x+x>p) {
- x-=p;
- if(x+x>=p) x -= p;
- }
- } else {
- p_half = 0.5*p;
- if(x>p_half) {
- x-=p;
- if(x>=p_half) x -= p;
- }
- }
- GET_LDOUBLE_EXP(sex,x);
- SET_LDOUBLE_EXP(x,sex^sx);
- return x;
-}
-strong_alias (__ieee754_remainderl, __remainderl_finite)
Removed: fsf/trunk/libc/sysdeps/ieee754/ldbl-96/s_ceill.c
==============================================================================
--- fsf/trunk/libc/sysdeps/ieee754/ldbl-96/s_ceill.c (original)
+++ fsf/trunk/libc/sysdeps/ieee754/ldbl-96/s_ceill.c (removed)
@@ -1,85 +1,0 @@
-/* s_ceill.c -- long double version of s_ceil.c.
- * Conversion to long double by Ulrich Drepper,
- * Cygnus Support, drepper@xxxxxxxxxxx
- */
-
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: $";
-#endif
-
-/*
- * ceill(x)
- * Return x rounded toward -inf to integral value
- * Method:
- * Bit twiddling.
- * Exception:
- * Inexact flag raised if x not equal to ceil(x).
- */
-
-#include <math.h>
-#include <math_private.h>
-
-static const long double huge = 1.0e4930;
-
-long double __ceill(long double x)
-{
- int32_t i1,j0;
- u_int32_t i,j,se,i0,sx;
- GET_LDOUBLE_WORDS(se,i0,i1,x);
- sx = (se>>15)&1;
- j0 = (se&0x7fff)-0x3fff;
- if(j0<31) {
- if(j0<0) { /* raise inexact if x != 0 */
- if(huge+x>0.0) {/* return 0*sign(x) if |x|<1 */
- if(sx) {se=0x8000;i0=0;i1=0;}
- else if((i0|i1)!=0) { se=0x3fff;i0=0;i1=0;}
- }
- } else {
- i = (0x7fffffff)>>j0;
- if(((i0&i)|i1)==0) return x; /* x is integral */
- if(huge+x>0.0) { /* raise inexact flag */
- if(sx==0) {
- if (j0>0 && (i0+(0x80000000>>j0))>i0)
- i0+=0x80000000>>j0;
- else
- {
- i = 0x7fffffff;
- ++se;
- }
- }
- i0 &= (~i); i1=0;
- }
- }
- } else if (j0>62) {
- if(j0==0x4000) return x+x; /* inf or NaN */
- else return x; /* x is integral */
- } else {
- i = ((u_int32_t)(0xffffffff))>>(j0-31);
- if((i1&i)==0) return x; /* x is integral */
- if(huge+x>0.0) { /* raise inexact flag */
- if(sx==0) {
- if(j0==31) i0+=1;
- else {
- j = i1 + (1<<(63-j0));
- if(j<i1) i0+=1; /* got a carry */
- i1 = j;
- }
- }
- i1 &= (~i);
- }
- }
- SET_LDOUBLE_WORDS(x,se,i0,i1);
- return x;
-}
-weak_alias (__ceill, ceill)
Removed: fsf/trunk/libc/sysdeps/ieee754/ldbl-96/s_fabsl.c
==============================================================================
--- fsf/trunk/libc/sysdeps/ieee754/ldbl-96/s_fabsl.c (original)
+++ fsf/trunk/libc/sysdeps/ieee754/ldbl-96/s_fabsl.c (removed)
@@ -1,35 +1,0 @@
-/* s_fabsl.c -- long double version of s_fabs.c.
- * Conversion to long double by Ulrich Drepper,
- * Cygnus Support, drepper@xxxxxxxxxxx
- */
-
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: $";
-#endif
-
-/*
- * fabsl(x) returns the absolute value of x.
- */
-
-#include <math.h>
-#include <math_private.h>
-
-long double __fabsl(long double x)
-{
- u_int32_t exp;
- GET_LDOUBLE_EXP(exp,x);
- SET_LDOUBLE_EXP(x,exp&0x7fff);
- return x;
-}
-weak_alias (__fabsl, fabsl)
Removed: fsf/trunk/libc/sysdeps/ieee754/ldbl-96/s_finitel.c
==============================================================================
--- fsf/trunk/libc/sysdeps/ieee754/ldbl-96/s_finitel.c (original)
+++ fsf/trunk/libc/sysdeps/ieee754/ldbl-96/s_finitel.c (removed)
@@ -1,36 +1,0 @@
-/* s_finitel.c -- long double version of s_finite.c.
- * Conversion to long double by Ulrich Drepper,
- * Cygnus Support, drepper@xxxxxxxxxxx
- */
-
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: $";
-#endif
-
-/*
- * finitel(x) returns 1 is x is finite, else 0;
- * no branching!
- */
-
-#include <math.h>
-#include <math_private.h>
-
-int __finitel(long double x)
-{
- int32_t exp;
- GET_LDOUBLE_EXP(exp,x);
- return (int)((u_int32_t)((exp&0x7fff)-0x7fff)>>31);
-}
-hidden_def (__finitel)
-weak_alias (__finitel, finitel)
Removed: fsf/trunk/libc/sysdeps/ieee754/ldbl-96/s_floorl.c
==============================================================================
--- fsf/trunk/libc/sysdeps/ieee754/ldbl-96/s_floorl.c (original)
+++ fsf/trunk/libc/sysdeps/ieee754/ldbl-96/s_floorl.c (removed)
@@ -1,86 +1,0 @@
-/* s_floorl.c -- long double version of s_floor.c.
- * Conversion to long double by Ulrich Drepper,
- * Cygnus Support, drepper@xxxxxxxxxxx
- */
-
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: $";
-#endif
-
-/*
- * floorl(x)
- * Return x rounded toward -inf to integral value
- * Method:
- * Bit twiddling.
- * Exception:
- * Inexact flag raised if x not equal to floor(x).
- */
-
-#include <math.h>
-#include <math_private.h>
-
-static const long double huge = 1.0e4930;
-
-long double __floorl(long double x)
-{
- int32_t i1,j0;
- u_int32_t i,j,se,i0,sx;
- GET_LDOUBLE_WORDS(se,i0,i1,x);
- sx = (se>>15)&1;
- j0 = (se&0x7fff)-0x3fff;
- if(j0<31) {
- if(j0<0) { /* raise inexact if x != 0 */
- if(huge+x>0.0) {/* return 0*sign(x) if |x|<1 */
- if(sx==0) {se=0;i0=i1=0;}
- else if(((se&0x7fff)|i0|i1)!=0)
- { se=0xbfff;i0=i1=0;}
- }
- } else {
- i = (0x7fffffff)>>j0;
- if(((i0&i)|i1)==0) return x; /* x is integral */
- if(huge+x>0.0) { /* raise inexact flag */
- if(sx) {
- if (j0>0 && (i0+(0x80000000>>j0))>i0)
- i0 += (0x80000000)>>j0;
- else
- {
- i = 0x7fffffff;
- ++se;
- }
- }
- i0 &= (~i); i1=0;
- }
- }
- } else if (j0>62) {
- if(j0==0x4000) return x+x; /* inf or NaN */
- else return x; /* x is integral */
- } else {
- i = ((u_int32_t)(0xffffffff))>>(j0-31);
- if((i1&i)==0) return x; /* x is integral */
- if(huge+x>0.0) { /* raise inexact flag */
- if(sx) {
- if(j0==31) i0+=1;
- else {
- j = i1+(1<<(63-j0));
- if(j<i1) i0 +=1 ; /* got a carry */
- i1=j;
- }
- }
- i1 &= (~i);
- }
- }
- SET_LDOUBLE_WORDS(x,se,i0,i1);
- return x;
-}
-weak_alias (__floorl, floorl)
Removed: fsf/trunk/libc/sysdeps/ieee754/ldbl-96/s_fpclassifyl.c
==============================================================================
--- fsf/trunk/libc/sysdeps/ieee754/ldbl-96/s_fpclassifyl.c (original)
+++ fsf/trunk/libc/sysdeps/ieee754/ldbl-96/s_fpclassifyl.c (removed)
@@ -1,44 +1,0 @@
-/* Return classification value corresponding to argument.
- Copyright (C) 1997-2013 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 1997.
- Fixed by Andreas Schwab <schwab@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>.
-
- 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, see
- <http://www.gnu.org/licenses/>. */
-
-#include <math.h>
-
-#include <math_private.h>
-
-
-int
-__fpclassifyl (long double x)
-{
- u_int32_t ex, hx, lx, m;
- int retval = FP_NORMAL;
-
- GET_LDOUBLE_WORDS (ex, hx, lx, x);
- m = (hx & 0x7fffffff) | lx;
- ex &= 0x7fff;
- if ((ex | m) == 0)
- retval = FP_ZERO;
- else if (ex == 0 && (hx & 0x80000000) == 0)
- retval = FP_SUBNORMAL;
- else if (ex == 0x7fff)
- retval = m != 0 ? FP_NAN : FP_INFINITE;
-
- return retval;
-}
-libm_hidden_def (__fpclassifyl)
Removed: fsf/trunk/libc/sysdeps/ieee754/ldbl-96/s_isinfl.c
==============================================================================
--- fsf/trunk/libc/sysdeps/ieee754/ldbl-96/s_isinfl.c (original)
+++ fsf/trunk/libc/sysdeps/ieee754/ldbl-96/s_isinfl.c (removed)
@@ -1,30 +1,0 @@
-/*
- * Written by J.T. Conklin <jtc@xxxxxxxxxx>.
- * Change for long double by Ulrich Drepper <drepper@xxxxxxxxxx>.
- * Public domain.
- */
-
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: $";
-#endif
-
-/*
- * isinfl(x) returns 1 if x is inf, -1 if x is -inf, else 0;
- * no branching!
- */
-
-#include <math.h>
-#include <math_private.h>
-
-int
-__isinfl (long double x)
-{
- int32_t se,hx,lx;
- GET_LDOUBLE_WORDS(se,hx,lx,x);
- lx |= (hx & 0x7fffffff) | ((se & 0x7fff) ^ 0x7fff);
- lx |= -lx;
- se &= 0x8000;
- return ~(lx >> 31) & (1 - (se >> 14));
-}
-hidden_def (__isinfl)
-weak_alias (__isinfl, isinfl)
Removed: fsf/trunk/libc/sysdeps/ieee754/ldbl-96/s_isnanl.c
==============================================================================
--- fsf/trunk/libc/sysdeps/ieee754/ldbl-96/s_isnanl.c (original)
+++ fsf/trunk/libc/sysdeps/ieee754/ldbl-96/s_isnanl.c (removed)
@@ -1,40 +1,0 @@
-/* s_isnanl.c -- long double version of s_isnan.c.
- * Conversion to long double by Ulrich Drepper,
- * Cygnus Support, drepper@xxxxxxxxxxx
- */
-
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: $";
-#endif
-
-/*
- * isnanl(x) returns 1 is x is nan, else 0;
- * no branching!
- */
-
-#include <math.h>
-#include <math_private.h>
-
-int __isnanl(long double x)
-{
- int32_t se,hx,lx;
- GET_LDOUBLE_WORDS(se,hx,lx,x);
- se = (se & 0x7fff) << 1;
- lx |= hx & 0x7fffffff;
- se |= (u_int32_t)(lx|(-lx))>>31;
- se = 0xfffe - se;
- return (int)(((u_int32_t)(se))>>31);
-}
-hidden_def (__isnanl)
-weak_alias (__isnanl, isnanl)
Removed: fsf/trunk/libc/sysdeps/ieee754/ldbl-96/s_logbl.c
==============================================================================
--- fsf/trunk/libc/sysdeps/ieee754/ldbl-96/s_logbl.c (original)
+++ fsf/trunk/libc/sysdeps/ieee754/ldbl-96/s_logbl.c (removed)
@@ -1,51 +1,0 @@
-/* s_logbl.c -- long double version of s_logb.c.
- * Conversion to long double by Ulrich Drepper,
- * Cygnus Support, drepper@xxxxxxxxxxx
- */
-
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-/*
- * long double logbl(x)
- * IEEE 754 logb. Included to pass IEEE test suite. Not recommend.
- * Use ilogb instead.
- */
-
-#include <math.h>
-#include <math_private.h>
-
-long double
-__logbl (long double x)
-{
- int32_t es, lx, ix;
-
- GET_LDOUBLE_WORDS (es, ix, lx, x);
- es &= 0x7fff; /* exponent */
- if ((es | ix | lx) == 0)
- return -1.0 / fabs (x);
- if (es == 0x7fff)
- return x * x;
- if (es == 0) /* IEEE 754 logb */
- {
- /* POSIX specifies that denormal number is treated as
- though it were normalized. */
- int ma;
- if (ix == 0)
- ma = __builtin_clz (lx) + 32;
- else
- ma = __builtin_clz (ix);
- es -= ma - 1;
- }
- return (long double) (es - 16383);
-}
-
-weak_alias (__logbl, logbl)
Removed: fsf/trunk/libc/sysdeps/ieee754/ldbl-96/s_nearbyintl.c
==============================================================================
--- fsf/trunk/libc/sysdeps/ieee754/ldbl-96/s_nearbyintl.c (original)
+++ fsf/trunk/libc/sysdeps/ieee754/ldbl-96/s_nearbyintl.c (removed)
@@ -1,88 +1,0 @@
-/* s_rintl.c -- long double version of s_rint.c.
- * Conversion to long double by Ulrich Drepper,
- * Cygnus Support, drepper@xxxxxxxxxxx
- */
-/* Adapted for use as nearbyint by Ulrich Drepper <drepper@xxxxxxxxxx>. */
-
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-/*
- * rintl(x)
- * Return x rounded to integral value according to the prevailing
- * rounding mode.
- * Method:
- * Using floating addition.
- * Exception:
- * Inexact flag raised if x not equal to rintl(x).
- */
-
-#include <fenv.h>
-#include <math.h>
-#include <math_private.h>
-
-static const long double
-TWO63[2]={
- 9.223372036854775808000000e+18, /* 0x403E, 0x00000000, 0x00000000 */
- -9.223372036854775808000000e+18 /* 0xC03E, 0x00000000, 0x00000000 */
-};
-
-long double __nearbyintl(long double x)
-{
- fenv_t env;
- int32_t se,j0,sx;
- u_int32_t i,i0,i1;
- long double w,t;
- GET_LDOUBLE_WORDS(se,i0,i1,x);
- sx = (se>>15)&1;
- j0 = (se&0x7fff)-0x3fff;
- if(j0<31) {
- if(j0<0) {
- if(((se&0x7fff)|i0|i1)==0) return x;
- i1 |= i0;
- i0 &= 0xe0000000;
- i0 |= (i1|-i1)&0x80000000;
- SET_LDOUBLE_MSW(x,i0);
- feholdexcept (&env);
- w = TWO63[sx]+x;
- t = w-TWO63[sx];
- math_force_eval (t);
- fesetenv (&env);
- GET_LDOUBLE_EXP(i0,t);
- SET_LDOUBLE_EXP(t,(i0&0x7fff)|(sx<<15));
- return t;
- } else {
- i = (0x7fffffff)>>j0;
- if(((i0&i)|i1)==0) return x; /* x is integral */
- i>>=1;
- if(((i0&i)|i1)!=0) {
- if (j0==30) i1 = 0x40000000; else
- i0 = (i0&(~i))|((0x20000000)>>j0);
- }
- }
- } else if (j0>62) {
- if(j0==0x4000) return x+x; /* inf or NaN */
- else return x; /* x is integral */
- } else {
- i = ((u_int32_t)(0xffffffff))>>(j0-31);
- if((i1&i)==0) return x; /* x is integral */
- i>>=1;
- if((i1&i)!=0) i1 = (i1&(~i))|((0x40000000)>>(j0-31));
- }
- SET_LDOUBLE_WORDS(x,se,i0,i1);
- feholdexcept (&env);
- w = TWO63[sx]+x;
- t = w-TWO63[sx];
- math_force_eval (t);
- fesetenv (&env);
- return t;
-}
-weak_alias (__nearbyintl, nearbyintl)
Removed: fsf/trunk/libc/sysdeps/ieee754/ldbl-96/s_nextafterl.c
==============================================================================
--- fsf/trunk/libc/sysdeps/ieee754/ldbl-96/s_nextafterl.c (original)
+++ fsf/trunk/libc/sysdeps/ieee754/ldbl-96/s_nextafterl.c (removed)
@@ -1,96 +1,0 @@
-/* s_nextafterl.c -- long double version of s_nextafter.c.
- * Conversion to long double by Ulrich Drepper,
- * Cygnus Support, drepper@xxxxxxxxxxx
- */
-
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: $";
-#endif
-
-/* IEEE functions
- * nextafterl(x,y)
- * return the next machine floating-point number of x in the
- * direction toward y.
- * Special cases:
- */
-
-#include <math.h>
-#include <math_private.h>
-
-long double __nextafterl(long double x, long double y)
-{
- int32_t hx,hy,ix,iy;
- u_int32_t lx,ly,esx,esy;
-
- GET_LDOUBLE_WORDS(esx,hx,lx,x);
- GET_LDOUBLE_WORDS(esy,hy,ly,y);
- ix = esx&0x7fff; /* |x| */
- iy = esy&0x7fff; /* |y| */
-
- if (((ix==0x7fff)&&((hx|lx)!=0)) || /* x is nan */
- ((iy==0x7fff)&&((hy|ly)!=0))) /* y is nan */
- return x+y;
- if(x==y) return y; /* x=y, return y */
- if((ix|hx|lx)==0) { /* x == 0 */
- long double u;
- SET_LDOUBLE_WORDS(x,esy&0x8000,0,1);/* return +-minsubnormal */
- u = math_opt_barrier (x);
- u = u * u;
- math_force_eval (u); /* raise underflow flag */
- return x;
- }
- if(esx<0x8000) { /* x > 0 */
- if(ix>iy||((ix==iy) && (hx>hy||((hx==hy)&&(lx>ly))))) {
- /* x > y, x -= ulp */
- if(lx==0) {
- if (hx==0) esx -= 1;
- hx -= 1;
- }
- lx -= 1;
- } else { /* x < y, x += ulp */
- lx += 1;
- if(lx==0) {
- hx += 1;
- if (hx==0)
- esx += 1;
- }
- }
- } else { /* x < 0 */
- if(esy>=0||(ix>iy||((ix==iy)&&(hx>hy||((hx==hy)&&(lx>ly)))))){
- /* x < y, x -= ulp */
- if(lx==0) {
- if (hx==0) esx -= 1;
- hx -= 1;
- }
- lx -= 1;
- } else { /* x > y, x += ulp */
- lx += 1;
- if(lx==0) {
- hx += 1;
- if (hx==0) esx += 1;
- }
- }
- }
- esy = esx&0x7fff;
- if(esy==0x7fff) return x+x; /* overflow */
- if(esy==0) {
- long double u = x*x; /* underflow */
- math_force_eval (u); /* raise underflow flag */
- }
- SET_LDOUBLE_WORDS(x,esx,hx,lx);
- return x;
-}
-weak_alias (__nextafterl, nextafterl)
-strong_alias (__nextafterl, __nexttowardl)
-weak_alias (__nextafterl, nexttowardl)
Removed: fsf/trunk/libc/sysdeps/ieee754/ldbl-96/s_rintl.c
==============================================================================
--- fsf/trunk/libc/sysdeps/ieee754/ldbl-96/s_rintl.c (original)
+++ fsf/trunk/libc/sysdeps/ieee754/ldbl-96/s_rintl.c (removed)
@@ -1,82 +1,0 @@
-/* s_rintl.c -- long double version of s_rint.c.
- * Conversion to long double by Ulrich Drepper,
- * Cygnus Support, drepper@xxxxxxxxxxx
- */
-
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: $";
-#endif
-
-/*
- * rintl(x)
- * Return x rounded to integral value according to the prevailing
- * rounding mode.
- * Method:
- * Using floating addition.
- * Exception:
- * Inexact flag raised if x not equal to rintl(x).
- */
-
-#include <math.h>
-#include <math_private.h>
-
-static const long double
-TWO63[2]={
- 9.223372036854775808000000e+18, /* 0x403E, 0x00000000, 0x00000000 */
- -9.223372036854775808000000e+18 /* 0xC03E, 0x00000000, 0x00000000 */
-};
-
-long double __rintl(long double x)
-{
- int32_t se,j0,sx;
- u_int32_t i,i0,i1;
- long double w,t;
- GET_LDOUBLE_WORDS(se,i0,i1,x);
- sx = (se>>15)&1;
- j0 = (se&0x7fff)-0x3fff;
- if(j0<31) {
- if(j0<0) {
- if(((se&0x7fff)|i0|i1)==0) return x;
- i1 |= i0;
- i0 &= 0xe0000000;
- i0 |= (i1|-i1)&0x80000000;
- SET_LDOUBLE_MSW(x,i0);
- w = TWO63[sx]+x;
- t = w-TWO63[sx];
- GET_LDOUBLE_EXP(i0,t);
- SET_LDOUBLE_EXP(t,(i0&0x7fff)|(sx<<15));
- return t;
- } else {
- i = (0x7fffffff)>>j0;
- if(((i0&i)|i1)==0) return x; /* x is integral */
- i>>=1;
- if(((i0&i)|i1)!=0) {
- if(j0==30) i1 = 0x40000000; else
- i0 = (i0&(~i))|((0x20000000)>>j0);
- }
- }
- } else if (j0>62) {
- if(j0==0x4000) return x+x; /* inf or NaN */
- else return x; /* x is integral */
- } else {
- i = ((u_int32_t)(0xffffffff))>>(j0-31);
- if((i1&i)==0) return x; /* x is integral */
- i>>=1;
- if((i1&i)!=0) i1 = (i1&(~i))|((0x40000000)>>(j0-31));
- }
- SET_LDOUBLE_WORDS(x,se,i0,i1);
- w = TWO63[sx]+x;
- return w-TWO63[sx];
-}
-weak_alias (__rintl, rintl)
Removed: fsf/trunk/libc/sysdeps/ieee754/ldbl-96/s_scalbnl.c
==============================================================================
--- fsf/trunk/libc/sysdeps/ieee754/ldbl-96/s_scalbnl.c (original)
+++ fsf/trunk/libc/sysdeps/ieee754/ldbl-96/s_scalbnl.c (removed)
@@ -1,61 +1,0 @@
-/* s_scalbnl.c -- long double version of s_scalbn.c.
- * Conversion to long double by Ulrich Drepper,
- * Cygnus Support, drepper@xxxxxxxxxxx
- */
-
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-/*
- * scalbnl (long double x, int n)
- * scalbnl(x,n) returns x* 2**n computed by exponent
- * manipulation rather than by actually performing an
- * exponentiation or a multiplication.
- */
-
-#include <math.h>
-#include <math_private.h>
-
-static const long double
-two64 = 1.8446744073709551616e19L,
-twom64 = 5.421010862427522170037e-20L,
-huge = 1.0e+4900L,
-tiny = 1.0e-4900L;
-
-long double
-__scalbnl (long double x, int n)
-{
- int32_t k,es,hx,lx;
- GET_LDOUBLE_WORDS(es,hx,lx,x);
- k = es&0x7fff; /* extract exponent */
- if (__builtin_expect(k==0, 0)) { /* 0 or subnormal x */
- if ((lx|(hx&0x7fffffff))==0) return x; /* +-0 */
- x *= two64;
- GET_LDOUBLE_EXP(hx,x);
- k = (hx&0x7fff) - 64;
- }
- if (__builtin_expect(k==0x7fff, 0)) return x+x; /* NaN or Inf */
- if (__builtin_expect(n< -50000, 0))
- return tiny*__copysignl(tiny,x);
- if (__builtin_expect(n> 50000 || k+n > 0x7ffe, 0))
- return huge*__copysignl(huge,x); /* overflow */
- /* Now k and n are bounded we know that k = k+n does not
- overflow. */
- k = k+n;
- if (__builtin_expect(k > 0, 1)) /* normal result */
- {SET_LDOUBLE_EXP(x,(es&0x8000)|k); return x;}
- if (k <= -64)
- return tiny*__copysignl(tiny,x); /*underflow*/
- k += 64; /* subnormal result */
- SET_LDOUBLE_EXP(x,(es&0x8000)|k);
- return x*twom64;
-}
-weak_alias (__scalbnl, scalbnl)
Removed: fsf/trunk/libc/sysdeps/ieee754/ldbl-96/s_truncl.c
==============================================================================
--- fsf/trunk/libc/sysdeps/ieee754/ldbl-96/s_truncl.c (original)
+++ fsf/trunk/libc/sysdeps/ieee754/ldbl-96/s_truncl.c (removed)
@@ -1,56 +1,0 @@
-/* Truncate argument to nearest integral value not larger than the argument.
- Copyright (C) 1997-2013 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 1997.
-
- 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, see
- <http://www.gnu.org/licenses/>. */
-
-#include <math.h>
-
-#include <math_private.h>
-
-
-long double
-__truncl (long double x)
-{
- int32_t i0, j0;
- u_int32_t se, i1;
- int sx;
-
- GET_LDOUBLE_WORDS (se, i0, i1, x);
- sx = se & 0x8000;
- j0 = (se & 0x7fff) - 0x3fff;
- if (j0 < 31)
- {
- if (j0 < 0)
- /* The magnitude of the number is < 1 so the result is +-0. */
- SET_LDOUBLE_WORDS (x, sx, 0, 0);
- else
- SET_LDOUBLE_WORDS (x, se, i0 & ~(0x7fffffff >> j0), 0);
- }
- else if (j0 > 63)
- {
- if (j0 == 0x4000)
- /* x is inf or NaN. */
- return x + x;
- }
- else
- {
- SET_LDOUBLE_WORDS (x, se, i0, i1 & ~(0xffffffffu >> (j0 - 31)));
- }
-
- return x;
-}
-weak_alias (__truncl, truncl)
Modified: fsf/trunk/libc/sysdeps/powerpc/fpu/fegetround.c
==============================================================================
--- fsf/trunk/libc/sysdeps/powerpc/fpu/fegetround.c (original)
+++ fsf/trunk/libc/sysdeps/powerpc/fpu/fegetround.c Fri Nov 29 00:01:57 2013
@@ -24,3 +24,4 @@
{
return __fegetround();
}
+libm_hidden_def (fegetround)
Modified: fsf/trunk/libc/sysdeps/powerpc/nofpu/Makefile
==============================================================================
--- fsf/trunk/libc/sysdeps/powerpc/nofpu/Makefile (original)
+++ fsf/trunk/libc/sysdeps/powerpc/nofpu/Makefile Fri Nov 29 00:01:57 2013
@@ -2,7 +2,8 @@
ifeq ($(subdir),soft-fp)
sysdep_routines += $(gcc-single-routines) $(gcc-double-routines) \
- sim-full
+ sim-full atomic-feholdexcept atomic-feclearexcept \
+ atomic-feupdateenv flt-rounds
endif
ifeq ($(subdir),math)
Modified: fsf/trunk/libc/sysdeps/powerpc/nofpu/Versions
==============================================================================
--- fsf/trunk/libc/sysdeps/powerpc/nofpu/Versions (original)
+++ fsf/trunk/libc/sysdeps/powerpc/nofpu/Versions Fri Nov 29 00:01:57 2013
@@ -17,6 +17,10 @@
__gtdf2; __gtsf2;
__ltdf2; __ltsf2;
}
+ GLIBC_2.19 {
+ __atomic_feholdexcept; __atomic_feclearexcept; __atomic_feupdateenv;
+ __flt_rounds;
+ }
GLIBC_PRIVATE {
__sim_exceptions_thread;
__sim_disabled_exceptions_thread;
Added: fsf/trunk/libc/sysdeps/powerpc/nofpu/atomic-feclearexcept.c
==============================================================================
--- fsf/trunk/libc/sysdeps/powerpc/nofpu/atomic-feclearexcept.c (added)
+++ fsf/trunk/libc/sysdeps/powerpc/nofpu/atomic-feclearexcept.c Fri Nov 29 00:01:57 2013
@@ -1,0 +1,28 @@
+/* Clear floating-point exceptions for atomic compound assignment.
+ Copyright (C) 2013 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, see
+ <http://www.gnu.org/licenses/>. */
+
+#include "soft-fp.h"
+#include "soft-supp.h"
+
+void
+__atomic_feclearexcept (void)
+{
+ /* This function postdates the global variables being turned into
+ compat symbols, so no need to set them. */
+ __sim_exceptions_thread = 0;
+}
Added: fsf/trunk/libc/sysdeps/powerpc/nofpu/atomic-feholdexcept.c
==============================================================================
--- fsf/trunk/libc/sysdeps/powerpc/nofpu/atomic-feholdexcept.c (added)
+++ fsf/trunk/libc/sysdeps/powerpc/nofpu/atomic-feholdexcept.c Fri Nov 29 00:01:57 2013
@@ -1,0 +1,38 @@
+/* Store current floating-point environment and clear exceptions for
+ atomic compound assignment.
+ Copyright (C) 2013 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, see
+ <http://www.gnu.org/licenses/>. */
+
+#include "soft-fp.h"
+#include "soft-supp.h"
+
+void
+__atomic_feholdexcept (fenv_t *envp)
+{
+ fenv_union_t u;
+
+ u.l[0] = __sim_exceptions_thread;
+ /* The rounding mode is not changed by arithmetic, so no need to
+ save it. */
+ u.l[1] = __sim_disabled_exceptions_thread;
+ *envp = u.fenv;
+
+ /* This function postdates the global variables being turned into
+ compat symbols, so no need to set them. */
+ __sim_exceptions_thread = 0;
+ __sim_disabled_exceptions_thread = FE_ALL_EXCEPT;
+}
Added: fsf/trunk/libc/sysdeps/powerpc/nofpu/atomic-feupdateenv.c
==============================================================================
--- fsf/trunk/libc/sysdeps/powerpc/nofpu/atomic-feupdateenv.c (added)
+++ fsf/trunk/libc/sysdeps/powerpc/nofpu/atomic-feupdateenv.c Fri Nov 29 00:01:57 2013
@@ -1,0 +1,37 @@
+/* Install given floating-point environment and raise exceptions for
+ atomic compound assignment.
+ Copyright (C) 2013 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, see
+ <http://www.gnu.org/licenses/>. */
+
+#include "soft-fp.h"
+#include "soft-supp.h"
+#include <signal.h>
+
+void
+__atomic_feupdateenv (const fenv_t *envp)
+{
+ fenv_union_t u;
+ int saved_exceptions = __sim_exceptions_thread;
+
+ /* This function postdates the global variables being turned into
+ compat symbols, so no need to set them. */
+ u.fenv = *envp;
+ __sim_exceptions_thread |= u.l[0];
+ __sim_disabled_exceptions_thread = u.l[1];
+ if (saved_exceptions & ~__sim_disabled_exceptions_thread)
+ raise (SIGFPE);
+}
Modified: fsf/trunk/libc/sysdeps/powerpc/nofpu/fegetround.c
==============================================================================
--- fsf/trunk/libc/sysdeps/powerpc/nofpu/fegetround.c (original)
+++ fsf/trunk/libc/sysdeps/powerpc/nofpu/fegetround.c Fri Nov 29 00:01:57 2013
@@ -26,3 +26,4 @@
{
return __sim_round_mode_thread;
}
+libm_hidden_def (fegetround)
Added: fsf/trunk/libc/sysdeps/powerpc/nofpu/flt-rounds.c
==============================================================================
--- fsf/trunk/libc/sysdeps/powerpc/nofpu/flt-rounds.c (added)
+++ fsf/trunk/libc/sysdeps/powerpc/nofpu/flt-rounds.c Fri Nov 29 00:01:57 2013
@@ -1,0 +1,38 @@
+/* Return current rounding mode as correct value for FLT_ROUNDS.
+ Copyright (C) 2013 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, see
+ <http://www.gnu.org/licenses/>. */
+
+#include "soft-fp.h"
+#include "soft-supp.h"
+
+int
+__flt_rounds (void)
+{
+ switch (__sim_round_mode_thread)
+ {
+ case FP_RND_ZERO:
+ return 0;
+ case FP_RND_NEAREST:
+ return 1;
+ case FP_RND_PINF:
+ return 2;
+ case FP_RND_MINF:
+ return 3;
+ default:
+ abort ();
+ }
+}
Added: fsf/trunk/libc/sysdeps/powerpc/powerpc32/e500/nofpu/atomic-feclearexcept.c
==============================================================================
--- fsf/trunk/libc/sysdeps/powerpc/powerpc32/e500/nofpu/atomic-feclearexcept.c (added)
+++ fsf/trunk/libc/sysdeps/powerpc/powerpc32/e500/nofpu/atomic-feclearexcept.c Fri Nov 29 00:01:57 2013
@@ -1,0 +1,50 @@
+/* Clear floating-point exceptions for atomic compound assignment.
+ e500 version.
+ Copyright (C) 2004-2013 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, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <fenv_libc.h>
+#include <stdlib.h>
+#include <sysdep.h>
+#include <sys/prctl.h>
+
+void
+__atomic_feclearexcept (void)
+{
+ unsigned int fpescr, old_fpescr;
+
+ /* Get the current state. */
+ old_fpescr = fpescr = fegetenv_register ();
+
+ /* Clear the relevant bits. */
+ fpescr &= ~SPEFSCR_ALL_EXCEPT;
+
+ /* Put the new state in effect. */
+ fesetenv_register (fpescr);
+
+ /* Let the kernel know if the "invalid" or "underflow" bit was
+ cleared. */
+ if (old_fpescr & (SPEFSCR_FINVS | SPEFSCR_FUNFS))
+ {
+ int pflags __attribute__ ((__unused__)), r;
+ INTERNAL_SYSCALL_DECL (err);
+
+ r = INTERNAL_SYSCALL (prctl, err, 2, PR_GET_FPEXC, &pflags);
+ if (INTERNAL_SYSCALL_ERROR_P (r, err))
+ abort ();
+ }
+}
Added: fsf/trunk/libc/sysdeps/powerpc/powerpc32/e500/nofpu/atomic-feholdexcept.c
==============================================================================
--- fsf/trunk/libc/sysdeps/powerpc/powerpc32/e500/nofpu/atomic-feholdexcept.c (added)
+++ fsf/trunk/libc/sysdeps/powerpc/powerpc32/e500/nofpu/atomic-feholdexcept.c Fri Nov 29 00:01:57 2013
@@ -1,0 +1,55 @@
+/* Store current floating-point environment and clear exceptions for
+ atomic compound assignment. e500 version.
+ Copyright (C) 2004-2013 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, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <fenv_libc.h>
+#include <stdlib.h>
+#include <sysdep.h>
+#include <sys/prctl.h>
+
+void
+__atomic_feholdexcept (fenv_t *envp)
+{
+ fenv_union_t u;
+ INTERNAL_SYSCALL_DECL (err);
+ int r;
+
+ /* Get the current state. */
+ r = INTERNAL_SYSCALL (prctl, err, 2, PR_GET_FPEXC, &u.l[0]);
+ if (INTERNAL_SYSCALL_ERROR_P (r, err))
+ abort ();
+
+ u.l[1] = fegetenv_register ();
+ *envp = u.fenv;
+
+ /* Clear everything except for the rounding mode and trapping to the
+ kernel. */
+ u.l[0] &= ~(PR_FP_EXC_DIV
+ | PR_FP_EXC_OVF
+ | PR_FP_EXC_UND
+ | PR_FP_EXC_RES
+ | PR_FP_EXC_INV);
+ u.l[1] &= SPEFSCR_FRMC | (SPEFSCR_ALL_EXCEPT_ENABLE & ~SPEFSCR_FINXE);
+
+ /* Put the new state in effect. */
+ fesetenv_register (u.l[1]);
+ r = INTERNAL_SYSCALL (prctl, err, 2, PR_SET_FPEXC,
+ u.l[0] | PR_FP_EXC_SW_ENABLE);
+ if (INTERNAL_SYSCALL_ERROR_P (r, err))
+ abort ();
+}
Added: fsf/trunk/libc/sysdeps/powerpc/powerpc32/e500/nofpu/atomic-feupdateenv.c
==============================================================================
--- fsf/trunk/libc/sysdeps/powerpc/powerpc32/e500/nofpu/atomic-feupdateenv.c (added)
+++ fsf/trunk/libc/sysdeps/powerpc/powerpc32/e500/nofpu/atomic-feupdateenv.c Fri Nov 29 00:01:57 2013
@@ -1,0 +1,46 @@
+/* Install given floating-point environment and raise exceptions for
+ atomic compound assignment. e500 version.
+ Copyright (C) 2004-2013 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, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <fenv_libc.h>
+#include <stdlib.h>
+#include <sysdep.h>
+#include <sys/prctl.h>
+
+void
+__atomic_feupdateenv (const fenv_t *envp)
+{
+ int exc;
+ fenv_union_t u;
+ INTERNAL_SYSCALL_DECL (err);
+ int r;
+
+ /* Save the currently set exceptions. */
+ exc = fegetenv_register () & SPEFSCR_ALL_EXCEPT;
+
+ u.fenv = *envp;
+
+ fesetenv_register (u.l[1]);
+ r = INTERNAL_SYSCALL (prctl, err, 2, PR_SET_FPEXC,
+ u.l[0] | PR_FP_EXC_SW_ENABLE);
+ if (INTERNAL_SYSCALL_ERROR_P (r, err))
+ abort ();
+
+ /* Raise (if appropriate) saved exceptions. */
+ __feraiseexcept_soft (exc);
+}
Modified: fsf/trunk/libc/sysdeps/powerpc/powerpc32/e500/nofpu/fegetround.c
==============================================================================
--- fsf/trunk/libc/sysdeps/powerpc/powerpc32/e500/nofpu/fegetround.c (original)
+++ fsf/trunk/libc/sysdeps/powerpc/powerpc32/e500/nofpu/fegetround.c Fri Nov 29 00:01:57 2013
@@ -27,3 +27,4 @@
fpescr = fegetenv_register ();
return fpescr & 3;
}
+libm_hidden_def (fegetround)
Modified: fsf/trunk/libc/sysdeps/powerpc/powerpc32/e500/nofpu/fenv_libc.h
==============================================================================
--- fsf/trunk/libc/sysdeps/powerpc/powerpc32/e500/nofpu/fenv_libc.h (original)
+++ fsf/trunk/libc/sysdeps/powerpc/powerpc32/e500/nofpu/fenv_libc.h Fri Nov 29 00:01:57 2013
@@ -26,6 +26,9 @@
int __feraiseexcept_spe (int);
libm_hidden_proto (__feraiseexcept_spe)
+
+int __feraiseexcept_soft (int);
+libc_hidden_proto (__feraiseexcept_soft)
int __fexcepts_to_spe (int);
libm_hidden_proto (__fexcepts_to_spe)
Added: fsf/trunk/libc/sysdeps/powerpc/powerpc32/e500/nofpu/flt-rounds.c
==============================================================================
--- fsf/trunk/libc/sysdeps/powerpc/powerpc32/e500/nofpu/flt-rounds.c (added)
+++ fsf/trunk/libc/sysdeps/powerpc/powerpc32/e500/nofpu/flt-rounds.c Fri Nov 29 00:01:57 2013
@@ -1,0 +1,39 @@
+/* Return current rounding mode as correct value for FLT_ROUNDS. e500
+ version.
+ Copyright (C) 2013 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, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <fenv_libc.h>
+#include <stdlib.h>
+
+int
+__flt_rounds (void)
+{
+ switch (fegetenv_register () & SPEFSCR_FRMC)
+ {
+ case FE_TOWARDZERO:
+ return 0;
+ case FE_TONEAREST:
+ return 1;
+ case FE_UPWARD:
+ return 2;
+ case FE_DOWNWARD:
+ return 3;
+ default:
+ abort ();
+ }
+}
Modified: fsf/trunk/libc/sysdeps/powerpc/powerpc32/e500/nofpu/fraiseexcept-soft.c
==============================================================================
--- fsf/trunk/libc/sysdeps/powerpc/powerpc32/e500/nofpu/fraiseexcept-soft.c (original)
+++ fsf/trunk/libc/sysdeps/powerpc/powerpc32/e500/nofpu/fraiseexcept-soft.c Fri Nov 29 00:01:57 2013
@@ -20,9 +20,6 @@
#include <fenv_libc.h>
#include <libc-symbols.h>
-int __feraiseexcept_soft (int);
-libc_hidden_proto (__feraiseexcept_soft)
-
#define __FERAISEEXCEPT_INTERNAL __feraiseexcept_soft
#include "spe-raise.c"
libc_hidden_def (__feraiseexcept_soft)
Modified: fsf/trunk/libc/sysdeps/s390/fpu/fegetround.c
==============================================================================
--- fsf/trunk/libc/sysdeps/s390/fpu/fegetround.c (original)
+++ fsf/trunk/libc/sysdeps/s390/fpu/fegetround.c Fri Nov 29 00:01:57 2013
@@ -29,3 +29,4 @@
return cw & FPC_RM_MASK;
}
+libm_hidden_def (fegetround)
Modified: fsf/trunk/libc/sysdeps/sh/sh4/fpu/fegetround.c
==============================================================================
--- fsf/trunk/libc/sysdeps/sh/sh4/fpu/fegetround.c (original)
+++ fsf/trunk/libc/sysdeps/sh/sh4/fpu/fegetround.c Fri Nov 29 00:01:57 2013
@@ -30,3 +30,4 @@
return cw & 0x1;
}
+libm_hidden_def (fegetround)
Modified: fsf/trunk/libc/sysdeps/sparc/fpu/fegetround.c
==============================================================================
--- fsf/trunk/libc/sysdeps/sparc/fpu/fegetround.c (original)
+++ fsf/trunk/libc/sysdeps/sparc/fpu/fegetround.c Fri Nov 29 00:01:57 2013
@@ -27,3 +27,4 @@
return tmp & __FE_ROUND_MASK;
}
+libm_hidden_def (fegetround)
Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libc.abilist
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libc.abilist (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libc.abilist Fri Nov 29 00:01:57 2013
@@ -1784,6 +1784,12 @@
GLIBC_2.18
GLIBC_2.18 A
__cxa_thread_atexit_impl F
+GLIBC_2.19
+ GLIBC_2.19 A
+ __atomic_feclearexcept F
+ __atomic_feholdexcept F
+ __atomic_feupdateenv F
+ __flt_rounds F
GLIBC_2.2
GLIBC_2.2 A
_IO_adjust_wcolumn F
Modified: fsf/trunk/libc/sysdeps/x86_64/fpu/fegetround.c
==============================================================================
--- fsf/trunk/libc/sysdeps/x86_64/fpu/fegetround.c (original)
+++ fsf/trunk/libc/sysdeps/x86_64/fpu/fegetround.c Fri Nov 29 00:01:57 2013
@@ -30,3 +30,4 @@
return cw & 0xc00;
}
+libm_hidden_def (fegetround)
_______________________________________________
Commits mailing list
Commits@xxxxxxxxxx
http://eglibc.org/cgi-bin/mailman/listinfo/commits