about summary refs log tree commit diff
path: root/sysdeps
Commit message (Collapse)AuthorAgeFilesLines
* Optimize i386 syscall inlining for GCC 5H.J. Lu2015-10-152-11/+107
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since GCC 5 and above can properly spill %ebx when needed, we can inline syscalls with 6 arguments if GCC 5 or above is used to compile glibc. This patch rewrites INTERNAL_SYSCALL macros and skips __libc_do_syscall for GCC 5. For sysdeps/unix/sysv/linux/i386/brk.c, with -O2 -march=i686 -mtune=generic, GCC 5.2 now generates: <__brk>: 0: push %ebx 1: mov $0x2d,%eax 6: mov 0x8(%esp),%ebx a: call b <__brk+0xb> b: R_386_PC32 __x86.get_pc_thunk.dx f: add $0x2,%edx 11: R_386_GOTPC _GLOBAL_OFFSET_TABLE_ 15: call *%gs:0x10 1c: mov 0x0(%edx),%edx 1e: R_386_GOT32 __curbrk 22: cmp %eax,%ebx 24: mov %eax,(%edx) 26: ja 30 <__brk+0x30> 28: xor %eax,%eax 2a: pop %ebx 2b: ret instead of <__brk>: 0: push %ebx 1: mov 0x8(%esp),%ecx 5: call 6 <__brk+0x6> 6: R_386_PC32 __x86.get_pc_thunk.bx a: add $0x2,%ebx c: R_386_GOTPC _GLOBAL_OFFSET_TABLE_ 10: xchg %ecx,%ebx 12: mov $0x2d,%eax 17: call *%gs:0x10 1e: xchg %ecx,%ebx 20: mov %eax,%edx 22: mov 0x0(%ebx),%eax 24: R_386_GOT32 __curbrk 28: mov %edx,(%eax) 2a: xor %eax,%eax 2c: cmp %edx,%ecx 2e: ja 38 <__brk+0x38> 30: pop %ebx 31: ret The new one is shorter by 2 instructions. * sysdeps/unix/sysv/linux/i386/libc-do-syscall.S (__libc_do_syscall): Defined only if !__GNUC_PREREQ (5,0). * sysdeps/unix/sysv/linux/i386/sysdep.h: Define assembler macros only if !__GNUC_PREREQ (5,0). (INTERNAL_SYSCALL_MAIN_6): Optimize for GCC 5. (INTERNAL_SYSCALL_MAIN_INLINE): Likewise. (INTERNAL_SYSCALL_NCS): Likewise. (LOADREGS_0): New macro for GCC 5. (ASMARGS_0): Likewise. (LOADREGS_1): Likewise. (ASMARGS_1): Likewise. (LOADREGS_2): Likewise. (ASMARGS_2): Likewise. (LOADREGS_3): Likewise. (ASMARGS_3): Likewise. (LOADREGS_4): Likewise. (ASMARGS_4): Likewise. (LOADREGS_5): Likewise. (ASMARGS_5): Likewise. (LOADREGS_6): Likewise. (ASMARGS_6): Likewise.
* i386: Remove syscall assembly codes with 6 argumentsH.J. Lu2015-10-155-268/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch removes i386 assembly implementation for mmap, mmap64, semtimeop now that i386 have 6 argument syscall support from C code and GCC 5 can inline syscalls with 6 arguments. We also compile mmap.c, mmap64.c and semtimedop.c with -fomit-frame-pointer since %ebp may be used to pass the 6th argument to syscall. Fo sysdeps/unix/sysv/linux/i386/mmap.c, with -O2 -march=i686 -mtune=generic, GCC 5.2 now generates: <__mmap>: 0: sub $0x10,%esp 3: mov 0x28(%esp),%eax 7: mov %ebx,(%esp) a: mov 0x18(%esp),%ecx e: mov %esi,0x4(%esp) 12: mov 0x14(%esp),%ebx 16: mov %edi,0x8(%esp) 1a: mov 0x1c(%esp),%edx 1e: test $0xfff,%eax 23: mov 0x20(%esp),%esi 27: mov %ebp,0xc(%esp) 2b: mov 0x24(%esp),%edi 2f: jne 60 <__mmap+0x60> 31: shr $0xc,%eax 34: mov %eax,%ebp 36: mov $0xc0,%eax 3b: call *%gs:0x10 42: cmp $0xfffff000,%eax 47: ja 65 <__mmap+0x65> 49: mov (%esp),%ebx 4c: mov 0x4(%esp),%esi 50: mov 0x8(%esp),%edi 54: mov 0xc(%esp),%ebp 58: add $0x10,%esp 5b: ret 5c: lea 0x0(%esi,%eiz,1),%esi 60: mov $0xffffffea,%eax 65: mov (%esp),%ebx 68: mov 0x4(%esp),%esi 6c: mov 0x8(%esp),%edi 70: mov 0xc(%esp),%ebp 74: add $0x10,%esp 77: jmp 78 <__mmap+0x78> vs sysdeps/unix/sysv/linux/i386/mmap.S: <__mmap>: 0: push %ebp 1: push %ebx 2: push %esi 3: push %edi 4: mov 0x14(%esp),%ebx 8: mov 0x18(%esp),%ecx c: mov 0x1c(%esp),%edx 10: mov 0x20(%esp),%esi 14: mov 0x24(%esp),%edi 18: mov 0x28(%esp),%ebp 1c: test $0xfff,%ebp 22: mov $0xffffffea,%eax 27: jne 38 <__mmap+0x38> 29: shr $0xc,%ebp 2c: mov $0xc0,%eax 31: call *%gs:0x10 38: pop %edi 39: pop %esi 3a: pop %ebx 3b: pop %ebp 3c: cmp $0xfffff000,%eax 41: ja 44 <__mmap+0x44> 43: ret 44: call 45 <__mmap+0x45> 45: R_386_PC32 __x86.get_pc_thunk.cx 49: add $0x2,%ecx 4b: R_386_GOTPC _GLOBAL_OFFSET_TABLE_ 4f: mov 0x0(%ecx),%ecx 51: R_386_TLS_GOTIE __libc_errno 55: neg %eax 57: mov %eax,%gs:(%ecx) 5a: or $0xffffffff,%eax 5d: ret The C version has: 3: mov 0x28(%esp),%eax ... 1e: test $0xfff,%eax ... 31: sar $0xc,%eax 34: mov %eax,%ebp is due to missing $ebx register constraint for inline asm. We have to use "r" constraint with register unsigned int _a6 asm ("ebp") = (unsigned int) (arg6); and compiler chose %eax for offset (arg6) in if (offset & (MMAP_PAGE_UNIT - 1)) * sysdeps/unix/sysv/linux/i386/Makefile (CFLAGS-epoll_pwait.c): Add -fomit-frame-pointer. (CFLAGS-mmap.c): Likewise. (CFLAGS-mmap64.c): Likewise. (CFLAGS-semtimedop.c): Likewise. * sysdeps/unix/sysv/linux/i386/mmap.c: New file. * sysdeps/unix/sysv/linux/i386/mmap.S: Remove file. * sysdeps/unix/sysv/linux/i386/mmap64.S: Likewise. * sysdeps/unix/sysv/linux/i386/semtimedop.S: Likewise.
* Always enable pointer guard [BZ #18928]Florian Weimer2015-10-151-3/+0
| | | | | | | | | | | | | | Honoring the LD_POINTER_GUARD environment variable in AT_SECURE mode has security implications. This commit enables pointer guard unconditionally, and the environment variable is now ignored. [BZ #18928] * sysdeps/generic/ldsodefs.h (struct rtld_global_ro): Remove _dl_pointer_guard member. * elf/rtld.c (_rtld_global_ro): Remove _dl_pointer_guard initializer. (security_init): Always set up pointer guard. (process_envvars): Do not process LD_POINTER_GUARD.
* Fix powerpc32 lround, lroundf spurious exceptions (bug 19134).Joseph Myers2015-10-141-2/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The powerpc32 implementation of lround and lroundf can produce spurious exceptions from adding 0.5 then converting to integer. This includes "inexact" from the conversion to integer (not allowed for integer arguments to these functions), and, for larger integer arguments, "inexact", and "overflow" when rounding upward, from the addition. In addition, "inexact" is not allowed together with "invalid" and so inexact addition must be avoided when the integer will be out of range of 32-bit long, whether or not the argument is an integer. This patch fixes these problems. As in the powerpc64 llround implementation, a check is added for too-large arguments; in the powerpc64 case that means arguments at least 2^52 in magnitude (so that 0.5 cannot be added exactly), while in this case it means arguments for which the result would overflow "long". In those cases a suitable overflowing value is used for the integer conversion without adding 0.5, while for smaller arguments it's tested whether the argument is an integer (by adding and subtracting 2^52 to the absolute value and comparing with the original absolute value) to avoid adding 0.5 to integers and generating spurious "inexact". This code is not used when the power5+ sysdeps directories are used, as there's a separate power5+ version of these functions.. Tested for powerpc. This gets test-float (for a default powerpc32 hard-float build without any --with-cpu) back to the point where it should pass once powerpc ulps are regenerated; test-double still needs another problem with exceptions fixed to get back to that point (and I haven't looked lately at what default powerpc64 results are like). [BZ #19134] * sysdeps/powerpc/powerpc32/fpu/s_lround.S (.LC1): New object. (.LC2): Likewise. (.LC3): Likewise. (__lround): Do not add 0.5 to integer or out-of-range arguments.
* [BZ #19129][ARM] Fix _dl_tlsdesc_resolve_hold to save r0Szabolcs Nagy2015-10-141-9/+18
| | | | | | | | | | | | | | | _dl_tlsdesc_resolve_hold calls into a C function that clobbers r0, but it assumes the original argument is still in r0 after the call. This can cause crash in case of concurrent TLS access when TLSDESC is in use (-mtls-dialect=gnu2). Run into this while fixing BZ 18572. Both r0 and r1 are saved/restored so the stack remains 8 byte aligned. [BZ #19129] * sysdeps/arm/dl-tlsdesc.S (_dl_tlsdesc_resolve_hold): Save and restore r0 and r1.
* Avoid PLT when calling __sched_getaffinity_newH.J. Lu2015-10-141-0/+7
| | | | | | | | | | | This patch adds an internal entry for __sched_getaffinity_new so that __sched_getaffinity_old calls __sched_getaffinity_new without going through PLT. [BZ #18822] * sysdeps/unix/sysv/linux/sched_getaffinity.c (__sched_getaffinity_new): Add libc_hidden_proto and libc_hidden_def.
* Support PLT and GOT references in local PIC checkH.J. Lu2015-10-142-15/+15
| | | | | | | | | | | | | | Linker in binutils 2.26 and newer generate GOT references instead PLT references when -z now is passed to linker. We need to extend scripts/localplt.awk to allow PLT or GOT references. [BZ #19007] * scripts/localplt.awk: Also allow GOT references. * sysdeps/unix/sysv/linux/i386/localplt.data: Mark _Unwind_Find_FDE, calloc, memalign, realloc and __libc_memalign with "+ REL R_386_GLOB_DAT". * sysdeps/x86_64/localplt.data: Mark calloc, memalign, realloc and __libc_memalign with "+ RELA R_X86_64_GLOB_DAT".
* Use INTERNAL_SYSCALL and INLINE_SYSCALL_ERROR_RETURN_VALUEH.J. Lu2015-10-149-47/+39
| | | | | | | | | | | | | | | | | | | | | | This patch uses INTERNAL_SYSCALL and INLINE_SYSCALL_ERROR_RETURN_VALUE to avoid reading and writing errno directly so that we don't need to call __x86.get_pc_thunk.reg to load PC into reg in case there is an error. * sysdeps/unix/sysv/linux/i386/brk.c (__brk): Use INLINE_SYSCALL_ERROR_RETURN_VALUE. * sysdeps/unix/sysv/linux/i386/fxstatat.c (__fxstatat): Likewise. * sysdeps/unix/sysv/linux/i386/setegid.c (setegid): Likewise. * sysdeps/unix/sysv/linux/i386/seteuid.c (seteuid): Likewise. * sysdeps/unix/sysv/linux/i386/fxstat.c (__fxstat): Use INTERNAL_SYSCALLINTERNAL_SYSCALL and INLINE_SYSCALL_ERROR_RETURN_VALUE. * sysdeps/unix/sysv/linux/i386/lockf64.c (lockf64): Likewise. * sysdeps/unix/sysv/linux/i386/lxstat.c (__lxstat): Likewise. * sysdeps/unix/sysv/linux/i386/sigaction.c (__libc_sigaction): Likewise. * sysdeps/unix/sysv/linux/i386/xstat.c (__xstat): Likewise.
* Fix powerpc32 llround, llroundf exceptions (bug 19125).Joseph Myers2015-10-132-2/+68
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The powerpc32 implementations of llroundf and llround produce spurious and missing exceptions (some arising from such exceptions from conversions to long long, some present even when fctidz is used). This patch fixes those problems in a similar way to the llrint / llrintf fixes. The spurious exceptions in the fctidz case for large arguments arise from a converted value that saturated as LLONG_MAX being converted back to float or double (the conversion back being inexact, but "inexact" must not be raised together with "invalid"), and from the subtraction x - xrf also being inexact for sufficiently large arguments (whether the saturation was to LLONG_MAX or LLONG_MIN); those are fixed by returning early if the argument is large enough that no rounding is needed. This code is not used for --with-cpu=power4 builds (I suspect the code used in that case may also produce spurious "inexact" exceptions, but that's something to investigate later). Tested for powerpc. [BZ #19125] * sysdeps/powerpc/powerpc32/fpu/s_llround.c: Include <limits.h>, <math_private.h> and <stdint.h>. (__llround): Avoid conversions to and from long long int, and subtractions, where those might raise spurious exceptions. * sysdeps/powerpc/powerpc32/fpu/s_llroundf.c: Include <math_private.h> and <stdint.h>. (__llroundf): Avoid conversions to and from long long int, and subtractions, where those might raise spurious exceptions.
* Use INLINE_SYSCALL_ERROR_RETURN_VALUEH.J. Lu2015-10-1329-158/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch replaces { __set_errno (ERRNO); return -1; } with INLINE_SYSCALL_ERROR_RETURN_VALUE (ERRNO). * sysdeps/unix/sysv/linux/adjtime.c (ADJTIME): Use INLINE_SYSCALL_ERROR_RETURN_VALUE. * sysdeps/unix/sysv/linux/dl-openat64.c (openat64): Likewise. * sysdeps/unix/sysv/linux/eventfd.c (eventfd): Likewise. * sysdeps/unix/sysv/linux/faccessat.c (faccessat): Likewise. * sysdeps/unix/sysv/linux/fchmodat.c (fchmodat): Likewise. * sysdeps/unix/sysv/linux/fcntl.c (do_fcntl): Likewise. * sysdeps/unix/sysv/linux/futimens.c (futimens): Likewise. * sysdeps/unix/sysv/linux/futimes.c (__futimes): Likewise. * sysdeps/unix/sysv/linux/fxstat.c (__fxstat): Likewise. * sysdeps/unix/sysv/linux/fxstatat.c (__fxstatat): Likewise. * sysdeps/unix/sysv/linux/fxstatat64.c (__fxstatat64): Likewise. * sysdeps/unix/sysv/linux/lutimes.c (lutimes): Likewise. * sysdeps/unix/sysv/linux/lxstat.c (__lxstat): Likewise. * sysdeps/unix/sysv/linux/lxstat64.c (___lxstat64): Likewise. * sysdeps/unix/sysv/linux/mmap64.c (__mmap64): Likewise. * sysdeps/unix/sysv/linux/mq_open.c (__mq_open): Likewise. * sysdeps/unix/sysv/linux/mq_unlink.c (mq_unlink): Likewise. * sysdeps/unix/sysv/linux/prlimit.c (prlimit): Likewise. * sysdeps/unix/sysv/linux/readahead.c (__readahead): Likewise. * sysdeps/unix/sysv/linux/shmat.c (shmat): Likewise. * sysdeps/unix/sysv/linux/signalfd.c (signalfd): Likewise. * sysdeps/unix/sysv/linux/speed.c (cfsetospeed): Likewise. * sysdeps/unix/sysv/linux/tcsetattr.c (tcsetattr): Likewise. * sysdeps/unix/sysv/linux/ustat.c (ustat): Likewise. * sysdeps/unix/sysv/linux/utimensat.c (utimensat): Likewise. * sysdeps/unix/sysv/linux/xmknod.c (__xmknod): Likewise. * sysdeps/unix/sysv/linux/xmknodat.c (__xmknodat): Likewise. * sysdeps/unix/sysv/linux/xstat.c (__xstat): Likewise. * sysdeps/unix/sysv/linux/xstatconv.c (__xstat_conv): Likewise. (__xstat64_conv): Likewise. (__xstat32_conv): Likewise.
* Add INLINE_SYSCALL_ERROR_RETURN_VALUEH.J. Lu2015-10-1322-85/+91
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For ia32 PIC, the first thing of many syscalls does is to call __x86.get_pc_thunk.reg to load PC into reg in case there is an error, which is required for setting errno. In most cases, there are no errors. But we still call __x86.get_pc_thunk.reg. This patch adds INLINE_SYSCALL_ERROR_RETURN_VALUE so that i386 can optimize setting errno by branching to the internal __syscall_error without PLT. With i386 INLINE_SYSCALL_ERROR_RETURN_VALUE and i386 syscall inlining optimization for GCC 5, for sysdeps/unix/sysv/linux/fchmodat.c with -O2 -march=i686 -mtune=generic, GCC 5.2 now generates: <fchmodat>: 0: push %ebx 1: mov 0x14(%esp),%eax 5: mov 0x8(%esp),%ebx 9: mov 0xc(%esp),%ecx d: mov 0x10(%esp),%edx 11: test $0xfffffeff,%eax 16: jne 38 <fchmodat+0x38> 18: test $0x1,%ah 1b: jne 48 <fchmodat+0x48> 1d: mov $0x132,%eax 22: call *%gs:0x10 29: cmp $0xfffff000,%eax 2e: ja 58 <fchmodat+0x58> 30: pop %ebx 31: ret 32: lea 0x0(%esi),%esi 38: pop %ebx 39: mov $0xffffffea,%eax 3e: jmp 3f <fchmodat+0x3f> 3f: R_386_PC32 __syscall_error 43: nop 44: lea 0x0(%esi,%eiz,1),%esi 48: pop %ebx 49: mov $0xffffffa1,%eax 4e: jmp 4f <fchmodat+0x4f> 4f: R_386_PC32 __syscall_error 53: nop 54: lea 0x0(%esi,%eiz,1),%esi 58: pop %ebx 59: jmp 5a <fchmodat+0x5a> 5a: R_386_PC32 __syscall_error instead of <fchmodat>: 0: sub $0x8,%esp 3: mov 0x18(%esp),%eax 7: mov %ebx,(%esp) a: call b <fchmodat+0xb> b: R_386_PC32 __x86.get_pc_thunk.bx f: add $0x2,%ebx 11: R_386_GOTPC _GLOBAL_OFFSET_TABLE_ 15: mov %edi,0x4(%esp) 19: test $0xfffffeff,%eax 1e: jne 70 <fchmodat+0x70> 20: test $0x1,%ah 23: jne 88 <fchmodat+0x88> 25: mov 0x14(%esp),%edx 29: mov 0x10(%esp),%ecx 2d: mov 0xc(%esp),%edi 31: xchg %ebx,%edi 33: mov $0x132,%eax 38: call *%gs:0x10 3f: xchg %edi,%ebx 41: cmp $0xfffff000,%eax 46: ja 58 <fchmodat+0x58> 48: mov (%esp),%ebx 4b: mov 0x4(%esp),%edi 4f: add $0x8,%esp 52: ret 53: nop 54: lea 0x0(%esi,%eiz,1),%esi 58: mov 0x0(%ebx),%edx 5a: R_386_TLS_GOTIE __libc_errno 5e: neg %eax 60: mov %eax,%gs:(%edx) 63: mov $0xffffffff,%eax 68: jmp 48 <fchmodat+0x48> 6a: lea 0x0(%esi),%esi 70: mov 0x0(%ebx),%eax 72: R_386_TLS_GOTIE __libc_errno 76: movl $0x16,%gs:(%eax) 7d: mov $0xffffffff,%eax 82: jmp 48 <fchmodat+0x48> 84: lea 0x0(%esi,%eiz,1),%esi 88: mov 0x0(%ebx),%eax 8a: R_386_TLS_GOTIE __libc_errno 8e: movl $0x5f,%gs:(%eax) 95: mov $0xffffffff,%eax 9a: jmp 48 <fchmodat+0x48> * sysdeps/unix/sysv/linux/sysdep.h: New file. * sysdeps/unix/sysv/linux/i386/sysdep.c: Likewise. * sysdeps/unix/sysv/linux/alpha/sysdep.h: Include <sysdeps/unix/sysv/linux/sysdep.h>. * sysdeps/unix/sysv/linux/arm/sysdep.h: Likewise. * sysdeps/unix/sysv/linux/generic/sysdep.h: Likewise. * sysdeps/unix/sysv/linux/hppa/sysdep.h: Likewise. * sysdeps/unix/sysv/linux/ia64/sysdep.h: Likewise. * sysdeps/unix/sysv/linux/m68k/sysdep.h: Likewise. * sysdeps/unix/sysv/linux/microblaze/sysdep.h: Likewise. * sysdeps/unix/sysv/linux/mips/mips32/sysdep.h: Likewise. * sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h: Likewise. * sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h: Likewise. * sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h: Likewise. * sysdeps/unix/sysv/linux/sh/sysdep.h: Likewise. * sysdeps/unix/sysv/linux/sparc/sysdep.h: Likewise. * sysdeps/unix/sysv/linux/x86_64/sysdep.h: Likewise. * sysdeps/unix/sysv/linux/i386/Makefile [$(subdir) == csu] (sysdep-dl-routines): Add sysdep. [$(subdir) == nptl] (libpthread-routines): Likewise. [$(subdir) == rt] (librt-routines): Likewise. * sysdeps/unix/sysv/linux/i386/clone.S (__clone): Don't check PIC when branching to SYSCALL_ERROR_LABEL. * sysdeps/unix/sysv/linux/i386/sysdep.S: Removed. * sysdeps/unix/sysv/linux/i386/sysdep.h: Include <sysdeps/unix/sysv/linux/sysdep.h>. (SYSCALL_ERROR_LABEL): Changed to __syscall_error. (SYSCALL_ERROR_ERRNO): Removed. (SYSCALL_ERROR_HANDLER): Changed to empty. (SYSCALL_ERROR_HANDLER_TLS_STORE): Likewise. (__syscall_error): New prototype. [IS_IN (libc)] (INLINE_SYSCALL): New macro. (INLINE_SYSCALL_ERROR_RETURN_VALUE): Likewise.
* Support x86-64 assmebler without AVX512H.J. Lu2015-10-131-16/+24
| | | | | | | | | | | | | | | | When x86-64 assmebler doesn't support AVX512, we should make _dl_runtime_resolve_avx512/_dl_runtime_profile_avx512 as aliases of _dl_runtime_resolve_avx/_dl_runtime_profile_avx. Tested on x86-64 using GCC 5.2 with binutils 20151008 and GCC 4.8 with binutils 20130219. There are no differences in ld.so with binutils 20151008. There are no unexpected failures with binutils 20130219 and 20151008. [BZ #19124] * sysdeps/x86_64/dl-trampoline.S [!HAVE_AVX512_ASM_SUPPORT] (_dl_runtime_resolve_avx512): Make it a hidden alias of _dl_runtime_resolve_avx. (_dl_runtime_profile_avx512): Make it a hidden alias of _dl_runtime_profile_avx.
* Move powerpc llround implementations to powerpc32 directory.Joseph Myers2015-10-132-0/+0
| | | | | | | | | | | | | | | | | sysdeps/powerpc/fpu/ has versions of llround and llroundf that are actually used only for powerpc32 because sysdeps/powerpc/powerpc64/fpu/ has its own versions of those functions. This patch moves them into sysdeps/powerpc/powerpc32/fpu to reflect where they are actually used (in preparation for fixing other problems with those functions). Tested for powerpc that installed stripped shared libraries are unchanged by this patch. * sysdeps/powerpc/fpu/s_llround.c: Move to .... * sysdeps/powerpc/powerpc32/fpu/s_llround.c: ...here. * sysdeps/powerpc/fpu/s_llroundf.c: Move to .... * sysdeps/powerpc/powerpc32/fpu/s_llroundf.c: ...here.
* Fix powerpc32 llrint, llrintf bad exceptions (bug 16422).Joseph Myers2015-10-134-2/+94
| | | | | | | | | | | | | | | | | | | | | | | | | The versions of llrint and llrintf for older powerpc32 processors convert the results of __rint / __rintf to long long int, resulting in spurious exceptions from such casts in certain cases. This patch makes glibc work around the problems with the libgcc conversions when the compiler used to build glibc doesn't use the fctidz instruction for them. Tested for powerpc. [BZ #16422] * sysdeps/powerpc/powerpc32/fpu/configure.ac (libc_cv_ppc_fctidz): New configure test. * sysdeps/powerpc/powerpc32/fpu/configure: Regenerated. * config.h.in [_LIBC] (HAVE_PPC_FCTIDZ): New macro. * sysdeps/powerpc/powerpc32/fpu/s_llrint.c: Include <limits.h>, <math_private.h> and <stdint.h>. (__llrint): Avoid conversions to long long int where those might raise spurious exceptions. * sysdeps/powerpc/powerpc32/fpu/s_llrintf.c: Include <math_private.h> and <stdint.h>. (__llrintf): Avoid conversions to long long int where those might raise spurious exceptions.
* Regenerate MIPS libm-test-ulps.Joseph Myers2015-10-092-100/+102
| | | | | * sysdeps/mips/mips32/libm-test-ulps: Regenerated. * sysdeps/mips/mips64/libm-test-ulps: Likewise.
* Regenerate ARM libm-test-ulps.Joseph Myers2015-10-091-115/+119
| | | | * sysdeps/arm/libm-test-ulps: Regenerated.
* Fix llrint, llround missing exceptions for ARM (bug 15470).Joseph Myers2015-10-091-0/+32
| | | | | | | | | | | | Similar to the recent fix for MIPS, ARM is also missing correct exceptions on overflow from llrint and llround functions because casts from floating-point types to long long do not result in correct exceptions on overflow. This patch enables the fix for this for ARM. Tested for ARM. [BZ #15470] * sysdeps/arm/fix-fp-int-convert-overflow.h: New file.
* Fix lrint, llrint, lround, llround missing exceptions for MIPS (bug 16399).Joseph Myers2015-10-0910-14/+164
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For 32-bit MIPS and some other systems, various of the lrint, llrint, lround, llround functions can be missing exceptions on overflow because casts do not (in current GCC) result in the proper exceptions. In the MIPS case there are two problems here: MIPS I code generation uses an assembler macro that doesn't raise exceptions, while the libgcc conversions of floating-point values to long long also do not raise "invalid" on all overflow cases (and can raise spurious "inexact"). This patch adds support in the generic code (only the functions for which this problem has actually been seen) for forcing the "invalid" exception in the problem cases, and enables that support for the affected MIPS cases. Tested for MIPS; also tested for x86_64 and x86 that installed stripped shared libraries are unchanged by this patch. [BZ #16399] * sysdeps/generic/fix-fp-int-convert-overflow.h: New file. * sysdeps/ieee754/dbl-64/s_llrint.c: Include <fenv.h>, <limits.h> and <fix-fp-int-convert-overflow.h>. (__llrint) [FE_INVALID]: Force FE_INVALID exception as needed if FIX_DBL_LLONG_CONVERT_OVERFLOW. * sysdeps/ieee754/dbl-64/s_llround.c: Include <fenv.h>, <limits.h> and <fix-fp-int-convert-overflow.h>. (__llround) [FE_INVALID]: Force FE_INVALID exception as needed if FIX_DBL_LLONG_CONVERT_OVERFLOW. * sysdeps/ieee754/dbl-64/s_lrint.c: Include <fix-fp-int-convert-overflow.h>. (__lrint) [FE_INVALID]: Force FE_INVALID exception as needed if FIX_DBL_LLONG_CONVERT_OVERFLOW. * sysdeps/ieee754/dbl-64/s_lround.c: Include <fix-fp-int-convert-overflow.h>. (__lround) [FE_INVALID]: Force FE_INVALID exception as needed if FIX_DBL_LLONG_CONVERT_OVERFLOW. * sysdeps/ieee754/flt-32/s_llrintf.c: Include <fenv.h>, <limits.h> and <fix-fp-int-convert-overflow.h>. (__llrintf) [FE_INVALID]: Force FE_INVALID exception as needed if FIX_DBL_LLONG_CONVERT_OVERFLOW. * sysdeps/ieee754/flt-32/s_llroundf.c: Include <fenv.h>, <limits.h> and <fix-fp-int-convert-overflow.h>. (__llroundf) [FE_INVALID]: Force FE_INVALID exception as needed if FIX_DBL_LLONG_CONVERT_OVERFLOW. * sysdeps/ieee754/flt-32/s_lrintf.c: Include <fenv.h>, <limits.h> and <fix-fp-int-convert-overflow.h>. (__lrintf) [FE_INVALID]: Force FE_INVALID exception as needed if FIX_DBL_LLONG_CONVERT_OVERFLOW. * sysdeps/ieee754/flt-32/s_lroundf.c: Include <fenv.h>, <limits.h> and <fix-fp-int-convert-overflow.h>. (__lroundf) [FE_INVALID]: Force FE_INVALID exception as needed if FIX_DBL_LLONG_CONVERT_OVERFLOW. * sysdeps/mips/mips32/fpu/fix-fp-int-convert-overflow.h: New file.
* Update lrint/lrintf/lrintl for x32H.J. Lu2015-10-096-1/+90
| | | | | | | | | | | | | | | | | | | | | | The x86_64 versions of lrint/lrintf/ lrintl are aliases for the long long versions which isn't correct for x32, where exceptions must respect overflow for 32-bit long. Separate versions of the long functions for x32 that convert to 32-bit long and raise the right exceptions for that conversion, while keeping the aliases in the non-x32 case. Tested on x86_64 and x32. There are no code changes in libm.so on x86_64. * sysdeps/x86_64/fpu/s_llrint.S (__lrint): Add alias only if __ILP32__ isn't defined. (lrint): Likewise. * sysdeps/x86_64/fpu/s_llrintf.S (__lrintf): Likewise. (lrintf): Likewise. * sysdeps/x86_64/fpu/s_llrintl.S (__lrintl): Likewise. (lrintl): Likewise. * sysdeps/x86_64/x32/fpu/s_lrint.S: New file. * sysdeps/x86_64/x32/fpu/s_lrintf.S: Likewise. * sysdeps/x86_64/x32/fpu/s_lrintl.S: Likewise.
* Mark lseek/llseek as non-cancellableAdhemerval Zanella2015-10-093-3/+3
| | | | | | | | | | | | | This patch sets lseek/llseek for 64-bit, MIPS n32, and x86_32 as non- cancelable. This make it consistant with 32-bit platform. Tested on i686, x86_64, and x32. * sysdeps/unix/sysv/linux/mips/mips64/syscalls.list (lseek): Set as non-cancelable. * sysdeps/unix/sysv/linux/wordsize-64/syscalls.list (llseek): Likewise. * sysdeps/unix/sysv/linux/x86_64/x32/lseek.S (__libc_lseek64): Likewise.
* Remove configure tests for -mno-vzeroupper support.Joseph Myers2015-10-095-64/+1
| | | | | | | | | | | | | | | | | | GCC added support for -mno-vzeroupper in version 4.6. Thus the configure tests for this support are obsolete, and this patch removes them. Tested for x86_64 and x86 (testsuite, and that installed stripped shared libraries are unchanged by this patch). * sysdeps/i386/configure.ac (libc_cv_cc_novzeroupper): Remove configure test. * sysdeps/i386/configure: Regenerated. * sysdeps/x86_64/configure.ac (libc_cv_cc_novzeroupper): Remove configure test. * sysdeps/x86_64/configure: Regenerated. * sysdeps/x86_64/Makefile [$(config-cflags-novzeroupper) = yes]: Make code unconditional.
* Remove configure tests for FMA4 support.Joseph Myers2015-10-0915-134/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | GCC added support for -mfma4 in version 4.5. Thus the configure tests for this support are obsolete, and this patch removes them. Tested for x86_64 and x86 (testsuite, and that installed stripped shared libraries are unchanged by this patch). * sysdeps/i386/configure.ac (libc_cv_cc_fma4): Remove configure test. * sysdeps/i386/configure: Regenerated. * sysdeps/x86_64/configure.ac (libc_cv_cc_fma4): Remove configure test. * sysdeps/x86_64/configure: Regenerated. * sysdeps/x86_64/fpu/multiarch/Makefile [$(have-mfma4) = yes]: Make code unconditional. * sysdeps/x86_64/fpu/multiarch/e_asin.c [HAVE_FMA4_SUPPORT]: Likewise. * sysdeps/x86_64/fpu/multiarch/e_atan2.c [HAVE_FMA4_SUPPORT]: Likewise. [!HAVE_FMA4_SUPPORT]: Remove conditional code. * sysdeps/x86_64/fpu/multiarch/e_exp.c [HAVE_FMA4_SUPPORT]: Make code unconditional. [!HAVE_FMA4_SUPPORT]: Remove conditional code. * sysdeps/x86_64/fpu/multiarch/e_log.c [HAVE_FMA4_SUPPORT]: Make code unconditional. [!HAVE_FMA4_SUPPORT]: Remove conditional code. * sysdeps/x86_64/fpu/multiarch/e_pow.c [HAVE_FMA4_SUPPORT]: Make code unconditional. * sysdeps/x86_64/fpu/multiarch/s_atan.c [HAVE_FMA4_SUPPORT]: Make code unconditional. [!HAVE_FMA4_SUPPORT]: Remove conditional code. * sysdeps/x86_64/fpu/multiarch/s_fma.c [HAVE_FMA4_SUPPORT]: Make code unconditional. [!HAVE_FMA4_SUPPORT]: Remove conditional code. * sysdeps/x86_64/fpu/multiarch/s_fmaf.c [HAVE_FMA4_SUPPORT]: Make code unconditional. [!HAVE_FMA4_SUPPORT]: Remove conditional code. * sysdeps/x86_64/fpu/multiarch/s_sin.c [HAVE_FMA4_SUPPORT]: Make code unconditional. [!HAVE_FMA4_SUPPORT]: Remove conditional code. * sysdeps/x86_64/fpu/multiarch/s_tan.c [HAVE_FMA4_SUPPORT]: Make code unconditional. [!HAVE_FMA4_SUPPORT]: Remove conditional code. * config.h.in (HAVE_FMA4_SUPPORT): Remove #undef.
* Fix dbl-64 lrint for 64-bit long (bug 19095).Joseph Myers2015-10-091-1/+1
| | | | | | | | | | | | | | | The dbl-64 implementation of lrint produces incorrect results for some arguments with 64-bit long because a 32-bit (unsigned) low part of the mantissa is shifted left, losing high bits in the process. This patch fixes this by casting to long int before shifting, as in lround (as this case only applies for 64-bit long, there are no issues with sign-extension). Tested for mips64 (n64). [BZ #19095] * sysdeps/ieee754/dbl-64/s_lrint.c (__lrint): Cast low part of mantissa to long int before shifting left.
* Fix lrint, llrint missing exceptions close to overflow threshold (bug 19094).Joseph Myers2015-10-085-22/+178
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The dbl-64, ldbl-96 and ldbl-128 implementations of lrint and llrint fail to produce "invalid" exceptions in cases where the rounded result overflows the target type, but truncating the floating-point argument to the next integer towards zero does not overflow it (so in particular casts do not produce such exceptions). (This issue cannot arise for float, or for double with 64-bit target type, or for ldbl-96 with 64-bit target type and negative arguments, because of insufficient precision in the floating-point type for arguments with the relevant property to exist. It also obviously cannot arise in FE_TOWARDZERO mode.) This patch fixes these problems by inserting checks for the special cases that can occur in each implementation, and explicitly raising FE_INVALID (and avoiding the cast if it might raise spurious FE_INEXACT, while raising FE_INEXACT explicitly in the cases where it is needed; unlike lround and llround, FE_INEXACT is required, not optional, for these functions for a within-range inexact result). The fixes are conditional on FE_INVALID or FE_INEXACT being defined. If any future architecture supports one but not both of those exceptions, the code will fail to compile and need fixing to handle that case (this seemed better than conditioning on both macros being defined, resulting in code that would compile but quietly miss exceptions on such a system). Tested for x86_64, x86 and mips64. Tested the ldbl-96 changes (only relevant for ia64, it appears) on x86_64 by removing the x86_64 versions of lrintl / llrintl. [BZ #19094] * sysdeps/ieee754/dbl-64/s_lrint.c: Include <fenv.h> and <limits.h>. (__lrint) [FE_INVALID || FE_INEXACT]: Force FE_INVALID exception when result overflows but exception would not result from cast. * sysdeps/ieee754/ldbl-128/s_llrintl.c: Include <fenv.h> and <limits.h>. (__llrintl) [FE_INVALID || FE_INEXACT]: Force FE_INVALID exception when result overflows but exception would not result from cast. * sysdeps/ieee754/ldbl-128/s_lrintl.c: Include <fenv.h> and <limits.h>. (__lrintl) [FE_INVALID || FE_INEXACT]: Force FE_INVALID exception when result overflows but exception would not result from cast. * sysdeps/ieee754/ldbl-96/s_llrintl.c: Include <fenv.h> and <limits.h>. (__llrintl) [FE_INVALID || FE_INEXACT]: Force FE_INVALID exception when result overflows but exception would not result from cast. * sysdeps/ieee754/ldbl-96/s_lrintl.c: Include <fenv.h> and <limits.h>. (__lrintl) [FE_INVALID || FE_INEXACT]: Force FE_INVALID exception when result overflows but exception would not result from cast. * math/libm-test.inc (lrint_test_data): Add more tests. (llrint_test_data): Likewise.
* Remove configure tests for AVX support.Joseph Myers2015-10-0821-273/+86
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | GCC added support for -mavx and -msse2avx in version 4.4. Thus the configure tests for this support are obsolete, and this patch removes them. Tested for x86_64 and x86 (testsuite, and that installed stripped shared libraries are unchanged by this patch). * sysdeps/i386/configure.ac (libc_cv_cc_avx): Remove configure test. (libc_cv_cc_sse2avx): Likewise. * sysdeps/i386/configure: Regenerated. * sysdeps/i386/i686/multiarch/Makefile [$(subdir)$(config-cflags-avx) = mathyes]: Change conditional to [$(subdir) = math]. * sysdeps/i386/i686/multiarch/s_fma-fma.c [HAVE_AVX_SUPPORT]: Make code unconditional. * sysdeps/i386/i686/multiarch/s_fma.c [HAVE_AVX_SUPPORT]: Likewise. * sysdeps/i386/i686/multiarch/s_fmaf-fma.c [HAVE_AVX_SUPPORT]: Likewise. * sysdeps/i386/i686/multiarch/s_fmaf.c [HAVE_AVX_SUPPORT]: Likewise. * sysdeps/x86_64/configure.ac (libc_cv_cc_avx): Remove configure test. (libc_cv_cc_sse2avx): Likewise. * sysdeps/x86_64/configure: Regenerated. * sysdeps/x86_64/Makefile [$(config-cflags-avx) = yes]: Make code unconditional. * sysdeps/x86_64/dl-trampoline.h (_dl_runtime_profile) [HAVE_AVX_SUPPORT || HAVE_AVX512_ASM_SUPPORT]: Make code unconditional. (_dl_runtime_profile) [!(HAVE_AVX_SUPPORT || HAVE_AVX512_ASM_SUPPORT)]: Remove conditional code. * sysdeps/x86_64/fpu/multiarch/Makefile [$(config-cflags-sse2avx) = yes]: Make code unconditional. * sysdeps/x86_64/fpu/multiarch/e_atan2.c [HAVE_FMA4_SUPPORT || HAVE_AVX_SUPPORT]: Likewise. * sysdeps/x86_64/fpu/multiarch/e_exp.c [HAVE_FMA4_SUPPORT || HAVE_AVX_SUPPORT]: Likewise. * sysdeps/x86_64/fpu/multiarch/e_log.c [HAVE_FMA4_SUPPORT || HAVE_AVX_SUPPORT]: Likewise. * sysdeps/x86_64/fpu/multiarch/s_atan.c [HAVE_FMA4_SUPPORT || HAVE_AVX_SUPPORT]: Likewise. * sysdeps/x86_64/fpu/multiarch/s_fma.c [HAVE_AVX_SUPPORT]: Likewise. * sysdeps/x86_64/fpu/multiarch/s_fmaf.c [HAVE_AVX_SUPPORT]: Likewise. * sysdeps/x86_64/fpu/multiarch/s_sin.c [HAVE_FMA4_SUPPORT || HAVE_AVX_SUPPORT]: Likewise. * sysdeps/x86_64/fpu/multiarch/s_tan.c [HAVE_FMA4_SUPPORT || HAVE_AVX_SUPPORT]: Likewise. * sysdeps/x86_64/multiarch/strcmp.S [HAVE_AVX_SUPPORT]: Likewise. * config.h.in (HAVE_AVX_SUPPORT): Remove #undef. (HAVE_SSE2AVX_SUPPORT): Likewise.
* Add task_notify to mach_interface_listSamuel Thibault2015-10-082-2/+2
| | | | * sysdeps/mach/configure.ac (mach_interface_list): Add task_notify.
* Fix lround, llround missing exceptions close to overflow threshold (bug 19088).Joseph Myers2015-10-076-13/+142
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The dbl-64, ldbl-96 and ldbl-128 implementations of lround and llround fail to produce "invalid" exceptions in cases where the rounded result overflows the target type, but truncating the floating-point argument to the next integer towards zero does not overflow it (so in particular casts do not produce such exceptions). (This issue cannot arise for float, or for double with 64-bit target type, or for ldbl-96 with 64-bit target type and negative arguments, because of insufficient precision in the floating-point type for arguments with the relevant property to exist.) This patch fixes these problems by inserting checks for the special cases that can occur in each implementation, and explicitly raising FE_INVALID (and avoiding the cast if it might raise spurious FE_INEXACT). Tested for x86_64, x86 and mips64. [BZ #19088] * sysdeps/ieee754/dbl-64/s_lround.c: Include <fenv.h> and <limits.h>. (__lround) [FE_INVALID]: Force FE_INVALID exception when result overflows but exception would not result from cast. * sysdeps/ieee754/dbl-64/wordsize-64/s_lround.c: Include <fenv.h> and <limits.h>. (__lround) [FE_INVALID]: Force FE_INVALID exception when result overflows but exception would not result from cast. * sysdeps/ieee754/ldbl-128/s_llroundl.c: Include <fenv.h> and <limits.h>. (__llroundl) [FE_INVALID]: Force FE_INVALID exception when result overflows but exception would not result from cast. * sysdeps/ieee754/ldbl-128/s_lroundl.c: Include <fenv.h> and <limits.h>. (__lroundl) [FE_INVALID]: Force FE_INVALID exception when result overflows but exception would not result from cast. * sysdeps/ieee754/ldbl-96/s_llroundl.c: Include <fenv.h> and <limits.h>. (__llroundl) [FE_INVALID]: Force FE_INVALID exception when result overflows but exception would not result from cast. * sysdeps/ieee754/ldbl-96/s_lroundl.c: Include <fenv.h> and <limits.h>. (__lroundl) [FE_INVALID]: Force FE_INVALID exception when result overflows but exception would not result from cast. * math/libm-test.inc (lround_test_data): Add more tests. (llround_test_data): Likewise.
* Fix ldbl-128 lrintl, lroundl missing exceptions for 32-bit long (bug 19085).Joseph Myers2015-10-072-22/+22
| | | | | | | | | | | | | | | The ldbl-128 implementations of lrintl and lroundl miss "invalid" exceptions on systems with 32-bit long for arguments that overflow long but have exponent below 48. This patch fixes this by rearranging the sequence of tests in the code so the exponent < 48 case is only used for exponents that don't overflow long. Tested for mips64 (n32 and n64). [BZ #19085] * sysdeps/ieee754/ldbl-128/s_lrintl.c (__lrintl): Move test for exponent below 48 inside case for non-overflowing exponent. * sysdeps/ieee754/ldbl-128/s_lroundl.c (__lroundl): Likewise.
* Use dbl-64/wordsize-64 for MIPS64.Joseph Myers2015-10-072-1/+1
| | | | | | | | | | | | This patch enables use of sysdeps/ieee754/dbl-64/wordsize-64 for MIPS64 (both n64 and n32), removing a #error in one case now that case has been tested and found to work. Tested for mips64 (n64 and n32). * sysdeps/mips/mips64/Implies: Use ieee754/dbl-64/wordsize-64. * sysdeps/ieee754/dbl-64/wordsize-64/s_issignaling.c (__issignaling) [HIGH_ORDER_BIT_IS_SET_FOR_SNAN]: Remove #error.
* Don't use dbl-64/wordsize-64 lround based on llround for ILP32 (bug 19079).Joseph Myers2015-10-074-24/+71
| | | | | | | | | | | | | | | | | | | | | | | | | | The implementation of lround in dbl-64/wordsize-64 as an alias or wrapper for llround is always incorrect when long is not 64-bit, because it misses required exceptions in overflow cases, as shown by my recently added tests. This patch removes that alias / wrapper in the non-LP64 case, together with the REGISTER_CAST_INT32_TO_INT64 macro, restoring the previous version of lround for dbl-64/wordsize-64 (newly conditioned on !_LP64). Tested for x86_64, and for mips64 with use of dbl-64/wordsize-64 enabled. [BZ #19079] * sysdeps/ieee754/dbl-64/wordsize-64/s_lround.c: Restore previous file, conditioned on [!_LP64]. * sysdeps/ieee754/dbl-64/wordsize-64/s_llround.c [!_LP64] (__lround): Do not define as function or alias. [!_LP64] (lround): Likewise. [!_LP64] (__lroundl): Likewise. [!_LP64] (lroundl): Likewise. * sysdeps/tile/sysdep.h (REGISTER_CAST_INT32_TO_INT64): Remove macro. * sysdeps/x86_64/x32/sysdep.h (REGISTER_CAST_INT32_TO_INT64): Likewise.
* Remove configure tests for SSE4 support.Joseph Myers2015-10-0610-98/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | GCC added support for -msse4 in version 4.3. Thus the configure tests for it are obsolete, and this patch removes them. Tested for x86_64 and x86 (testsuite, and that installed stripped shared libraries are unchanged by this patch). * sysdeps/i386/configure.ac (libc_cv_cc_sse4): Remove configure test. * sysdeps/i386/configure: Regenerated. * sysdeps/i386/i686/multiarch/Makefile [$(config-cflags-sse4) = yes]: Make code unconditional. * sysdeps/i386/i686/multiarch/strcspn.S [HAVE_SSE4_SUPPORT]: Likewise. * sysdeps/i386/i686/multiarch/strspn.S [HAVE_SSE4_SUPPORT]: Likewise. * sysdeps/x86_64/configure.ac (libc_cv_cc_sse4): Remove configure test. * sysdeps/x86_64/configure: Regenerated. * sysdeps/x86_64/multiarch/Makefile [$(config-cflags-sse4) = yes]: Make code unconditional. * sysdeps/x86_64/multiarch/strcspn.S [HAVE_SSE4_SUPPORT]: Likewise. * sysdeps/x86_64/multiarch/strspn.S [HAVE_SSE4_SUPPORT]: Likewise. * config.h.in (HAVE_SSE4_SUPPORT): Remove #undef.
* Fix ldbl-128ibm expl overflow in non-default rounding modes (bug 19078).Joseph Myers2015-10-061-5/+2
| | | | | | | | | | | | | | | | | The ldbl-128ibm expl wrapper checks the argument to determine when to call __kernel_standard_l, thereby overriding overflowing results from __ieee754_expl that could otherwise (given appropriately patched libgcc) be correct for the rounding mode. This patch changes it to check the result of __ieee754_expl instead, as other versions of this wrapper do. Tested for powerpc. [BZ #19078] * sysdeps/ieee754/ldbl-128ibm/w_expl.c (o_thres): Remove variable. (u_thres): Likewise. (__expl): Determine whether to call __kernel_standard_l based on value of result, not argument.
* Fix ldbl-128ibm logl (1) sign of zero result (bug 19077).Joseph Myers2015-10-061-0/+2
| | | | | | | | | | | | The ldbl-128ibm implementation of logl produces a zero with the wrong sign for logl (1) in FE_DOWNWARD mode. This patch makes it explicitly return 0.0L in that case, as in e.g. the ldbl-128 implementation. Tested for powerpc. [BZ #19077] * sysdeps/ieee754/ldbl-128ibm/e_logl.c (__ieee754_logl): Return 0.0L for argument 1.0L.
* Fix ldbl-128ibm log1pl (-1) sign of infinity (bug 19076).Joseph Myers2015-10-061-1/+1
| | | | | | | | | | | | | The ldbl-128ibm implementation of log1pl produces an infinity with the wrong sign for log1pl (-1) in FE_DOWNWARD mode. This patch fixes this by changing a division (-1.0L / (x - x)) (incorrect in FE_DOWNWARD mode) to (-1.0L / 0.0L) (correct in all rounding modes). Tested for powerpc. [BZ #19076] * sysdeps/ieee754/ldbl-128ibm/s_log1pl.c (__log1pl): Divide by constant 0.0L when computing infinite result.
* Fix ldbl-96 lroundl just below powers of 2 (bug 19071).Joseph Myers2015-10-051-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The ldbl-96 version of lroundl is incorrect for systems with 64-bit long when the argument's absolute value is just below a power of 2, 2^32 or more, and rounds up to the next integer; in such cases, it returns 0. The problem is incrementing the high part of the mantissa loses the high bit of the value (which is not an issue for any other floating-point format, and is handled specially in lround when the bit corresponding to 0.5 was in the high part rather than the low part). This patch fixes this in a similar way to that used in llroundl: storing the high part in an unsigned long variable before incrementing it, so problems cannot occur in the case when this code is reachable. I improved test coverage for both lround and llround by making them use the same test inputs (appropriately conditioned on the size of long in the lround case) - complete with the same comments, to make comparison as easy as possible. (This test coverage improvement was how I found the lroundl bug.) Tested for x86_64 and x86. [BZ #19071] * sysdeps/ieee754/ldbl-96/s_lroundl.c (__lroundl): Use unsigned long int variable to store possibly incremented high part of mantissa. * math/libm-test.inc (lround_test_data): Add tests used for llround. Use [LONG_MAX > 0x7fffffff] consistently as condition for tests requiring 64-bit long. Do not condition tests on [TEST_FLOAT] unnecessarily. (llround_test_data): Add tests used for lround. Add another expectation for the "inexact" exception. Do not condition tests on [TEST_FLOAT] unnecessarily.
* Work around powerpc32 integer 0 converting to -0 (bug 887, bug 19049, bug ↵Joseph Myers2015-10-0514-5/+145
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 19050). On powerpc32 hard-float, older processors (ones where fcfid is not available for 32-bit code), GCC generates conversions from integers to floating point that wrongly convert integer 0 to -0 instead of +0 in FE_DOWNWARD mode. This in turn results in logb and a few other functions wrongly returning -0 when they should return +0. This patch works around this issue in glibc as I proposed in <https://sourceware.org/ml/libc-alpha/2015-09/msg00728.html>, so that the affected functions can be correct and the affected tests pass in the absence of a GCC fix for this longstanding issue (GCC bug 67771 - if fixed, of course we can put in GCC version conditionals, and eventually phase out the workarounds). A new macro FIX_INT_FP_CONVERT_ZERO is added in a new sysdeps header fix-int-fp-convert-zero.h, and the powerpc32/fpu version of that header defines the macro based on the results of a configure test for whether such conversions use the fcfid instruction. Tested for x86_64 (that installed stripped shared libraries are unchanged by the patch) and powerpc (that HAVE_PPC_FCFID comes out to 0 as expected and that the relevant tests are fixed). Also tested a build with GCC configured for -mcpu=power4 and verified that HAVE_PPC_FCFID comes out to 1 in that case. There are still some other issues to fix to get test-float and test-double passing cleanly for older powerpc32 processors (apart from the need for an ulps regeneration for powerpc). (test-ldouble will be harder to get passing cleanly, but with a combination of selected fixes to ldbl-128ibm code that don't involve significant performance issues, allowing spurious underflow and inexact exceptions for that format, and lots of XFAILing for the default case of unpatched libgcc, it should be doable.) [BZ #887] [BZ #19049] [BZ #19050] * sysdeps/generic/fix-int-fp-convert-zero.h: New file. * sysdeps/ieee754/dbl-64/e_log10.c: Include <fix-int-fp-convert-zero.h>. (__ieee754_log10): Adjust signs as needed if FIX_INT_FP_CONVERT_ZERO. * sysdeps/ieee754/dbl-64/e_log2.c: Include <fix-int-fp-convert-zero.h>. (__ieee754_log2): Adjust signs as needed if FIX_INT_FP_CONVERT_ZERO. * sysdeps/ieee754/dbl-64/s_erf.c: Include <fix-int-fp-convert-zero.h>. (__erfc): Adjust signs as needed if FIX_INT_FP_CONVERT_ZERO. * sysdeps/ieee754/dbl-64/s_logb.c: Include <fix-int-fp-convert-zero.h>. (__logb): Adjust signs as needed if FIX_INT_FP_CONVERT_ZERO. * sysdeps/ieee754/flt-32/e_log10f.c: Include <fix-int-fp-convert-zero.h>. (__ieee754_log10f): Adjust signs as needed if FIX_INT_FP_CONVERT_ZERO. * sysdeps/ieee754/flt-32/e_log2f.c: Include <fix-int-fp-convert-zero.h>. (__ieee754_log2f): Adjust signs as needed if FIX_INT_FP_CONVERT_ZERO. * sysdeps/ieee754/flt-32/s_erff.c: Include <fix-int-fp-convert-zero.h>. (__erfcf): Adjust signs as needed if FIX_INT_FP_CONVERT_ZERO. * sysdeps/ieee754/flt-32/s_logbf.c: Include <fix-int-fp-convert-zero.h>. (__logbf): Adjust signs as needed if FIX_INT_FP_CONVERT_ZERO. * sysdeps/ieee754/ldbl-128ibm/s_erfl.c: Include <fix-int-fp-convert-zero.h>. (__erfcl): Adjust signs as needed if FIX_INT_FP_CONVERT_ZERO. * sysdeps/ieee754/ldbl-128ibm/s_logbl.c: Include <fix-int-fp-convert-zero.h>. (__logbl): Adjust signs as needed if FIX_INT_FP_CONVERT_ZERO. * sysdeps/powerpc/powerpc32/fpu/configure.ac: New file. * sysdeps/powerpc/powerpc32/fpu/configure: New generated file. * sysdeps/powerpc/powerpc32/fpu/fix-int-fp-convert-zero.h: New file. * config.h.in [_LIBC] (HAVE_PPC_FCFID): New macro.
* sysdeps/x86_64/fpu/libm-test-ulps: Regenerated on Haswell.Paul Pluzhnikov2015-10-031-1/+1
|
* Fix nexttoward overflow in non-default rounding modes (bug 19059).Joseph Myers2015-10-029-17/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ISO C requires overflowing results from nexttoward to be the appropriate infinity independent of the rounding mode, but some implementations use a rounding-mode-dependent result (this is the same issue as was fixed for nextafter in bug 16677). This patch fixes the problem by making the nexttoward implementations discard the result from the floating-point computation that forced an overflow exception and then return the infinity previously computed with integer arithmetic. Tested for x86_64, x86, mips64 and powerpc. [BZ #19059] * math/s_nexttowardf.c (__nexttowardf): Do not return value from overflowing computation. * sysdeps/i386/fpu/s_nexttoward.c (__nexttoward): Likewise. * sysdeps/i386/fpu/s_nexttowardf.c (__nexttowardf): Likewise. * sysdeps/ieee754/ldbl-128/s_nexttoward.c (__nexttoward): Likewise. * sysdeps/ieee754/ldbl-128/s_nexttowardf.c (__nexttowardf): Likewise. * sysdeps/ieee754/ldbl-128ibm/s_nexttoward.c (__nexttoward): Likewise. * sysdeps/ieee754/ldbl-128ibm/s_nexttowardf.c (__nexttowardf): Likewise. * sysdeps/ieee754/ldbl-96/s_nexttoward.c (__nexttoward): Likewise. * sysdeps/ieee754/ldbl-96/s_nexttowardf.c (__nexttowardf): Likewise. * sysdeps/ieee754/ldbl-opt/s_nexttowardfd.c (__nldbl_nexttowardf): Likewise. * math/libm-test.inc (nexttoward_test_data): Add more tests.
* PowerPC: Add comments to optimized strncpyGabriel F. T. Gomes2015-10-011-2/+38
| | | | | * sysdeps/powerpc/powerpc64/power8/strncpy.S: Added comments to some assembly instructions.
* PowerPC: Fix operand prefixesGabriel F. T. Gomes2015-10-011-6/+6
| | | | | | | | | | | | | | | | | | | | The file sysdeps/powerpc/sysdeps.h defines aliases for register operands, which add the letter 'r' as a prefix to a register name. E.g.: register 20 can be written as 'r20', instead of '20'. On the one hand, this increases readability, as it makes it easier for readers to know whether the operand is a register or an immediate. On the other hand, this permits that immediate operands be written as if they were registers, and vice-versa, thus reducing the readability of the code. This commit removes some of these unintentional misuses. This commit also increases readability of the code by adding the prefix 'cr' to some uses of the control register. Both changes have no effect on the final code. Checked with objdump. * sysdeps/powerpc/powerpc64/power8/strncpy.S: Remove or add register prefix from operands.
* Fix ldbl-128 / ldbl-128ibm lgamma overflow handling (bug 16347, bug 19046).Joseph Myers2015-10-011-7/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The ldbl-128 / ldbl-128ibm implementation of lgamma has problems with its handling of large arguments. It has an overflow threshold that is correct only for ldbl-128, despite being used for both types - with diagnostic control macros as a temporary measure to disable warnings about that constant overflowing for ldbl-128ibm - and it has a calculation that's roughly x * log(x) - x, resulting in overflows for arguments that are roughly at most a factor 1/log(threshold) below the overflow threshold. This patch fixes both issues, using an overflow threshold appropriate for the type in question and adding another case for large arguments that avoids the possible intermediate overflow. Tested for x86_64, x86, mips64 and powerpc. [BZ #16347] [BZ #19046] * sysdeps/ieee754/ldbl-128/e_lgammal_r.c: Do not include <libc-internal.h>. (MAXLGM): Do not use diagnostic control macros. [LDBL_MANT_DIG == 106] (MAXLGM): Change value to overflow threshold for ldbl-128ibm. (__ieee754_lgammal_r): For large arguments, multiply by log - 1 instead of multiplying by log then subtracting. * math/auto-libm-test-in: Add more tests of lgamma. * math/auto-libm-test-out: Regenerated.
* Fix ldbl-128ibm exp10l spurious overflows (bug 16620).Joseph Myers2015-09-301-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | The ldbl-128ibm implementation of exp10l uses a version of log(10) split into high and low parts - but the low part is negative, so causing spurious overflows from __ieee754_expl (exp_high) in cases close to the overflow threshold (I added relevant tests close to the overflow threshold to the testsuite earlier today). The same issue applies close to the underflow threshold as well (except that spurious underflows in IBM long double arithmetic are harder to fix than the other deficiencies, so we might end up permitting those for IBM long double in the libm testsuite, as permitted by ISO C). This patch fixes it to use a low part rounded downward to 48 bits instead. (The choice of 48 instead of 53 bits is to make it more obviously safe even when the low part of the argument is negative.) Tested for powerpc. (Note that because of libgcc bugs with multiplication very close to LDBL_MAX, libgcc also needs patching for all the problem cases to be fixed, but this patch is still safe and correct in the absence of such libgcc fixes.) [BZ #16620] * sysdeps/ieee754/ldbl-128ibm/e_exp10l.c (log10_high): Use value of log (10) rounded downward to 48 bits. (log10_low): Use corresponding low part of log (10).
* Fix i386 acosh (-qNaN) spurious "invalid" exception.Joseph Myers2015-09-302-4/+6
| | | | | | | | | | | | | | | | | | The i386 versions of acoshf and acosh raise a spurious "invalid" exception for an argument that is a quiet NaN with the sign bit set. The integer arithmetic to detect arguments < 1 also detects -NaN, and then the computation 0 / 0 in that case raises the exception. This patch fixes this by using (x - x) / (x - x) as the computation in that case instead, which will always raise the exception for non-NaN arguments reaching that code, but not for quiet NaN arguments. Tested for x86_64 and x86. [BZ #19032] * sysdeps/i386/fpu/e_acosh.S (__ieee754_acosh): For arguments < 1, compute result as (x - x) / (x - x) not as 0 / 0. * sysdeps/i386/fpu/e_acoshf.S (__ieee754_acoshf): Likewise. * math/libm-test.inc (acosh_test_data): Add another test of acosh.
* Improve test coverage of real libm functions [a-e]*.Joseph Myers2015-09-301-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch improves test coverage of the real libm functions [a-e]*, ensuring that special cases and ranges of input values of potential significance (such as close to overflow and underflow thresholds) are more systematically covered. This is a followup to <https://sourceware.org/ml/libc-alpha/2013-12/msg00757.html> which covered [a-c]* (however, I found more weaknesses in the coverage of those functions when preparing this patch, hence the additional tests being added for them here). Addition of a test for acosh (-qNaN) is temporarily deferred, to be included as part of a fix for bug 19032 which was discovered in the course of adding these tests (and which illustrates the use of testing -qNaN as well as +qNaN as input even to functions for which the sign of a NaN isn't meant to be significant). Tested for x86_64 and x86. * math/auto-libm-test-in: Add more tests of acos, acosh, asin, atan, atan2, atanh, cbrt, cos, cosh, erf, erfc, exp, exp10, exp2 and expm1. * math/auto-libm-test-out: Regenerated. * math/libm-test.inc (acos_test_data): Add more tests. (asin_test_data): Likewise. (asinh_test_data): Likewise. (atan_test_data): Likewise. (atanh_test_data): Likewise. (atan2_test_data): Likewise. (cbrt_test_data): Likewise. (ceil_test_data): Likewise. (copysign_test_data): Likewise. (cos_test_data): Likewise. (cosh_test_data): Likewise. (erf_test_data): Likewise. (erfc_test_data): Likewise. (exp_test_data): Likewise. (exp10_test_data): Likewise. (exp2_test_data): Likewise. (expm1_test_data): Likewise. * sysdeps/x86_64/fpu/libm-test-ulps: Update.
* Move sysdeps/unix/sysv/linux/i386/i486/*.? to i386H.J. Lu2015-09-3030-254/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since glibc doesn't support i386 any more, we can move sysdeps/unix/sysv/linux/i386/i486/*.? to i386. [BZ #19006] * sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S: Moved to ... * sysdeps/unix/sysv/linux/i386/libc-lowlevellock.S: Here. * sysdeps/unix/sysv/linux/i386/i486/lll_timedlock_wait.c: Moved to ... * sysdeps/unix/sysv/linux/i386/lll_timedlock_wait.c: Here. * sysdeps/unix/sysv/linux/i386/i486/lll_timedwait_tid.c: Moved to ... * sysdeps/unix/sysv/linux/i386/lll_timedwait_tid.c: Here. * sysdeps/unix/sysv/linux/i386/i486/lowlevellock.S: Moved to ... * sysdeps/unix/sysv/linux/i386/lowlevellock.S: Here. * sysdeps/unix/sysv/linux/i386/i486/lowlevelrobustlock.S: Moved to ... * sysdeps/unix/sysv/linux/i386/lowlevelrobustlock.S: Here. * sysdeps/unix/sysv/linux/i386/i486/pthread_barrier_wait.S: Moved to ... * sysdeps/unix/sysv/linux/i386/pthread_barrier_wait.S: Here. * sysdeps/unix/sysv/linux/i386/i486/pthread_cond_broadcast.S: Moved to ... * sysdeps/unix/sysv/linux/i386/pthread_cond_broadcast.S: Here. * sysdeps/unix/sysv/linux/i386/i486/pthread_cond_signal.S: Moved to ... * sysdeps/unix/sysv/linux/i386/pthread_cond_signal.S: Here. * sysdeps/unix/sysv/linux/i386/i486/pthread_cond_timedwait.S: Moved to ... * sysdeps/unix/sysv/linux/i386/pthread_cond_timedwait.S: Here. * sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S: Moved to ... * sysdeps/unix/sysv/linux/i386/pthread_cond_wait.S: Here. * sysdeps/unix/sysv/linux/i386/i586/libc-lowlevellock.S: Removed. * sysdeps/unix/sysv/linux/i386/i586/lll_timedlock_wait.c: Likewise. * sysdeps/unix/sysv/linux/i386/i586/lll_timedwait_tid.c: Likewise. * sysdeps/unix/sysv/linux/i386/i586/lowlevellock.S: Likewise. * sysdeps/unix/sysv/linux/i386/i586/lowlevelrobustlock.S: Likewise. * sysdeps/unix/sysv/linux/i386/i586/pthread_barrier_wait.S: Likewise. * sysdeps/unix/sysv/linux/i386/i586/pthread_cond_broadcast.S: Likewise. * sysdeps/unix/sysv/linux/i386/i586/pthread_cond_signal.S: Likewise. * sysdeps/unix/sysv/linux/i386/i586/pthread_cond_timedwait.S: Likewise. * sysdeps/unix/sysv/linux/i386/i586/pthread_cond_wait.S: Likewise. * sysdeps/unix/sysv/linux/i386/i686/libc-lowlevellock.S: Likewise. * sysdeps/unix/sysv/linux/i386/i686/lll_timedlock_wait.c: Likewise. * sysdeps/unix/sysv/linux/i386/i686/lll_timedwait_tid.c: Likewise. * sysdeps/unix/sysv/linux/i386/i686/lowlevellock.S: Likewise. * sysdeps/unix/sysv/linux/i386/i686/lowlevelrobustlock.S: Likewise. * sysdeps/unix/sysv/linux/i386/i686/pthread_barrier_wait.S: Likewise. * sysdeps/unix/sysv/linux/i386/i686/pthread_cond_broadcast.S: Likewise. * sysdeps/unix/sysv/linux/i386/i686/pthread_cond_signal.S: Likewise. * sysdeps/unix/sysv/linux/i386/i686/pthread_cond_wait.S: Likewise. * sysdeps/unix/sysv/linux/i386/i686/pthread_cond_timedwait.S: Replace ../i486/pthread_cond_timedwait.S with ../pthread_cond_timedwait.S.
* Fix clog, clog10 inaccuracy (bug 19016).Joseph Myers2015-09-289-143/+119
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For arguments with X^2 + Y^2 close to 1, clog and clog10 avoid large errors from log(hypot) by computing X^2 + Y^2 - 1 in a way that avoids cancellation error and then using log1p. However, the thresholds for using that approach still result in log being used on argument as large as sqrt(13/16) > 0.9, leading to significant errors, in some cases above the 9ulp maximum allowed in glibc libm. This patch arranges for the approach using log1p to be used in any cases where |X|, |Y| < 1 and X^2 + Y^2 >= 0.5 (with the existing allowance for cases where one of X and Y is very small), adjusting the __x2y2m1 functions to work with the wider range of inputs. This way, log only gets used on arguments below sqrt(1/2) (or substantially above 1), where the error involved is much less. Tested for x86_64, x86, mips64 and powerpc. For the ulps regeneration I removed the existing clog and clog10 ulps before regenerating to allow any reduced ulps to appear. Tests added include those found by random test generation to produce large ulps either before or after the patch, and some found by trying inputs close to the (0.75, 0.5) threshold where the potential errors from using log are largest. [BZ #19016] * sysdeps/generic/math_private.h (__x2y2m1f): Update comment to allow more cases with X^2 + Y^2 >= 0.5. * sysdeps/ieee754/dbl-64/x2y2m1.c (__x2y2m1): Likewise. Add -1 as normal element in sum instead of special-casing based on values of arguments. * sysdeps/ieee754/dbl-64/x2y2m1f.c (__x2y2m1f): Update comment. * sysdeps/ieee754/ldbl-128/x2y2m1l.c (__x2y2m1l): Likewise. Add -1 as normal element in sum instead of special-casing based on values of arguments. * sysdeps/ieee754/ldbl-128ibm/x2y2m1l.c (__x2y2m1l): Likewise. * sysdeps/ieee754/ldbl-96/x2y2m1.c [FLT_EVAL_METHOD != 0] (__x2y2m1): Update comment. * sysdeps/ieee754/ldbl-96/x2y2m1l.c (__x2y2m1l): Likewise. Add -1 as normal element in sum instead of special-casing based on values of arguments. * math/s_clog.c (__clog): Handle more cases using log1p without hypot. * 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/auto-libm-test-in: Add more tests of clog and clog10. * math/auto-libm-test-out: Regenerated. * sysdeps/i386/fpu/libm-test-ulps: Update. * sysdeps/x86_64/fpu/libm-test-ulps: Likewise.
* Fix powf inaccuracy (bug 18956).Joseph Myers2015-09-262-9/+11
| | | | | | | | | | | | | | | | | | | | | | The flt-32 version of powf can be inaccurate because of bugs in the extra-precision calculation of (x-1)/(x+1) or (x-1.5)/(x+1.5) as part of calculating log(x) with extra precision: a constant used (as part of adding 1 or 1.5 through integer arithmetic) is incorrect, and then the code fails to mask a computed high part before using it in arithmetic that relies on s_h*t_h being exactly representable. This patch fixes these bugs. Tested for x86_64 and x86. x86_64 ulps for powf removed and regenerated to reflect reduced ulps from the increased accuracy for existing tests. [BZ #18956] * sysdeps/ieee754/flt-32/e_powf.c (__ieee754_powf): Add 0x00400000 not 0x0040000 for high bit of mantissa. Mask with 0xfffff000 when extracting high part. * math/auto-libm-test-in: Add another test of pow. * math/auto-libm-test-out: Regenerated. * sysdeps/x86_64/fpu/libm-test-ulps: Update.
* Fix pow missing underflows (bug 18825).Joseph Myers2015-09-2511-7/+99
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Similar to various other bugs in this area, pow functions can fail to raise the underflow exception when the result is tiny and inexact but one or more low bits of the intermediate result that is scaled down (or, in the i386 case, converted from a wider evaluation format) are zero. This patch forces the exception in a similar way to previous fixes, thereby concluding the fixes for known bugs with missing underflow exceptions currently filed in Bugzilla. Tested for x86_64, x86, mips64 and powerpc. [BZ #18825] * sysdeps/i386/fpu/i386-math-asm.h (FLT_NARROW_EVAL_UFLOW_NONNAN): New macro. (DBL_NARROW_EVAL_UFLOW_NONNAN): Likewise. (LDBL_CHECK_FORCE_UFLOW_NONNAN): Likewise. * sysdeps/i386/fpu/e_pow.S: Use DEFINE_DBL_MIN. (__ieee754_pow): Use DBL_NARROW_EVAL_UFLOW_NONNAN instead of DBL_NARROW_EVAL, reloading the PIC register as needed. * sysdeps/i386/fpu/e_powf.S: Use DEFINE_FLT_MIN. (__ieee754_powf): Use FLT_NARROW_EVAL_UFLOW_NONNAN instead of FLT_NARROW_EVAL. Use separate return path for case when first argument is NaN. * sysdeps/i386/fpu/e_powl.S: Include <i386-math-asm.h>. Use DEFINE_LDBL_MIN. (__ieee754_powl): Use LDBL_CHECK_FORCE_UFLOW_NONNAN, reloading the PIC register. * sysdeps/ieee754/dbl-64/e_pow.c (__ieee754_pow): Use math_check_force_underflow_nonneg. * sysdeps/ieee754/flt-32/e_powf.c (__ieee754_powf): Force underflow for subnormal result. * sysdeps/ieee754/ldbl-128/e_powl.c (__ieee754_powl): Likewise. * sysdeps/ieee754/ldbl-128ibm/e_powl.c (__ieee754_powl): Use math_check_force_underflow_nonneg. * sysdeps/x86/fpu/powl_helper.c (__powl_helper): Use math_check_force_underflow. * sysdeps/x86_64/fpu/x86_64-math-asm.h (LDBL_CHECK_FORCE_UFLOW_NONNAN): New macro. * sysdeps/x86_64/fpu/e_powl.S: Include <x86_64-math-asm.h>. Use DEFINE_LDBL_MIN. (__ieee754_powl): Use LDBL_CHECK_FORCE_UFLOW_NONNAN. * math/auto-libm-test-in: Add more tests of pow. * math/auto-libm-test-out: Regenerated.
* Use soft-fp fma for no-FPU ColdFire (bug 13304).Joseph Myers2015-09-253-0/+3
| | | | | | | | | | | | | | | | Systems without floating-point exceptions and rounding modes should use the soft-fp versions of fmaf and fma, not the sysdeps/ieee754 versions that rely on setting rounding to zero and testing for the "inexact" exception; this has been noted on <https://sourceware.org/glibc/wiki/PortStatus> for some time. This patch makes no-FPU ColdFire use the soft-fp files; sfp-machine.h is made to include the nios2 version of sfp-machine.h which seems sufficiently generic for 32-bit systems. [BZ #13304] * sysdeps/m68k/coldfire/nofpu/s_fma.c: New file. * sysdeps/m68k/coldfire/nofpu/s_fmaf.c: Likewise. * sysdeps/m68k/coldfire/nofpu/sfp-machine.h: Likewise.
* Use soft-fp fma for MicroBlaze (bug 13304).Joseph Myers2015-09-253-0/+3
| | | | | | | | | | | | | | | | Systems without floating-point exceptions and rounding modes should use the soft-fp versions of fmaf and fma, not the sysdeps/ieee754 versions that rely on setting rounding to zero and testing for the "inexact" exception; this has been noted on <https://sourceware.org/glibc/wiki/PortStatus> for some time. This patch makes MicroBlaze use the soft-fp files; sfp-machine.h is made to include the nios2 version of sfp-machine.h which seems sufficiently generic for 32-bit systems. [BZ #13304] * sysdeps/microblaze/s_fma.c: New file. * sysdeps/microblaze/s_fmaf.c: Likewise. * sysdeps/microblaze/sfp-machine.h: Likewise.