about summary refs log tree commit diff
path: root/sysdeps/x86_64
Commit message (Collapse)AuthorAgeFilesLines
* Remove configure tests for assembler CFI support.Joseph Myers2014-06-262-57/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch removes configure tests for assembler CFI support (and thereby eliminates an architecture-specific case in the main configure.ac), instead assuming that support is present unconditionally. The main test was added in 2003 around the time CFI support was added to the assembler. cfi_personality and cfi_lsda support were added to the assembler in 2006. cfi_sections support was added in 2009, a few weeks before binutils 2.20 was released; it's in 2.20, the minimum supported version, so even that configure test is obsolete. Tested x86_64 that the installed shared libraries are unchanged by this patch. * configure.ac (libc_cv_asm_cfi_directives): Remove configure test. * configure: Regenerated. * config.h.in (HAVE_ASM_CFI_DIRECTIVES): Remove macro undefine. * sysdeps/arm/configure.ac (libc_cv_asm_cfi_directive_sections): Remove configure test. * sysdeps/arm/configure: Regenerated. * sysdeps/nptl/configure.ac: Do not check libc_cv_asm_cfi_directives. * sysdeps/nptl/configure: Regenerated. * sysdeps/x86_64/nptl/configure.ac: Remove file. * sysdeps/x86_64/nptl/configure: Remove generated file. * b/sysdeps/generic/sysdep.h [HAVE_ASM_CFI_DIRECTIVES]: Make code unconditional. [!HAVE_ASM_CFI_DIRECTIVES]: Remove conditional code.
* Fix Wundef warning for ELF_MACHINE_NO_RELASiddhesh Poyarekar2014-06-261-0/+1
| | | | | | | This patch defines ELF_MACHINE_NO_RELA on all architectures. Tested only on x86_64 to verify that the sources before and after are identical except for two instructions that pass the current line number in dl-machine.h to assert_fail.
* Fix exp10 spurious underflows (bug 16560).Joseph Myers2014-06-251-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | This patch fixes spurious underflows from exp10 for arguments near 0 (part of bug 16560; that bug also includes spurious underflows from exp2, which are not fixed by this patch). The problem is underflows in the internal computation converting the exp10 argument to arguments for exp (with extra precision), and the fix is simply to return 1 early for arguments near enough to 0 (just as arguments with large enough magnitude have their own overflow / underflow logic at the start of the function). Tested x86_64 and x86 and ulps updated accordingly; also tested for powerpc32 and mips64 to validate the ldbl-128ibm and ldbl-128 changes. [BZ #16560] * sysdeps/ieee754/dbl-64/e_exp10.c (__ieee754_exp10): Return 1 for arguments close to 0. * sysdeps/ieee754/ldbl-128/e_exp10l.c (__ieee754_exp10l): Likewise. * sysdeps/ieee754/ldbl-128ibm/e_exp10l.c (__ieee754_exp10l): Likewise. * math/auto-libm-test-in: Add more tests of exp10. * math/auto-libm-test-out: Regenerated. * sysdeps/x86_64/fpu/libm-test-ulps: Update.
* x86: Consolidate unnecessary nptl/ subdirectories.Roland McGrath2014-06-243-7/+0
|
* Fix x86/x86_64 expm1l spurious underflow exceptions (bug 16539).Joseph Myers2014-06-241-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | This patch fixes bug 16539, spurious underflow exceptions from x86 / x86-64 expm1l. The problem is that the computation of a base-2 exponent with extra precision involves spurious underflows for arguments that are small but not subnormal, so a check is added to just return the argument in those cases. (If the argument *is* subnormal, underflowing is correct and the existing code will always underflow, so it suffices to keep using the existing code in that case; some expm1 implementations have a bug (bug 16353) with missing underflow exceptions, but I don't think there's such a bug in this particular version.) Tested x86_64 and x86; no ulps updates needed. (auto-libm-test-out diffs omitted below.) [BZ #16539] * sysdeps/i386/fpu/e_expl.S (IEEE754_EXPL) [USE_AS_EXPM1L]: Just return the argument for normal arguments with exponent below -64. * sysdeps/x86_64/fpu/e_expl.S (IEEE754_EXPL) [USE_AS_EXPM1L]: Likewise. * math/auto-libm-test-in: Add another test of expm1. * math/auto-libm-test-out: Regenerated.
* Test cpow in all rounding modes.Joseph Myers2014-06-231-0/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch enables testing of cpow in all rounding modes using ALL_RM_TEST. There were two reasons this was previously deferred: * MPC has complicated rounding-mode-dependent rules for the signs of exact zero real or imaginary parts in the result of mpc_pow. Annex G does not impose any such requirements and I don't think glibc should try to implement any particular logic here. This patch adds support for gen-auto-libm-tests passing the IGNORE_ZERO_INF_SIGN flag to libm-test.inc. * Error accumulations in some tests in non-default rounding modes exceed the maximum error permitted in libm-test.inc. This patch marks the problem tests with xfail-rounding. (It might be possible to reduce the accumulations a bit by using round-to-nearest when cpow calls clog, but I don't think there's much point; the implementation approach for cpow is fundamentally deficient, as discussed in the existing bug for cpow inaccuracy which can reasonably be considered to cover these less-inaccurate cases as well. It's possible that the test "cpow 2 0 10 0" will also need xfail-rounding on some platforms.) Tested x86_64 and x86 and ulps updated accordingly. * math/gen-auto-libm-tests.c: Document use of ignore-zero-inf-sign. (input_flag_type): Add value flag_ignore_zero_inf_sign. (input_flags): Add ignore-zero-inf-sign. (output_for_one_input_case): Handle flag_ignore_zero_inf_sign. * math/gen-libm-test.pl (generate_testfile): Handle ignore-zero-inf-sign. * math/auto-libm-test-in: Mark some cpow tests with ignore-zero-inf-sign and some with xfail-rounding. * math/auto-libm-test-out: Regenerated. * math/libm-test.inc (cpow_test): Use ALL_RM_TEST. * sysdeps/i386/fpu/libm-test-ulps: Update. * sysdeps/x86_64/fpu/libm-test-ulps: Likewise.
* Fix pow overflow in non-default rounding modes (bug 16315).Joseph Myers2014-06-233-52/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch fixes bug 16315, bad pow handling of overflow/underflow in non-default rounding modes. Tests of pow are duly converted to ALL_RM_TEST to run all tests in all rounding modes. There are two main issues here. First, various implementations compute a negative result by negating a positive result, but this yields inappropriate overflow / underflow values for directed rounding, so either overflow / underflow results need recomputing in the correct sign, or the relevant overflowing / underflowing operation needs to be made to have a result of the correct sign. Second, the dbl-64 implementation sets FE_TONEAREST internally; in the overflow / underflow case, the result needs recomputing in the original rounding mode. Tested x86_64 and x86 and ulps updated accordingly. [BZ #16315] * sysdeps/i386/fpu/e_pow.S (__ieee754_pow): Ensure possibly overflowing or underflowing operations take place with sign of result. * sysdeps/i386/fpu/e_powf.S (__ieee754_powf): Likewise. * sysdeps/i386/fpu/e_powl.S (__ieee754_powl): Likewise. * sysdeps/ieee754/dbl-64/e_pow.c: Include <math.h>. (__ieee754_pow): Recompute overflowing and underflowing results in original rounding mode. * sysdeps/x86/fpu/powl_helper.c: Include <stdbool.h>. (__powl_helper): Allow negative argument X and scale negated value as needed. Avoid passing value outside [-1, 1] to f2xm1. * sysdeps/x86_64/fpu/e_powl.S (__ieee754_powl): Ensure possibly overflowing or underflowing operations take place with sign of result. * sysdeps/x86_64/fpu/multiarch/e_pow.c [HAVE_FMA4_SUPPORT]: Include <math.h>. * math/auto-libm-test-in: Add more tests of pow. * math/auto-libm-test-out: Regenerated. * math/libm-test.inc (pow_test): Use ALL_RM_TEST. (pow_tonearest_test_data): Remove. (pow_test_tonearest): Likewise. (pow_towardzero_test_data): Likewise. (pow_test_towardzero): Likewise. (pow_downward_test_data): Likewise. (pow_test_downward): Likewise. (pow_upward_test_data): Likewise. (pow_test_upward): Likewise. (main): Don't call removed functions. * sysdeps/i386/fpu/libm-test-ulps: Update. * sysdeps/x86_64/fpu/libm-test-ulps: Likewise.
* Clean up stack-coloring macros.Roland McGrath2014-06-202-7/+1
|
* Include <kernel-features.h> explicitly where required.Joseph Myers2014-06-201-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | This patch makes files using __ASSUME_* macros include <kernel-features.h> explicitly, rather than relying on some other header (such as tls.h, lowlevellock.h or pthreadP.h) to include it implicitly. (I omitted cases where I've already posted or am testing the patch that stops the file from needing __ASSUME_* at all.) This accords with the general principle of making source files include the headers for anything they use, and also helps make it safe to remove <kernel-features.h> includes from any file that doesn't use __ASSUME_* (some of those may be stray includes left behind after increasing the minimum kernel version, others may never have been needed or may have become obsolete after some other change). Tested x86_64 that the disassembly of installed shared libraries is unchanged by this patch. * nptl/pthread_cond_wait.c: Include <kernel-features.h>. * nptl/pthread_rwlock_timedrdlock.c: Likewise. * nptl/pthread_rwlock_timedwrlock.c: Likewise. * nptl/sysdeps/unix/sysv/linux/lowlevelrobustlock.c: Likewise. * nscd/nscd.c: Likewise. * sysdeps/i386/nptl/tcb-offsets.sym: Likewise. * sysdeps/powerpc/nptl/tcb-offsets.sym: Likewise. * sysdeps/sh/nptl/tcb-offsets.sym: Likewise. * sysdeps/x86_64/nptl/tcb-offsets.sym: Likewise.
* Add ifunc tests for x86_64 memset_chk and memsetH.J. Lu2014-06-202-1/+12
| | | | | | | | | | | | This patch adds ifunc tests for x86_64 memset_chk and memset. It also defines HAS_AVX2 with AVX2_Usable since AVX2 may not be usable even if processor has AVX2. * sysdeps/x86_64/multiarch/ifunc-impl-list.c (__libc_ifunc_impl_list): Add tests for memset_chk and memset. * sysdeps/x86_64/multiarch/init-arch.h (HAS_AVX2): Defined with AVX2_Usable.
* Remove sysdeps/x86_64/multiarch/rtld-strlen.SH.J. Lu2014-06-201-1/+0
| | | | | | | Since there is no sysdeps/x86_64/multiarch/strlen.S, sysdeps/x86_64/rtld-strlen.S will be used. * sysdeps/x86_64/multiarch/rtld-strlen.S: Removed.
* Add x86_64 memset optimized for AVX2Ling Ma2014-06-195-1/+275
| | | | | | | | | | | | | | | In this patch we take advantage of HSW memory bandwidth, manage to reduce miss branch prediction by avoiding using branch instructions and force destination to be aligned with avx & avx2 instruction. The CPU2006 403.gcc benchmark indicates this patch improves performance from 26% to 59%. * sysdeps/x86_64/multiarch/Makefile: Add memset-avx2. * sysdeps/x86_64/multiarch/memset-avx2.S: New file. * sysdeps/x86_64/multiarch/memset.S: Likewise. * sysdeps/x86_64/multiarch/memset_chk.S: Likewise. * sysdeps/x86_64/multiarch/rtld-memset.S: Likewise.
* Fix __ieee754_logl (-LDBL_MAX) in FE_DOWNWARD mode (bug 17022).Joseph Myers2014-06-181-1/+4
| | | | | | | | | | | | | | | | | | | This patch fixes __ieee754_logl (-LDBL_MAX) on x86_64 and x86 not to subtract 1 from its argument and so cause spurious overflow in FE_DOWNWARD mode. (For any argument strictly less than -1, it doesn't matter whether or not 1 is subtracted before computing log1p, as long as the result doesn't overflow to -Inf.) Tested x86_64 and x86. (This particular case lacks test coverage, since the testsuite doesn't cover -lieee, but it will be covered by tests after the following patch to test pow in all rounding modes, which was the context in which this bug was found.) [BZ #17022] * sysdeps/i386/fpu/e_logl.S (__ieee754_logl): Do not subtract 1 from arguments -2 or below. * sysdeps/i386/i686/fpu/e_logl.S (__ieee754_logl): Likewise. * sysdeps/x86_64/fpu/e_logl.S (__ieee754_logl): Likewise.
* Move i386 code out of nptl/ subdirectory.Roland McGrath2014-06-121-1/+1
|
* Move x86_64 code out of nptl/ subdirectory.Roland McGrath2014-06-1113-0/+738
|
* Fix log2 (1) in round-downward mode (bug 17042).Joseph Myers2014-06-102-1/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | As with other issues of this kind, bug 17042 is log2 (1) wrongly returning -0 instead of +0 in round-downward mode because of implementations effectively in terms of log1p (x - 1). This patch fixes the issue in the same way used for log and log10. Tested x86_64 and x86 and ulps updated accordingly. Also tested for mips64 to confirm a fix was needed for ldbl-128 and to validate that fix (also applied to ldbl-128ibm since that version of log2l is essentially the same as the ldbl-128 one). [BZ #17042] * sysdeps/i386/fpu/e_log2.S (__ieee754_log2): Take absolete value when x - 1 is zero. * sysdeps/i386/fpu/e_log2f.S (__ieee754_log2f): Likewise. * sysdeps/i386/fpu/e_log2l.S (__ieee754_log2l): Likewise. * sysdeps/ieee754/ldbl-128/e_log2l.c (__ieee754_log2l): Return 0.0L for an argument of 1.0L. * sysdeps/ieee754/ldbl-128ibm/e_log2l.c (__ieee754_log2l): Likewise. * sysdeps/x86_64/fpu/e_log2l.S (__ieee754_log2l): Take absolute value when x - 1 is zero. * math/libm-test.inc (log2_test): Use ALL_RM_TEST. * sysdeps/i386/fpu/libm-test-ulps: Update. * sysdeps/x86_64/fpu/libm-test-ulps: Likewise.
* Replace __int128 with __int128_tMarko Myllynen2014-05-301-1/+1
| | | | | * sysdeps/x86_64/link-defines.sym (BND_SIZE): Replace __int128 with __int128_t.
* Fix log10 (1) in round-downward mode (bug 16977).Joseph Myers2014-05-232-1/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | As with various other issues of this kind, bug 16977 is log10 (1) wrongly returning -0 rather than +0 in round-downward mode because of an implementation effectively in terms of log1p (x - 1). This patch fixes the issue in the same way used for log. Tested x86_64 and x86 and ulps updated accordingly. Also tested for mips64 to confirm a fix was needed for ldbl-128 and to validate that fix (also applied to ldbl-128ibm since that version of logl is essentially the same as the ldbl-128 one). [BZ #16977] * sysdeps/i386/fpu/e_log10.S (__ieee754_log10): Take absolute value when x - 1 is zero. * sysdeps/i386/fpu/e_log10f.S (__ieee754_log10f): Likewise. * sysdeps/i386/fpu/e_log10l.S (__ieee754_log10l): Likewise. * sysdeps/ieee754/ldbl-128/e_log10l.c (__ieee754_log10l): Return 0.0L for an argument of 1.0L. * sysdeps/ieee754/ldbl-128ibm/e_log10l.c (__ieee754_log10l): Likewise. * sysdeps/x86_64/fpu/e_log10l.S (__ieee754_log10l): Take absolute value when x - 1 is zero. * math/libm-test.inc (log10_test): Use ALL_RM_TEST. * sysdeps/i386/fpu/libm-test-ulps: Update. * sysdeps/x86_64/fpu/libm-test-ulps: Likewise.
* Move NPTL public ABI headers for x86 to sysdeps/x86/nptl/.Roland McGrath2014-05-141-0/+1
|
* Fix log1pl (LDBL_MAX) in FE_UPWARD mode (bug 16564).Joseph Myers2014-05-141-1/+6
| | | | | | | | | | | | | | | | | | | | | | | Bug 16564 is spurious overflow of log1pl (LDBL_MAX) in FE_UPWARD mode, resulting from log1pl adding 1 to its argument (for arguments not close to 0), which overflows in that mode. This patch fixes this by avoiding adding 1 to large arguments (precisely what counts as large depends on the floating-point format). Tested x86_64 and x86, and spot-checked log1pl tests on mips64 and powerpc64. [BZ #16564] * sysdeps/i386/fpu/s_log1pl.S (__log1pl): Do not add 1 to positive arguments with exponent 65 or above. * sysdeps/ieee754/ldbl-128/s_log1pl.c (__log1pl): Do not add 1 to arguments 0x1p113L or above. * sysdeps/ieee754/ldbl-128ibm/s_log1pl.c (__log1pl): Do not add 1 to arguments 0x1p107L or above. * sysdeps/x86_64/fpu/s_log1pl.S (__log1pl): Do not add 1 to positive arguments with exponent 65 or above. * math/auto-libm-test-in: Add more tests of log1p. * math/auto-libm-test-out: Regenerated.
* Fix cacos (+Inf + finite*i) in round-downward mode (bug 16928).Joseph Myers2014-05-141-0/+48
| | | | | | | | | | | | | | | | | | | | | According to C99/C11 Annex G, cacos applied to a value with real part +Inf and finite imaginary part should produce a result with real part +0. glibc wrongly produces a result with real part -0 in FE_DOWNWARD mode. This patch fixes this by checking for zero results in the relevant case of non-finite arguments (where there should never be a result with -0 real part), and converts the tests of cacos to ALL_RM_TEST. Tested x86_64 and x86 and ulps updated accordingly. [BZ #16928] * math/s_cacos.c (__cacos): Ensure zero real part of result from non-finite arguments is +0. * math/s_cacosf.c (__cacosf): Likewise. * math/s_cacosl.c (__cacosl): Likewise. * math/libm-test.inc (cacos_test): Use ALL_RM_TEST. * sysdeps/i386/fpu/libm-test-ulps: Update. * sysdeps/x86_64/fpu/libm-test-ulps: Likewise.
* Fix acosh (1) in round-downward mode (bug 16927).Joseph Myers2014-05-141-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | According to C99 and C11 Annex F, acosh (1) should be +0 in all rounding modes. However, some implementations in glibc wrongly return -0 in round-downward mode (which is what you get if you end up computing log1p (-0), via 1 - 1 being -0 in round-downward mode). This patch fixes the problem implementations, by correcting the test for an exact 1 value in the ldbl-96 implementation to allow for the explicit high bit of the mantissa, and by inserting fabs instructions in the i386 implementations; tests of acosh are duly converted to ALL_RM_TEST. I believe all the other sysdeps/ieee754 implementations are already OK (I haven't checked the ia64 versions, but if buggy then that will be obvious from the results of test runs after this patch is in). Tested x86_64 and x86 and ulps updated accordingly. [BZ #16927] * sysdeps/i386/fpu/e_acosh.S (__ieee754_acosh): Use fabs on x-1 value. * sysdeps/i386/fpu/e_acoshf.S (__ieee754_acoshf): Likewise. * sysdeps/i386/fpu/e_acoshl.S (__ieee754_acoshl): Likewise. * sysdeps/ieee754/ldbl-96/e_acoshl.c (__ieee754_acoshl): Correct for explicit high bit of mantissa when testing for argument equal to 1. * math/libm-test.inc (acosh_test): Use ALL_RM_TEST. * sysdeps/i386/fpu/libm-test-ulps: Update. * sysdeps/x86_64/fpu/libm-test-ulps: Likewise.
* Fix -Wundef warning for FEATURE_INDEX_1.Carlos O'Donell2014-05-031-7/+6
| | | | | | | | Define FEATURE_INDEX_1 and FEATURE_INDEX_MAX as macros for use by both assembly and C code. This fixes the -Wundef error for cases where FEATURE_INDEX_1 was not defined but used the correct value of 0 for an undefined macro.
* Detect if AVX2 is usableSihai Yao2014-04-173-0/+12
| | | | | | | | | | | | | | | This patch checks and sets bit_AVX2_Usable in __cpu_features.feature. * sysdeps/x86_64/multiarch/ifunc-defines.sym (COMMON_CPUID_INDEX_7): New. * sysdeps/x86_64/multiarch/init-arch.c (__init_cpu_features): Check and set bit_AVX2_Usable. * sysdeps/x86_64/multiarch/init-arch.h (bit_AVX2_Usable): New macro. (bit_AVX2): Likewise. (index_AVX2_Usable): Likewise. (CPUID_AVX2): Likewise. (HAS_AVX2): Likewise.
* Save/restore bound registers for _dl_runtime_profileIgor Zamyatin2014-04-163-0/+56
| | | | | | | | | | | | | | | | | This patch saves and restores bound registers in x86-64 PLT for ld.so profile and LD_AUDIT: * sysdeps/x86_64/bits/link.h (La_x86_64_regs): Add lr_bnd. (La_x86_64_retval): Add lrv_bnd0 and lrv_bnd1. * sysdeps/x86_64/dl-trampoline.S (_dl_runtime_profile): Save Intel MPX bound registers before _dl_profile_fixup. * sysdeps/x86_64/dl-trampoline.h: Restore Intel MPX bound registers after _dl_profile_fixup. Save and restore bound registers bnd0/bnd1 when calling _dl_call_pltexit. * sysdeps/x86_64/link-defines.sym (BND_SIZE): New. (LR_BND_OFFSET): Likewise. (LRV_BND0_OFFSET): Likewise. (LRV_BND1_OFFSET): Likewise.
* 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.
* Factor mmap/munmap of PT_LOAD segments out of _dl_map_object_from_fd et al.Roland McGrath2014-04-031-2/+2
|
* Fix catan, catanh, __ieee754_logf in round-downward mode (bug 16799, bug 16800).Joseph Myers2014-04-021-0/+96
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-021-0/+96
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Fix x86/x86_64 expl/exp10l spurious underflows (bug 16348).Joseph Myers2014-03-271-2/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Relax gen-auto-libm-tests may-underflow rules, test log1p in all rounding modes.Joseph Myers2014-03-251-0/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-241-0/+1
| | | | | | | | | | | | | | | 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.
* Fix dbl-64 exp overflow/underflow in non-default rounding modes (bug 16284).Joseph Myers2014-03-241-0/+192
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 log (1) in round-downward mode (bug 16731).Joseph Myers2014-03-212-1/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Test most libm functions in all rounding modes.Joseph Myers2014-03-211-0/+592
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Check AVX-512 assembler support firstH.J. Lu2014-03-142-35/+35
| | | | | | | | | | | It checks AVX-512 assembler support first and sets libc_cv_cc_avx512 to $libc_cv_asm_avx512, instead of yes. GCC won't support AVX-512 if assembler doesn't support it. * sysdeps/x86_64/configure.ac: Check AVX-512 assembler support first. Disable AVX-512 GCC support if assembler doesn't support it. * sysdeps/x86_64/configure: Regenerated.
* Save and restore AVX-512 zmm registers to x86-64 ld.soIgor Zamyatin2014-03-139-40/+570
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | AVX-512 ISA adds 512-bit zmm registers. This patch updates _dl_runtime_profile to pass zmm registers to run-time audit. It also changes _dl_x86_64_save_sse and _dl_x86_64_restore_sse to upport zmm registers, which are called when only when RTLD_PREPARE_FOREIGN_CALL is used. Its performance impact is minimum. * config.h.in (HAVE_AVX512_SUPPORT): New #undef. (HAVE_AVX512_ASM_SUPPORT): Likewise. * sysdeps/x86_64/bits/link.h (La_x86_64_zmm): New. (La_x86_64_vector): Add zmm. * sysdeps/x86_64/Makefile (tests): Add tst-audit10. (modules-names): Add tst-auditmod10a and tst-auditmod10b. ($(objpfx)tst-audit10): New target. ($(objpfx)tst-audit10.out): Likewise. (tst-audit10-ENV): New. (AVX512-CFLAGS): Likewise. (CFLAGS-tst-audit10.c): Likewise. (CFLAGS-tst-auditmod10a.c): Likewise. (CFLAGS-tst-auditmod10b.c): Likewise. * sysdeps/x86_64/configure.ac: Set config-cflags-avx512, HAVE_AVX512_SUPPORT and HAVE_AVX512_ASM_SUPPORT. * sysdeps/x86_64/configure: Regenerated. * sysdeps/x86_64/dl-trampoline.S (_dl_runtime_profile): Add AVX-512 zmm register support. (_dl_x86_64_save_sse): Likewise. (_dl_x86_64_restore_sse): Likewise. * sysdeps/x86_64/dl-trampoline.h: Updated to support different size vector registers. * sysdeps/x86_64/link-defines.sym (YMM_SIZE): New. (ZMM_SIZE): Likewise. * sysdeps/x86_64/tst-audit10.c: New file. * sysdeps/x86_64/tst-auditmod10a.c: Likewise. * sysdeps/x86_64/tst-auditmod10b.c: Likewise.
* Don't include individual test ulps in libm-test-ulps.Joseph Myers2014-03-051-17415/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As recently discussed <https://sourceware.org/ml/libc-alpha/2014-02/msg00670.html>, it doesn't seem particularly useful for libm-test-ulps files to contain huge amounts of data on ulps for individual tests; just the global maximum observed ulps for each function, together with the verification of exceptions, errno and special results such as infinities and NaNs for each test, suffices to verify that a function's behavior on the given test inputs is within the expected accuracy. Removing this data reduces source tree churn caused by updates to these files when libm tests are added, and reduces the frequency with which testsuite additions actually need libm-test-ulps changes at all. Accordingly, this patch removes that data, so that individual tests get checked against the global bounds for the given function and only generate an error if those are exceeded. Tested x86_64 (including verifying that if an ulps value is artificially reduced, the tests do indeed fail as they should and "make regen-ulps" generates the expected changes). * math/libm-test.inc (struct ulp_data): Don't refer to ulps for individual tests in comment. (libm-test-ulps.h): Don't refer to test_ulps in #include comment. (prev_max_error): New variable. (prev_real_max_error): Likewise. (prev_imag_max_error): Likewise. (compare_ulp_data): Don't refer to test names in comment. (find_test_ulps): Remove function. (find_function_ulps): Likewise. (find_complex_function_ulps): Likewise. (init_max_error): Take function name as argument. Look up ulps for that function. (print_ulps): Remove function. (print_max_error): Use prev_max_error instead of calling find_function_ulps. (print_complex_max_error): Use prev_real_max_error and prev_imag_max_error instead of calling find_complex_function_ulps. (check_float_internal): Take max_ulp parameter instead of calling find_test_ulps. Don't call print_ulps. (check_float): Update call to check_float_internal. (check_complex): Update calls to check_float_internal. (START): Pass argument to init_max_error. * math/gen-libm-test.pl (%results): Don't include "kind" information. (parse_ulps): Don't handle ulps of individual tests. (print_ulps_file): Likewise. (output_ulps): Likewise. * math/README.libm-test: Update. * manual/libm-err-tab.pl (parse_ulps): Don't handle ulps of individual tests. * sysdeps/aarch64/libm-test-ulps: Remove individual test ulps. * sysdeps/alpha/fpu/libm-test-ulps: Likewise. * sysdeps/arm/libm-test-ulps: Likewise. * sysdeps/i386/fpu/libm-test-ulps: Likewise. * sysdeps/ia64/fpu/libm-test-ulps: Likewise. * sysdeps/m68k/coldfire/fpu/libm-test-ulps: Likewise. * sysdeps/m68k/m680x0/fpu/libm-test-ulps: Likewise. * sysdeps/microblaze/libm-test-ulps: Likewise. * sysdeps/mips/mips32/libm-test-ulps: Likewise. * sysdeps/mips/mips64/libm-test-ulps: Likewise. * sysdeps/powerpc/fpu/libm-test-ulps: Likewise. * sysdeps/powerpc/nofpu/libm-test-ulps: Likewise. * sysdeps/s390/fpu/libm-test-ulps: Likewise. * sysdeps/sh/libm-test-ulps: Likewise. * sysdeps/sparc/fpu/libm-test-ulps: Likewise. * sysdeps/tile/libm-test-ulps: Likewise. * sysdeps/x86_64/fpu/libm-test-ulps: Likewise. * sysdeps/hppa/fpu/libm-test-ulps: Remove individual test ulps.
* Fix sign of input to bsloww1 (BZ #16623)Siddhesh Poyarekar2014-02-271-0/+44
| | | | | | | | In 84ba214c, I removed some redundant sign computations and in the process, I incorrectly got rid of a temporary variable, thus passing the absolute value of the input to bsloww1. This caused #16623. This fix undoes the incorrect change.
* Move tests of clog10 from libm-test.inc to auto-libm-test-in.Joseph Myers2014-02-191-4/+3507
| | | | | | | | | | | | | | | | | | This patch moves tests of clog10 to auto-libm-test-in. Note that this means gen-auto-libm-tests will now depend on the recent MPC 1.0.2 release which added a fix for a bug that made gen-auto-libm-tests hang for clog10. (It still can't conveniently be used for cacos cacosh casin casinh catan catanh csin csinh because of extreme slowness of those functions for special cases in MPC; at least some slow cases of csin / csinh are fixed in MPC trunk, but not in a release.) Tested x86_64 and x86 and ulps updated accordingly. * math/auto-libm-test-in: Add tests of clog10. * math/auto-libm-test-out: Regenerated. * math/libm-test.inc (clog10_test_data): Use AUTO_TESTS_c_c. * sysdeps/i386/fpu/libm-test-ulps: Update. * sysdeps/x86_64/fpu/libm-test-ulps: Likewise.
* Fix gen-auto-libm-tests sticky bit setting for negative results.Joseph Myers2014-02-181-0/+69
| | | | | | | | | | | | | | | | | | | | | | | | | | | gen-auto-libm-tests has a bug in the logic for setting a sticky bit based on the ternary value from MPFR: it is correct for positive results, but for negative results mpz_setbit acts as if a two's complement representation is used, whereas the low bit needs setting based on the sign-magnitude representation GMP actually uses. (This showed up in converting fma tests to use auto-libm-test-in / gen-auto-libm-tests.) This patch fixes the problem by negating the mpz_t value to set its low bit. There are lots of changes to auto-libm-test-out (mainly 1ulp fixes to ldbl-128 expected results), but only a few ulps updates are needed on x86 / x86_64. In one case, a corrected expectation showed up a spurious underflow exception where the correct result is slightly outside the underflowing range. Tested x86_64 and x86 and ulps updated accordingly. * math/gen-auto-libm-tests.c (adjust_real): Ensure integers are non-negative before setting low bit. * math/auto-libm-test-in: Mark one asin test possibly having spurious underflow. * math/auto-libm-test-out: Regenerated. * sysdeps/i386/fpu/libm-test-ulps: Update. * sysdeps/x86_64/fpu/libm-test-ulps: Likewise.
* Update x86_64 libm-test-ulps on AMD family 21h model 1 (bug 16545).Dylan Alex Simon2014-02-121-16/+63
|
* Regenerate x86_64 ulps.Joseph Myers2014-02-111-0/+3
|
* Use glibc_likely instead __builtin_expect.Ondřej Bílka2014-02-102-12/+12
|
* Update x86_64 ULPs (AMD family 21, model 2)Eric Wong2014-02-041-3/+161
| | | | Tested on an AMD FX-8320 CPU
* Update x86_64 ULPs (AMD Family 10h)Eric Wong2014-02-041-2/+611
|
* Include generic symbol-hacks.h for x32H.J. Lu2014-01-201-1/+1
| | | | | | In BZ #15605 fix with addding memset/memmove alias in symbol-hacks.h, x32 symbol-hacks.h change was missing. Fixed by including <sysdeps/generic/symbol-hacks.h> in x32 symbol-hacks.h.
* Regenerate x86 / x86_64 ulps.Joseph Myers2014-01-011-2979/+16
|
* Update copyright notices with scripts/update-copyrightsAllan McRae2014-01-01165-165/+165
|