about summary refs log tree commit diff
path: root/sysdeps
Commit message (Collapse)AuthorAgeFilesLines
* Regenerate sparc ULPs.David S. Miller2014-04-131-4/+1022
| | | | * sysdeps/sparc/fpu/libm-test-ulps: Update.
* Fixed and unified pthread_once.Torvald Riegel2014-04-116-549/+0
| | | | | | | [BZ #15215] This unifies various pthread_once architecture-specific implementations which were using the same algorithm with slightly different implementations. It also adds missing memory barriers that are required for correctness.
* S/390: Unify 31 and 64 bit configure.acStefan Liebler2014-04-114-12/+0
|
* Save/restore bound registers in _dl_runtime_resolveIgor Zamyatin2014-04-093-20/+121
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch saves and restores bound registers in symbol lookup for x86-64: 1. Branches without BND prefix clear bound registers. 2. x86-64 pass bounds in bound registers as specified in MPX psABI extension on hjl/mpx/master branch at https://github.com/hjl-tools/x86-64-psABI https://groups.google.com/forum/#!topic/x86-64-abi/KFsB0XTgWYc Binutils has been updated to create an alternate PLT to add BND prefix when branching to ld.so. * config.h.in (HAVE_MPX_SUPPORT): New #undef. * sysdeps/x86_64/configure.ac: Set HAVE_MPX_SUPPORT. * sysdeps/x86_64/configure: Regenerated. * sysdeps/x86_64/dl-trampoline.S (REGISTER_SAVE_AREA): New macro. (REGISTER_SAVE_RAX): Likewise. (REGISTER_SAVE_RCX): Likewise. (REGISTER_SAVE_RDX): Likewise. (REGISTER_SAVE_RSI): Likewise. (REGISTER_SAVE_RDI): Likewise. (REGISTER_SAVE_R8): Likewise. (REGISTER_SAVE_R9): Likewise. (REGISTER_SAVE_BND0): Likewise. (REGISTER_SAVE_BND1): Likewise. (REGISTER_SAVE_BND2): Likewise. (_dl_runtime_resolve): Use them. Save and restore Intel MPX bound registers when calling _dl_fixup.
* Use statvfs64() for pathconf(_PC_NAME_MAX).Peter TB Brett2014-04-091-11/+3
| | | | | | | | | pathconf(_PC_NAME_MAX) was implemented on top of statfs(). The 32bit version therefore fails EOVERFLOW if the filesystem blockcount is sufficiently large. Most pathconf() queries use statvfs64(), which avoids this issue. This patch modifies pathconf(_PC_NAME_MAX) to do likewise.
* Move __PTHREAD_SPINS definition to architecture specific headerAdhemerval Zanella2014-04-098-0/+24
| | | | | | | This patch moves the __PTHREAD_SPINS definition to arch specific header since pthread_mutex_t layout is also arch specific. This leads to no need to defining __PTHREAD_MUTEX_HAVE_ELISION and thus removing of the undefined compiler warning.
* PowerPC: Fix --disable-multi-arch buildsAdhemerval Zanella2014-04-0910-6/+14
| | | | | | | | | | This patch fixes some powerpc32 and powerpc64 builds with --disable-multi-arch option along with different --with-cpu=powerN. It cleanups the Implies directories by removing the multiarch folder for non multiarch config and also fixing two assembly implementations: powerpc64/power7/strncat.S that is calling the wrong strlen; and power8/fpu/s_isnan.S that misses the hidden_def and weak_alias directives.
* PowerPC: define _CALL_ELF if compiler does notAdhemerval Zanella2014-04-062-0/+37
| | | | | | | | | | | | This patch makes the configure adds -D_CALL_ELF=1 when compiler does not define _CALL_ELF (versions before powerpc64le support). It cleans up compiler warnings on old compiler where _CALL_ELF is not defined on powerpc64(be) builds. It does by add a new config.make variable for configure-deduced CPPFLAGS and accumulate into that (confix-extra-cppflags). It also generalizes libc_extra_cflags so it accumulates in sysdeps configure fragmenets.
* PowerPC: Fix nearbyint/nearbyintf result for FE_DOWNWARDAdhemerval Zanella2014-04-063-10/+203
| | | | | | | | | This patch fixes the powerpc32 optimized nearbyint/nearbyintf bogus results for FE_DOWNWARD rounding mode. This is due wrong instructions sequence used in the rounding calculation (two subtractions instead of adition and a subtraction). Fixes BZ#16815.
* tile: Fix cut-and-paste bug in commit fcccd5128.Chris Metcalf2014-04-041-2/+2
|
* Factor mmap/munmap of PT_LOAD segments out of _dl_map_object_from_fd et al.Roland McGrath2014-04-036-12/+11
|
* Fix catan, catanh, __ieee754_logf in round-downward mode (bug 16799, bug 16800).Joseph Myers2014-04-023-1/+193
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch fixes incorrect results from catan and catanh of certain special inputs in round-downward mode (bug 16799), and incorrect results of __ieee754_logf (+/-0) in round-downward mode (bug 16800) that show up through catan/catanh when tested in all rounding modes, but not directly in the testing for logf because the bug gets hidden by the wrappers. Both bugs involve a zero that should be +0 being -0 instead: one computed as (1-x)*(1+x) in the catan/catanh case, and one as (x-x) in the logf case. The fixes ensure positive zero is used. Testing of catan and catanh in all rounding modes is duly enabled. I expect there are various other bugs in special cases in __ieee754_* functions that are normally hidden by the wrappers but would show up for testing with -lieee (or in future with -fno-math-errno if we replace -lieee and _LIB_VERSION with compile-time redirection to new *_noerrno symbol names). Tested x86_64 and x86 and ulps updated accordingly. [BZ #16799] [BZ #16800] * math/s_catan.c (__catan): Avoid passing -0 denominator to atan2 with 0 numerator. * math/s_catanf.c (__catanf): Likewise. * math/s_catanh.c (__catanh): Likewise. * math/s_catanhf.c (__catanhf): Likewise. * math/s_catanhl.c (__catanhl): Likewise. * math/s_catanl.c (__catanl): Likewise. * sysdeps/ieee754/flt-32/e_logf.c (__ieee754_logf): Always divide by positive zero when computing -Inf result. * math/libm-test.inc (catan_test): Use ALL_RM_TEST. (catanh_test): Likewise. * sysdeps/i386/fpu/libm-test-ulps: Update. * sysdeps/x86_64/fpu/libm-test-ulps: Likewise.
* Fix clog / clog10 sign of zero result in round-downward mode (bug 16789).Joseph Myers2014-04-022-0/+192
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch fixes bug 16789, incorrect sign of (real part) zero result from clog and clog10 in round-downward mode, arising from that real part being computed as 0 - 0. To ensure that an underflow exception occurred, the code used an underflowing value (the next term in the series for log1p) in arithmetic computing the real part of the result, yielding the problematic 0 - 0 computation in some cases even when the mathematical result would be small but positive. The patch changes this code to use the math_force_eval approach to ensuring that an underflowing computation actually occurs. Tests of clog and clog10 are enabled in all rounding modes. Tested x86_64 and x86 and ulps updated accordingly. [BZ #16789] * math/s_clog.c (__clog): Use math_force_eval to ensure underflow instead of using underflowing value in computing result. * math/s_clog10.c (__clog10): Likewise. * math/s_clog10f.c (__clog10f): Likewise. * math/s_clog10l.c (__clog10l): Likewise. * math/s_clogf.c (__clogf): Likewise. * math/s_clogl.c (__clogl): Likewise. * math/libm-test.inc (clog_test): Use ALL_RM_TEST. (clog10_test): Likewise. * sysdeps/i386/fpu/libm-test-ulps: Update. * sysdeps/x86_64/fpu/libm-test-ulps: Likewise.
* Correct IBM long double nextafterl.Alan Modra2014-04-021-16/+33
| | | | | | | | | | | | Fix for values near a power of two, and some tidies. [BZ #16739] * sysdeps/ieee754/ldbl-128ibm/s_nextafterl.c (__nextafterl): Correct output when value is near a power of two. Use int64_t for lx and remove casts. Use decimal rather than hex exponent constants. Don't use long double multiplication when double will suffice. * math/libm-test.inc (nextafter_test_data): Add tests. * NEWS: Add 16739 and 16786 to bug list.
* Correct prefetch hint in power7 memrchr.Alan Modra2014-04-021-1/+1
| | | | | | Typo fix. * sysdeps/powerpc/powerpc64/power7/memrchr.S: Correct stream hint.
* Fix reference to toc symbol.Alan Modra2014-04-021-1/+1
| | | | | | | https://sourceware.org/ml/binutils/2014-03/msg00033.html removes the "magic" treatment of symbols defined in a .toc section. * sysdeps/powerpc/powerpc64/start.S: Add @toc to toc symbol reference.
* Fix s_copysign stack temp for PowerPC64 ELFv2Alan Modra2014-04-011-2/+2
| | | | | [BZ #16786] * sysdeps/powerpc/powerpc64/fpu/s_copysign.S: Don't trash stack.
* PowerPC: Fix little endian enconding for mfvsrdAdhemerval Zanella2014-03-315-0/+25
| | | | | This patch fixes the MFVSRD_R3_V1 macro that encodes 'mfvsrd r3,vs1' (to support old binutils) for little endian.
* Correct robust mutex / PI futex kernel assumptions (bug 9894).Joseph Myers2014-03-315-6/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch continues fixing __ASSUME_* issues in preparation for moving to a 2.6.32 minimum kernel version by addressing assumptions on robust mutex and PI futex support availability. Those assumptions are bug 9894, but to be clear this patch does not address all the issues from that bug about wrong version assumptions, only those still applicable for --enable-kernel=2.6.32 or later (with the expectation that the move to that minimum kernel will obsolete the other parts of the bug). The patch is independent of <https://sourceware.org/ml/libc-alpha/2014-03/msg00585.html>, my other pending-review patch preparing for the kernel version change; the two together complete all the changes I believe are needed in preparation regarding any macro in sysdeps/unix/sysv/linux/kernel-features.h that would be affected by such a change. (I have not checked the correctness of macros whose conditions are unaffected by such a change, or macros only defined in other kernel-features.h files.) As discussed in that bug, robust mutexes and PI futexes need futex_atomic_cmpxchg_inatomic to be implemented, in addition to certain syscalls needed for robust mutexes (and architecture-independent kernel pieces for all the features in question). That is, as I understand it, they need futex_atomic_cmpxchg_inatomic to *work* (not return an ENOSYS error). The issues identified in my analysis relate to ARM, M68K, MicroBlaze, MIPS and SPARC. On ARM, whether futex_atomic_cmpxchg_inatomic works depends on the kernel configuration. As of 3.13, the condition for *not* working is CONFIG_CPU_USE_DOMAINS && CONFIG_SMP. As of 2.6.32 it was simply CONFIG_SMP that meant the feature was not implemented. I don't know if there are any circumstances in which we can say "we can assume a userspace glibc binary built with these options will never run on a kernel with the problematic configuration", but at least for now I'm just undefining the relevant __ASSUME_* macros for ARM. On M68K, two of the three macros are undefined for kernels before 3.10, but as far as I can see __ASSUME_FUTEX_LOCK_PI is in the same group needing futex_atomic_cmpxchg_inatomic support and so should be undefined as well. On MicroBlaze the required support was added in 2.6.33. On MIPS, the support depends on cpu_has_llsc in the kernel - that is, actual hardware LL/SC support (GCC and glibc for MIPS GNU/Linux rely on the instructions being supported in some way, but it may be kernel emulation; futex_atomic_cmpxchg_inatomic doesn't work with that emulation). The same condition as in GCC for indicating LL/SC support may not be available is used for undefining the macros in glibc, __mips == 1 || defined _MIPS_ARCH_R5900. (Maybe we could in fact desupport MIPS processors without the hardware support in glibc.) On SPARC, 32-bit kernels don't support futex_atomic_cmpxchg_inatomic; __arch64__ || __sparc_v9__ is used as the condition for binaries that won't run on 32-bit kernels. This patch is not tested beyond the sanity check of an x86_64 build. [BZ #9894] * sysdeps/unix/sysv/linux/kernel-features.h [__sparc__ && !__arch64__ && !__sparc_v9__] (__ASSUME_SET_ROBUST_LIST): Do not define. [__sparc__ && !__arch64__ && !__sparc_v9__] (__ASSUME_FUTEX_LOCK_PI): Likewise. [__sparc__ && !__arch64__ && !__sparc_v9__] (__ASSUME_REQUEUE_PI): Likewise. * sysdeps/unix/sysv/linux/arm/kernel-features.h (__ASSUME_FUTEX_LOCK_PI): Undefine. (__ASSUME_REQUEUE_PI): Likewise. (__ASSUME_SET_ROBUST_LIST): Likewise. * sysdeps/unix/sysv/linux/m68k/kernel-features.h [__LINUX_KERNEL_VERSION < 0x030a00] (__ASSUME_FUTEX_LOCK_PI): Undefine. * sysdeps/unix/sysv/linux/microblaze/kernel-features.h [__LINUX_KERNEL_VERSION < 0x020621] (__ASSUME_FUTEX_LOCK_PI): Likewise. [__LINUX_KERNEL_VERSION < 0x020621] (__ASSUME_REQUEUE_PI): Likewise. [__LINUX_KERNEL_VERSION < 0x020621] (__ASSUME_SET_ROBUST_LIST): Likewise. * sysdeps/unix/sysv/linux/mips/kernel-features.h [__mips == 1 || _MIPS_ARCH_R5900] (__ASSUME_FUTEX_LOCK_PI): Undefine. [__mips == 1 || _MIPS_ARCH_R5900] (__ASSUME_REQUEUE_PI): Likewise. [__mips == 1 || _MIPS_ARCH_R5900] (__ASSUME_SET_ROBUST_LIST): Likewise.
* Fix futimesat for older MicroBlaze kernels (bug 16648).Joseph Myers2014-03-312-0/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Continuing the fixes for __ASSUME_* issues in preparation for moving to a 2.6.32 minimum kernel version, this *untested* patch fixes bug 16648, the definition of __ASSUME_ATFCTS meaning that the futimesat syscall is assumed for all MicroBlaze kernels despite not being present until 2.6.33. __ASSUME_ATFCTS controls conditionals relating to a lot of different syscalls in Linux-specific code (fstatat64 faccessat fchmodat fchownat futimesat newfstatat linkat mkdirat openat readlinkat renameat symlinkat unlinkat mknodat), where whether newfstatat fstatat64 futimesat are used depends on the architecture, as well as controlling whether openat64_not_cancel_3 is expected to work in sysdeps/posix/getcwd.c. The assumptions are all OK as of 2.6.32 except for this MicroBlaze case, and it's generally desirable to get rid of as many of the __ASSUME_ATFCTS conditionals as possible, to simplify the code (the fallbacks include potential unbounded dynamic stack allocations). Thus, rather than the simplest approach of undefining __ASSUME_ATFCTS for older kernels on MicroBlaze, this patch takes the approach of using the linux-generic implementation of futimesat for MicroBlaze kernels before 2.6.33 (all such kernels have the utimensat syscall). [BZ #16648] * sysdeps/unix/sysv/linux/microblaze/kernel-features.h [__LINUX_KERNEL_VERSION >= 0x020621] (__ASSUME_FUTIMESAT): Define. * sysdeps/unix/sysv/linux/microblaze/futimesat.c: New file.
* Fix x86/x86_64 expl/exp10l spurious underflows (bug 16348).Joseph Myers2014-03-272-4/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | This patch fixes bug 16348, spurious underflows from x86/x86_64 expl on arguments close to 0. These implementations effectively use expm1 (on the fractional part of the argument) internally, so resulting in spurious underflows when the result is very close to 1. For arguments small enough that the round-to-nearest correct result is 1, this patch uses 1+x instead. These implementations are also used for exp10l and so the patch fixes similar issues there (the 0x1p-67 threshold being small enough to be correct for exp10l as well as expl). But because of spurious underflows in other exp10 implementations (bug 16560), the tests aren't added for exp10 at this point - they can be added when the other exp10 parts of that bug are fixed. Tested x86_64 and x86; no ulps updates needed. [BZ #16348] * sysdeps/i386/fpu/e_expl.S (IEEE754_EXPL) [!USE_AS_EXPM1L]: Use 1+x for argument with exponent below -67. * sysdeps/x86_64/fpu/e_expl.S (IEEE754_EXPL) [!USE_AS_EXPM1L]: Likewise. * math/auto-libm-test-in: Add more tests of exp. * math/auto-libm-test-out: Regenerated.
* Make x86_64 fegetenv preserve exception mask (bug 16198).Joseph Myers2014-03-261-0/+3
| | | | | | | | | | | | | Bug 16198 is x86_64 fegetenv wrongly masking exceptions for which traps are enabled, because that's a side-effect of the fnstenv instruction. This patch fixes it to use fldenv immediately after fnstenv, like the i386 version. Tested x86_64 and x86. [BZ #16198] * sysdeps/x86_64/fpu/fegetenv.c (fegetenv): Use fldenv after fnstenv. * math/test-fenv-preserve.c: New file. * math/Makefile (tests): Add test-fenv-preserve.
* Update powerpc-fpu ULPs.Adhemerval Zanella2014-03-251-0/+874
|
* Fix use of uninitialized variableAndreas Schwab2014-03-251-5/+6
|
* Relax gen-auto-libm-tests may-underflow rules, test log1p in all rounding modes.Joseph Myers2014-03-252-0/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | gen-auto-libm-tests presently allows but does not require underflow exceptions for results with magnitude in the range (greatest subnormal, least normal]. In some cases, the magnitude of the exact result is very slightly above the least normal, but rounding in the implementation results in it effectively computing an infinite-precision result that is slightly below the least normal, so raising an underflow exception. This is in accordance with the documented accuracy goals, but results in testsuite failures. This patch changes the logic to allow underflows when the mathematical result is up to 0.5ulp above the least normal (so in any case where the round-to-nearest result is the least normal). Ideally underflows in all these cases would be accepted only when an underflow with the actual result is consistent with the rounding mode (in FE_TOWARDZERO mode, a return value of the least normal implies that the infinite-precision result did not underflow so there should be no underflow exception, for example), so as to match the documented goals more precisely - whereas at present the tests for exceptions are completely independent of the tests of the returned values. (The same applies to overflow exceptions as well - they too should be checked for consistency with the result, as in FE_TOWARDZERO mode a result 1ulp below the largest finite value should be inconsistent with an overflow exception and cause a failure with overflow rather than simply being considered a 1ulp error when overflow is expected.) But the present patch at least deals with the cases causing spurious failures so that (a) certain existing tests no longer need to be marked as having spurious exceptions (such markings in auto-libm-test-in end up applying to more cases than just those they are needed for) and (b) log1p can be tested in all rounding modes without introducing more such failures. This patch duly moves tests of log1p to ALL_RM_TEST. Tested x86_64 and x86 and ulps updated accordingly. [BZ #16357] [BZ #16599] * math/gen-auto-libm-tests.c (fp_format_desc): Add field min_plus_half. (fp_formats): Update initializers. (init_fp_formats): Initialize new field. (output_for_one_input_case): Allow underflow for results up to min_plus_half. * math/libm-test.inc (log1p_test): Use ALL_RM_TEST. * math/auto-libm-test-in: Don't mark some underflows from asin and atanh as spurious. * math/auto-libm-test-out: Regenerated. * sysdeps/i386/fpu/libm-test-ulps: Update. * sysdeps/x86_64/fpu/libm-test-ulps: Likewise.
* Fix implicit __isinf declarations in exp.Joseph Myers2014-03-242-0/+2
| | | | | | | | | | | | | | | My recent exp patch introduced warnings about implicit __isinf declarations in exp because e_exp.c didn't include <math.h>. This patch fixes this. Because <math.h> can't be included after <math_private.h> (because of macro definitions of __nan*), it was necessary to put an include in sysdeps/x86_64/fpu/multiarch/e_exp.c as well. Tested x86_64. * sysdeps/ieee754/dbl-64/e_exp.c: Include <math.h>. * sysdeps/x86_64/fpu/multiarch/e_exp.c [HAVE_FMA4_SUPPORT || HAVE_AVX_SUPPORT]: Likewise.
* S390: Fix namespace violation in struct stat (BZ #16714).Stefan Liebler2014-03-241-2/+2
|
* S390: Define SIZE_MAX as unsigned long (BZ #16712).Stefan Liebler2014-03-243-1/+7
|
* S390: Correct type of sa_flags in struct sigaction for POSIX conformanceStefan Liebler2014-03-241-1/+2
| | | | (BZ #16713).
* Fix use of half-initialized result in getaddrinfo when using nscd (bug 16743)Andreas Schwab2014-03-241-0/+8
| | | | | | | | | | | | | | | | | | This fixes a bug in the way the results from __nscd_getai are collected: for every returned result a new entry is first added to the gaih_addrtuple list, but if that result doesn't match the request this entry remains uninitialized. So for this non-matching result an extra result with uninitialized content is returned. To reproduce (with nscd running): $ getent ahostsv4 localhost 127.0.0.1 STREAM localhost 127.0.0.1 DGRAM 127.0.0.1 RAW (null) STREAM (null) DGRAM (null) RAW
* Account for alloca use when collecting interface addresses (bug 16002)Andreas Schwab2014-03-241-4/+28
| | | | | | | | | | | | To reproduce: # ip li add name dummy0 type dummy # site_id=$(head -c6 /dev/urandom | od -tx2 -An | tr ' ' ':') # for ((i = 0; i < 65536; i++)) do > ip ad ad $(printf fd80$site_id::%04x $i)/128 dev dummy0 > done # (ulimit -s 900; getent ahosts localhost) # ip li de dummy0
* Fix dbl-64 exp overflow/underflow in non-default rounding modes (bug 16284).Joseph Myers2014-03-243-143/+537
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The dbl-64 version of exp needs round-to-nearest mode for its internal computations, but that has the consequence of inappropriate overflowing and underflowing results in other rounding modes. This patch fixes this by recomputing the relevant results in cases where the round-to-nearest result overflows to infinity or underflows to zero (most of the diffs are actually just consequent reindentation). Tests are enabled in all rounding modes for complex functions using exp - but not for cexp because it turns out there are bugs causing spurious underflows for cexp for some tests, which will need to be fixed separately (I suspect ccos ccosh csin csinh ctan ctanh have similar bugs, just not shown by the present set of test inputs). Tested x86_64 and x86 and ulps updated accordingly. [BZ #16284] * sysdeps/ieee754/dbl-64/e_exp.c (__ieee754_exp): Use original rounding mode to recompute results that overflow to infinity or underflow to zero. * math/auto-libm-test-in: Don't mark tests as expected to fail for bug 16284. * math/auto-libm-test-out: Regenerated. * math/libm-test.inc (ccos_test): Use ALL_RM_TEST. (ccosh_test): Likewise. (csin_test_data): Use plus_oflow. (csin_test): Use ALL_RM_TEST. (csinh_test_data): Use plus_oflow. (csinh_test): Use ALL_RM_TEST. * sysdeps/i386/fpu/libm-test-ulps: Update. * sysdeps/x86_64/fpu/libm-test-ulps: Likewise.
* Fix -Wundef warnings for _ABI* on MIPS.Joseph Myers2014-03-213-0/+5
| | | | | | | | | | | | | | | | This patch fixes -Wundef warnings related to the _ABI* macros on MIPS. GCC predefines only the _ABI* macro related to the ABI actually in use, meaning that a conditional such as "#if _MIPS_SIM == _ABI64" is true only for the ABI in question (all the macros are nonzero), but produces a -Wundef warning for the other ABIs. The normal approach to using these macros is to include <sgidefs.h>, which ensures that all three _ABI* macros are defined rather than just one; this patch does so in the places that caused warnings (the bulk of the warnings arising from <bits/wordsize.h>). Tested that the warnings are fixed. * sysdeps/mips/bits/wordsize.h: Include <sgidefs.h>. * sysdeps/unix/sysv/linux/mips/getrlimit64.c: Likewise. * sysdeps/unix/sysv/linux/mips/setrlimit64.c: Likewise.
* Fix log (1) in round-downward mode (bug 16731).Joseph Myers2014-03-219-5/+69
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | According to ISO C Annex F, log (1) should be +0 in all rounding modes, but some implementations in glibc wrongly return -0 in round-downward mode (mapping to log1p (x - 1) is problematic because 1 - 1 is -0 in round-downward mode, and log1p (-0) is -0). This patch fixes this. (It helps with some implementations of other functions such as acosh, log2 and log10 that call out to log, but not enough to enable all-rounding-modes testing for those functions without further fixes to other implementations of them.) Tested x86_64 and x86 and ulps updated accordingly, and did spot tests for mips64 for the ldbl-128 fix, and i586 for the sysdeps/i386/fpu implementations shadowed by those in sysdeps/i386/i686/fpu. [BZ #16731] * sysdeps/i386/fpu/e_log.S (__ieee754_log): Take absolute value when x - 1 is zero. * sysdeps/i386/fpu/e_logf.S (__ieee754_logf): Likewise. * sysdeps/i386/fpu/e_logl.S (__ieee754_logl): Likewise. * sysdeps/i386/i686/fpu/e_logl.S (__ieee754_logl): Likewise. * sysdeps/ieee754/dbl-64/e_log.c (__ieee754_log): Return +0 when argument is 1. * sysdeps/ieee754/ldbl-128/e_logl.c (__ieee754_logl): Likewise. * sysdeps/x86_64/fpu/e_logl.S: Take absolute value when x - 1 is zero. * math/libm-test.inc (log_test): Use ALL_RM_TEST. * sysdeps/i386/fpu/libm-test-ulps: Update. * sysdeps/x86_64/fpu/libm-test-ulps: Likewise.
* Fix -Wundef warnins for __FP_FAST_FMA*Siddhesh Poyarekar2014-03-213-9/+9
| | | | | The macros are defined by the compiler, so we can only verify whether they are defined or not.
* PowerPC: optimized strpbrk for POWER7Adhemerval Zanella2014-03-206-1/+259
| | | | | | | | | This patch add an optimized strpbrk for POWER7 by using a different algorithm than default implementation: it constructs a table based on the 'accept' argument and use this table to check for any occurance on the input string. The idea is similar as x86_64 uses. For PowerPC some tunings were added, such as unroll loops and memory clear using VSX instructions.
* Test most libm functions in all rounding modes.Joseph Myers2014-03-212-0/+1166
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch makes libm-test.inc tests of most functions use ALL_RM_TEST unless there was some reason to defer that change for a particular function. I started out planning to defer the change for pow (bug 16315), cexp / ccos / ccosh / csin / csinh (likely fallout from exp, bug 16284) and cpow (exact expectations for signs of exact zero results not wanted). Testing on x86_64 and x86 showed additional failures for acosh, cacos, catan, catanh, clog, clog10, jn, log, log10, log1p, log2, tgamma, yn, so making the change for those functions was deferred as well, pending investigation to show which of these represent distinct bugs (some such bugs may already be filed) and appropriate fixing / XFAILing. Failures include wrong signs of zero results, errors slightly above the 9ulp bound (in such cases it may make sense for functions to set round-to-nearest internally to reduce error accumulation), large errors and incorrect overflow/underflow for the rounding mode (with consequent missing errno settings in some cases). It's possible some could be issues with test expectations, though I didn't notice any that were obviously like that (I added NO_TEST_INLINE for cases that were failing for ildoubl on x86 and where it seemed reasonable for them to fail for the fast-math inlines). There may of course be failures on other architectures for functions that didn't fail on x86_64 or x86, in which case the usual rule applies: file a bug (preferably identifying the underlying problem function, in cases where function A calls function B and a problem with function B may present in the test results for function A) if not already in Bugzilla then fix or XFAIL. Tested x86_64 and x86 and ulps updated accordingly. * math/libm-test.inc (asinh_test): Use ALL_RM_TEST. (atan_test): Likewise. (atanh_test_data): Use NO_TEST_INLINE for two tests. (atanh_test): Use ALL_RM_TEST. (atan2_test_data): Likewise. (cabs_test): Likewise. (cacosh_test): Likewise. (carg_test): Likewise. (casin_test): Likewise. (casinh_test): Likewise. (cbrt_test): Likewise. (csqrt_test): Likewise. (erf_test): Likewise. (erfc_test): Likewise. (pow10_test): Likewise. (exp2_test): Likewise. (hypot_test): Likewise. (j0_test): Likewise. (j1_test): Likewise. (lgamma_test): Likewise. (gamma_test): Likewise. (sincos_test): Likewise. (tanh_test): Likewise. (y0_test): Likewise. (y1_test): Likewise. * sysdeps/i386/fpu/libm-test-ulps: Update. * sysdeps/x86_64/fpu/libm-test-ulps: Likewise.
* PowerPC: optimized strcspn for PPC64/POWER7Adhemerval Zanella2014-03-206-1/+249
| | | | | | | | | | This patch add a optimized strcspn for POWER7 by using a different algorithm than default implementation: it constructs a table based on the 'accept' argument and use this table to check for any occurance on the input string. The idea is similar as x86_64 uses. For PowerPC some tunings were added, such as unroll loops and align stack memory to table to 16 bytes (so VSX clean can ran without alignment issues).
* Fix __ASSUME_PREADV and __ASSUME_PWRITEV for Alpha and MicroBlaze (bug 16649).Joseph Myers2014-03-192-1/+10
| | | | | | | | | | | | | | | | | | | | Reviewing (for all architectures, with a baseline kernel version of 2.6.32) the kernel support for features for which __ASSUME_* macros would be affected by a move to 2.6.32 as minimum kernel version showed up that __ASSUME_PREADV and __ASSUME_PWRITEV were wrongly defined for MicroBlaze (despite the corresponding syscall table entries not being wired up in the kernel) and Alpha for 2.6.30 and above (although the support on Alpha was added in 2.6.33). This patch makes the kernel-features.h files undefine those macros for appropriate versions. [BZ #16649] * sysdeps/unix/sysv/linux/alpha/kernel-features.h [__LINUX_KERNEL_VERSION < 0x020621] (__ASSUME_PREADV): Undefine. [__LINUX_KERNEL_VERSION < 0x020621] (__ASSUME_PWRITEV): Likewise. * sysdeps/unix/sysv/linux/microblaze/kernel-features.h (__ASSUME_PREADV): Undefine. (__ASSUME_PWRITEV): Likewise.
* Add comments about non-Linux use of bits/mman-linux.h.Roland McGrath2014-03-181-0/+7
|
* Move bits/mman-linux.h out of sysdeps/unix/sysv/linux/.Roland McGrath2014-03-181-108/+0
| | | | | This way, non-Linux ports using the Linux values for bits/mman.h constants need not duplicate the header.
* aarch64: Remove inaccurate comment from sysdep.hWill Newton2014-03-181-4/+0
| | | | | | | | | | This comment appears to have been copied from the ARM port where it makes more sense. 2014-03-18 Will Newton <will.newton@linaro.org> * sysdeps/unix/sysv/linux/aarch64/sysdep.h: Remove inaccurate comment.
* Revert "Fix HP_SMALL_TIMING_AVAIL -Wundef warnings"Will Newton2014-03-171-2/+2
| | | | This reverts commit 53f1bed39263541ef7f3d86f9701005524938016.
* Revert "Fix HAVE_RM_CTX -Wundef warnings"Will Newton2014-03-171-1/+1
| | | | This reverts commit 9290130a8de3f30970f741c79dfe8459f798e05f.
* Fix HAVE_RM_CTX -Wundef warningsWill Newton2014-03-171-1/+1
| | | | | | | | | | ChangeLog: 2014-03-17 Will Newton <will.newton@linaro.org> * sysdeps/generic/math_private.h: Check whether HAVE_RM_CTX is defined with #ifdef rather than #if.
* Fix HP_SMALL_TIMING_AVAIL -Wundef warningsWill Newton2014-03-171-2/+2
| | | | | | | | | | ChangeLog: 2014-03-17 Will Newton <will.newton@linaro.org> * sysdeps/generic/ldsodefs.h: Check whether HP_SMALL_TIMING_AVAIL is defined with #ifdef rather than #if.
* Compile with -Wundef.Roland McGrath2014-03-149-0/+9
|
* PowerPC: remove wrong roundl implementation for PowerPC64Adhemerval Zanella2014-03-141-132/+0
| | | | | | | | | | | | | | | | | The roundl assembly implementation (sysdeps/powerpc/powerpc64/fpu/s_roundl.S) returns wrong results for some inputs where first double is a exact integer and the precision is determined by second long double. Checking on implementation comments and history, I am very confident the assembly implementation was based on a version before commit 5c68d401698a58cf7da150d9cce769fa6679ba5f that fixes BZ#2423 (Errors in long double (ldbl-128ibm) rounding functions in glibc-2.4). By just removing the implementation and make the build select sysdeps/ieee754/ldbl-128ibm/s_roundl.c instead fixes the failing math. This fixes 16707.
* PowerPC: remove wrong nearbyintl implementation for PPC64Adhemerval Zanella2014-03-141-113/+0
| | | | | | | | | | | | | | | | | | The nearbyintl assembly implementation (sysdeps/powerpc/powerpc64/fpu/s_nearbyintl.S) returns wrong results for some inputs where first double is a exact integer and the precision is determined by second long double. Checking on implementation comments and history, I am very confident the assembly implementation was based on a version before commit 5c68d401698a58cf7da150d9cce769fa6679ba5f that fixes BZ#2423 (Errors in long double (ldbl-128ibm) rounding functions in glibc-2.4). By just removing the implementation and make the build select sysdeps/ieee754/ldbl-128ibm/s_nearbyintl.c instead fixes the failing math. Fixes BZ#16706.
* PowerPC: remove wrong ceill implementation for PowerPC64Adhemerval Zanella2014-03-141-132/+0
| | | | | | | | | | | | | | | | The ceill assembly implementation (sysdeps/powerpc/powerpc64/fpu/s_ceill.S) returns wrong results for some inputs where first double is a exact integer and the precision is determined by second long double. Checking on implementation comments and history, I am very confident the assembly implementation was based on a version before commit 5c68d401698a58cf7da150d9cce769fa6679ba5f that fixes BZ#2423 (Errors in long double (ldbl-128ibm) rounding functions in glibc-2.4). By just removing the implementation and make the build select sysdeps/ieee754/ldbl-128ibm/s_ceill.c instead fixes the failing math. Fixes BZ#16701.