diff options
Diffstat (limited to 'sysdeps/i386')
408 files changed, 6101 insertions, 5428 deletions
diff --git a/sysdeps/i386/Implies b/sysdeps/i386/Implies index 20b2dffc29..76cb207173 100644 --- a/sysdeps/i386/Implies +++ b/sysdeps/i386/Implies @@ -1,5 +1,6 @@ x86 wordsize-32 +ieee754/float128 ieee754/ldbl-96 ieee754/dbl-64 ieee754/flt-32 diff --git a/sysdeps/i386/Makefile b/sysdeps/i386/Makefile index 168512fc32..c0a4fe15d4 100644 --- a/sysdeps/i386/Makefile +++ b/sysdeps/i386/Makefile @@ -5,6 +5,14 @@ asm-CPPFLAGS += -DGAS_SYNTAX # The i386 `long double' is a distinct type we support. long-double-fcts = yes +ifeq ($(subdir),math) +# These functions change the rounding mode internally and need to +# update both the SSE2 rounding mode and the 387 rounding mode. See +# the handling of MATH_SET_BOTH_ROUNDING_MODES in +# sysdeps/i386/fpu/fenv_private.h. +CFLAGS-e_gamma_r.c += -DMATH_SET_BOTH_ROUNDING_MODES +endif + ifeq ($(subdir),string) sysdep_routines += cacheinfo endif @@ -19,50 +27,10 @@ CFLAGS-dl-load.c += -Wno-unused CFLAGS-dl-reloc.c += -Wno-unused endif -ifeq ($(subdir),debug) -CFLAGS-backtrace.c += -fexceptions -endif - -# Most of the glibc routines don't ever call user defined callbacks -# nor use any FPU or SSE* and as such don't need bigger %esp alignment -# than 4 bytes. -# Lots of routines in math will use FPU, so make math subdir an exception -# here. -# In gcc 4.6 (and maybe earlier?) giving -mpreferred-stack-boundary=2 is -# an error, so don't try to reduce it here like we used to. We still -# explicit set -mpreferred-stack-boundary=4 the places where it matters, -# in case an older compiler defaulted to 2. -ifeq ($(subdir),math) -sysdep-CFLAGS += -mpreferred-stack-boundary=4 -else ifeq ($(subdir),csu) -sysdep-CFLAGS += -mpreferred-stack-boundary=4 gen-as-const-headers += link-defines.sym else -# Likewise, any function which calls user callbacks -uses-callbacks += -mpreferred-stack-boundary=4 -# Likewise, any stack alignment tests -stack-align-test-flags += -malign-double -mpreferred-stack-boundary=4 -endif -endif - -# And a couple of other routines -ifeq ($(subdir),stdlib) -CFLAGS-exit.c += -mpreferred-stack-boundary=4 -CFLAGS-cxa_finalize.c += -mpreferred-stack-boundary=4 -endif -ifeq ($(subdir),elf) -CFLAGS-dl-init.c += -mpreferred-stack-boundary=4 -CFLAGS-dl-fini.c += -mpreferred-stack-boundary=4 -CFLAGS-dl-open.c += -mpreferred-stack-boundary=4 -CFLAGS-dl-close.c += -mpreferred-stack-boundary=4 -CFLAGS-dl-error.c += -mpreferred-stack-boundary=4 -endif -ifeq ($(subdir),dlfcn) -CFLAGS-dlopen.c += -mpreferred-stack-boundary=4 -CFLAGS-dlopenold.c += -mpreferred-stack-boundary=4 -CFLAGS-dlclose.c += -mpreferred-stack-boundary=4 -CFLAGS-dlerror.c += -mpreferred-stack-boundary=4 +stack-align-test-flags += -malign-double endif ifneq (,$(filter -mno-tls-direct-seg-refs,$(CFLAGS))) @@ -84,16 +52,20 @@ ifeq ($(subdir),csu) gen-as-const-headers += tlsdesc.sym endif -ifeq ($(subdir),elf) # Make sure no code in ld.so uses mm/xmm/ymm/zmm registers on i386 since # the first 3 mm/xmm/ymm/zmm registers are used to pass vector parameters # which must be preserved. +# With SSE disabled, ensure -fpmath is not set to use sse either. +rtld-CFLAGS += -mno-sse -mno-mmx -mfpmath=387 +ifeq ($(subdir),elf) CFLAGS-.os += $(if $(filter $(@F),$(patsubst %,%.os,$(all-rtld-routines))),\ - -mno-sse -mno-mmx) + $(rtld-CFLAGS)) tests-special += $(objpfx)tst-ld-sse-use.out $(objpfx)tst-ld-sse-use.out: ../sysdeps/i386/tst-ld-sse-use.sh $(objpfx)ld.so @echo "Checking ld.so for SSE register use. This will take a few seconds..." $(BASH) $< $(objpfx) '$(NM)' '$(OBJDUMP)' '$(READELF)' > $@; \ $(evaluate-test) +else +CFLAGS-.os += $(if $(filter rtld-%.os,$(@F)), $(rtld-CFLAGS)) endif diff --git a/sysdeps/i386/__longjmp.S b/sysdeps/i386/__longjmp.S index 36c692209e..6e98ed538d 100644 --- a/sysdeps/i386/__longjmp.S +++ b/sysdeps/i386/__longjmp.S @@ -1,5 +1,5 @@ /* longjmp for i386. - Copyright (C) 1995-2016 Free Software Foundation, Inc. + Copyright (C) 1995-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -18,14 +18,55 @@ #include <sysdep.h> #include <jmpbuf-offsets.h> +#include <jmp_buf-ssp.h> #include <asm-syntax.h> #include <stap-probe.h> +/* Don't restore shadow stack register if + 1. Shadow stack isn't enabled. Or + 2. __longjmp is defined for __longjmp_cancel. + */ +#if !SHSTK_ENABLED || defined __longjmp +# undef SHADOW_STACK_POINTER_OFFSET +#endif + .text ENTRY (__longjmp) #ifdef PTR_DEMANGLE movl 4(%esp), %eax /* User's jmp_buf in %eax. */ +# ifdef SHADOW_STACK_POINTER_OFFSET +# if IS_IN (libc) && defined SHARED && defined FEATURE_1_OFFSET + /* Check if Shadow Stack is enabled. */ + testl $X86_FEATURE_1_SHSTK, %gs:FEATURE_1_OFFSET + jz L(skip_ssp) +# else + xorl %edx, %edx +# endif + /* Check and adjust the Shadow-Stack-Pointer. */ + rdsspd %edx + /* And compare it with the saved ssp value. */ + subl SHADOW_STACK_POINTER_OFFSET(%eax), %edx + je L(skip_ssp) + /* Count the number of frames to adjust and adjust it + with incssp instruction. The instruction can adjust + the ssp by [0..255] value only thus use a loop if + the number of frames is bigger than 255. */ + negl %edx + shrl $2, %edx + /* NB: We saved Shadow-Stack-Pointer of setjmp. Since we are + restoring Shadow-Stack-Pointer of setjmp's caller, we + need to unwind shadow stack by one more frame. */ + addl $1, %edx + movl $255, %ebx +L(loop): + cmpl %ebx, %edx + cmovb %edx, %ebx + incsspd %ebx + subl %ebx, %edx + ja L(loop) +L(skip_ssp): +# endif /* Save the return address now. */ movl (JB_PC*4)(%eax), %edx /* Get the stack pointer. */ @@ -56,6 +97,38 @@ ENTRY (__longjmp) #else movl 4(%esp), %ecx /* User's jmp_buf in %ecx. */ movl 8(%esp), %eax /* Second argument is return value. */ +# ifdef SHADOW_STACK_POINTER_OFFSET +# if IS_IN (libc) && defined SHARED + /* Check if Shadow Stack is enabled. */ + testl $X86_FEATURE_1_SHSTK, %gs:FEATURE_1_OFFSET + jz L(skip_ssp) +# endif + /* Check and adjust the Shadow-Stack-Pointer. */ + xorl %edx, %edx + /* Get the current ssp. */ + rdsspd %edx + /* And compare it with the saved ssp value. */ + subl SHADOW_STACK_POINTER_OFFSET(%ecx), %edx + je L(skip_ssp) + /* Count the number of frames to adjust and adjust it + with incssp instruction. The instruction can adjust + the ssp by [0..255] value only thus use a loop if + the number of frames is bigger than 255. */ + negl %edx + shrl $2, %edx + /* NB: We saved Shadow-Stack-Pointer of setjmp. Since we are + restoring Shadow-Stack-Pointer of setjmp's caller, we + need to unwind shadow stack by one more frame. */ + addl $1, %edx + movl $255, %ebx +L(loop): + cmpl %ebx, %edx + cmovb %edx, %ebx + incsspd %ebx + subl %ebx, %edx + ja L(loop) +L(skip_ssp): +# endif /* Save the return address now. */ movl (JB_PC*4)(%ecx), %edx LIBC_PROBE (longjmp, 3, 4@%ecx, -4@%eax, 4@%edx) diff --git a/sysdeps/i386/add_n.S b/sysdeps/i386/add_n.S index 5ef5afc378..998858469c 100644 --- a/sysdeps/i386/add_n.S +++ b/sysdeps/i386/add_n.S @@ -1,6 +1,6 @@ /* Add two limb vectors of the same length > 0 and store sum in a third limb vector. - Copyright (C) 1992-2016 Free Software Foundation, Inc. + Copyright (C) 1992-2018 Free Software Foundation, Inc. This file is part of the GNU MP Library. The GNU MP Library is free software; you can redistribute it and/or modify @@ -17,7 +17,7 @@ along with the GNU MP Library; see the file COPYING.LIB. If not, see <http://www.gnu.org/licenses/>. */ -#include "sysdep.h" +#include <sysdep.h> #include "asm-syntax.h" #define PARMS 4+8 /* space for 2 saved regs */ @@ -40,6 +40,13 @@ ENTRY (__mpn_add_n) cfi_rel_offset (esi, 0) movl S2(%esp),%edx movl SIZE(%esp),%ecx + +#if IBT_ENABLED + pushl %ebx + cfi_adjust_cfa_offset (4) + cfi_rel_offset (ebx, 0) +#endif + movl %ecx,%eax shrl $3,%ecx /* compute count for unrolled loop */ negl %eax @@ -51,6 +58,9 @@ ENTRY (__mpn_add_n) subl %eax,%esi /* ... by a constant when we ... */ subl %eax,%edx /* ... enter the loop */ shrl $2,%eax /* restore previous value */ +#if IBT_ENABLED + leal -4(,%eax,4),%ebx /* Count for 4-byte endbr32 */ +#endif #ifdef PIC /* Calculate start address in loop for PIC. Due to limitations in some assemblers, Loop-L0-3 cannot be put into the leal */ @@ -65,29 +75,39 @@ L(0): leal (%eax,%eax,8),%eax /* Calculate start address in loop for non-PIC. */ leal (L(oop) - 3)(%eax,%eax,8),%eax #endif +#if IBT_ENABLED + addl %ebx,%eax /* Adjust for endbr32 */ +#endif jmp *%eax /* jump into loop */ ALIGN (3) L(oop): movl (%esi),%eax adcl (%edx),%eax movl %eax,(%edi) + _CET_ENDBR movl 4(%esi),%eax adcl 4(%edx),%eax movl %eax,4(%edi) + _CET_ENDBR movl 8(%esi),%eax adcl 8(%edx),%eax movl %eax,8(%edi) + _CET_ENDBR movl 12(%esi),%eax adcl 12(%edx),%eax movl %eax,12(%edi) + _CET_ENDBR movl 16(%esi),%eax adcl 16(%edx),%eax movl %eax,16(%edi) + _CET_ENDBR movl 20(%esi),%eax adcl 20(%edx),%eax movl %eax,20(%edi) + _CET_ENDBR movl 24(%esi),%eax adcl 24(%edx),%eax movl %eax,24(%edi) + _CET_ENDBR movl 28(%esi),%eax adcl 28(%edx),%eax movl %eax,28(%edi) @@ -100,6 +120,11 @@ L(oop): movl (%esi),%eax sbbl %eax,%eax negl %eax +#if IBT_ENABLED + popl %ebx + cfi_adjust_cfa_offset (-4) + cfi_restore (ebx) +#endif popl %esi cfi_adjust_cfa_offset (-4) cfi_restore (esi) diff --git a/sysdeps/i386/addmul_1.S b/sysdeps/i386/addmul_1.S index f211263702..36f6ff2697 100644 --- a/sysdeps/i386/addmul_1.S +++ b/sysdeps/i386/addmul_1.S @@ -1,6 +1,6 @@ /* i80386 __mpn_addmul_1 -- Multiply a limb vector with a limb and add the result to a second limb vector. - Copyright (C) 1992-2016 Free Software Foundation, Inc. + Copyright (C) 1992-2018 Free Software Foundation, Inc. This file is part of the GNU MP Library. The GNU MP Library is free software; you can redistribute it and/or modify diff --git a/sysdeps/i386/asm-syntax.h b/sysdeps/i386/asm-syntax.h index ef87d69f53..398a0621cc 100644 --- a/sysdeps/i386/asm-syntax.h +++ b/sysdeps/i386/asm-syntax.h @@ -1,5 +1,5 @@ /* Definitions for x86 syntax variations. - Copyright (C) 1992-2016 Free Software Foundation, Inc. + Copyright (C) 1992-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Its master source is NOT part of the C library, however. The master source lives in the GNU MP Library. diff --git a/sysdeps/i386/atomic-machine.h b/sysdeps/i386/atomic-machine.h index ce62b335af..272da5dd8f 100644 --- a/sysdeps/i386/atomic-machine.h +++ b/sysdeps/i386/atomic-machine.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2002-2016 Free Software Foundation, Inc. +/* Copyright (C) 2002-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. @@ -56,6 +56,7 @@ typedef uintmax_t uatomic_max_t; #define __HAVE_64B_ATOMICS 0 #define USE_ATOMIC_COMPILER_BUILTINS 0 +#define ATOMIC_EXCHANGE_USES_CAS 0 #define atomic_compare_and_exchange_val_acq(mem, newval, oldval) \ diff --git a/sysdeps/i386/backtrace.c b/sysdeps/i386/backtrace.c index 1ec51aaf43..da033379e7 100644 --- a/sysdeps/i386/backtrace.c +++ b/sysdeps/i386/backtrace.c @@ -1,5 +1,5 @@ /* Return backtrace of current program state. - Copyright (C) 1998-2016 Free Software Foundation, Inc. + Copyright (C) 1998-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998. diff --git a/sysdeps/i386/bsd-_setjmp.S b/sysdeps/i386/bsd-_setjmp.S index d97964a641..db47df0ba1 100644 --- a/sysdeps/i386/bsd-_setjmp.S +++ b/sysdeps/i386/bsd-_setjmp.S @@ -1,5 +1,5 @@ /* BSD `_setjmp' entry point to `sigsetjmp (..., 0)'. i386 version. - Copyright (C) 1994-2016 Free Software Foundation, Inc. + Copyright (C) 1994-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -22,12 +22,18 @@ #include <sysdep.h> #include <jmpbuf-offsets.h> +#include <jmp_buf-ssp.h> #include <stap-probe.h> #define PARMS 4 /* no space for saved regs */ #define JMPBUF PARMS #define SIGMSK JMPBUF+4 +/* Don't save shadow stack register if shadow stack isn't enabled. */ +#if !SHSTK_ENABLED +# undef SHADOW_STACK_POINTER_OFFSET +#endif + ENTRY (_setjmp) xorl %eax, %eax @@ -51,6 +57,21 @@ ENTRY (_setjmp) movl %ebp, (JB_BP*4)(%edx) /* Save caller's frame pointer. */ movl %eax, JB_SIZE(%edx) /* No signal mask set. */ +#ifdef SHADOW_STACK_POINTER_OFFSET +# if IS_IN (libc) && defined SHARED && defined FEATURE_1_OFFSET + /* Check if Shadow Stack is enabled. */ + testl $X86_FEATURE_1_SHSTK, %gs:FEATURE_1_OFFSET + jz L(skip_ssp) +# else + xorl %ecx, %ecx +# endif + /* Get the current Shadow-Stack-Pointer and save it. */ + rdsspd %ecx + movl %ecx, SHADOW_STACK_POINTER_OFFSET(%edx) +# if IS_IN (libc) && defined SHARED && defined FEATURE_1_OFFSET +L(skip_ssp): +# endif +#endif ret END (_setjmp) libc_hidden_def (_setjmp) diff --git a/sysdeps/i386/bsd-setjmp.S b/sysdeps/i386/bsd-setjmp.S index a6e7c1ab88..1290d0d82b 100644 --- a/sysdeps/i386/bsd-setjmp.S +++ b/sysdeps/i386/bsd-setjmp.S @@ -1,5 +1,5 @@ /* BSD `setjmp' entry point to `sigsetjmp (..., 1)'. i386 version. - Copyright (C) 1994-2016 Free Software Foundation, Inc. + Copyright (C) 1994-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -22,12 +22,18 @@ #include <sysdep.h> #include <jmpbuf-offsets.h> +#include <jmp_buf-ssp.h> #include <stap-probe.h> #define PARMS 4 /* no space for saved regs */ #define JMPBUF PARMS #define SIGMSK JMPBUF+4 +/* Don't save shadow stack register if shadow stack isn't enabled. */ +#if !SHSTK_ENABLED +# undef SHADOW_STACK_POINTER_OFFSET +#endif + ENTRY (setjmp) /* Note that we have to use a non-exported symbol in the next jump since otherwise gas will emit it as a jump through the @@ -51,6 +57,21 @@ ENTRY (setjmp) #endif movl %ecx, (JB_PC*4)(%eax) movl %ebp, (JB_BP*4)(%eax) /* Save caller's frame pointer. */ +#ifdef SHADOW_STACK_POINTER_OFFSET +# if IS_IN (libc) && defined SHARED && defined FEATURE_1_OFFSET + /* Check if Shadow Stack is enabled. */ + testl $X86_FEATURE_1_SHSTK, %gs:FEATURE_1_OFFSET + jz L(skip_ssp) +# else + xorl %ecx, %ecx +# endif + /* Get the current Shadow-Stack-Pointer and save it. */ + rdsspd %ecx + movl %ecx, SHADOW_STACK_POINTER_OFFSET(%eax) +# if IS_IN (libc) && defined SHARED && defined FEATURE_1_OFFSET +L(skip_ssp): +# endif +#endif /* Call __sigjmp_save. */ pushl $1 diff --git a/sysdeps/i386/cacheinfo.c b/sysdeps/i386/cacheinfo.c index 0b50c6d346..f15fe0779a 100644 --- a/sysdeps/i386/cacheinfo.c +++ b/sysdeps/i386/cacheinfo.c @@ -1,3 +1,3 @@ #define DISABLE_PREFETCHW -#include <sysdeps/x86_64/cacheinfo.c> +#include <sysdeps/x86/cacheinfo.c> diff --git a/sysdeps/i386/configure b/sysdeps/i386/configure index 9515719daa..90c63caf35 100644 --- a/sysdeps/i386/configure +++ b/sysdeps/i386/configure @@ -26,7 +26,7 @@ libc_compiler_builtin_inlined=no cat > conftest.c <<EOF int _start (void) { int a, b, c; __sync_val_compare_and_swap (&a, b, c); return 0; } EOF -if ! { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS +if ! { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp -O0 -nostdlib -nostartfiles -S conftest.c -o - | fgrep "__sync_val_compare_and_swap" 1>&5' @@ -50,6 +50,39 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_compiler_builtin_inlined" >&5 $as_echo "$libc_compiler_builtin_inlined" >&6; } +if test "$static_pie" = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for linker static PIE support" >&5 +$as_echo_n "checking for linker static PIE support... " >&6; } +if ${libc_cv_ld_static_pie+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat > conftest.s <<\EOF + .text + .global _start +_start: + movl _start@GOT(%ebx), %eax +EOF + libc_cv_pie_option="-Wl,-pie" + libc_cv_ld_static_pie=no + if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -nostartfiles -nostdlib $no_ssp $libc_cv_pie_option -o conftest conftest.s 1>&5' + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 + (eval $ac_try) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then + if $READELF -r conftest | grep 'There are no relocations in this file.' > /dev/null; then + libc_cv_ld_static_pie=yes + fi + fi +rm -f conftest* +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_ld_static_pie" >&5 +$as_echo "$libc_cv_ld_static_pie" >&6; } + if test "$libc_cv_ld_static_pie" != yes; then + as_fn_error $? "linker support for static PIE needed" "$LINENO" 5 + fi +fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Intel MPX support" >&5 $as_echo_n "checking for Intel MPX support... " >&6; } if ${libc_cv_asm_mpx+:} false; then : @@ -72,13 +105,15 @@ rm -f conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_asm_mpx" >&5 $as_echo "$libc_cv_asm_mpx" >&6; } -if test $libc_cv_asm_mpx == yes; then +if test $libc_cv_asm_mpx = yes; then $as_echo "#define HAVE_MPX_SUPPORT 1" >>confdefs.h fi -$as_echo "#define USE_REGPARMS 1" >>confdefs.h +$as_echo "#define PI_STATIC_AND_HIDDEN 1" >>confdefs.h -$as_echo "#define PI_STATIC_AND_HIDDEN 1" >>confdefs.h +if test x"$multi_arch" != xno; then + $as_echo "#define NO_HIDDEN_EXTERN_FUNC_IN_PIE 1" >>confdefs.h +fi diff --git a/sysdeps/i386/configure.ac b/sysdeps/i386/configure.ac index f8f9e44909..6d2068d2b3 100644 --- a/sysdeps/i386/configure.ac +++ b/sysdeps/i386/configure.ac @@ -30,6 +30,29 @@ LIBC_COMPILER_BUILTIN_INLINED( *** Please use host i786, i686, i586, or i486. *** For example: /source/glibc/configure CFLAGS='-O2 -march=i686' ...])]) +dnl Check if linker can convert "movl main@GOT(%ebx), %eax" to +dnl "leal main@GOTOFF(%ebx), %eax" for static PIE. +if test "$static_pie" = yes; then + AC_CACHE_CHECK(for linker static PIE support, libc_cv_ld_static_pie, [dnl +cat > conftest.s <<\EOF + .text + .global _start +_start: + movl _start@GOT(%ebx), %eax +EOF + libc_cv_pie_option="-Wl,-pie" + libc_cv_ld_static_pie=no + if AC_TRY_COMMAND(${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -nostartfiles -nostdlib $no_ssp $libc_cv_pie_option -o conftest conftest.s 1>&AS_MESSAGE_LOG_FD); then + if $READELF -r conftest | grep 'There are no relocations in this file.' > /dev/null; then + libc_cv_ld_static_pie=yes + fi + fi +rm -f conftest*]) + if test "$libc_cv_ld_static_pie" != yes; then + AC_MSG_ERROR([linker support for static PIE needed]) + fi +fi + dnl Check whether asm supports Intel MPX AC_CACHE_CHECK(for Intel MPX support, libc_cv_asm_mpx, [dnl cat > conftest.s <<\EOF @@ -41,12 +64,16 @@ else libc_cv_asm_mpx=no fi rm -f conftest*]) -if test $libc_cv_asm_mpx == yes; then +if test $libc_cv_asm_mpx = yes; then AC_DEFINE(HAVE_MPX_SUPPORT) fi -AC_DEFINE(USE_REGPARMS) - dnl It is always possible to access static and hidden symbols in an dnl position independent way. AC_DEFINE(PI_STATIC_AND_HIDDEN) + +dnl When multi-arch is enabled, all external functions must be called +dnl via PIC PLT in PIE, which requires setting up EBX register. +if test x"$multi_arch" != xno; then + AC_DEFINE(NO_HIDDEN_EXTERN_FUNC_IN_PIE) +fi diff --git a/sysdeps/i386/crti.S b/sysdeps/i386/crti.S index 2fbc5711e3..65ddc1c934 100644 --- a/sysdeps/i386/crti.S +++ b/sysdeps/i386/crti.S @@ -1,5 +1,5 @@ /* Special .init and .fini section support for x86. - Copyright (C) 1995-2016 Free Software Foundation, Inc. + Copyright (C) 1995-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -58,8 +58,10 @@ .section .init,"ax",@progbits .p2align 2 .globl _init + .hidden _init .type _init, @function _init: + _CET_ENDBR pushl %ebx /* Maintain 16-byte stack alignment for called functions. */ subl $8, %esp @@ -68,7 +70,7 @@ _init: movl PREINIT_FUNCTION@GOT(%ebx), %eax testl %eax, %eax je .Lno_weak_fn - call PREINIT_FUNCTION@PLT + call *%eax .Lno_weak_fn: #else call PREINIT_FUNCTION @@ -77,8 +79,10 @@ _init: .section .fini,"ax",@progbits .p2align 2 .globl _fini + .hidden _fini .type _fini, @function _fini: + _CET_ENDBR pushl %ebx subl $8, %esp LOAD_PIC_REG (bx) diff --git a/sysdeps/i386/crtn.S b/sysdeps/i386/crtn.S index 1445f03ccc..e3a0f1e310 100644 --- a/sysdeps/i386/crtn.S +++ b/sysdeps/i386/crtn.S @@ -1,5 +1,5 @@ /* Special .init and .fini section support for x86. - Copyright (C) 1995-2016 Free Software Foundation, Inc. + Copyright (C) 1995-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/sysdeps/i386/dl-cet.c b/sysdeps/i386/dl-cet.c new file mode 100644 index 0000000000..5d9a4e8d51 --- /dev/null +++ b/sysdeps/i386/dl-cet.c @@ -0,0 +1,67 @@ +/* Linux/i386 CET initializers function. + Copyright (C) 2018 Free Software Foundation, Inc. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + + +#define LINKAGE static inline +#define _dl_cet_check cet_check +#include <sysdeps/x86/dl-cet.c> +#undef _dl_cet_check + +#ifdef SHARED +void +_dl_cet_check (struct link_map *main_map, const char *program) +{ + cet_check (main_map, program); + + if ((GL(dl_x86_feature_1)[0] & GNU_PROPERTY_X86_FEATURE_1_SHSTK)) + { + /* Replace _dl_runtime_resolve and _dl_runtime_profile with + _dl_runtime_resolve_shstk and _dl_runtime_profile_shstk, + respectively if SHSTK is enabled. */ + extern void _dl_runtime_resolve (Elf32_Word) attribute_hidden; + extern void _dl_runtime_resolve_shstk (Elf32_Word) attribute_hidden; + extern void _dl_runtime_profile (Elf32_Word) attribute_hidden; + extern void _dl_runtime_profile_shstk (Elf32_Word) attribute_hidden; + unsigned int i; + struct link_map *l; + Elf32_Addr *got; + + if (main_map->l_info[DT_JMPREL]) + { + got = (Elf32_Addr *) D_PTR (main_map, l_info[DT_PLTGOT]); + if (got[2] == (Elf32_Addr) &_dl_runtime_resolve) + got[2] = (Elf32_Addr) &_dl_runtime_resolve_shstk; + else if (got[2] == (Elf32_Addr) &_dl_runtime_profile) + got[2] = (Elf32_Addr) &_dl_runtime_profile_shstk; + } + + i = main_map->l_searchlist.r_nlist; + while (i-- > 0) + { + l = main_map->l_initfini[i]; + if (l->l_info[DT_JMPREL]) + { + got = (Elf32_Addr *) D_PTR (l, l_info[DT_PLTGOT]); + if (got[2] == (Elf32_Addr) &_dl_runtime_resolve) + got[2] = (Elf32_Addr) &_dl_runtime_resolve_shstk; + else if (got[2] == (Elf32_Addr) &_dl_runtime_profile) + got[2] = (Elf32_Addr) &_dl_runtime_profile_shstk; + } + } + } +} +#endif diff --git a/sysdeps/i386/dl-irel.h b/sysdeps/i386/dl-irel.h index bfdf1b3375..55303180c7 100644 --- a/sysdeps/i386/dl-irel.h +++ b/sysdeps/i386/dl-irel.h @@ -1,6 +1,6 @@ /* Machine-dependent ELF indirect relocation inline functions. i386 version. - Copyright (C) 2009-2016 Free Software Foundation, Inc. + Copyright (C) 2009-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/sysdeps/i386/dl-lookupcfg.h b/sysdeps/i386/dl-lookupcfg.h index 033b475889..5399cf25ab 100644 --- a/sysdeps/i386/dl-lookupcfg.h +++ b/sysdeps/i386/dl-lookupcfg.h @@ -1,5 +1,5 @@ /* Configuration of lookup functions. - Copyright (C) 2005-2016 Free Software Foundation, Inc. + Copyright (C) 2005-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -26,7 +26,6 @@ struct link_map; -extern void _dl_unmap (struct link_map *map) - internal_function attribute_hidden; +extern void _dl_unmap (struct link_map *map) attribute_hidden; #define DL_UNMAP(map) _dl_unmap (map) diff --git a/sysdeps/i386/dl-machine.h b/sysdeps/i386/dl-machine.h index 130bcf56a9..1afdcbd9ea 100644 --- a/sysdeps/i386/dl-machine.h +++ b/sysdeps/i386/dl-machine.h @@ -1,5 +1,5 @@ /* Machine-dependent ELF dynamic relocation inline functions. i386 version. - Copyright (C) 1995-2016 Free Software Foundation, Inc. + Copyright (C) 1995-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -150,9 +150,11 @@ extern ElfW(Addr) _dl_profile_fixup (struct link_map *l, .globl _start\n\ .globl _dl_start_user\n\ _start:\n\ - # Note that _dl_start gets the parameter in %eax.\n\ movl %esp, %eax\n\ + subl $12, %esp\n\ + pushl %eax\n\ call _dl_start\n\ + addl $16, %esp\n\ _dl_start_user:\n\ # Save the user entry point address in %edi.\n\ movl %eax, %edi\n\ @@ -175,17 +177,20 @@ _dl_start_user:\n\ # switch stacks if it moves these contents over.\n\ " RTLD_START_SPECIAL_INIT "\n\ # Load the parameters again.\n\ - # (eax, edx, ecx, *--esp) = (_dl_loaded, argc, argv, envp)\n\ + # (eax, edx, ecx, esi) = (_dl_loaded, argc, argv, envp)\n\ movl _rtld_local@GOTOFF(%ebx), %eax\n\ leal 8(%esp,%edx,4), %esi\n\ leal 4(%esp), %ecx\n\ movl %esp, %ebp\n\ # Make sure _dl_init is run with 16 byte aligned stack.\n\ andl $-16, %esp\n\ - pushl %eax\n\ - pushl %eax\n\ + subl $12, %esp\n\ pushl %ebp\n\ + # Arguments for _dl_init.\n\ pushl %esi\n\ + pushl %ecx\n\ + pushl %edx\n\ + pushl %eax\n\ # Clear %ebp, so that even constructors have terminated backchain.\n\ xorl %ebp, %ebp\n\ # Call the function to run the initializers.\n\ @@ -193,7 +198,7 @@ _dl_start_user:\n\ # Pass our finalizer function to the user in %edx, as per ELF ABI.\n\ leal _dl_fini@GOTOFF(%ebx), %edx\n\ # Restore %esp _start expects.\n\ - movl (%esp), %esp\n\ + movl 16(%esp), %esp\n\ # Jump to the user's entry point.\n\ jmp *%edi\n\ .previous\n\ @@ -233,15 +238,20 @@ _dl_start_user:\n\ static inline void __attribute__ ((unused)) dl_platform_init (void) { +#if IS_IN (rtld) + /* init_cpu_features has been called early from __libc_start_main in + static executable. */ + init_cpu_features (&GLRO(dl_x86_cpu_features)); +#else if (GLRO(dl_platform) != NULL && *GLRO(dl_platform) == '\0') /* Avoid an empty string which would disturb us. */ GLRO(dl_platform) = NULL; - - init_cpu_features (&GLRO(dl_x86_cpu_features)); +#endif } static inline Elf32_Addr elf_machine_fixup_plt (struct link_map *map, lookup_t t, + const ElfW(Sym) *refsym, const ElfW(Sym) *sym, const Elf32_Rel *reloc, Elf32_Addr *reloc_addr, Elf32_Addr value) { @@ -310,14 +320,29 @@ elf_machine_rel (struct link_map *map, const Elf32_Rel *reloc, const Elf32_Sym *const refsym = sym; # endif struct link_map *sym_map = RESOLVE_MAP (&sym, version, r_type); - Elf32_Addr value = sym_map == NULL ? 0 : sym_map->l_addr + sym->st_value; + Elf32_Addr value = SYMBOL_ADDRESS (sym_map, sym, true); if (sym != NULL - && __builtin_expect (ELFW(ST_TYPE) (sym->st_info) == STT_GNU_IFUNC, - 0) - && __builtin_expect (sym->st_shndx != SHN_UNDEF, 1) - && __builtin_expect (!skip_ifunc, 1)) - value = ((Elf32_Addr (*) (void)) value) (); + && __glibc_unlikely (ELFW(ST_TYPE) (sym->st_info) == STT_GNU_IFUNC) + && __glibc_likely (sym->st_shndx != SHN_UNDEF) + && __glibc_likely (!skip_ifunc)) + { +# ifndef RTLD_BOOTSTRAP + if (sym_map != map + && sym_map->l_type != lt_executable + && !sym_map->l_relocated) + { + const char *strtab + = (const char *) D_PTR (map, l_info[DT_STRTAB]); + _dl_error_printf ("\ +%s: Relink `%s' with `%s' for IFUNC symbol `%s'\n", + RTLD_PROGNAME, map->l_name, + sym_map->l_name, + strtab + refsym->st_name); + } +# endif + value = ((Elf32_Addr (*) (void)) value) (); + } switch (r_type) { @@ -430,8 +455,8 @@ elf_machine_rel (struct link_map *map, const Elf32_Rel *reloc, /* This can happen in trace mode if an object could not be found. */ break; - if (__builtin_expect (sym->st_size > refsym->st_size, 0) - || (__builtin_expect (sym->st_size < refsym->st_size, 0) + if (__glibc_unlikely (sym->st_size > refsym->st_size) + || (__glibc_unlikely(sym->st_size < refsym->st_size) && GLRO(dl_verbose))) { const char *strtab; @@ -475,12 +500,12 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc, const Elf32_Sym *const refsym = sym; # endif struct link_map *sym_map = RESOLVE_MAP (&sym, version, r_type); - Elf32_Addr value = sym == NULL ? 0 : sym_map->l_addr + sym->st_value; + Elf32_Addr value = SYMBOL_ADDRESS (sym_map, sym, true); if (sym != NULL - && __builtin_expect (sym->st_shndx != SHN_UNDEF, 1) - && __builtin_expect (ELFW(ST_TYPE) (sym->st_info) == STT_GNU_IFUNC, 0) - && __builtin_expect (!skip_ifunc, 1)) + && __glibc_likely (sym->st_shndx != SHN_UNDEF) + && __glibc_unlikely (ELFW(ST_TYPE) (sym->st_info) == STT_GNU_IFUNC) + && __glibc_likely (!skip_ifunc)) value = ((Elf32_Addr (*) (void)) value) (); switch (ELF32_R_TYPE (reloc->r_info)) @@ -575,8 +600,8 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc, /* This can happen in trace mode if an object could not be found. */ break; - if (__builtin_expect (sym->st_size > refsym->st_size, 0) - || (__builtin_expect (sym->st_size < refsym->st_size, 0) + if (__glibc_unlikely (sym->st_size > refsym->st_size) + || (__glibc_unlikely (sym->st_size < refsym->st_size) && GLRO(dl_verbose))) { const char *strtab; @@ -637,7 +662,8 @@ elf_machine_lazy_rel (struct link_map *map, /* Check for unexpected PLT reloc type. */ if (__glibc_likely (r_type == R_386_JMP_SLOT)) { - if (__builtin_expect (map->l_mach.plt, 0) == 0) + /* Prelink has been deprecated. */ + if (__glibc_likely (map->l_mach.plt == 0)) *reloc_addr += l_addr; else *reloc_addr = (map->l_mach.plt diff --git a/sysdeps/i386/dl-procinfo.c b/sysdeps/i386/dl-procinfo.c index ffa6b9da0a..cd779e3078 100644 --- a/sysdeps/i386/dl-procinfo.c +++ b/sysdeps/i386/dl-procinfo.c @@ -1,5 +1,5 @@ /* Data for i386 version of processor capability information. - Copyright (C) 2001-2016 Free Software Foundation, Inc. + Copyright (C) 2001-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@redhat.com>, 2001. @@ -17,10 +17,7 @@ License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ -/* This information must be kept in sync with the _DL_HWCAP_COUNT and - _DL_PLATFORM_COUNT definitions in procinfo.h. - - If anything should be added here check whether the size of each string +/* If anything should be added here check whether the size of each string is still ok with the given array size. All the #ifdefs in the definitions are quite irritating but @@ -43,21 +40,7 @@ # define PROCINFO_CLASS #endif -#if !IS_IN (ldconfig) -# if !defined PROCINFO_DECL && defined SHARED - ._dl_x86_cpu_features -# else -PROCINFO_CLASS struct cpu_features _dl_x86_cpu_features -# endif -# ifndef PROCINFO_DECL -= { } -# endif -# if !defined SHARED || defined PROCINFO_DECL -; -# else -, -# endif -#endif +#include <sysdeps/x86/dl-procinfo.c> #if !defined PROCINFO_DECL && defined SHARED ._dl_x86_cap_flags @@ -78,21 +61,5 @@ PROCINFO_CLASS const char _dl_x86_cap_flags[32][8] , #endif -#if !defined PROCINFO_DECL && defined SHARED - ._dl_x86_platforms -#else -PROCINFO_CLASS const char _dl_x86_platforms[4][5] -#endif -#ifndef PROCINFO_DECL -= { - "i386", "i486", "i586", "i686" - } -#endif -#if !defined SHARED || defined PROCINFO_DECL -; -#else -, -#endif - #undef PROCINFO_DECL #undef PROCINFO_CLASS diff --git a/sysdeps/i386/dl-procinfo.h b/sysdeps/i386/dl-procinfo.h deleted file mode 100644 index 9fbb58847e..0000000000 --- a/sysdeps/i386/dl-procinfo.h +++ /dev/null @@ -1,109 +0,0 @@ -/* i386 version of processor capability information handling macros. - Copyright (C) 1998-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#ifndef _DL_PROCINFO_H -#define _DL_PROCINFO_H 1 -#include <ldsodefs.h> - -#define _DL_HWCAP_COUNT 32 - -#define _DL_PLATFORMS_COUNT 4 - -/* Start at 48 to reserve some space. */ -#define _DL_FIRST_PLATFORM 48 -/* Mask to filter out platforms. */ -#define _DL_HWCAP_PLATFORM (((1ULL << _DL_PLATFORMS_COUNT) - 1) \ - << _DL_FIRST_PLATFORM) - -enum -{ - HWCAP_I386_FPU = 1 << 0, - HWCAP_I386_VME = 1 << 1, - HWCAP_I386_DE = 1 << 2, - HWCAP_I386_PSE = 1 << 3, - HWCAP_I386_TSC = 1 << 4, - HWCAP_I386_MSR = 1 << 5, - HWCAP_I386_PAE = 1 << 6, - HWCAP_I386_MCE = 1 << 7, - HWCAP_I386_CX8 = 1 << 8, - HWCAP_I386_APIC = 1 << 9, - HWCAP_I386_SEP = 1 << 11, - HWCAP_I386_MTRR = 1 << 12, - HWCAP_I386_PGE = 1 << 13, - HWCAP_I386_MCA = 1 << 14, - HWCAP_I386_CMOV = 1 << 15, - HWCAP_I386_FCMOV = 1 << 16, - HWCAP_I386_MMX = 1 << 23, - HWCAP_I386_OSFXSR = 1 << 24, - HWCAP_I386_XMM = 1 << 25, - HWCAP_I386_XMM2 = 1 << 26, - HWCAP_I386_AMD3D = 1 << 31, - - /* XXX Which others to add here? */ - HWCAP_IMPORTANT = (HWCAP_I386_XMM2) - -}; - -/* We cannot provide a general printing function. */ -#define _dl_procinfo(type, word) -1 - -static inline const char * -__attribute__ ((unused)) -_dl_hwcap_string (int idx) -{ - return GLRO(dl_x86_cap_flags)[idx]; -}; - -static inline const char * -__attribute__ ((unused)) -_dl_platform_string (int idx) -{ - return GLRO(dl_x86_platforms)[idx - _DL_FIRST_PLATFORM]; -}; - -static inline int -__attribute__ ((unused, always_inline)) -_dl_string_hwcap (const char *str) -{ - int i; - - for (i = 0; i < _DL_HWCAP_COUNT; i++) - { - if (strcmp (str, GLRO(dl_x86_cap_flags)[i]) == 0) - return i; - } - return -1; -}; - -static inline int -__attribute__ ((unused, always_inline)) -_dl_string_platform (const char *str) -{ - int i; - - if (str != NULL) - for (i = 0; i < _DL_PLATFORMS_COUNT; ++i) - { - if (strcmp (str, GLRO(dl_x86_platforms)[i]) == 0) - return _DL_FIRST_PLATFORM + i; - } - return -1; -}; - -#endif /* dl-procinfo.h */ diff --git a/sysdeps/i386/dl-tls.h b/sysdeps/i386/dl-tls.h index 1a8c358bfc..1123dd7e6a 100644 --- a/sysdeps/i386/dl-tls.h +++ b/sysdeps/i386/dl-tls.h @@ -1,5 +1,5 @@ /* Thread-local storage handling in the ELF dynamic linker. i386 version. - Copyright (C) 2002-2016 Free Software Foundation, Inc. + Copyright (C) 2002-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -59,6 +59,3 @@ rtld_hidden_def (___tls_get_addr) # endif #endif - -/* Value used for dtv entries for which the allocation is delayed. */ -#define TLS_DTV_UNALLOCATED ((void *) -1l) diff --git a/sysdeps/i386/dl-tlsdesc.S b/sysdeps/i386/dl-tlsdesc.S index 7c189ab93d..128f0af318 100644 --- a/sysdeps/i386/dl-tlsdesc.S +++ b/sysdeps/i386/dl-tlsdesc.S @@ -1,5 +1,5 @@ /* Thread-local storage handling in the ELF dynamic linker. i386 version. - Copyright (C) 2004-2016 Free Software Foundation, Inc. + Copyright (C) 2004-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -37,6 +37,7 @@ cfi_startproc .align 16 _dl_tlsdesc_return: + _CET_ENDBR movl 4(%eax), %eax ret cfi_endproc @@ -58,6 +59,7 @@ _dl_tlsdesc_return: cfi_startproc .align 16 _dl_tlsdesc_undefweak: + _CET_ENDBR movl 4(%eax), %eax subl %gs:0, %eax ret @@ -99,6 +101,7 @@ _dl_tlsdesc_dynamic (struct tlsdesc *tdp) cfi_startproc .align 16 _dl_tlsdesc_dynamic: + _CET_ENDBR /* Like all TLS resolvers, preserve call-clobbered registers. We need two scratch regs anyway. */ subl $28, %esp @@ -126,7 +129,11 @@ _dl_tlsdesc_dynamic: .p2align 4,,7 .Lslow: cfi_adjust_cfa_offset (28) +#ifdef NO_RTLD_HIDDEN + call JUMPTARGET (___tls_get_addr) +#else call HIDDEN_JUMPTARGET (___tls_get_addr) +#endif jmp .Lret cfi_endproc .size _dl_tlsdesc_dynamic, .-_dl_tlsdesc_dynamic @@ -150,6 +157,7 @@ _dl_tlsdesc_dynamic: .align 16 _dl_tlsdesc_resolve_abs_plus_addend: 0: + _CET_ENDBR pushl %eax cfi_adjust_cfa_offset (4) pushl %ecx @@ -188,6 +196,7 @@ _dl_tlsdesc_resolve_abs_plus_addend: .align 16 _dl_tlsdesc_resolve_rel: 0: + _CET_ENDBR pushl %eax cfi_adjust_cfa_offset (4) pushl %ecx @@ -226,6 +235,7 @@ _dl_tlsdesc_resolve_rel: .align 16 _dl_tlsdesc_resolve_rela: 0: + _CET_ENDBR pushl %eax cfi_adjust_cfa_offset (4) pushl %ecx @@ -264,6 +274,7 @@ _dl_tlsdesc_resolve_rela: .align 16 _dl_tlsdesc_resolve_hold: 0: + _CET_ENDBR pushl %eax cfi_adjust_cfa_offset (4) pushl %ecx diff --git a/sysdeps/i386/dl-tlsdesc.h b/sysdeps/i386/dl-tlsdesc.h index 02c4a71d76..c8a1e05615 100644 --- a/sysdeps/i386/dl-tlsdesc.h +++ b/sysdeps/i386/dl-tlsdesc.h @@ -1,6 +1,6 @@ /* Thread-local storage descriptor handling in the ELF dynamic linker. i386 version. - Copyright (C) 2005-2016 Free Software Foundation, Inc. + Copyright (C) 2005-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -51,8 +51,7 @@ extern ptrdiff_t attribute_hidden __attribute__ ((regparm (1))) # ifdef SHARED extern void *_dl_make_tlsdesc_dynamic (struct link_map *map, - size_t ti_offset) - internal_function attribute_hidden; + size_t ti_offset) attribute_hidden; extern ptrdiff_t attribute_hidden __attribute__ ((regparm (1))) _dl_tlsdesc_dynamic (struct tlsdesc *); diff --git a/sysdeps/i386/dl-trampoline.S b/sysdeps/i386/dl-trampoline.S index 6a024c8edc..6dc0319216 100644 --- a/sysdeps/i386/dl-trampoline.S +++ b/sysdeps/i386/dl-trampoline.S @@ -1,5 +1,5 @@ /* PLT trampolines. i386 version. - Copyright (C) 2004-2016 Free Software Foundation, Inc. + Copyright (C) 2004-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -32,6 +32,7 @@ .align 16 _dl_runtime_resolve: cfi_adjust_cfa_offset (8) + _CET_ENDBR pushl %eax # Preserve registers otherwise clobbered. cfi_adjust_cfa_offset (4) pushl %ecx @@ -50,14 +51,85 @@ _dl_runtime_resolve: cfi_endproc .size _dl_runtime_resolve, .-_dl_runtime_resolve +# The SHSTK compatible version. + .text + .globl _dl_runtime_resolve_shstk + .type _dl_runtime_resolve_shstk, @function + cfi_startproc + .align 16 +_dl_runtime_resolve_shstk: + cfi_adjust_cfa_offset (8) + _CET_ENDBR + pushl %eax # Preserve registers otherwise clobbered. + cfi_adjust_cfa_offset (4) + pushl %edx + cfi_adjust_cfa_offset (4) + movl 12(%esp), %edx # Copy args pushed by PLT in register. Note + movl 8(%esp), %eax # that `fixup' takes its parameters in regs. + call _dl_fixup # Call resolver. + movl (%esp), %edx # Get register content back. + movl %eax, %ecx # Store the function address. + movl 4(%esp), %eax # Get register content back. + addl $16, %esp # Adjust stack: PLT1 + PLT2 + %eax + %edx + cfi_adjust_cfa_offset (-16) + jmp *%ecx # Jump to function address. + cfi_endproc + .size _dl_runtime_resolve_shstk, .-_dl_runtime_resolve_shstk #ifndef PROF +# The SHSTK compatible version. + .globl _dl_runtime_profile_shstk + .type _dl_runtime_profile_shstk, @function + cfi_startproc + .align 16 +_dl_runtime_profile_shstk: + cfi_adjust_cfa_offset (8) + _CET_ENDBR + pushl %esp + cfi_adjust_cfa_offset (4) + addl $8, (%esp) # Account for the pushed PLT data + pushl %ebp + cfi_adjust_cfa_offset (4) + pushl %eax # Preserve registers otherwise clobbered. + cfi_adjust_cfa_offset (4) + pushl %ecx + cfi_adjust_cfa_offset (4) + pushl %edx + cfi_adjust_cfa_offset (4) + movl %esp, %ecx + subl $8, %esp + cfi_adjust_cfa_offset (8) + movl $-1, 4(%esp) + leal 4(%esp), %edx + movl %edx, (%esp) + pushl %ecx # Address of the register structure + cfi_adjust_cfa_offset (4) + movl 40(%esp), %ecx # Load return address + movl 36(%esp), %edx # Copy args pushed by PLT in register. Note + movl 32(%esp), %eax # that `fixup' takes its parameters in regs. + call _dl_profile_fixup # Call resolver. + cfi_adjust_cfa_offset (-8) + movl (%esp), %edx + testl %edx, %edx + jns 1f + movl 4(%esp), %edx # Get register content back. + movl %eax, %ecx # Store the function address. + movl 12(%esp), %eax # Get register content back. + # Adjust stack: PLT1 + PLT2 + %esp + %ebp + %eax + %ecx + %edx + # + free. + addl $32, %esp + cfi_adjust_cfa_offset (-32) + jmp *%ecx # Jump to function address. + cfi_endproc + .size _dl_runtime_profile_shstk, .-_dl_runtime_profile_shstk + .globl _dl_runtime_profile .type _dl_runtime_profile, @function cfi_startproc .align 16 _dl_runtime_profile: cfi_adjust_cfa_offset (8) + _CET_ENDBR pushl %esp cfi_adjust_cfa_offset (4) addl $8, (%esp) # Account for the pushed PLT data diff --git a/sysdeps/i386/ffs.c b/sysdeps/i386/ffs.c index 559ee98273..d28d78e272 100644 --- a/sysdeps/i386/ffs.c +++ b/sysdeps/i386/ffs.c @@ -1,7 +1,7 @@ /* ffs -- find first set bit in a word, counted from least significant end. For Intel 80x86, x>=3. This file is part of the GNU C Library. - Copyright (C) 1991-2016 Free Software Foundation, Inc. + Copyright (C) 1991-2018 Free Software Foundation, Inc. Contributed by Torbjorn Granlund (tege@sics.se). The GNU C Library is free software; you can redistribute it and/or diff --git a/sysdeps/i386/fpu/e_acosh.S b/sysdeps/i386/fpu/e_acosh.S index f560d255f3..8d37247a2b 100644 --- a/sysdeps/i386/fpu/e_acosh.S +++ b/sysdeps/i386/fpu/e_acosh.S @@ -1,5 +1,5 @@ /* ix87 specific implementation of arcsinh. - Copyright (C) 1996-2016 Free Software Foundation, Inc. + Copyright (C) 1996-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. diff --git a/sysdeps/i386/fpu/e_acoshf.S b/sysdeps/i386/fpu/e_acoshf.S index ff6f25371b..964c08603d 100644 --- a/sysdeps/i386/fpu/e_acoshf.S +++ b/sysdeps/i386/fpu/e_acoshf.S @@ -1,5 +1,5 @@ /* ix87 specific implementation of arcsinh. - Copyright (C) 1996-2016 Free Software Foundation, Inc. + Copyright (C) 1996-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. diff --git a/sysdeps/i386/fpu/e_acoshl.S b/sysdeps/i386/fpu/e_acoshl.S index 6a353119b5..8c6921eb84 100644 --- a/sysdeps/i386/fpu/e_acoshl.S +++ b/sysdeps/i386/fpu/e_acoshl.S @@ -1,5 +1,5 @@ /* ix87 specific implementation of arcsinh. - Copyright (C) 1996-2016 Free Software Foundation, Inc. + Copyright (C) 1996-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. diff --git a/sysdeps/i386/fpu/e_atanh.S b/sysdeps/i386/fpu/e_atanh.S index 2242040499..8cb7bc7c66 100644 --- a/sysdeps/i386/fpu/e_atanh.S +++ b/sysdeps/i386/fpu/e_atanh.S @@ -1,5 +1,5 @@ /* ix87 specific implementation of arctanh function. - Copyright (C) 1996-2016 Free Software Foundation, Inc. + Copyright (C) 1996-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. diff --git a/sysdeps/i386/fpu/e_atanhf.S b/sysdeps/i386/fpu/e_atanhf.S index e338e65981..cf27dbe565 100644 --- a/sysdeps/i386/fpu/e_atanhf.S +++ b/sysdeps/i386/fpu/e_atanhf.S @@ -1,5 +1,5 @@ /* ix87 specific implementation of arctanh function. - Copyright (C) 1996-2016 Free Software Foundation, Inc. + Copyright (C) 1996-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. diff --git a/sysdeps/i386/fpu/e_atanhl.S b/sysdeps/i386/fpu/e_atanhl.S index dc5ca51a4b..bd1f096470 100644 --- a/sysdeps/i386/fpu/e_atanhl.S +++ b/sysdeps/i386/fpu/e_atanhl.S @@ -1,5 +1,5 @@ /* ix87 specific implementation of arctanh function. - Copyright (C) 1996-2016 Free Software Foundation, Inc. + Copyright (C) 1996-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. @@ -121,6 +121,7 @@ ENTRY(__ieee754_atanhl) cmpl $0, 4(%esp) je 7b 6: fldt 4(%esp) + fadd %st(0) ret END(__ieee754_atanhl) strong_alias (__ieee754_atanhl, __atanhl_finite) diff --git a/sysdeps/i386/fpu/e_exp2f.S b/sysdeps/i386/fpu/e_exp2f.S deleted file mode 100644 index 30623cd850..0000000000 --- a/sysdeps/i386/fpu/e_exp2f.S +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Written by J.T. Conklin <jtc@netbsd.org>. - * Adapted for exp2 by Ulrich Drepper <drepper@cygnus.com>. - * Public domain. - */ - -#include <machine/asm.h> -#include <i386-math-asm.h> - -DEFINE_FLT_MIN - -#ifdef PIC -# define MO(op) op##@GOTOFF(%ecx) -#else -# define MO(op) op -#endif - - .text -ENTRY(__ieee754_exp2f) -#ifdef PIC - LOAD_PIC_REG (cx) -#endif - flds 4(%esp) -/* I added the following ugly construct because exp(+-Inf) resulted - in NaN. The ugliness results from the bright minds at Intel. - For the i686 the code can be written better. - -- drepper@cygnus.com. */ - fxam /* Is NaN or +-Inf? */ - fstsw %ax - movb $0x45, %dh - andb %ah, %dh - cmpb $0x05, %dh - je 1f /* Is +-Inf, jump. */ - fld %st - frndint /* int(x) */ - fsubr %st,%st(1) /* fract(x) */ - fxch - f2xm1 /* 2^(fract(x)) - 1 */ - fld1 - faddp /* 2^(fract(x)) */ - fscale /* e^x */ - fstp %st(1) - FLT_NARROW_EVAL_UFLOW_NONNEG_NAN - ret - -1: testl $0x200, %eax /* Test sign. */ - jz 2f /* If positive, jump. */ - fstp %st - fldz /* Set result to 0. */ -2: ret -END (__ieee754_exp2f) -strong_alias (__ieee754_exp2f, __exp2f_finite) diff --git a/sysdeps/i386/fpu/e_expf.S b/sysdeps/i386/fpu/e_expf.S deleted file mode 100644 index 65cb4ec204..0000000000 --- a/sysdeps/i386/fpu/e_expf.S +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Written by J.T. Conklin <jtc@netbsd.org>. - * Public domain. - * Adapted for float type by Ulrich Drepper <drepper@cygnus.com>. - */ - -#include <machine/asm.h> -#include <i386-math-asm.h> - -DEFINE_FLT_MIN - -#ifdef PIC -# define MO(op) op##@GOTOFF(%ecx) -#else -# define MO(op) op -#endif - - .text -/* e^x = 2^(x * log2(e)) */ -ENTRY(__ieee754_expf) -#ifdef PIC - LOAD_PIC_REG (cx) -#endif - flds 4(%esp) -/* I added the following ugly construct because exp(+-Inf) resulted - in NaN. The ugliness results from the bright minds at Intel. - For the i686 the code can be written better. - -- drepper@cygnus.com. */ - fxam /* Is NaN or +-Inf? */ - fstsw %ax - movb $0x45, %dh - andb %ah, %dh - cmpb $0x05, %dh - je 1f /* Is +-Inf, jump. */ - fldl2e - fmulp /* x * log2(e) */ - fld %st - frndint /* int(x * log2(e)) */ - fsubr %st,%st(1) /* fract(x * log2(e)) */ - fxch - f2xm1 /* 2^(fract(x * log2(e))) - 1 */ - fld1 - faddp /* 2^(fract(x * log2(e))) */ - fscale /* e^x */ - fstp %st(1) - FLT_NARROW_EVAL_UFLOW_NONNEG_NAN - ret - -1: testl $0x200, %eax /* Test sign. */ - jz 2f /* If positive, jump. */ - fstp %st - fldz /* Set result to 0. */ -2: ret -END (__ieee754_expf) - - -ENTRY(__expf_finite) -#ifdef PIC - LOAD_PIC_REG (cx) -#endif - fldl2e - fmuls 4(%esp) /* x * log2(e) */ - fld %st - frndint /* int(x * log2(e)) */ - fsubr %st,%st(1) /* fract(x * log2(e)) */ - fxch - f2xm1 /* 2^(fract(x * log2(e))) - 1 */ - fld1 - faddp /* 2^(fract(x * log2(e))) */ - fscale /* e^x */ - fstp %st(1) - FLT_NARROW_EVAL_UFLOW_NONNEG - ret -END(__expf_finite) diff --git a/sysdeps/i386/fpu/e_expl.S b/sysdeps/i386/fpu/e_expl.S index 64e0d96839..18a627e9da 100644 --- a/sysdeps/i386/fpu/e_expl.S +++ b/sysdeps/i386/fpu/e_expl.S @@ -22,6 +22,7 @@ * -- moshier@na-net.ornl.gov */ +#include <libm-alias-ldouble.h> #include <machine/asm.h> #include <i386-math-asm.h> @@ -102,7 +103,7 @@ ENTRY(IEEE754_EXPL) /* Below -64.0 (may be -NaN or -Inf). */ andb %ah, %dh cmpb $0x01, %dh - je 2f /* Is +-NaN, jump. */ + je 6f /* Is +-NaN, jump. */ jmp 1f /* -large, possibly -Inf. */ 4: /* In range -64.0 to 64.0 (may be +-0 but not NaN or +-Inf). */ @@ -144,7 +145,7 @@ ENTRY(IEEE754_EXPL) cmpb $0x05, %dh je 1f /* Is +-Inf, jump. */ cmpb $0x01, %dh - je 2f /* Is +-NaN, jump. */ + je 6f /* Is +-NaN, jump. */ /* Overflow or underflow; saturate. */ fstp %st fldt MO(csat) @@ -214,10 +215,13 @@ ENTRY(IEEE754_EXPL) fldz /* Set result to 0. */ #endif 2: ret +6: /* NaN argument. */ + fadd %st + ret END(IEEE754_EXPL) #ifdef USE_AS_EXPM1L libm_hidden_def (__expm1l) -weak_alias (__expm1l, expm1l) +libm_alias_ldouble (__expm1, expm1) #else strong_alias (IEEE754_EXPL, EXPL_FINITE) #endif diff --git a/sysdeps/i386/fpu/e_hypot.S b/sysdeps/i386/fpu/e_hypot.S index 0ca788407f..5b7deb356a 100644 --- a/sysdeps/i386/fpu/e_hypot.S +++ b/sysdeps/i386/fpu/e_hypot.S @@ -1,5 +1,5 @@ /* Compute the hypothenuse of X and Y. - Copyright (C) 1998-2016 Free Software Foundation, Inc. + Copyright (C) 1998-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998. diff --git a/sysdeps/i386/fpu/e_hypotf.S b/sysdeps/i386/fpu/e_hypotf.S index 58b883bea8..8e394c9c7f 100644 --- a/sysdeps/i386/fpu/e_hypotf.S +++ b/sysdeps/i386/fpu/e_hypotf.S @@ -1,5 +1,5 @@ /* Compute the hypothenuse of X and Y. - Copyright (C) 1998-2016 Free Software Foundation, Inc. + Copyright (C) 1998-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998. diff --git a/sysdeps/i386/fpu/e_log10l.S b/sysdeps/i386/fpu/e_log10l.S index 45b9c6d21d..9326b19796 100644 --- a/sysdeps/i386/fpu/e_log10l.S +++ b/sysdeps/i386/fpu/e_log10l.S @@ -65,6 +65,7 @@ ENTRY(__ieee754_log10l) 3: jp 4b // in case x is ±Inf fstp %st(1) fstp %st(1) + fadd %st(0) ret END(__ieee754_log10l) strong_alias (__ieee754_log10l, __log10l_finite) diff --git a/sysdeps/i386/fpu/e_log2f.S b/sysdeps/i386/fpu/e_log2f.S deleted file mode 100644 index 344eeb495e..0000000000 --- a/sysdeps/i386/fpu/e_log2f.S +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Written by J.T. Conklin <jtc@netbsd.org>. - * Adapted for use as log2 by Ulrich Drepper <drepper@cygnus.com>. - * Public domain. - * - * Changed to use fyl2xp1 for values near 1, <drepper@cygnus.com>. - */ - -#include <machine/asm.h> - - .section .rodata.cst8,"aM",@progbits,8 - - .p2align 3 - .type one,@object -one: .double 1.0 - ASM_SIZE_DIRECTIVE(one) - /* It is not important that this constant is precise. It is only - a value which is known to be on the safe side for using the - fyl2xp1 instruction. */ - .type limit,@object -limit: .double 0.29 - ASM_SIZE_DIRECTIVE(limit) - - -#ifdef PIC -# define MO(op) op##@GOTOFF(%edx) -#else -# define MO(op) op -#endif - - .text -ENTRY(__ieee754_log2f) -#ifdef PIC - LOAD_PIC_REG (dx) -#endif - fldl MO(one) - flds 4(%esp) // x : 1 - fxam - fnstsw - fld %st // x : x : 1 - sahf - jc 3f // in case x is NaN or ±Inf -4: fsub %st(2), %st // x-1 : x : 1 - fld %st // x-1 : x-1 : x : 1 - fabs // |x-1| : x-1 : x : 1 - fcompl MO(limit) // x-1 : x : 1 - fnstsw // x-1 : x : 1 - andb $0x45, %ah - jz 2f - fxam - fnstsw - andb $0x45, %ah - cmpb $0x40, %ah - jne 5f - fabs // log2(1) is +0 in all rounding modes. -5: fstp %st(1) // x-1 : 1 - fyl2xp1 // log(x) - ret - -2: fstp %st(0) // x : 1 - fyl2x // log(x) - ret - -3: jp 4b // in case x is ±Inf - fstp %st(1) - fstp %st(1) - ret -END (__ieee754_log2f) -strong_alias (__ieee754_log2f, __log2f_finite) diff --git a/sysdeps/i386/fpu/e_log2l.S b/sysdeps/i386/fpu/e_log2l.S index 0f5f7e5789..73e62ea908 100644 --- a/sysdeps/i386/fpu/e_log2l.S +++ b/sysdeps/i386/fpu/e_log2l.S @@ -64,6 +64,7 @@ ENTRY(__ieee754_log2l) 3: jp 4b // in case x is ±Inf fstp %st(1) fstp %st(1) + fadd %st(0) ret END (__ieee754_log2l) strong_alias (__ieee754_log2l, __log2l_finite) diff --git a/sysdeps/i386/fpu/e_logf.S b/sysdeps/i386/fpu/e_logf.S deleted file mode 100644 index de967a31f5..0000000000 --- a/sysdeps/i386/fpu/e_logf.S +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Written by J.T. Conklin <jtc@netbsd.org>. - * Public domain. - * Adapted for float by Ulrich Drepper <drepper@cygnus.com>. - * - * Changed to use fyl2xp1 for values near 1, <drepper@cygnus.com>. - */ - -#include <machine/asm.h> - - .section .rodata.cst8,"aM",@progbits,8 - - .p2align 3 - .type one,@object -one: .double 1.0 - ASM_SIZE_DIRECTIVE(one) - /* It is not important that this constant is precise. It is only - a value which is known to be on the safe side for using the - fyl2xp1 instruction. */ - .type limit,@object -limit: .double 0.29 - ASM_SIZE_DIRECTIVE(limit) - - -#ifdef PIC -# define MO(op) op##@GOTOFF(%edx) -#else -# define MO(op) op -#endif - - .text -ENTRY(__ieee754_logf) - fldln2 // log(2) - flds 4(%esp) // x : log(2) - fxam - fnstsw -#ifdef PIC - LOAD_PIC_REG (dx) -#endif - fld %st // x : x : log(2) - sahf - jc 3f // in case x is NaN or +-Inf -4: fsubl MO(one) // x-1 : x : log(2) - fld %st // x-1 : x-1 : x : log(2) - fabs // |x-1| : x-1 : x : log(2) - fcompl MO(limit) // x-1 : x : log(2) - fnstsw // x-1 : x : log(2) - andb $0x45, %ah - jz 2f - fxam - fnstsw - andb $0x45, %ah - cmpb $0x40, %ah - jne 5f - fabs // log(1) is +0 in all rounding modes. -5: fstp %st(1) // x-1 : log(2) - fyl2xp1 // log(x) - ret - -2: fstp %st(0) // x : log(2) - fyl2x // log(x) - ret - -3: jp 4b // in case x is +-Inf - fstp %st(1) - fstp %st(1) - ret -END (__ieee754_logf) - -ENTRY(__logf_finite) - fldln2 // log(2) - flds 4(%esp) // x : log(2) -#ifdef PIC - LOAD_PIC_REG (dx) -#endif - fld %st // x : x : log(2) - fsubl MO(one) // x-1 : x : log(2) - fld %st // x-1 : x-1 : x : log(2) - fabs // |x-1| : x-1 : x : log(2) - fcompl MO(limit) // x-1 : x : log(2) - fnstsw // x-1 : x : log(2) - andb $0x45, %ah - jz 2b - fxam - fnstsw - andb $0x45, %ah - cmpb $0x40, %ah - jne 6f - fabs // log(1) is +0 in all rounding modes. -6: fstp %st(1) // x-1 : log(2) - fyl2xp1 // log(x) - ret -END(__logf_finite) diff --git a/sysdeps/i386/fpu/e_logl.S b/sysdeps/i386/fpu/e_logl.S index 7a6d370e8f..53127d704e 100644 --- a/sysdeps/i386/fpu/e_logl.S +++ b/sysdeps/i386/fpu/e_logl.S @@ -67,6 +67,7 @@ ENTRY(__ieee754_logl) 3: jp 4b // in case x is +-Inf fstp %st(1) fstp %st(1) + fadd %st(0) ret END (__ieee754_logl) diff --git a/sysdeps/i386/fpu/e_pow.S b/sysdeps/i386/fpu/e_pow.S index 5773394b0e..b11bc9596e 100644 --- a/sysdeps/i386/fpu/e_pow.S +++ b/sysdeps/i386/fpu/e_pow.S @@ -1,5 +1,5 @@ /* ix87 specific implementation of pow function. - Copyright (C) 1996-2016 Free Software Foundation, Inc. + Copyright (C) 1996-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. diff --git a/sysdeps/i386/fpu/e_powf.S b/sysdeps/i386/fpu/e_powf.S deleted file mode 100644 index ee96c704dc..0000000000 --- a/sysdeps/i386/fpu/e_powf.S +++ /dev/null @@ -1,392 +0,0 @@ -/* ix87 specific implementation of pow function. - Copyright (C) 1996-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#include <machine/asm.h> -#include <i386-math-asm.h> - - .section .rodata.cst8,"aM",@progbits,8 - - .p2align 3 - .type one,@object -one: .double 1.0 - ASM_SIZE_DIRECTIVE(one) - .type limit,@object -limit: .double 0.29 - ASM_SIZE_DIRECTIVE(limit) - .type p31,@object -p31: .byte 0, 0, 0, 0, 0, 0, 0xe0, 0x41 - ASM_SIZE_DIRECTIVE(p31) - - .section .rodata.cst16,"aM",@progbits,16 - - .p2align 3 - .type infinity,@object -inf_zero: -infinity: - .byte 0, 0, 0, 0, 0, 0, 0xf0, 0x7f - ASM_SIZE_DIRECTIVE(infinity) - .type zero,@object -zero: .double 0.0 - ASM_SIZE_DIRECTIVE(zero) - .type minf_mzero,@object -minf_mzero: -minfinity: - .byte 0, 0, 0, 0, 0, 0, 0xf0, 0xff -mzero: - .byte 0, 0, 0, 0, 0, 0, 0, 0x80 - ASM_SIZE_DIRECTIVE(minf_mzero) -DEFINE_FLT_MIN - -#ifdef PIC -# define MO(op) op##@GOTOFF(%ecx) -# define MOX(op,x,f) op##@GOTOFF(%ecx,x,f) -#else -# define MO(op) op -# define MOX(op,x,f) op(,x,f) -#endif - - .text -ENTRY(__ieee754_powf) - flds 8(%esp) // y - fxam - -#ifdef PIC - LOAD_PIC_REG (cx) -#endif - - fnstsw - movb %ah, %dl - andb $0x45, %ah - cmpb $0x40, %ah // is y == 0 ? - je 11f - - cmpb $0x05, %ah // is y == ±inf ? - je 12f - - cmpb $0x01, %ah // is y == NaN ? - je 30f - - flds 4(%esp) // x : y - - subl $4, %esp - cfi_adjust_cfa_offset (4) - - fxam - fnstsw - movb %ah, %dh - andb $0x45, %ah - cmpb $0x40, %ah - je 20f // x is ±0 - - cmpb $0x05, %ah - je 15f // x is ±inf - - cmpb $0x01, %ah - je 33f // x is NaN - - fxch // y : x - - /* fistpl raises invalid exception for |y| >= 1L<<31. */ - fld %st // y : y : x - fabs // |y| : y : x - fcompl MO(p31) // y : x - fnstsw - sahf - jnc 2f - - /* First see whether `y' is a natural number. In this case we - can use a more precise algorithm. */ - fld %st // y : y : x - fistpl (%esp) // y : x - fildl (%esp) // int(y) : y : x - fucomp %st(1) // y : x - fnstsw - sahf - jne 3f - - /* OK, we have an integer value for y. */ - popl %edx - cfi_adjust_cfa_offset (-4) - orl $0, %edx - fstp %st(0) // x - jns 4f // y >= 0, jump - fdivrl MO(one) // 1/x (now referred to as x) - negl %edx -4: fldl MO(one) // 1 : x - fxch - - /* If y is even, take the absolute value of x. Otherwise, - ensure all intermediate values that might overflow have the - sign of x. */ - testb $1, %dl - jnz 6f - fabs - -6: shrl $1, %edx - jnc 5f - fxch - fabs - fmul %st(1) // x : ST*x - fxch -5: fld %st // x : x : ST*x - fabs // |x| : x : ST*x - fmulp // |x|*x : ST*x - testl %edx, %edx - jnz 6b - fstp %st(0) // ST*x - FLT_NARROW_EVAL_UFLOW_NONNAN - ret - - /* y is ±NAN */ -30: flds 4(%esp) // x : y - fldl MO(one) // 1.0 : x : y - fucomp %st(1) // x : y - fnstsw - sahf - je 31f - fxch // y : x -31: fstp %st(1) - ret - - cfi_adjust_cfa_offset (4) - .align ALIGNARG(4) -2: /* y is a large integer (so even). */ - fxch // x : y - fabs // |x| : y - fxch // y : x - .align ALIGNARG(4) -3: /* y is a real number. */ - fxch // x : y - fldl MO(one) // 1.0 : x : y - fldl MO(limit) // 0.29 : 1.0 : x : y - fld %st(2) // x : 0.29 : 1.0 : x : y - fsub %st(2) // x-1 : 0.29 : 1.0 : x : y - fabs // |x-1| : 0.29 : 1.0 : x : y - fucompp // 1.0 : x : y - fnstsw - fxch // x : 1.0 : y - sahf - ja 7f - fsub %st(1) // x-1 : 1.0 : y - fyl2xp1 // log2(x) : y - jmp 8f - -7: fyl2x // log2(x) : y -8: fmul %st(1) // y*log2(x) : y - fst %st(1) // y*log2(x) : y*log2(x) - frndint // int(y*log2(x)) : y*log2(x) - fsubr %st, %st(1) // int(y*log2(x)) : fract(y*log2(x)) - fxch // fract(y*log2(x)) : int(y*log2(x)) - f2xm1 // 2^fract(y*log2(x))-1 : int(y*log2(x)) - faddl MO(one) // 2^fract(y*log2(x)) : int(y*log2(x)) - fscale // 2^fract(y*log2(x))*2^int(y*log2(x)) : int(y*log2(x)) -32: addl $4, %esp - cfi_adjust_cfa_offset (-4) - fstp %st(1) // 2^fract(y*log2(x))*2^int(y*log2(x)) - FLT_NARROW_EVAL_UFLOW_NONNAN - ret - - /* x is NaN. */ - cfi_adjust_cfa_offset (4) -33: addl $4, %esp - cfi_adjust_cfa_offset (-4) - fstp %st(1) - ret - - // pow(x,±0) = 1 - .align ALIGNARG(4) -11: fstp %st(0) // pop y - fldl MO(one) - ret - - // y == ±inf - .align ALIGNARG(4) -12: fstp %st(0) // pop y - fldl MO(one) // 1 - flds 4(%esp) // x : 1 - fabs // abs(x) : 1 - fucompp // < 1, == 1, or > 1 - fnstsw - andb $0x45, %ah - cmpb $0x45, %ah - je 13f // jump if x is NaN - - cmpb $0x40, %ah - je 14f // jump if |x| == 1 - - shlb $1, %ah - xorb %ah, %dl - andl $2, %edx - fldl MOX(inf_zero, %edx, 4) - ret - - .align ALIGNARG(4) -14: fldl MO(one) - ret - - .align ALIGNARG(4) -13: flds 4(%esp) // load x == NaN - ret - - cfi_adjust_cfa_offset (4) - .align ALIGNARG(4) - // x is ±inf -15: fstp %st(0) // y - testb $2, %dh - jz 16f // jump if x == +inf - - // fistpl raises invalid exception for |y| >= 1L<<31, so test - // that (in which case y is certainly even) before testing - // whether y is odd. - fld %st // y : y - fabs // |y| : y - fcompl MO(p31) // y - fnstsw - sahf - jnc 16f - - // We must find out whether y is an odd integer. - fld %st // y : y - fistpl (%esp) // y - fildl (%esp) // int(y) : y - fucompp // <empty> - fnstsw - sahf - jne 17f - - // OK, the value is an integer. - popl %edx - cfi_adjust_cfa_offset (-4) - testb $1, %dl - jz 18f // jump if not odd - // It's an odd integer. - shrl $31, %edx - fldl MOX(minf_mzero, %edx, 8) - ret - - cfi_adjust_cfa_offset (4) - .align ALIGNARG(4) -16: fcompl MO(zero) - addl $4, %esp - cfi_adjust_cfa_offset (-4) - fnstsw - shrl $5, %eax - andl $8, %eax - fldl MOX(inf_zero, %eax, 1) - ret - - cfi_adjust_cfa_offset (4) - .align ALIGNARG(4) -17: shll $30, %edx // sign bit for y in right position - addl $4, %esp - cfi_adjust_cfa_offset (-4) -18: shrl $31, %edx - fldl MOX(inf_zero, %edx, 8) - ret - - cfi_adjust_cfa_offset (4) - .align ALIGNARG(4) - // x is ±0 -20: fstp %st(0) // y - testb $2, %dl - jz 21f // y > 0 - - // x is ±0 and y is < 0. We must find out whether y is an odd integer. - testb $2, %dh - jz 25f - - // fistpl raises invalid exception for |y| >= 1L<<31, so test - // that (in which case y is certainly even) before testing - // whether y is odd. - fld %st // y : y - fabs // |y| : y - fcompl MO(p31) // y - fnstsw - sahf - jnc 25f - - fld %st // y : y - fistpl (%esp) // y - fildl (%esp) // int(y) : y - fucompp // <empty> - fnstsw - sahf - jne 26f - - // OK, the value is an integer. - popl %edx - cfi_adjust_cfa_offset (-4) - testb $1, %dl - jz 27f // jump if not odd - // It's an odd integer. - // Raise divide-by-zero exception and get minus infinity value. - fldl MO(one) - fdivl MO(zero) - fchs - ret - - cfi_adjust_cfa_offset (4) -25: fstp %st(0) -26: addl $4, %esp - cfi_adjust_cfa_offset (-4) -27: // Raise divide-by-zero exception and get infinity value. - fldl MO(one) - fdivl MO(zero) - ret - - cfi_adjust_cfa_offset (4) - .align ALIGNARG(4) - // x is ±0 and y is > 0. We must find out whether y is an odd integer. -21: testb $2, %dh - jz 22f - - // fistpl raises invalid exception for |y| >= 1L<<31, so test - // that (in which case y is certainly even) before testing - // whether y is odd. - fcoml MO(p31) // y - fnstsw - sahf - jnc 22f - - fld %st // y : y - fistpl (%esp) // y - fildl (%esp) // int(y) : y - fucompp // <empty> - fnstsw - sahf - jne 23f - - // OK, the value is an integer. - popl %edx - cfi_adjust_cfa_offset (-4) - testb $1, %dl - jz 24f // jump if not odd - // It's an odd integer. - fldl MO(mzero) - ret - - cfi_adjust_cfa_offset (4) -22: fstp %st(0) -23: addl $4, %esp // Don't use pop. - cfi_adjust_cfa_offset (-4) -24: fldl MO(zero) - ret - -END(__ieee754_powf) -strong_alias (__ieee754_powf, __powf_finite) diff --git a/sysdeps/i386/fpu/e_powl.S b/sysdeps/i386/fpu/e_powl.S index 77d2abfaea..51a0c334f0 100644 --- a/sysdeps/i386/fpu/e_powl.S +++ b/sysdeps/i386/fpu/e_powl.S @@ -1,5 +1,5 @@ /* ix87 specific implementation of pow function. - Copyright (C) 1996-2016 Free Software Foundation, Inc. + Copyright (C) 1996-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. @@ -26,9 +26,9 @@ .type one,@object one: .double 1.0 ASM_SIZE_DIRECTIVE(one) - .type p3,@object -p3: .byte 0, 0, 0, 0, 0, 0, 0x20, 0x40 - ASM_SIZE_DIRECTIVE(p3) + .type p2,@object +p2: .byte 0, 0, 0, 0, 0, 0, 0x10, 0x40 + ASM_SIZE_DIRECTIVE(p2) .type p63,@object p63: .byte 0, 0, 0, 0, 0, 0, 0xe0, 0x43 ASM_SIZE_DIRECTIVE(p63) @@ -146,11 +146,11 @@ ENTRY(__ieee754_powl) jmp 3f 9: /* OK, we have an integer value for y. Unless very small - (we use < 8), use the algorithm for real exponent to avoid + (we use < 4), use the algorithm for real exponent to avoid accumulation of errors. */ fld %st // y : y : x fabs // |y| : y : x - fcompl MO(p3) // y : x + fcompl MO(p2) // y : x fnstsw sahf jnc 3f @@ -201,15 +201,21 @@ ENTRY(__ieee754_powl) fucomp %st(1) // x : y fnstsw sahf - je 31f - fxch // y : x -31: fstp %st(1) + je 33f +31: /* At least one argument NaN, and result should be NaN. */ + faddp + ret +33: jp 31b + /* pow (1, NaN); check if the NaN signaling. */ + testb $0x40, 23(%esp) + jz 31b + fstp %st(1) ret cfi_adjust_cfa_offset (8) 32: addl $8, %esp cfi_adjust_cfa_offset (-8) - fstp %st(1) + faddp ret cfi_adjust_cfa_offset (8) @@ -241,12 +247,24 @@ ENTRY(__ieee754_powl) cfi_adjust_cfa_offset (-36) ret - // pow(x,±0) = 1 + // pow(x,±0) = 1, unless x is sNaN .align ALIGNARG(4) 11: fstp %st(0) // pop y + fldt 4(%esp) // x + fxam + fnstsw + andb $0x45, %ah + cmpb $0x01, %ah + je 112f // x is NaN +111: fstp %st(0) fldl MO(one) ret +112: testb $0x40, 11(%esp) + jnz 111b + fadd %st(0) + ret + // y == ±inf .align ALIGNARG(4) 12: fstp %st(0) // pop y @@ -274,6 +292,7 @@ ENTRY(__ieee754_powl) .align ALIGNARG(4) 13: fldt 4(%esp) // load x == NaN + fadd %st(0) ret cfi_adjust_cfa_offset (8) diff --git a/sysdeps/i386/fpu/e_scalbl.S b/sysdeps/i386/fpu/e_scalbl.S index d10b22ea83..896f599cb0 100644 --- a/sysdeps/i386/fpu/e_scalbl.S +++ b/sysdeps/i386/fpu/e_scalbl.S @@ -45,7 +45,7 @@ ENTRY(__ieee754_scalbl) fnstsw andl $0x4500, %eax cmpl $0x0100, %eax - je 3f + je 2f fld %st(1) frndint fcomp %st(2) @@ -76,18 +76,8 @@ ENTRY(__ieee754_scalbl) fldl MOX(zero_nan, %eax, 1) ret - /* The result is NaN, but we must not raise an exception. - So use a variable. */ -2: fstp %st - fstp %st -#ifdef PIC - LOAD_PIC_REG (cx) -#endif - fldl MO(nan) - ret - - /* The first parameter is a NaN. Return it. */ -3: fstp %st(1) + /* The result is NaN; raise an exception for sNaN arguments. */ +2: faddp ret /* Return NaN and raise the invalid exception. */ diff --git a/sysdeps/i386/fpu/fclrexcpt.c b/sysdeps/i386/fpu/fclrexcpt.c index 68a8f863d6..8463b102e7 100644 --- a/sysdeps/i386/fpu/fclrexcpt.c +++ b/sysdeps/i386/fpu/fclrexcpt.c @@ -1,5 +1,5 @@ /* Clear given exceptions in current floating-point environment. - Copyright (C) 1997-2016 Free Software Foundation, Inc. + Copyright (C) 1997-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -41,7 +41,7 @@ __feclearexcept (int excepts) __asm__ ("fldenv %0" : : "m" (*&temp)); /* If the CPU supports SSE, we clear the MXCSR as well. */ - if ((GLRO(dl_hwcap) & HWCAP_I386_XMM) != 0) + if (HAS_CPU_FEATURE (SSE)) { unsigned int xnew_exc; diff --git a/sysdeps/i386/fpu/fedisblxcpt.c b/sysdeps/i386/fpu/fedisblxcpt.c index 07fd4cfacb..e2738e6d6c 100644 --- a/sysdeps/i386/fpu/fedisblxcpt.c +++ b/sysdeps/i386/fpu/fedisblxcpt.c @@ -1,5 +1,5 @@ /* Disable floating-point exceptions. - Copyright (C) 1999-2016 Free Software Foundation, Inc. + Copyright (C) 1999-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Andreas Jaeger <aj@suse.de>, 1999. @@ -38,7 +38,7 @@ fedisableexcept (int excepts) __asm__ ("fldcw %0" : : "m" (*&new_exc)); /* If the CPU supports SSE we set the MXCSR as well. */ - if ((GLRO(dl_hwcap) & HWCAP_I386_XMM) != 0) + if (HAS_CPU_FEATURE (SSE)) { unsigned int xnew_exc; diff --git a/sysdeps/i386/fpu/feenablxcpt.c b/sysdeps/i386/fpu/feenablxcpt.c index 0d0377d21a..a4d9862666 100644 --- a/sysdeps/i386/fpu/feenablxcpt.c +++ b/sysdeps/i386/fpu/feenablxcpt.c @@ -1,5 +1,5 @@ /* Enable floating-point exceptions. - Copyright (C) 1999-2016 Free Software Foundation, Inc. + Copyright (C) 1999-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Andreas Jaeger <aj@suse.de>, 1999. @@ -38,7 +38,7 @@ feenableexcept (int excepts) __asm__ ("fldcw %0" : : "m" (*&new_exc)); /* If the CPU supports SSE we set the MXCSR as well. */ - if ((GLRO(dl_hwcap) & HWCAP_I386_XMM) != 0) + if (HAS_CPU_FEATURE (SSE)) { unsigned int xnew_exc; diff --git a/sysdeps/i386/fpu/fegetenv.c b/sysdeps/i386/fpu/fegetenv.c index b4b384fe19..2a1a8507ba 100644 --- a/sysdeps/i386/fpu/fegetenv.c +++ b/sysdeps/i386/fpu/fegetenv.c @@ -1,5 +1,5 @@ /* Store current floating-point environment. - Copyright (C) 1997-2016 Free Software Foundation, Inc. + Copyright (C) 1997-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -31,7 +31,7 @@ __fegetenv (fenv_t *envp) would block all exceptions. */ __asm__ ("fldenv %0" : : "m" (*envp)); - if ((GLRO(dl_hwcap) & HWCAP_I386_XMM) != 0) + if (HAS_CPU_FEATURE (SSE)) __asm__ ("stmxcsr %0" : "=m" (envp->__eip)); /* Success. */ diff --git a/sysdeps/i386/fpu/fegetexcept.c b/sysdeps/i386/fpu/fegetexcept.c index 9d3d090a30..bb43a20bc0 100644 --- a/sysdeps/i386/fpu/fegetexcept.c +++ b/sysdeps/i386/fpu/fegetexcept.c @@ -1,5 +1,5 @@ /* Get enabled floating-point exceptions. - Copyright (C) 1999-2016 Free Software Foundation, Inc. + Copyright (C) 1999-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Andreas Jaeger <aj@suse.de>, 1999. diff --git a/sysdeps/i386/i686/fpu/s_fdimf.S b/sysdeps/i386/fpu/fegetmode.c index 291433f275..86de9f5548 100644 --- a/sysdeps/i386/i686/fpu/s_fdimf.S +++ b/sysdeps/i386/fpu/fegetmode.c @@ -1,7 +1,6 @@ -/* Compute positive difference. - Copyright (C) 1997-2016 Free Software Foundation, Inc. +/* Store current floating-point control modes. i386 version. + Copyright (C) 2016-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. - Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -17,27 +16,17 @@ License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ -#include <sysdep.h> - - .text -ENTRY(__fdimf) - flds 4(%esp) // x - flds 8(%esp) // x : y - - fucomi %st(1), %st - jp 1f - - jc 3f - fstp %st(1) - fldz - jmp 2f - -3: fsubrp %st, %st(1) - ret - -1: fucomi %st(0), %st - fcmovnu %st(1), %st -2: fstp %st(1) - ret -END(__fdimf) -weak_alias (__fdimf, fdimf) +#include <fenv.h> +#include <fpu_control.h> +#include <unistd.h> +#include <ldsodefs.h> +#include <dl-procinfo.h> + +int +fegetmode (femode_t *modep) +{ + _FPU_GETCW (modep->__control_word); + if (HAS_CPU_FEATURE (SSE)) + __asm__ ("stmxcsr %0" : "=m" (modep->__mxcsr)); + return 0; +} diff --git a/sysdeps/i386/fpu/fegetround.c b/sysdeps/i386/fpu/fegetround.c index 8c83d8e017..291ad80f5a 100644 --- a/sysdeps/i386/fpu/fegetround.c +++ b/sysdeps/i386/fpu/fegetround.c @@ -1,5 +1,5 @@ /* Return current rounding direction. - Copyright (C) 1997-2016 Free Software Foundation, Inc. + Copyright (C) 1997-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. diff --git a/sysdeps/i386/fpu/feholdexcpt.c b/sysdeps/i386/fpu/feholdexcpt.c index a345db3513..270554df31 100644 --- a/sysdeps/i386/fpu/feholdexcpt.c +++ b/sysdeps/i386/fpu/feholdexcpt.c @@ -1,5 +1,5 @@ /* Store current floating-point environment and clear exceptions. - Copyright (C) 1997-2016 Free Software Foundation, Inc. + Copyright (C) 1997-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -30,7 +30,7 @@ __feholdexcept (fenv_t *envp) __asm__ volatile ("fnstenv %0; fnclex" : "=m" (*envp)); /* If the CPU supports SSE we set the MXCSR as well. */ - if ((GLRO(dl_hwcap) & HWCAP_I386_XMM) != 0) + if (HAS_CPU_FEATURE (SSE)) { unsigned int xwork; diff --git a/sysdeps/i386/fpu/fenv_private.h b/sysdeps/i386/fpu/fenv_private.h index e20e1f1662..637dae5f05 100644 --- a/sysdeps/i386/fpu/fenv_private.h +++ b/sysdeps/i386/fpu/fenv_private.h @@ -1,39 +1,10 @@ #ifndef FENV_PRIVATE_H #define FENV_PRIVATE_H 1 +#include <bits/floatn.h> #include <fenv.h> #include <fpu_control.h> -#ifdef __SSE2_MATH__ -# define math_opt_barrier(x) \ - ({ __typeof(x) __x; \ - if (sizeof (x) <= sizeof (double)) \ - __asm ("" : "=x" (__x) : "0" (x)); \ - else \ - __asm ("" : "=t" (__x) : "0" (x)); \ - __x; }) -# define math_force_eval(x) \ - do { \ - if (sizeof (x) <= sizeof (double)) \ - __asm __volatile ("" : : "x" (x)); \ - else \ - __asm __volatile ("" : : "f" (x)); \ - } while (0) -#else -# define math_opt_barrier(x) \ - ({ __typeof (x) __x; \ - __asm ("" : "=t" (__x) : "0" (x)); \ - __x; }) -# define math_force_eval(x) \ - do { \ - __typeof (x) __x = (x); \ - if (sizeof (x) <= sizeof (double)) \ - __asm __volatile ("" : : "m" (__x)); \ - else \ - __asm __volatile ("" : : "f" (__x)); \ - } while (0) -#endif - /* This file is used by both the 32- and 64-bit ports. The 64-bit port has a field in the fenv_t for the mxcsr; the 32-bit port does not. Instead, we (ab)use the only 32-bit field extant in the struct. */ @@ -322,6 +293,21 @@ libc_feresetround_387 (fenv_t *e) # define libc_feholdsetround_53bit libc_feholdsetround_387_53bit #endif +#ifdef __x86_64__ +/* The SSE rounding mode is used by soft-fp (libgcc and glibc) on + x86_64, so that must be set for float128 computations. */ +# define SET_RESTORE_ROUNDF128(RM) \ + SET_RESTORE_ROUND_GENERIC (RM, libc_feholdsetround_sse, libc_feresetround_sse) +# define libc_feholdexcept_setroundf128 libc_feholdexcept_setround_sse +# define libc_feupdateenv_testf128 libc_feupdateenv_test_sse +#else +/* The 387 rounding mode is used by soft-fp for 32-bit, but whether + 387 or SSE exceptions are used depends on whether libgcc was built + for SSE math, which is not known when glibc is being built. */ +# define libc_feholdexcept_setroundf128 default_libc_feholdexcept_setround +# define libc_feupdateenv_testf128 default_libc_feupdateenv_test +#endif + /* We have support for rounding mode context. */ #define HAVE_RM_CTX 1 @@ -474,11 +460,19 @@ libc_feupdateenv_387_ctx (struct rm_ctx *ctx) #endif /* __SSE_MATH__ */ #ifdef __SSE2_MATH__ -# define libc_feholdexcept_setround_ctx libc_feholdexcept_setround_sse_ctx -# define libc_fesetenv_ctx libc_fesetenv_sse_ctx -# define libc_feupdateenv_ctx libc_feupdateenv_sse_ctx -# define libc_feholdsetround_ctx libc_feholdsetround_sse_ctx -# define libc_feresetround_ctx libc_feresetround_sse_ctx +# if defined (__x86_64__) || !defined (MATH_SET_BOTH_ROUNDING_MODES) +# define libc_feholdexcept_setround_ctx libc_feholdexcept_setround_sse_ctx +# define libc_fesetenv_ctx libc_fesetenv_sse_ctx +# define libc_feupdateenv_ctx libc_feupdateenv_sse_ctx +# define libc_feholdsetround_ctx libc_feholdsetround_sse_ctx +# define libc_feresetround_ctx libc_feresetround_sse_ctx +# else +# define libc_feholdexcept_setround_ctx default_libc_feholdexcept_setround_ctx +# define libc_fesetenv_ctx default_libc_fesetenv_ctx +# define libc_feupdateenv_ctx default_libc_feupdateenv_ctx +# define libc_feholdsetround_ctx default_libc_feholdsetround_ctx +# define libc_feresetround_ctx default_libc_feresetround_ctx +# endif #else # define libc_feholdexcept_setround_ctx libc_feholdexcept_setround_387_ctx # define libc_feupdateenv_ctx libc_feupdateenv_387_ctx diff --git a/sysdeps/i386/fpu/fesetenv.c b/sysdeps/i386/fpu/fesetenv.c index 0d8f435f0b..6df6849da4 100644 --- a/sysdeps/i386/fpu/fesetenv.c +++ b/sysdeps/i386/fpu/fesetenv.c @@ -1,5 +1,5 @@ /* Install given floating-point environment. - Copyright (C) 1997-2016 Free Software Foundation, Inc. + Copyright (C) 1997-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -79,7 +79,7 @@ __fesetenv (const fenv_t *envp) __asm__ ("fldenv %0" : : "m" (temp)); - if ((GLRO(dl_hwcap) & HWCAP_I386_XMM) != 0) + if (HAS_CPU_FEATURE (SSE)) { unsigned int mxcsr; __asm__ ("stmxcsr %0" : "=m" (mxcsr)); diff --git a/sysdeps/i386/i686/fpu/s_fdim.S b/sysdeps/i386/fpu/fesetexcept.c index 2cbf815f98..180b93f60b 100644 --- a/sysdeps/i386/i686/fpu/s_fdim.S +++ b/sysdeps/i386/fpu/fesetexcept.c @@ -1,7 +1,6 @@ -/* Compute positive difference. - Copyright (C) 1997-2016 Free Software Foundation, Inc. +/* Set given exception flags. i386 version. + Copyright (C) 2016-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. - Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -17,27 +16,16 @@ License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ -#include <sysdep.h> +#include <fenv.h> - .text -ENTRY(__fdim) - fldl 4(%esp) // x - fldl 12(%esp) // x : y +int +fesetexcept (int excepts) +{ + fenv_t temp; - fucomi %st(1), %st - jp 1f + __asm__ ("fnstenv %0" : "=m" (*&temp)); + temp.__status_word |= excepts & FE_ALL_EXCEPT; + __asm__ ("fldenv %0" : : "m" (*&temp)); - jc 3f - fstp %st(1) - fldz - jmp 2f - -3: fsubrp %st, %st(1) - ret - -1: fucomi %st(0), %st - fcmovnu %st(1), %st -2: fstp %st(1) - ret -END(__fdim) -weak_alias (__fdim, fdim) + return 0; +} diff --git a/sysdeps/i386/fpu/fesetmode.c b/sysdeps/i386/fpu/fesetmode.c new file mode 100644 index 0000000000..9aad6ea99f --- /dev/null +++ b/sysdeps/i386/fpu/fesetmode.c @@ -0,0 +1,54 @@ +/* Install given floating-point control modes. i386 version. + Copyright (C) 2016-2018 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#include <fenv.h> +#include <fpu_control.h> +#include <unistd.h> +#include <ldsodefs.h> +#include <dl-procinfo.h> + +/* All exceptions, including the x86-specific "denormal operand" + exception. */ +#define FE_ALL_EXCEPT_X86 (FE_ALL_EXCEPT | __FE_DENORM) + +int +fesetmode (const femode_t *modep) +{ + fpu_control_t cw; + if (modep == FE_DFL_MODE) + cw = _FPU_DEFAULT; + else + cw = modep->__control_word; + _FPU_SETCW (cw); + if (HAS_CPU_FEATURE (SSE)) + { + unsigned int mxcsr; + __asm__ ("stmxcsr %0" : "=m" (mxcsr)); + /* Preserve SSE exception flags but restore other state in + MXCSR. */ + mxcsr &= FE_ALL_EXCEPT_X86; + if (modep == FE_DFL_MODE) + /* Default MXCSR state has all bits zero except for those + masking exceptions. */ + mxcsr |= FE_ALL_EXCEPT_X86 << 7; + else + mxcsr |= modep->__mxcsr & ~FE_ALL_EXCEPT_X86; + __asm__ ("ldmxcsr %0" : : "m" (mxcsr)); + } + return 0; +} diff --git a/sysdeps/i386/fpu/fesetround.c b/sysdeps/i386/fpu/fesetround.c index 1c1b2fcf26..d260046c65 100644 --- a/sysdeps/i386/fpu/fesetround.c +++ b/sysdeps/i386/fpu/fesetround.c @@ -1,5 +1,5 @@ /* Set current rounding direction. - Copyright (C) 1997-2016 Free Software Foundation, Inc. + Copyright (C) 1997-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -37,7 +37,7 @@ __fesetround (int round) __asm__ ("fldcw %0" : : "m" (*&cw)); /* If the CPU supports SSE we set the MXCSR as well. */ - if ((GLRO(dl_hwcap) & HWCAP_I386_XMM) != 0) + if (HAS_CPU_FEATURE (SSE)) { unsigned int xcw; diff --git a/sysdeps/i386/fpu/feupdateenv.c b/sysdeps/i386/fpu/feupdateenv.c index 9d225cf8bb..db3ff96dfa 100644 --- a/sysdeps/i386/fpu/feupdateenv.c +++ b/sysdeps/i386/fpu/feupdateenv.c @@ -1,5 +1,5 @@ /* Install given floating-point environment and raise exceptions. - Copyright (C) 1997-2016 Free Software Foundation, Inc. + Copyright (C) 1997-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -32,7 +32,7 @@ __feupdateenv (const fenv_t *envp) __asm__ ("fnstsw %0" : "=m" (*&temp)); /* If the CPU supports SSE we test the MXCSR as well. */ - if ((GLRO(dl_hwcap) & HWCAP_I386_XMM) != 0) + if (HAS_CPU_FEATURE (SSE)) __asm__ ("stmxcsr %0" : "=m" (*&xtemp)); temp = (temp | xtemp) & FE_ALL_EXCEPT; diff --git a/sysdeps/i386/fpu/fgetexcptflg.c b/sysdeps/i386/fpu/fgetexcptflg.c index 1cb1ebb3fb..39d1f7df3a 100644 --- a/sysdeps/i386/fpu/fgetexcptflg.c +++ b/sysdeps/i386/fpu/fgetexcptflg.c @@ -1,5 +1,5 @@ /* Store current representation for exceptions. - Copyright (C) 1997-2016 Free Software Foundation, Inc. + Copyright (C) 1997-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -34,7 +34,7 @@ __fegetexceptflag (fexcept_t *flagp, int excepts) *flagp = temp & excepts & FE_ALL_EXCEPT; /* If the CPU supports SSE, we clear the MXCSR as well. */ - if ((GLRO(dl_hwcap) & HWCAP_I386_XMM) != 0) + if (HAS_CPU_FEATURE (SSE)) { unsigned int sse_exc; diff --git a/sysdeps/i386/fpu/fraiseexcpt.c b/sysdeps/i386/fpu/fraiseexcpt.c index ad980cca32..6c781df218 100644 --- a/sysdeps/i386/fpu/fraiseexcpt.c +++ b/sysdeps/i386/fpu/fraiseexcpt.c @@ -1,5 +1,5 @@ /* Raise given exceptions. - Copyright (C) 1997-2016 Free Software Foundation, Inc. + Copyright (C) 1997-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. diff --git a/sysdeps/i386/fpu/fsetexcptflg.c b/sysdeps/i386/fpu/fsetexcptflg.c index cea473e293..21e70251cf 100644 --- a/sysdeps/i386/fpu/fsetexcptflg.c +++ b/sysdeps/i386/fpu/fsetexcptflg.c @@ -1,5 +1,5 @@ /* Set floating-point environment exception handling. - Copyright (C) 1997-2016 Free Software Foundation, Inc. + Copyright (C) 1997-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -41,7 +41,7 @@ __fesetexceptflag (const fexcept_t *flagp, int excepts) __asm__ ("fldenv %0" : : "m" (*&temp)); /* If the CPU supports SSE, we set the MXCSR as well. */ - if ((GLRO(dl_hwcap) & HWCAP_I386_XMM) != 0) + if (HAS_CPU_FEATURE (SSE)) { unsigned int xnew_exc; diff --git a/sysdeps/i386/fpu/ftestexcept.c b/sysdeps/i386/fpu/ftestexcept.c index 0f7408fad0..c1b5e90356 100644 --- a/sysdeps/i386/fpu/ftestexcept.c +++ b/sysdeps/i386/fpu/ftestexcept.c @@ -1,5 +1,5 @@ /* Test exception in current environment. - Copyright (C) 1997-2016 Free Software Foundation, Inc. + Copyright (C) 1997-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -32,7 +32,7 @@ fetestexcept (int excepts) __asm__ ("fnstsw %0" : "=a" (temp)); /* If the CPU supports SSE we test the MXCSR as well. */ - if ((GLRO(dl_hwcap) & HWCAP_I386_XMM) != 0) + if (HAS_CPU_FEATURE (SSE)) __asm__ ("stmxcsr %0" : "=m" (*&xtemp)); return (temp | xtemp) & excepts & FE_ALL_EXCEPT; diff --git a/sysdeps/i386/fpu/halfulp.c b/sysdeps/i386/fpu/halfulp.c deleted file mode 100644 index 1cc8931700..0000000000 --- a/sysdeps/i386/fpu/halfulp.c +++ /dev/null @@ -1 +0,0 @@ -/* Not needed. */ diff --git a/sysdeps/i386/fpu/i386-math-asm.h b/sysdeps/i386/fpu/i386-math-asm.h index 20307d3a4a..87025b522e 100644 --- a/sysdeps/i386/fpu/i386-math-asm.h +++ b/sysdeps/i386/fpu/i386-math-asm.h @@ -1,5 +1,5 @@ /* Helper macros for x86 libm functions. - Copyright (C) 2015-2016 Free Software Foundation, Inc. + Copyright (C) 2015-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/sysdeps/i386/fpu/k_rem_pio2l.c b/sysdeps/i386/fpu/k_rem_pio2l.c deleted file mode 100644 index 1347b0468c..0000000000 --- a/sysdeps/i386/fpu/k_rem_pio2l.c +++ /dev/null @@ -1,3 +0,0 @@ -/* Empty. This file is only meant to avoid compiling the file with the - same name in the libm-ieee754 directory. The code is not used since - there is an assembler version for all users of this file. */ diff --git a/sysdeps/i386/fpu/libm-test-ulps b/sysdeps/i386/fpu/libm-test-ulps index 84da4753eb..e83bae71b4 100644 --- a/sysdeps/i386/fpu/libm-test-ulps +++ b/sysdeps/i386/fpu/libm-test-ulps @@ -3,2187 +3,2767 @@ # Maximal error of functions: Function: "acos": double: 1 +float128: 1 idouble: 1 +ifloat128: 1 ildouble: 1 ldouble: 1 Function: "acos_downward": +float128: 1 +ifloat128: 1 ildouble: 2 ldouble: 2 Function: "acos_towardzero": +float128: 1 +ifloat128: 1 ildouble: 2 ldouble: 2 Function: "acos_upward": double: 1 +float128: 1 idouble: 1 +ifloat128: 1 ildouble: 2 ldouble: 2 Function: "acosh": double: 1 +float128: 2 idouble: 1 +ifloat128: 2 ildouble: 4 ldouble: 2 Function: "acosh_downward": double: 1 +float128: 3 idouble: 1 +ifloat128: 3 ildouble: 6 ldouble: 4 Function: "acosh_towardzero": double: 1 +float128: 2 idouble: 1 +ifloat128: 2 ildouble: 6 ldouble: 4 Function: "acosh_upward": double: 1 +float128: 2 idouble: 1 +ifloat128: 2 ildouble: 4 ldouble: 3 Function: "asin": double: 1 +float128: 1 idouble: 1 +ifloat128: 1 ildouble: 1 ldouble: 1 Function: "asin_downward": double: 1 +float128: 2 idouble: 1 +ifloat128: 2 ildouble: 2 ldouble: 2 Function: "asin_towardzero": double: 1 +float128: 1 idouble: 1 +ifloat128: 1 ildouble: 1 ldouble: 1 Function: "asin_upward": double: 1 float: 1 +float128: 2 idouble: 1 ifloat: 1 +ifloat128: 2 ildouble: 1 ldouble: 1 Function: "asinh": double: 1 +float128: 3 idouble: 1 +ifloat128: 3 ildouble: 3 ldouble: 3 Function: "asinh_downward": double: 1 float: 1 +float128: 4 idouble: 1 +ifloat: 1 +ifloat128: 4 ildouble: 5 ldouble: 5 Function: "asinh_towardzero": double: 1 float: 1 +float128: 2 idouble: 1 +ifloat: 1 +ifloat128: 2 ildouble: 4 ldouble: 4 Function: "asinh_upward": double: 1 float: 1 +float128: 4 idouble: 1 ifloat: 1 +ifloat128: 4 ildouble: 5 ldouble: 5 Function: "atan": double: 1 +float128: 1 idouble: 1 +ifloat128: 1 ildouble: 1 ldouble: 1 Function: "atan2": double: 1 +float128: 1 idouble: 1 +ifloat128: 1 ildouble: 1 ldouble: 1 Function: "atan2_downward": double: 1 float: 1 +float128: 2 idouble: 1 ifloat: 1 +ifloat128: 2 ildouble: 1 ldouble: 1 Function: "atan2_towardzero": double: 1 float: 1 +float128: 3 idouble: 1 ifloat: 1 +ifloat128: 3 ildouble: 1 ldouble: 1 Function: "atan2_upward": double: 1 float: 1 +float128: 2 idouble: 1 ifloat: 1 +ifloat128: 2 ildouble: 1 ldouble: 1 Function: "atan_downward": double: 1 float: 1 +float128: 2 idouble: 1 ifloat: 1 +ifloat128: 2 ildouble: 1 ldouble: 1 Function: "atan_towardzero": double: 1 float: 1 +float128: 1 idouble: 1 ifloat: 1 +ifloat128: 1 ildouble: 1 ldouble: 1 Function: "atan_upward": double: 1 float: 1 +float128: 2 idouble: 1 ifloat: 1 +ifloat128: 2 ildouble: 1 ldouble: 1 Function: "atanh": double: 1 +float128: 3 idouble: 1 +ifloat128: 3 ildouble: 3 ldouble: 3 Function: "atanh_downward": double: 1 float: 1 +float128: 4 idouble: 1 ifloat: 1 -ildouble: 3 +ifloat128: 4 +ildouble: 4 ldouble: 4 Function: "atanh_towardzero": double: 1 float: 1 +float128: 2 idouble: 1 ifloat: 1 +ifloat128: 2 ildouble: 5 ldouble: 3 Function: "atanh_upward": double: 1 float: 1 +float128: 4 idouble: 1 ifloat: 1 +ifloat128: 4 ildouble: 5 ldouble: 5 Function: "cabs": double: 1 +float128: 1 idouble: 1 +ifloat128: 1 ildouble: 1 ldouble: 1 Function: "cabs_downward": double: 1 +float128: 1 idouble: 1 +ifloat128: 1 ildouble: 1 ldouble: 1 Function: "cabs_towardzero": double: 1 +float128: 1 idouble: 1 +ifloat128: 1 ildouble: 1 ldouble: 1 Function: "cabs_upward": double: 1 +float128: 1 idouble: 1 +ifloat128: 1 ildouble: 1 ldouble: 1 Function: Real part of "cacos": double: 1 -float: 1 +float: 2 +float128: 2 idouble: 1 -ifloat: 1 +ifloat: 2 +ifloat128: 2 ildouble: 1 ldouble: 1 Function: Imaginary part of "cacos": -double: 1 -float: 1 -idouble: 1 -ifloat: 1 +double: 2 +float: 2 +float128: 2 +idouble: 2 +ifloat: 2 +ifloat128: 2 ildouble: 2 ldouble: 2 Function: Real part of "cacos_downward": double: 1 float: 1 +float128: 3 idouble: 1 ifloat: 1 +ifloat128: 3 ildouble: 2 ldouble: 2 Function: Imaginary part of "cacos_downward": -double: 4 +double: 5 float: 3 -idouble: 4 +float128: 6 +idouble: 5 ifloat: 3 -ildouble: 5 -ldouble: 5 +ifloat128: 6 +ildouble: 6 +ldouble: 6 Function: Real part of "cacos_towardzero": double: 1 float: 1 +float128: 3 idouble: 1 ifloat: 1 +ifloat128: 3 ildouble: 2 ldouble: 2 Function: Imaginary part of "cacos_towardzero": double: 4 float: 3 +float128: 5 idouble: 4 ifloat: 3 +ifloat128: 5 ildouble: 5 ldouble: 5 Function: Real part of "cacos_upward": double: 2 float: 2 +float128: 3 idouble: 2 ifloat: 2 +ifloat128: 3 ildouble: 2 ldouble: 2 Function: Imaginary part of "cacos_upward": -double: 4 -float: 4 -idouble: 4 -ifloat: 4 -ildouble: 5 -ldouble: 5 +double: 7 +float: 7 +float128: 7 +idouble: 7 +ifloat: 7 +ifloat128: 7 +ildouble: 7 +ldouble: 7 Function: Real part of "cacosh": -double: 1 -float: 1 -idouble: 1 -ifloat: 1 +double: 2 +float: 2 +float128: 2 +idouble: 2 +ifloat: 2 +ifloat128: 2 ildouble: 2 ldouble: 2 Function: Imaginary part of "cacosh": double: 1 -float: 1 +float: 2 +float128: 2 idouble: 1 -ifloat: 1 +ifloat: 2 +ifloat128: 2 ildouble: 1 ldouble: 1 Function: Real part of "cacosh_downward": double: 4 float: 3 +float128: 5 idouble: 4 ifloat: 3 +ifloat128: 5 ildouble: 5 ldouble: 5 Function: Imaginary part of "cacosh_downward": -double: 1 -float: 1 -idouble: 1 -ifloat: 1 -ildouble: 2 -ldouble: 2 +double: 2 +float: 2 +float128: 4 +idouble: 2 +ifloat: 2 +ifloat128: 4 +ildouble: 3 +ldouble: 3 Function: Real part of "cacosh_towardzero": double: 4 float: 3 +float128: 5 idouble: 4 ifloat: 3 +ifloat128: 5 ildouble: 5 ldouble: 5 Function: Imaginary part of "cacosh_towardzero": double: 1 float: 1 +float128: 3 idouble: 1 ifloat: 1 +ifloat128: 3 ildouble: 2 ldouble: 2 Function: Real part of "cacosh_upward": -double: 4 +double: 5 float: 4 -idouble: 4 +float128: 6 +idouble: 5 ifloat: 4 +ifloat128: 6 ildouble: 5 ldouble: 5 Function: Imaginary part of "cacosh_upward": -double: 2 +double: 3 float: 2 -idouble: 2 +float128: 4 +idouble: 3 ifloat: 2 -ildouble: 2 -ldouble: 2 +ifloat128: 4 +ildouble: 3 +ldouble: 3 Function: "carg": double: 1 +float128: 2 idouble: 1 +ifloat128: 2 ildouble: 1 ldouble: 1 Function: "carg_downward": double: 1 float: 1 +float128: 2 idouble: 1 ifloat: 1 +ifloat128: 2 ildouble: 1 ldouble: 1 Function: "carg_towardzero": double: 1 float: 1 +float128: 3 idouble: 1 ifloat: 1 +ifloat128: 3 ildouble: 1 ldouble: 1 Function: "carg_upward": double: 1 float: 1 +float128: 2 idouble: 1 ifloat: 1 +ifloat128: 2 ildouble: 1 ldouble: 1 Function: Real part of "casin": double: 1 float: 1 +float128: 2 idouble: 1 ifloat: 1 +ifloat128: 2 ildouble: 1 ldouble: 1 Function: Imaginary part of "casin": -double: 1 -float: 1 -idouble: 1 -ifloat: 1 -ildouble: 2 -ldouble: 2 - -Function: Real part of "casin_downward": double: 2 float: 2 +float128: 2 idouble: 2 ifloat: 2 +ifloat128: 2 ildouble: 2 ldouble: 2 +Function: Real part of "casin_downward": +double: 3 +float: 2 +float128: 3 +idouble: 3 +ifloat: 2 +ifloat128: 3 +ildouble: 3 +ldouble: 3 + Function: Imaginary part of "casin_downward": -double: 4 +double: 5 float: 3 -idouble: 4 +float128: 6 +idouble: 5 ifloat: 3 -ildouble: 5 -ldouble: 5 +ifloat128: 6 +ildouble: 6 +ldouble: 6 Function: Real part of "casin_towardzero": -double: 1 +double: 3 float: 1 -idouble: 1 +float128: 3 +idouble: 3 ifloat: 1 -ildouble: 2 -ldouble: 2 +ifloat128: 3 +ildouble: 3 +ldouble: 3 Function: Imaginary part of "casin_towardzero": double: 4 float: 3 +float128: 5 idouble: 4 ifloat: 3 +ifloat128: 5 ildouble: 5 ldouble: 5 Function: Real part of "casin_upward": double: 2 float: 2 +float128: 3 idouble: 2 ifloat: 2 +ifloat128: 3 ildouble: 2 ldouble: 2 Function: Imaginary part of "casin_upward": -double: 4 -float: 4 -idouble: 4 -ifloat: 4 -ildouble: 5 -ldouble: 5 +double: 7 +float: 7 +float128: 7 +idouble: 7 +ifloat: 7 +ifloat128: 7 +ildouble: 7 +ldouble: 7 Function: Real part of "casinh": -double: 1 -float: 1 -idouble: 1 -ifloat: 1 +double: 2 +float: 2 +float128: 2 +idouble: 2 +ifloat: 2 +ifloat128: 2 ildouble: 2 ldouble: 2 Function: Imaginary part of "casinh": double: 1 float: 1 +float128: 2 idouble: 1 ifloat: 1 +ifloat128: 2 ildouble: 1 ldouble: 1 Function: Real part of "casinh_downward": -double: 4 +double: 5 float: 3 -idouble: 4 +float128: 6 +idouble: 5 ifloat: 3 -ildouble: 5 -ldouble: 5 +ifloat128: 6 +ildouble: 6 +ldouble: 6 Function: Imaginary part of "casinh_downward": -double: 2 +double: 3 float: 2 -idouble: 2 +float128: 3 +idouble: 3 ifloat: 2 -ildouble: 2 -ldouble: 2 +ifloat128: 3 +ildouble: 3 +ldouble: 3 Function: Real part of "casinh_towardzero": double: 4 float: 3 +float128: 5 idouble: 4 ifloat: 3 +ifloat128: 5 ildouble: 5 ldouble: 5 Function: Imaginary part of "casinh_towardzero": -double: 1 +double: 3 float: 1 -idouble: 1 +float128: 3 +idouble: 3 ifloat: 1 -ildouble: 2 -ldouble: 2 +ifloat128: 3 +ildouble: 3 +ldouble: 3 Function: Real part of "casinh_upward": -double: 4 -float: 4 -idouble: 4 -ifloat: 4 -ildouble: 5 -ldouble: 5 +double: 7 +float: 7 +float128: 7 +idouble: 7 +ifloat: 7 +ifloat128: 7 +ildouble: 7 +ldouble: 7 Function: Imaginary part of "casinh_upward": double: 2 float: 2 +float128: 3 idouble: 2 ifloat: 2 +ifloat128: 3 ildouble: 2 ldouble: 2 +Function: Real part of "catan": +double: 1 +float128: 1 +idouble: 1 +ifloat128: 1 +ildouble: 1 +ldouble: 1 + Function: Imaginary part of "catan": double: 1 float: 1 +float128: 1 idouble: 1 ifloat: 1 +ifloat128: 1 ildouble: 1 ldouble: 1 Function: Real part of "catan_downward": double: 1 float: 1 +float128: 2 idouble: 1 ifloat: 1 +ifloat128: 2 ildouble: 1 ldouble: 1 Function: Imaginary part of "catan_downward": double: 2 float: 1 +float128: 2 idouble: 2 ifloat: 1 +ifloat128: 2 ildouble: 4 ldouble: 4 Function: Real part of "catan_towardzero": double: 1 float: 1 +float128: 2 idouble: 1 ifloat: 1 +ifloat128: 2 ildouble: 1 ldouble: 1 Function: Imaginary part of "catan_towardzero": double: 2 float: 1 +float128: 2 idouble: 2 ifloat: 1 +ifloat128: 2 ildouble: 4 ldouble: 4 Function: Real part of "catan_upward": double: 1 float: 1 +float128: 2 idouble: 1 ifloat: 1 +ifloat128: 2 ildouble: 1 ldouble: 1 Function: Imaginary part of "catan_upward": double: 2 float: 2 +float128: 3 idouble: 2 ifloat: 2 +ifloat128: 3 ildouble: 3 ldouble: 3 Function: Real part of "catanh": double: 1 float: 1 +float128: 1 idouble: 1 ifloat: 1 +ifloat128: 1 +ildouble: 1 +ldouble: 1 + +Function: Imaginary part of "catanh": +double: 1 +float128: 1 +idouble: 1 +ifloat128: 1 ildouble: 1 ldouble: 1 Function: Real part of "catanh_downward": double: 2 float: 1 +float128: 2 idouble: 2 ifloat: 1 +ifloat128: 2 ildouble: 4 ldouble: 4 Function: Imaginary part of "catanh_downward": double: 1 float: 1 +float128: 2 idouble: 1 ifloat: 1 +ifloat128: 2 ildouble: 1 ldouble: 1 Function: Real part of "catanh_towardzero": double: 2 float: 1 +float128: 2 idouble: 2 ifloat: 1 +ifloat128: 2 ildouble: 4 ldouble: 4 Function: Imaginary part of "catanh_towardzero": double: 1 float: 1 +float128: 2 idouble: 1 ifloat: 1 +ifloat128: 2 ildouble: 1 ldouble: 1 Function: Real part of "catanh_upward": -double: 2 -float: 2 -idouble: 2 -ifloat: 2 +double: 4 +float: 4 +float128: 4 +idouble: 4 +ifloat: 4 +ifloat128: 4 ildouble: 4 ldouble: 4 Function: Imaginary part of "catanh_upward": double: 1 float: 1 +float128: 2 idouble: 1 ifloat: 1 +ifloat128: 2 ildouble: 1 ldouble: 1 Function: "cbrt": double: 1 float: 1 +float128: 1 idouble: 1 ifloat: 1 +ifloat128: 1 ildouble: 3 ldouble: 3 Function: "cbrt_downward": double: 1 float: 1 +float128: 1 idouble: 1 ifloat: 1 +ifloat128: 1 ildouble: 4 ldouble: 4 Function: "cbrt_towardzero": double: 1 float: 1 +float128: 1 idouble: 1 ifloat: 1 +ifloat128: 1 ildouble: 3 ldouble: 3 Function: "cbrt_upward": double: 1 float: 1 +float128: 1 idouble: 1 ifloat: 1 +ifloat128: 1 ildouble: 4 ldouble: 4 Function: Real part of "ccos": double: 1 float: 1 +float128: 1 idouble: 1 ifloat: 1 +ifloat128: 1 ildouble: 1 ldouble: 1 Function: Imaginary part of "ccos": double: 1 float: 1 +float128: 1 idouble: 1 ifloat: 1 +ifloat128: 1 ildouble: 1 ldouble: 1 Function: Real part of "ccos_downward": double: 1 float: 1 +float128: 2 idouble: 1 ifloat: 1 +ifloat128: 2 ildouble: 3 ldouble: 3 Function: Imaginary part of "ccos_downward": double: 3 float: 3 +float128: 2 idouble: 3 ifloat: 3 +ifloat128: 2 ildouble: 3 ldouble: 3 Function: Real part of "ccos_towardzero": double: 1 -float: 1 +float: 2 +float128: 2 idouble: 1 -ifloat: 1 +ifloat: 2 +ifloat128: 2 ildouble: 3 ldouble: 3 Function: Imaginary part of "ccos_towardzero": double: 3 float: 3 +float128: 2 idouble: 3 ifloat: 3 +ifloat128: 2 ildouble: 3 ldouble: 3 Function: Real part of "ccos_upward": double: 2 float: 2 +float128: 3 idouble: 2 ifloat: 2 +ifloat128: 3 ildouble: 2 ldouble: 2 Function: Imaginary part of "ccos_upward": double: 2 float: 2 +float128: 2 idouble: 2 ifloat: 2 +ifloat128: 2 ildouble: 2 ldouble: 2 Function: Real part of "ccosh": double: 1 float: 1 +float128: 1 idouble: 1 ifloat: 1 +ifloat128: 1 ildouble: 1 ldouble: 1 Function: Imaginary part of "ccosh": double: 1 float: 1 +float128: 1 idouble: 1 ifloat: 1 +ifloat128: 1 ildouble: 1 ldouble: 1 Function: Real part of "ccosh_downward": -double: 1 -float: 1 -idouble: 1 -ifloat: 1 +double: 2 +float: 2 +float128: 2 +idouble: 2 +ifloat: 2 +ifloat128: 2 ildouble: 3 ldouble: 3 Function: Imaginary part of "ccosh_downward": double: 3 float: 3 +float128: 2 idouble: 3 ifloat: 3 +ifloat128: 2 ildouble: 3 ldouble: 3 Function: Real part of "ccosh_towardzero": -double: 1 -float: 2 -idouble: 1 -ifloat: 2 +double: 2 +float: 3 +float128: 2 +idouble: 2 +ifloat: 3 +ifloat128: 2 ildouble: 3 ldouble: 3 Function: Imaginary part of "ccosh_towardzero": double: 3 float: 3 +float128: 2 idouble: 3 ifloat: 3 +ifloat128: 2 ildouble: 3 ldouble: 3 Function: Real part of "ccosh_upward": double: 2 float: 2 +float128: 3 idouble: 2 ifloat: 2 +ifloat128: 3 ildouble: 2 ldouble: 2 Function: Imaginary part of "ccosh_upward": double: 3 float: 2 +float128: 2 idouble: 3 ifloat: 2 +ifloat128: 2 ildouble: 2 ldouble: 2 Function: Real part of "cexp": double: 2 float: 1 +float128: 1 idouble: 2 ifloat: 1 +ifloat128: 1 ildouble: 1 ldouble: 1 Function: Imaginary part of "cexp": double: 1 float: 2 +float128: 1 idouble: 1 ifloat: 2 +ifloat128: 1 ildouble: 1 ldouble: 1 Function: Real part of "cexp_downward": double: 2 float: 2 +float128: 2 idouble: 2 ifloat: 2 +ifloat128: 2 ildouble: 3 ldouble: 3 Function: Imaginary part of "cexp_downward": double: 3 float: 3 +float128: 2 idouble: 3 ifloat: 3 +ifloat128: 2 ildouble: 3 ldouble: 3 Function: Real part of "cexp_towardzero": double: 2 float: 2 +float128: 2 idouble: 2 ifloat: 2 +ifloat128: 2 ildouble: 3 ldouble: 3 Function: Imaginary part of "cexp_towardzero": double: 3 float: 3 +float128: 2 idouble: 3 ifloat: 3 +ifloat128: 2 ildouble: 3 ldouble: 3 Function: Real part of "cexp_upward": double: 1 float: 2 +float128: 3 idouble: 1 ifloat: 2 +ifloat128: 3 ildouble: 2 ldouble: 2 Function: Imaginary part of "cexp_upward": double: 3 float: 2 +float128: 3 idouble: 3 ifloat: 2 +ifloat128: 3 ildouble: 3 ldouble: 3 Function: Real part of "clog": double: 2 -float: 1 +float: 3 +float128: 2 idouble: 2 -ifloat: 1 +ifloat: 3 +ifloat128: 2 ildouble: 3 ldouble: 3 Function: Imaginary part of "clog": double: 1 +float128: 1 idouble: 1 +ifloat128: 1 ildouble: 1 ldouble: 1 Function: Real part of "clog10": -double: 2 -float: 2 -idouble: 2 -ifloat: 2 +double: 3 +float: 4 +float128: 2 +idouble: 3 +ifloat: 4 +ifloat128: 2 ildouble: 4 ldouble: 4 Function: Imaginary part of "clog10": -double: 1 -idouble: 1 +double: 2 +float: 1 +float128: 2 +idouble: 2 +ifloat: 1 +ifloat128: 2 ildouble: 2 ldouble: 2 Function: Real part of "clog10_downward": -double: 3 -float: 3 -idouble: 3 -ifloat: 3 +double: 4 +float: 4 +float128: 3 +idouble: 4 +ifloat: 4 +ifloat128: 3 ildouble: 8 ldouble: 8 Function: Imaginary part of "clog10_downward": -double: 1 -float: 1 -idouble: 1 -ifloat: 1 +double: 2 +float: 2 +float128: 3 +idouble: 2 +ifloat: 2 +ifloat128: 3 ildouble: 3 ldouble: 3 Function: Real part of "clog10_towardzero": -double: 3 -float: 3 -idouble: 3 -ifloat: 3 +double: 5 +float: 5 +float128: 4 +idouble: 5 +ifloat: 5 +ifloat128: 4 ildouble: 8 ldouble: 8 Function: Imaginary part of "clog10_towardzero": -double: 1 -float: 1 -idouble: 1 -ifloat: 1 +double: 2 +float: 2 +float128: 3 +idouble: 2 +ifloat: 2 +ifloat128: 3 ildouble: 3 ldouble: 3 Function: Real part of "clog10_upward": -double: 3 -float: 3 -idouble: 3 -ifloat: 3 +double: 4 +float: 5 +float128: 4 +idouble: 4 +ifloat: 5 +ifloat128: 4 ildouble: 7 ldouble: 7 Function: Imaginary part of "clog10_upward": -double: 1 -float: 1 -idouble: 1 -ifloat: 1 +double: 2 +float: 2 +float128: 3 +idouble: 2 +ifloat: 2 +ifloat128: 3 ildouble: 3 ldouble: 3 Function: Real part of "clog_downward": double: 3 float: 3 +float128: 3 idouble: 3 ifloat: 3 +ifloat128: 3 ildouble: 5 ldouble: 5 Function: Imaginary part of "clog_downward": double: 1 float: 1 +float128: 2 idouble: 1 ifloat: 1 +ifloat128: 2 ildouble: 1 ldouble: 1 Function: Real part of "clog_towardzero": double: 3 -float: 3 +float: 4 +float128: 3 idouble: 3 -ifloat: 3 +ifloat: 4 +ifloat128: 3 ildouble: 5 ldouble: 5 Function: Imaginary part of "clog_towardzero": double: 1 float: 1 +float128: 2 idouble: 1 ifloat: 1 +ifloat128: 2 ildouble: 1 ldouble: 1 Function: Real part of "clog_upward": double: 2 float: 3 +float128: 4 idouble: 2 ifloat: 3 +ifloat128: 4 ildouble: 4 ldouble: 4 Function: Imaginary part of "clog_upward": double: 1 float: 1 +float128: 2 idouble: 1 ifloat: 1 +ifloat128: 2 ildouble: 1 ldouble: 1 Function: "cos": +double: 1 float: 1 +float128: 1 +idouble: 1 ifloat: 1 +ifloat128: 1 ildouble: 1 ldouble: 1 Function: "cos_downward": double: 1 float: 1 +float128: 3 idouble: 1 ifloat: 1 +ifloat128: 3 ildouble: 3 ldouble: 3 Function: "cos_towardzero": double: 1 float: 1 +float128: 1 idouble: 1 ifloat: 1 +ifloat128: 1 ildouble: 2 ldouble: 2 Function: "cos_upward": double: 1 float: 1 +float128: 2 idouble: 1 ifloat: 1 +ifloat128: 2 ildouble: 2 ldouble: 2 Function: "cosh": double: 1 float: 1 +float128: 1 idouble: 1 +ifloat: 1 +ifloat128: 1 ildouble: 2 ldouble: 2 Function: "cosh_downward": double: 2 float: 1 -idouble: 1 +float128: 2 +idouble: 2 ifloat: 1 +ifloat128: 1 ildouble: 2 ldouble: 3 Function: "cosh_towardzero": double: 2 float: 1 -idouble: 1 +float128: 2 +idouble: 2 ifloat: 1 +ifloat128: 1 ildouble: 2 ldouble: 2 Function: "cosh_upward": double: 4 float: 2 -idouble: 1 -ifloat: 1 +float128: 3 +idouble: 4 +ifloat: 2 +ifloat128: 1 ildouble: 2 ldouble: 3 Function: Real part of "cpow": double: 2 float: 5 +float128: 4 idouble: 2 ifloat: 5 +ifloat128: 4 ildouble: 3 ldouble: 3 Function: Imaginary part of "cpow": float: 2 +float128: 1 ifloat: 2 +ifloat128: 1 ildouble: 4 ldouble: 4 Function: Real part of "cpow_downward": double: 5 float: 8 +float128: 6 idouble: 5 ifloat: 8 +ifloat128: 6 ildouble: 7 ldouble: 7 Function: Imaginary part of "cpow_downward": double: 2 float: 2 +float128: 2 idouble: 2 ifloat: 2 +ifloat128: 2 ildouble: 2 ldouble: 2 Function: Real part of "cpow_towardzero": double: 5 float: 8 +float128: 6 idouble: 5 ifloat: 8 +ifloat128: 6 ildouble: 7 ldouble: 7 Function: Imaginary part of "cpow_towardzero": double: 2 float: 2 +float128: 2 idouble: 2 ifloat: 2 +ifloat128: 2 ildouble: 1 ldouble: 1 Function: Real part of "cpow_upward": double: 4 float: 1 +float128: 3 idouble: 4 ifloat: 1 +ifloat128: 3 ildouble: 2 ldouble: 2 Function: Imaginary part of "cpow_upward": double: 1 float: 2 +float128: 2 idouble: 1 ifloat: 2 +ifloat128: 2 ildouble: 2 ldouble: 2 Function: Real part of "csin": double: 1 float: 1 +float128: 1 idouble: 1 ifloat: 1 +ifloat128: 1 ildouble: 1 ldouble: 1 Function: Imaginary part of "csin": float: 1 +float128: 1 ifloat: 1 +ifloat128: 1 Function: Real part of "csin_downward": double: 3 float: 3 +float128: 2 idouble: 3 ifloat: 3 +ifloat128: 2 ildouble: 3 ldouble: 3 Function: Imaginary part of "csin_downward": double: 1 float: 1 +float128: 2 idouble: 1 ifloat: 1 +ifloat128: 2 ildouble: 3 ldouble: 3 Function: Real part of "csin_towardzero": double: 3 float: 3 +float128: 2 idouble: 3 ifloat: 3 +ifloat128: 2 ildouble: 3 ldouble: 3 Function: Imaginary part of "csin_towardzero": double: 1 float: 1 +float128: 2 idouble: 1 ifloat: 1 +ifloat128: 2 ildouble: 3 ldouble: 3 Function: Real part of "csin_upward": double: 3 float: 2 +float128: 2 idouble: 3 ifloat: 2 +ifloat128: 2 ildouble: 2 ldouble: 2 Function: Imaginary part of "csin_upward": double: 2 float: 2 +float128: 3 idouble: 2 ifloat: 2 +ifloat128: 3 ildouble: 2 ldouble: 2 Function: Real part of "csinh": +float: 1 +float128: 1 +ifloat: 1 +ifloat128: 1 ildouble: 1 ldouble: 1 Function: Imaginary part of "csinh": double: 1 float: 1 +float128: 1 idouble: 1 ifloat: 1 +ifloat128: 1 ildouble: 1 ldouble: 1 Function: Real part of "csinh_downward": -double: 1 +double: 2 float: 1 -idouble: 1 +float128: 2 +idouble: 2 ifloat: 1 +ifloat128: 2 ildouble: 3 ldouble: 3 Function: Imaginary part of "csinh_downward": double: 3 float: 3 +float128: 2 idouble: 3 ifloat: 3 +ifloat128: 2 ildouble: 3 ldouble: 3 Function: Real part of "csinh_towardzero": -double: 1 -float: 1 -idouble: 1 -ifloat: 1 +double: 2 +float: 2 +float128: 2 +idouble: 2 +ifloat: 2 +ifloat128: 2 ildouble: 3 ldouble: 3 Function: Imaginary part of "csinh_towardzero": double: 3 float: 3 +float128: 2 idouble: 3 ifloat: 3 +ifloat128: 2 ildouble: 3 ldouble: 3 Function: Real part of "csinh_upward": double: 2 float: 2 +float128: 3 idouble: 2 ifloat: 2 +ifloat128: 3 ildouble: 2 ldouble: 2 Function: Imaginary part of "csinh_upward": double: 3 float: 2 +float128: 2 idouble: 3 ifloat: 2 +ifloat128: 2 ildouble: 2 ldouble: 2 Function: Real part of "csqrt": -double: 1 -idouble: 1 +double: 2 +float: 2 +float128: 2 +idouble: 2 +ifloat: 2 +ifloat128: 2 ildouble: 2 ldouble: 2 Function: Imaginary part of "csqrt": -double: 1 -float: 1 -idouble: 1 -ifloat: 1 +double: 2 +float: 2 +float128: 2 +idouble: 2 +ifloat: 2 +ifloat128: 2 ildouble: 2 ldouble: 2 Function: Real part of "csqrt_downward": -double: 1 -float: 1 -idouble: 1 -ifloat: 1 +double: 4 +float: 4 +float128: 4 +idouble: 4 +ifloat: 4 +ifloat128: 4 ildouble: 5 ldouble: 5 Function: Imaginary part of "csqrt_downward": -double: 1 -float: 1 -idouble: 1 -ifloat: 1 +double: 3 +float: 3 +float128: 3 +idouble: 3 +ifloat: 3 +ifloat128: 3 ildouble: 4 ldouble: 4 Function: Real part of "csqrt_towardzero": -double: 1 -float: 1 -idouble: 1 -ifloat: 1 +double: 3 +float: 3 +float128: 3 +idouble: 3 +ifloat: 3 +ifloat128: 3 ildouble: 4 ldouble: 4 Function: Imaginary part of "csqrt_towardzero": -double: 1 -float: 1 -idouble: 1 -ifloat: 1 +double: 3 +float: 3 +float128: 3 +idouble: 3 +ifloat: 3 +ifloat128: 3 ildouble: 4 ldouble: 4 Function: Real part of "csqrt_upward": -double: 1 -float: 1 -idouble: 1 -ifloat: 1 +double: 4 +float: 4 +float128: 4 +idouble: 4 +ifloat: 4 +ifloat128: 4 ildouble: 5 ldouble: 5 Function: Imaginary part of "csqrt_upward": -double: 1 -float: 2 -idouble: 1 -ifloat: 2 +double: 3 +float: 3 +float128: 3 +idouble: 3 +ifloat: 3 +ifloat128: 3 ildouble: 4 ldouble: 4 Function: Real part of "ctan": double: 1 float: 1 +float128: 3 idouble: 1 ifloat: 1 +ifloat128: 3 ildouble: 2 ldouble: 2 Function: Imaginary part of "ctan": -double: 1 -float: 1 -idouble: 1 -ifloat: 1 +double: 2 +float: 2 +float128: 3 +idouble: 2 +ifloat: 2 +ifloat128: 3 ildouble: 1 ldouble: 1 Function: Real part of "ctan_downward": -double: 1 -float: 1 -idouble: 1 -ifloat: 1 +double: 6 +float: 5 +float128: 4 +idouble: 6 +ifloat: 5 +ifloat128: 4 ildouble: 5 ldouble: 5 Function: Imaginary part of "ctan_downward": double: 2 -float: 1 +float: 2 +float128: 5 idouble: 2 -ifloat: 1 +ifloat: 2 +ifloat128: 5 ildouble: 4 ldouble: 4 Function: Real part of "ctan_towardzero": -double: 3 -float: 2 -idouble: 3 -ifloat: 2 +double: 5 +float: 3 +float128: 4 +idouble: 5 +ifloat: 3 +ifloat128: 4 ildouble: 5 ldouble: 5 Function: Imaginary part of "ctan_towardzero": double: 2 float: 3 +float128: 5 idouble: 2 ifloat: 3 +ifloat128: 5 ildouble: 4 ldouble: 4 Function: Real part of "ctan_upward": double: 3 -float: 2 +float: 4 +float128: 5 idouble: 3 -ifloat: 2 +ifloat: 4 +ifloat128: 5 ildouble: 3 ldouble: 3 Function: Imaginary part of "ctan_upward": double: 2 float: 1 +float128: 5 idouble: 2 ifloat: 1 +ifloat128: 5 ildouble: 3 ldouble: 3 Function: Real part of "ctanh": -double: 1 -float: 1 -idouble: 1 -ifloat: 1 +double: 2 +float: 2 +float128: 3 +idouble: 2 +ifloat: 2 +ifloat128: 3 ildouble: 1 ldouble: 1 Function: Imaginary part of "ctanh": -double: 1 -float: 1 -idouble: 1 -ifloat: 1 +double: 2 +float: 2 +float128: 3 +idouble: 2 +ifloat: 2 +ifloat128: 3 ildouble: 2 ldouble: 2 Function: Real part of "ctanh_downward": double: 2 float: 2 +float128: 5 idouble: 2 ifloat: 2 +ifloat128: 5 ildouble: 4 ldouble: 4 Function: Imaginary part of "ctanh_downward": -double: 2 -float: 1 -idouble: 2 -ifloat: 1 +double: 6 +float: 5 +float128: 4 +idouble: 6 +ifloat: 5 +ifloat128: 4 ildouble: 4 ldouble: 4 Function: Real part of "ctanh_towardzero": double: 2 float: 3 +float128: 5 idouble: 2 ifloat: 3 +ifloat128: 5 ildouble: 4 ldouble: 4 Function: Imaginary part of "ctanh_towardzero": -double: 2 -float: 2 -idouble: 2 -ifloat: 2 +double: 5 +float: 3 +float128: 3 +idouble: 5 +ifloat: 3 +ifloat128: 3 ildouble: 3 ldouble: 3 Function: Real part of "ctanh_upward": double: 2 -float: 1 +float: 2 +float128: 5 idouble: 2 -ifloat: 1 +ifloat: 2 +ifloat128: 5 ildouble: 3 ldouble: 3 Function: Imaginary part of "ctanh_upward": double: 3 -float: 2 +float: 3 +float128: 5 idouble: 3 -ifloat: 2 +ifloat: 3 +ifloat128: 5 ildouble: 3 ldouble: 3 Function: "erf": double: 1 float: 1 +float128: 1 idouble: 1 ifloat: 1 +ifloat128: 1 ildouble: 1 ldouble: 1 Function: "erf_downward": double: 1 float: 1 +float128: 2 idouble: 1 ifloat: 1 +ifloat128: 2 ildouble: 1 ldouble: 1 Function: "erf_towardzero": double: 1 float: 1 +float128: 1 idouble: 1 ifloat: 1 +ifloat128: 1 ildouble: 1 ldouble: 1 Function: "erf_upward": double: 1 float: 1 +float128: 2 idouble: 1 ifloat: 1 +ifloat128: 2 ildouble: 1 ldouble: 1 Function: "erfc": -double: 1 -float: 1 -idouble: 1 -ifloat: 1 +double: 3 +float: 2 +float128: 2 +idouble: 3 +ifloat: 2 +ifloat128: 2 ildouble: 3 ldouble: 3 Function: "erfc_downward": -double: 2 -float: 3 -idouble: 2 -ifloat: 3 +double: 5 +float: 6 +float128: 5 +idouble: 5 +ifloat: 6 +ifloat128: 5 ildouble: 4 ldouble: 4 Function: "erfc_towardzero": -double: 2 -float: 2 -idouble: 2 -ifloat: 2 +double: 3 +float: 4 +float128: 4 +idouble: 3 +ifloat: 4 +ifloat128: 4 ildouble: 4 ldouble: 4 Function: "erfc_upward": -double: 2 -float: 3 -idouble: 2 -ifloat: 3 +double: 5 +float: 6 +float128: 5 +idouble: 5 +ifloat: 6 +ifloat128: 5 ildouble: 5 ldouble: 5 Function: "exp": double: 1 +float128: 1 idouble: 1 +ifloat128: 1 ildouble: 1 ldouble: 1 Function: "exp10": double: 1 +float128: 2 idouble: 1 +ifloat128: 2 ildouble: 1 ldouble: 1 Function: "exp10_downward": double: 1 float: 1 +float128: 3 idouble: 1 ifloat: 1 +ifloat128: 3 ildouble: 2 ldouble: 2 Function: "exp10_towardzero": double: 1 float: 1 +float128: 3 idouble: 1 ifloat: 1 +ifloat128: 3 ildouble: 2 ldouble: 2 Function: "exp10_upward": double: 1 float: 1 +float128: 3 idouble: 1 ifloat: 1 +ifloat128: 3 ildouble: 2 ldouble: 2 Function: "exp2": double: 1 +float128: 1 idouble: 1 +ifloat128: 1 ildouble: 1 ldouble: 1 Function: "exp2_downward": +float128: 1 +ifloat128: 1 ildouble: 1 ldouble: 1 Function: "exp2_towardzero": double: 1 +float128: 1 idouble: 1 +ifloat128: 1 ildouble: 1 ldouble: 1 Function: "exp2_upward": +float: 1 +float128: 2 +ifloat: 1 +ifloat128: 2 ildouble: 1 ldouble: 1 Function: "exp_downward": double: 1 +float: 1 idouble: 1 +ifloat: 1 ildouble: 1 ldouble: 1 Function: "exp_towardzero": double: 1 +float: 1 idouble: 1 +ifloat: 1 ildouble: 2 ldouble: 2 Function: "exp_upward": double: 1 +float: 1 idouble: 1 +ifloat: 1 ildouble: 1 ldouble: 1 Function: "expm1": double: 1 +float128: 1 idouble: 1 +ifloat128: 1 ildouble: 2 ldouble: 2 Function: "expm1_downward": double: 1 float: 1 +float128: 2 idouble: 1 ifloat: 1 +ifloat128: 2 ildouble: 4 ldouble: 4 Function: "expm1_towardzero": double: 1 float: 1 +float128: 4 idouble: 1 ifloat: 1 +ifloat128: 4 ildouble: 4 ldouble: 4 Function: "expm1_upward": double: 1 float: 1 +float128: 3 idouble: 1 ifloat: 1 +ifloat128: 3 ildouble: 4 ldouble: 4 Function: "gamma": -double: 3 -float: 2 -idouble: 3 -ifloat: 2 +double: 4 +float: 3 +idouble: 4 +ifloat: 3 ildouble: 4 ldouble: 4 Function: "gamma_downward": -double: 4 -float: 4 -idouble: 4 -ifloat: 4 +double: 5 +float: 5 +idouble: 5 +ifloat: 5 ildouble: 7 ldouble: 7 Function: "gamma_towardzero": -double: 4 -float: 2 -idouble: 4 -ifloat: 2 +double: 5 +float: 4 +idouble: 5 +ifloat: 4 ildouble: 7 ldouble: 7 Function: "gamma_upward": -double: 3 -float: 4 -idouble: 3 -ifloat: 4 +double: 5 +float: 5 +idouble: 5 +ifloat: 5 ildouble: 5 ldouble: 5 Function: "hypot": double: 1 +float128: 1 idouble: 1 +ifloat128: 1 ildouble: 1 ldouble: 1 Function: "hypot_downward": double: 1 +float128: 1 idouble: 1 +ifloat128: 1 ildouble: 1 ldouble: 1 Function: "hypot_towardzero": double: 1 +float128: 1 idouble: 1 +ifloat128: 1 ildouble: 1 ldouble: 1 Function: "hypot_upward": double: 1 +float128: 1 idouble: 1 +ifloat128: 1 ildouble: 1 ldouble: 1 Function: "j0": -double: 1 -float: 1 -idouble: 1 -ifloat: 1 +double: 2 +float: 2 +float128: 2 +idouble: 2 +ifloat: 2 +ifloat128: 2 ildouble: 2 ldouble: 2 Function: "j0_downward": -double: 1 -float: 2 -idouble: 1 -ifloat: 2 +double: 2 +float: 4 +float128: 4 +idouble: 2 +ifloat: 4 +ifloat128: 4 ildouble: 4 ldouble: 4 Function: "j0_towardzero": -double: 2 -float: 1 -idouble: 2 -ifloat: 1 +double: 3 +float: 2 +float128: 2 +idouble: 3 +ifloat: 2 +ifloat128: 2 ildouble: 5 ldouble: 5 Function: "j0_upward": -double: 1 +double: 3 float: 3 -idouble: 1 +float128: 5 +idouble: 3 ifloat: 3 +ifloat128: 5 ildouble: 4 ldouble: 4 Function: "j1": double: 2 -float: 1 +float: 2 +float128: 4 idouble: 2 -ifloat: 1 +ifloat: 2 +ifloat128: 4 ildouble: 1 ldouble: 1 Function: "j1_downward": -double: 2 -float: 2 -idouble: 2 -ifloat: 2 +double: 3 +float: 3 +float128: 4 +idouble: 3 +ifloat: 3 +ifloat128: 4 ildouble: 4 ldouble: 4 Function: "j1_towardzero": -double: 2 -float: 1 -idouble: 2 -ifloat: 1 +double: 3 +float: 2 +float128: 4 +idouble: 3 +ifloat: 2 +ifloat128: 4 ildouble: 4 ldouble: 4 Function: "j1_upward": -double: 2 -float: 3 -idouble: 2 -ifloat: 3 +double: 3 +float: 5 +float128: 3 +idouble: 3 +ifloat: 5 +ifloat128: 3 ildouble: 3 ldouble: 3 Function: "jn": -double: 2 -float: 3 -idouble: 2 -ifloat: 3 +double: 4 +float: 4 +float128: 7 +idouble: 4 +ifloat: 4 +ifloat128: 7 ildouble: 4 ldouble: 4 Function: "jn_downward": -double: 2 -float: 3 -idouble: 2 -ifloat: 3 +double: 5 +float: 5 +float128: 8 +idouble: 5 +ifloat: 5 +ifloat128: 8 ildouble: 4 ldouble: 4 Function: "jn_towardzero": -double: 2 -float: 3 -idouble: 2 -ifloat: 3 +double: 5 +float: 5 +float128: 8 +idouble: 5 +ifloat: 5 +ifloat128: 8 ildouble: 5 ldouble: 5 Function: "jn_upward": -double: 2 -float: 3 -idouble: 2 -ifloat: 3 +double: 5 +float: 5 +float128: 7 +idouble: 5 +ifloat: 5 +ifloat128: 7 ildouble: 5 ldouble: 5 Function: "lgamma": -double: 3 -float: 2 -idouble: 3 -ifloat: 2 +double: 4 +float: 3 +float128: 5 +idouble: 4 +ifloat: 3 +ifloat128: 5 ildouble: 4 ldouble: 4 Function: "lgamma_downward": -double: 4 -float: 4 -idouble: 4 -ifloat: 4 +double: 5 +float: 5 +float128: 8 +idouble: 5 +ifloat: 5 +ifloat128: 8 ildouble: 7 ldouble: 7 Function: "lgamma_towardzero": -double: 4 -float: 2 -idouble: 4 -ifloat: 2 +double: 5 +float: 4 +float128: 5 +idouble: 5 +ifloat: 4 +ifloat128: 5 ildouble: 7 ldouble: 7 Function: "lgamma_upward": -double: 3 -float: 4 -idouble: 3 -ifloat: 4 +double: 5 +float: 5 +float128: 8 +idouble: 5 +ifloat: 5 +ifloat128: 8 ildouble: 5 ldouble: 5 Function: "log": double: 1 +float128: 1 idouble: 1 +ifloat128: 1 ildouble: 1 ldouble: 1 Function: "log10": double: 1 +float128: 1 idouble: 1 +ifloat128: 1 ildouble: 1 ldouble: 1 Function: "log10_downward": double: 1 float: 1 +float128: 1 idouble: 1 ifloat: 1 +ifloat128: 1 ildouble: 2 ldouble: 2 Function: "log10_towardzero": double: 1 float: 1 +float128: 1 idouble: 1 ifloat: 1 +ifloat128: 1 ildouble: 2 ldouble: 2 Function: "log10_upward": double: 1 float: 1 +float128: 1 idouble: 1 ifloat: 1 +ifloat128: 1 ildouble: 1 ldouble: 1 Function: "log1p": double: 1 +float128: 2 idouble: 1 +ifloat128: 2 ildouble: 2 ldouble: 2 Function: "log1p_downward": double: 1 float: 1 +float128: 3 idouble: 1 ifloat: 1 +ifloat128: 3 ildouble: 4 ldouble: 4 Function: "log1p_towardzero": double: 1 float: 1 +float128: 3 idouble: 1 ifloat: 1 +ifloat128: 3 ildouble: 4 ldouble: 4 Function: "log1p_upward": double: 1 float: 1 +float128: 2 idouble: 1 ifloat: 1 +ifloat128: 2 ildouble: 3 ldouble: 3 Function: "log2": double: 1 +float: 1 +float128: 2 idouble: 1 +ifloat: 1 +ifloat128: 2 ildouble: 1 ldouble: 1 Function: "log2_downward": double: 1 +float128: 3 idouble: 1 +ifloat128: 3 ildouble: 1 ldouble: 1 Function: "log2_towardzero": double: 1 float: 1 +float128: 1 idouble: 1 ifloat: 1 +ifloat128: 1 ildouble: 1 ldouble: 1 Function: "log2_upward": double: 1 float: 1 +float128: 1 idouble: 1 ifloat: 1 +ifloat128: 1 ildouble: 1 ldouble: 1 Function: "log_downward": double: 1 +float128: 1 idouble: 1 +ifloat128: 1 ildouble: 2 ldouble: 2 Function: "log_towardzero": double: 1 +float128: 2 idouble: 1 +ifloat128: 2 ildouble: 2 ldouble: 2 Function: "log_upward": double: 1 +float128: 1 idouble: 1 +ifloat128: 1 ildouble: 1 ldouble: 1 Function: "pow": double: 1 +float128: 2 idouble: 1 +ifloat128: 2 ildouble: 1 ldouble: 1 -Function: "pow10": -double: 1 -idouble: 1 -ildouble: 1 -ldouble: 1 - -Function: "pow10_downward": +Function: "pow_downward": double: 1 float: 1 +float128: 2 idouble: 1 ifloat: 1 -ildouble: 2 -ldouble: 2 +ifloat128: 2 +ildouble: 4 +ldouble: 4 -Function: "pow10_towardzero": +Function: "pow_towardzero": double: 1 float: 1 +float128: 2 idouble: 1 ifloat: 1 -ildouble: 2 -ldouble: 2 +ifloat128: 2 +ildouble: 4 +ldouble: 4 -Function: "pow10_upward": +Function: "pow_upward": double: 1 float: 1 +float128: 2 idouble: 1 ifloat: 1 -ildouble: 2 -ldouble: 2 - -Function: "pow_downward": -double: 1 -idouble: 1 +ifloat128: 2 ildouble: 4 ldouble: 4 -Function: "pow_towardzero": -double: 1 -idouble: 1 -ildouble: 1 -ldouble: 1 - -Function: "pow_upward": -double: 1 -idouble: 1 -ildouble: 2 -ldouble: 2 - Function: "sin": +double: 1 float: 1 +float128: 1 +idouble: 1 ifloat: 1 +ifloat128: 1 ildouble: 1 ldouble: 1 Function: "sin_downward": double: 1 float: 1 +float128: 3 idouble: 1 ifloat: 1 +ifloat128: 3 ildouble: 3 ldouble: 3 Function: "sin_towardzero": double: 1 float: 1 +float128: 2 idouble: 1 ifloat: 1 +ifloat128: 2 ildouble: 2 ldouble: 2 Function: "sin_upward": double: 1 float: 1 +float128: 3 idouble: 1 ifloat: 1 +ifloat128: 3 ildouble: 3 ldouble: 3 Function: "sincos": +double: 1 float: 1 +float128: 1 +idouble: 1 ifloat: 1 +ifloat128: 1 ildouble: 1 ldouble: 1 Function: "sincos_downward": double: 1 float: 1 +float128: 3 idouble: 1 ifloat: 1 +ifloat128: 3 ildouble: 3 ldouble: 3 Function: "sincos_towardzero": double: 1 float: 1 +float128: 2 idouble: 1 ifloat: 1 +ifloat128: 2 ildouble: 2 ldouble: 2 Function: "sincos_upward": double: 1 float: 1 +float128: 3 idouble: 1 ifloat: 1 +ifloat128: 3 ildouble: 3 ldouble: 3 Function: "sinh": -double: 1 +double: 2 +float: 2 +float128: 2 +idouble: 2 +ifloat: 2 +ifloat128: 2 ildouble: 2 ldouble: 2 Function: "sinh_downward": -double: 2 -float: 1 -idouble: 1 -ifloat: 1 -ildouble: 4 +double: 3 +float: 3 +float128: 3 +idouble: 3 +ifloat: 3 +ifloat128: 3 +ildouble: 5 ldouble: 5 Function: "sinh_towardzero": double: 2 -float: 1 -idouble: 1 -ifloat: 1 -ildouble: 3 +float: 2 +float128: 3 +idouble: 2 +ifloat: 2 +ifloat128: 3 +ildouble: 4 ldouble: 4 Function: "sinh_upward": double: 4 -float: 2 -idouble: 1 -ifloat: 1 -ildouble: 4 +float: 3 +float128: 4 +idouble: 4 +ifloat: 3 +ifloat128: 4 +ildouble: 5 ldouble: 5 Function: "tan": float: 1 +float128: 1 ifloat: 1 +ifloat128: 1 ildouble: 2 ldouble: 2 Function: "tan_downward": double: 1 float: 2 +float128: 1 idouble: 1 ifloat: 2 +ifloat128: 1 ildouble: 3 ldouble: 3 Function: "tan_towardzero": double: 1 float: 2 +float128: 1 idouble: 1 ifloat: 2 +ifloat128: 1 ildouble: 3 ldouble: 3 Function: "tan_upward": double: 1 float: 2 +float128: 1 idouble: 1 ifloat: 2 +ifloat128: 1 ildouble: 2 ldouble: 2 Function: "tanh": -double: 1 -idouble: 1 +double: 2 +float: 2 +float128: 2 +idouble: 2 +ifloat: 2 +ifloat128: 2 ildouble: 3 ldouble: 3 Function: "tanh_downward": -double: 1 -float: 1 -idouble: 1 -ifloat: 1 +double: 3 +float: 3 +float128: 4 +idouble: 3 +ifloat: 3 +ifloat128: 4 ildouble: 7 ldouble: 4 Function: "tanh_towardzero": -double: 1 -float: 1 -idouble: 1 -ifloat: 1 +double: 2 +float: 2 +float128: 3 +idouble: 2 +ifloat: 2 +ifloat128: 3 ildouble: 3 ldouble: 3 Function: "tanh_upward": -double: 1 -float: 1 -idouble: 1 -ifloat: 1 -ildouble: 5 -ldouble: 4 - -Function: "tgamma": double: 3 float: 3 +float128: 3 idouble: 3 ifloat: 3 +ifloat128: 3 +ildouble: 5 +ldouble: 4 + +Function: "tgamma": +double: 5 +float: 4 +float128: 4 +idouble: 5 +ifloat: 4 +ifloat128: 4 ildouble: 5 ldouble: 5 Function: "tgamma_downward": -double: 3 -float: 3 -idouble: 3 -ifloat: 3 +double: 6 +float: 5 +float128: 5 +idouble: 6 +ifloat: 5 +ifloat128: 5 ildouble: 5 ldouble: 5 Function: "tgamma_towardzero": -double: 3 -float: 3 -idouble: 3 -ifloat: 3 +double: 6 +float: 4 +float128: 5 +idouble: 6 +ifloat: 4 +ifloat128: 5 ildouble: 5 ldouble: 5 Function: "tgamma_upward": -double: 3 -float: 3 -idouble: 3 -ifloat: 3 +double: 5 +float: 4 +float128: 4 +idouble: 5 +ifloat: 4 +ifloat128: 4 ildouble: 5 ldouble: 5 Function: "y0": -double: 1 +double: 2 float: 1 -idouble: 1 +float128: 3 +idouble: 2 ifloat: 1 +ifloat128: 3 ildouble: 1 ldouble: 1 Function: "y0_downward": -double: 2 -float: 2 -idouble: 2 -ifloat: 2 +double: 3 +float: 4 +float128: 4 +idouble: 3 +ifloat: 4 +ifloat128: 4 ildouble: 5 ldouble: 5 Function: "y0_towardzero": -double: 2 -float: 2 -idouble: 2 -ifloat: 2 +double: 3 +float: 3 +float128: 3 +idouble: 3 +ifloat: 3 +ifloat128: 3 ildouble: 5 ldouble: 5 Function: "y0_upward": -double: 1 -float: 2 -idouble: 1 -ifloat: 2 +double: 3 +float: 5 +float128: 3 +idouble: 3 +ifloat: 5 +ifloat128: 3 ildouble: 3 ldouble: 3 Function: "y1": -double: 2 +double: 3 float: 2 -idouble: 2 +float128: 2 +idouble: 3 ifloat: 2 +ifloat128: 2 ildouble: 2 ldouble: 2 Function: "y1_downward": -double: 2 -float: 2 -idouble: 2 -ifloat: 2 +double: 3 +float: 3 +float128: 4 +idouble: 3 +ifloat: 3 +ifloat128: 4 ildouble: 7 ldouble: 7 Function: "y1_towardzero": -double: 2 -float: 2 -idouble: 2 -ifloat: 2 +double: 3 +float: 3 +float128: 2 +idouble: 3 +ifloat: 3 +ifloat128: 2 ildouble: 5 ldouble: 5 Function: "y1_upward": -double: 1 -float: 2 -idouble: 1 -ifloat: 2 +double: 7 +float: 3 +float128: 5 +idouble: 7 +ifloat: 3 +ifloat128: 5 ildouble: 7 ldouble: 7 Function: "yn": -double: 2 +double: 3 float: 3 -idouble: 2 +float128: 5 +idouble: 3 ifloat: 3 +ifloat128: 5 ildouble: 4 ldouble: 4 Function: "yn_downward": -double: 2 -float: 2 -idouble: 2 -ifloat: 2 +double: 3 +float: 4 +float128: 5 +idouble: 3 +ifloat: 4 +ifloat128: 5 ildouble: 5 ldouble: 5 Function: "yn_towardzero": double: 3 float: 3 +float128: 5 idouble: 3 ifloat: 3 +ifloat128: 5 ildouble: 5 ldouble: 5 Function: "yn_upward": -double: 3 -float: 3 -idouble: 3 -ifloat: 3 +double: 4 +float: 5 +float128: 5 +idouble: 4 +ifloat: 5 +ifloat128: 5 ildouble: 4 ldouble: 4 diff --git a/sysdeps/i386/fpu/libm-test-ulps-name b/sysdeps/i386/fpu/libm-test-ulps-name new file mode 100644 index 0000000000..54ca0d8295 --- /dev/null +++ b/sysdeps/i386/fpu/libm-test-ulps-name @@ -0,0 +1 @@ +ix86 diff --git a/sysdeps/i386/fpu/math-tests.h b/sysdeps/i386/fpu/math-tests.h index 80492fe632..6aba8414d4 100644 --- a/sysdeps/i386/fpu/math-tests.h +++ b/sysdeps/i386/fpu/math-tests.h @@ -1,5 +1,5 @@ /* Configuration for math tests. 32-bit x86 version. - Copyright (C) 2013-2016 Free Software Foundation, Inc. + Copyright (C) 2013-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/sysdeps/i386/fpu/mpexp.c b/sysdeps/i386/fpu/mpexp.c deleted file mode 100644 index 1cc8931700..0000000000 --- a/sysdeps/i386/fpu/mpexp.c +++ /dev/null @@ -1 +0,0 @@ -/* Not needed. */ diff --git a/sysdeps/i386/fpu/mplog.c b/sysdeps/i386/fpu/mplog.c deleted file mode 100644 index 1cc8931700..0000000000 --- a/sysdeps/i386/fpu/mplog.c +++ /dev/null @@ -1 +0,0 @@ -/* Not needed. */ diff --git a/sysdeps/i386/fpu/s_asinh.S b/sysdeps/i386/fpu/s_asinh.S index 6a6e5b9004..2a03a588ac 100644 --- a/sysdeps/i386/fpu/s_asinh.S +++ b/sysdeps/i386/fpu/s_asinh.S @@ -1,5 +1,5 @@ /* ix87 specific implementation of arcsinh. - Copyright (C) 1996-2016 Free Software Foundation, Inc. + Copyright (C) 1996-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. @@ -18,6 +18,7 @@ <http://www.gnu.org/licenses/>. */ #include <machine/asm.h> +#include <libm-alias-double.h> .section .rodata @@ -136,4 +137,4 @@ ENTRY(__asinh) fchs 4: ret END(__asinh) -weak_alias (__asinh, asinh) +libm_alias_double (__asinh, asinh) diff --git a/sysdeps/i386/fpu/s_asinhf.S b/sysdeps/i386/fpu/s_asinhf.S index 31f25192f3..bc082f0e7b 100644 --- a/sysdeps/i386/fpu/s_asinhf.S +++ b/sysdeps/i386/fpu/s_asinhf.S @@ -1,5 +1,5 @@ /* ix87 specific implementation of arcsinh. - Copyright (C) 1996-2016 Free Software Foundation, Inc. + Copyright (C) 1996-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. @@ -18,6 +18,7 @@ <http://www.gnu.org/licenses/>. */ #include <machine/asm.h> +#include <libm-alias-float.h> .section .rodata @@ -136,4 +137,4 @@ ENTRY(__asinhf) fchs 4: ret END(__asinhf) -weak_alias (__asinhf, asinhf) +libm_alias_float (__asinh, asinh) diff --git a/sysdeps/i386/fpu/s_asinhl.S b/sysdeps/i386/fpu/s_asinhl.S index c9d5714bee..21cb30a9e6 100644 --- a/sysdeps/i386/fpu/s_asinhl.S +++ b/sysdeps/i386/fpu/s_asinhl.S @@ -1,5 +1,5 @@ /* ix87 specific implementation of arcsinh. - Copyright (C) 1996-2016 Free Software Foundation, Inc. + Copyright (C) 1996-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. @@ -17,6 +17,7 @@ License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ +#include <libm-alias-ldouble.h> #include <machine/asm.h> .section .rodata @@ -88,6 +89,7 @@ ENTRY(__asinhl) 4: ret 7: fldt 4(%esp) + fadd %st ret 6: faddl MO(one) @@ -140,4 +142,4 @@ ENTRY(__asinhl) fchs 4: ret END(__asinhl) -weak_alias (__asinhl, asinhl) +libm_alias_ldouble (__asinh, asinh) diff --git a/sysdeps/i386/fpu/s_atan.S b/sysdeps/i386/fpu/s_atan.S index 644de78feb..0102281be9 100644 --- a/sysdeps/i386/fpu/s_atan.S +++ b/sysdeps/i386/fpu/s_atan.S @@ -5,6 +5,7 @@ #include <machine/asm.h> #include <i386-math-asm.h> +#include <libm-alias-double.h> RCSID("$NetBSD: s_atan.S,v 1.4 1995/05/08 23:50:41 jtc Exp $") @@ -27,4 +28,4 @@ ENTRY(__atan) DBL_CHECK_FORCE_UFLOW ret END (__atan) -weak_alias (__atan, atan) +libm_alias_double (__atan, atan) diff --git a/sysdeps/i386/fpu/s_atanf.S b/sysdeps/i386/fpu/s_atanf.S index 0589c1135e..15ecd345d9 100644 --- a/sysdeps/i386/fpu/s_atanf.S +++ b/sysdeps/i386/fpu/s_atanf.S @@ -5,6 +5,7 @@ #include <machine/asm.h> #include <i386-math-asm.h> +#include <libm-alias-float.h> RCSID("$NetBSD: s_atanf.S,v 1.3 1995/05/08 23:51:33 jtc Exp $") @@ -27,4 +28,4 @@ ENTRY(__atanf) FLT_CHECK_FORCE_UFLOW ret END (__atanf) -weak_alias (__atanf, atanf) +libm_alias_float (__atan, atan) diff --git a/sysdeps/i386/fpu/s_atanl.c b/sysdeps/i386/fpu/s_atanl.c index b7dba88aad..2b02ac1e32 100644 --- a/sysdeps/i386/fpu/s_atanl.c +++ b/sysdeps/i386/fpu/s_atanl.c @@ -6,6 +6,7 @@ */ #include <math_private.h> +#include <libm-alias-ldouble.h> long double __atanl (long double x) @@ -19,4 +20,4 @@ __atanl (long double x) return res; } -weak_alias (__atanl, atanl) +libm_alias_ldouble (__atan, atan) diff --git a/sysdeps/i386/fpu/s_cbrt.S b/sysdeps/i386/fpu/s_cbrt.S index 6e7e99d9e8..abce211322 100644 --- a/sysdeps/i386/fpu/s_cbrt.S +++ b/sysdeps/i386/fpu/s_cbrt.S @@ -1,5 +1,5 @@ /* Compute cubic root of double value. - Copyright (C) 1997-2016 Free Software Foundation, Inc. + Copyright (C) 1997-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Dirk Alboth <dirka@uni-paderborn.de> and Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -19,6 +19,7 @@ <http://www.gnu.org/licenses/>. */ #include <machine/asm.h> +#include <libm-alias-double.h> .section .rodata @@ -197,4 +198,4 @@ ENTRY(__cbrt) 1: fldl 4(%esp) ret END(__cbrt) -weak_alias (__cbrt, cbrt) +libm_alias_double (__cbrt, cbrt) diff --git a/sysdeps/i386/fpu/s_cbrtf.S b/sysdeps/i386/fpu/s_cbrtf.S index 0a9db49523..0bdb2f32ec 100644 --- a/sysdeps/i386/fpu/s_cbrtf.S +++ b/sysdeps/i386/fpu/s_cbrtf.S @@ -1,5 +1,5 @@ /* Compute cubic root of float value. - Copyright (C) 1997-2016 Free Software Foundation, Inc. + Copyright (C) 1997-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Dirk Alboth <dirka@uni-paderborn.de> and Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -19,6 +19,7 @@ <http://www.gnu.org/licenses/>. */ #include <machine/asm.h> +#include <libm-alias-float.h> .section .rodata @@ -174,4 +175,4 @@ ENTRY(__cbrtf) 1: flds 4(%esp) ret END(__cbrtf) -weak_alias (__cbrtf, cbrtf) +libm_alias_float (__cbrt, cbrt) diff --git a/sysdeps/i386/fpu/s_cbrtl.S b/sysdeps/i386/fpu/s_cbrtl.S index 3bf170075b..0328c96f6b 100644 --- a/sysdeps/i386/fpu/s_cbrtl.S +++ b/sysdeps/i386/fpu/s_cbrtl.S @@ -1,5 +1,5 @@ /* Compute cubic root of long double value. - Copyright (C) 1997-2016 Free Software Foundation, Inc. + Copyright (C) 1997-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Dirk Alboth <dirka@uni-paderborn.de> and Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -18,6 +18,7 @@ License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ +#include <libm-alias-ldouble.h> #include <machine/asm.h> .section .rodata @@ -223,6 +224,7 @@ ENTRY(__cbrtl) /* Return the argument. */ 1: fldt 4(%esp) + fadd %st ret END(__cbrtl) -weak_alias (__cbrtl, cbrtl) +libm_alias_ldouble (__cbrt, cbrt) diff --git a/sysdeps/i386/fpu/s_ceil.S b/sysdeps/i386/fpu/s_ceil.S index f32fa26d34..9287ab0673 100644 --- a/sysdeps/i386/fpu/s_ceil.S +++ b/sysdeps/i386/fpu/s_ceil.S @@ -4,15 +4,16 @@ */ #include <machine/asm.h> +#include <libm-alias-double.h> RCSID("$NetBSD: s_ceil.S,v 1.4 1995/05/08 23:52:13 jtc Exp $") ENTRY(__ceil) fldl 4(%esp) - subl $8,%esp - cfi_adjust_cfa_offset (8) + subl $32,%esp + cfi_adjust_cfa_offset (32) - fstcw 4(%esp) /* store fpu control word */ + fnstenv 4(%esp) /* store fpu environment */ /* We use here %edx although only the low 1 bits are defined. But none of the operations should care and they are faster @@ -25,10 +26,10 @@ ENTRY(__ceil) frndint /* round */ - fldcw 4(%esp) /* restore original control word */ + fldenv 4(%esp) /* restore original environment */ - addl $8,%esp - cfi_adjust_cfa_offset (-8) + addl $32,%esp + cfi_adjust_cfa_offset (-32) ret END (__ceil) -weak_alias (__ceil, ceil) +libm_alias_double (__ceil, ceil) diff --git a/sysdeps/i386/fpu/s_ceilf.S b/sysdeps/i386/fpu/s_ceilf.S index 4fe703b179..2a6e3db273 100644 --- a/sysdeps/i386/fpu/s_ceilf.S +++ b/sysdeps/i386/fpu/s_ceilf.S @@ -4,15 +4,16 @@ */ #include <machine/asm.h> +#include <libm-alias-float.h> RCSID("$NetBSD: s_ceilf.S,v 1.3 1995/05/08 23:52:44 jtc Exp $") ENTRY(__ceilf) flds 4(%esp) - subl $8,%esp - cfi_adjust_cfa_offset (8) + subl $32,%esp + cfi_adjust_cfa_offset (32) - fstcw 4(%esp) /* store fpu control word */ + fnstenv 4(%esp) /* store fpu environment */ /* We use here %edx although only the low 1 bits are defined. But none of the operations should care and they are faster @@ -25,10 +26,10 @@ ENTRY(__ceilf) frndint /* round */ - fldcw 4(%esp) /* restore original control word */ + fldenv 4(%esp) /* restore original environment */ - addl $8,%esp - cfi_adjust_cfa_offset (-8) + addl $32,%esp + cfi_adjust_cfa_offset (-32) ret END (__ceilf) -weak_alias (__ceilf, ceilf) +libm_alias_float (__ceil, ceil) diff --git a/sysdeps/i386/fpu/s_ceill.S b/sysdeps/i386/fpu/s_ceill.S index 4b272c522a..70d5c6ce0c 100644 --- a/sysdeps/i386/fpu/s_ceill.S +++ b/sysdeps/i386/fpu/s_ceill.S @@ -4,16 +4,17 @@ * Public domain. */ +#include <libm-alias-ldouble.h> #include <machine/asm.h> RCSID("$NetBSD: $") ENTRY(__ceill) fldt 4(%esp) - subl $8,%esp - cfi_adjust_cfa_offset (8) + subl $32,%esp + cfi_adjust_cfa_offset (32) - fstcw 4(%esp) /* store fpu control word */ + fnstenv 4(%esp) /* store fpu environment */ /* We use here %edx although only the low 1 bits are defined. But none of the operations should care and they are faster @@ -26,10 +27,15 @@ ENTRY(__ceill) frndint /* round */ - fldcw 4(%esp) /* restore original control word */ + /* Preserve "invalid" exceptions from sNaN input. */ + fnstsw + andl $0x1, %eax + orl %eax, 8(%esp) - addl $8,%esp - cfi_adjust_cfa_offset (-8) + fldenv 4(%esp) /* restore original environment */ + + addl $32,%esp + cfi_adjust_cfa_offset (-32) ret END (__ceill) -weak_alias (__ceill, ceill) +libm_alias_ldouble (__ceil, ceil) diff --git a/sysdeps/i386/fpu/s_copysign.S b/sysdeps/i386/fpu/s_copysign.S index 2520a94427..1434d407a7 100644 --- a/sysdeps/i386/fpu/s_copysign.S +++ b/sysdeps/i386/fpu/s_copysign.S @@ -4,6 +4,7 @@ */ #include <machine/asm.h> +#include <libm-alias-double.h> RCSID("$NetBSD: s_copysign.S,v 1.4 1995/05/08 23:53:02 jtc Exp $") @@ -17,4 +18,4 @@ ENTRY(__copysign) fldl 4(%esp) ret END (__copysign) -weak_alias (__copysign, copysign) +libm_alias_double (__copysign, copysign) diff --git a/sysdeps/i386/fpu/s_copysignf.S b/sysdeps/i386/fpu/s_copysignf.S index 57b1a6f119..a05b749f1b 100644 --- a/sysdeps/i386/fpu/s_copysignf.S +++ b/sysdeps/i386/fpu/s_copysignf.S @@ -4,6 +4,7 @@ */ #include <machine/asm.h> +#include <libm-alias-float.h> RCSID("$NetBSD: s_copysignf.S,v 1.3 1995/05/08 23:53:25 jtc Exp $") @@ -17,4 +18,4 @@ ENTRY(__copysignf) flds 4(%esp) ret END (__copysignf) -weak_alias (__copysignf, copysignf) +libm_alias_float (__copysign, copysign) diff --git a/sysdeps/i386/fpu/s_copysignl.S b/sysdeps/i386/fpu/s_copysignl.S index 2163e7b014..671ce683ba 100644 --- a/sysdeps/i386/fpu/s_copysignl.S +++ b/sysdeps/i386/fpu/s_copysignl.S @@ -4,6 +4,7 @@ * Public domain. */ +#include <libm-alias-ldouble.h> #include <machine/asm.h> RCSID("$NetBSD: $") @@ -18,4 +19,4 @@ ENTRY(__copysignl) fldt 4(%esp) ret END (__copysignl) -weak_alias (__copysignl, copysignl) +libm_alias_ldouble (__copysign, copysign) diff --git a/sysdeps/i386/fpu/s_expm1.S b/sysdeps/i386/fpu/s_expm1.S index 0bd227ee7a..2a7c41e72f 100644 --- a/sysdeps/i386/fpu/s_expm1.S +++ b/sysdeps/i386/fpu/s_expm1.S @@ -1,5 +1,5 @@ /* ix87 specific implementation of exp(x)-1. - Copyright (C) 1996-2016 Free Software Foundation, Inc. + Copyright (C) 1996-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. Based on code by John C. Bowman <bowman@ipp-garching.mpg.de>. @@ -24,6 +24,7 @@ #include <sysdep.h> #include <machine/asm.h> #include <i386-math-asm.h> +#include <libm-alias-double.h> .section .rodata @@ -110,4 +111,4 @@ ENTRY(__expm1) fldl MO(minus1) // Set result to -1.0. 3: ret END(__expm1) -weak_alias (__expm1, expm1) +libm_alias_double (__expm1, expm1) diff --git a/sysdeps/i386/fpu/s_expm1f.S b/sysdeps/i386/fpu/s_expm1f.S index 669140eb75..5acf374c4b 100644 --- a/sysdeps/i386/fpu/s_expm1f.S +++ b/sysdeps/i386/fpu/s_expm1f.S @@ -1,5 +1,5 @@ /* ix87 specific implementation of exp(x)-1. - Copyright (C) 1996-2016 Free Software Foundation, Inc. + Copyright (C) 1996-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. Based on code by John C. Bowman <bowman@ipp-garching.mpg.de>. @@ -24,6 +24,7 @@ #include <sysdep.h> #include <machine/asm.h> #include <i386-math-asm.h> +#include <libm-alias-float.h> .section .rodata @@ -110,4 +111,4 @@ ENTRY(__expm1f) fldl MO(minus1) // Set result to -1.0. 3: ret END(__expm1f) -weak_alias (__expm1f, expm1f) +libm_alias_float (__expm1, expm1) diff --git a/sysdeps/i386/fpu/s_f32xaddf64.c b/sysdeps/i386/fpu/s_f32xaddf64.c new file mode 100644 index 0000000000..9d5e85b409 --- /dev/null +++ b/sysdeps/i386/fpu/s_f32xaddf64.c @@ -0,0 +1,42 @@ +/* Add _Float64 values, converting the result to _Float32x. i386 version. + Copyright (C) 2018 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#include <math.h> +#include <fpu_control.h> +#include <math-narrow-eval.h> +#include <math_private.h> +#include <math-narrow.h> + +_Float32x +__f32xaddf64 (_Float64 x, _Float64 y) +{ + /* To avoid double rounding, set double precision for the addition. + math_narrow_eval is still needed to eliminate excess range in the + case of overflow. If the result of the addition is in the + subnormal range for double, it is exact, so no issues of double + rounding for subnormals arise. */ + fpu_control_t cw, cw_double; + _FPU_GETCW (cw); + cw_double = (cw & ~_FPU_EXTENDED) | _FPU_DOUBLE; + _FPU_SETCW (cw_double); + _Float32x ret = math_narrow_eval (x + y); + _FPU_SETCW (cw); + CHECK_NARROW_ADD (ret, x, y); + return ret; +} +libm_alias_float32x_float64 (add) diff --git a/sysdeps/i386/fpu/s_f32xdivf64.c b/sysdeps/i386/fpu/s_f32xdivf64.c new file mode 100644 index 0000000000..77f965a290 --- /dev/null +++ b/sysdeps/i386/fpu/s_f32xdivf64.c @@ -0,0 +1,29 @@ +/* Divide _Float64 values, converting the result to _Float32x. i386 version. + Copyright (C) 2018 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#include <math.h> +#include <math-narrow.h> + +_Float32x +__f32xdivf64 (_Float64 x, _Float64 y) +{ + /* To avoid double rounding, use round-to-odd on long double. */ + NARROW_DIV_ROUND_TO_ODD ((long double) x, (long double) y, double, + union ieee854_long_double, l, mantissa1); +} +libm_alias_float32x_float64 (div) diff --git a/sysdeps/i386/fpu/s_f32xmulf64.c b/sysdeps/i386/fpu/s_f32xmulf64.c new file mode 100644 index 0000000000..7710fa47a8 --- /dev/null +++ b/sysdeps/i386/fpu/s_f32xmulf64.c @@ -0,0 +1,29 @@ +/* Multiply _Float64 values, converting the result to _Float32x. i386 version. + Copyright (C) 2018 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#include <math.h> +#include <math-narrow.h> + +_Float32x +__f32xmulf64 (_Float64 x, _Float64 y) +{ + /* To avoid double rounding, use round-to-odd on long double. */ + NARROW_MUL_ROUND_TO_ODD ((long double) x, (long double) y, double, + union ieee854_long_double, l, mantissa1); +} +libm_alias_float32x_float64 (mul) diff --git a/sysdeps/i386/fpu/s_f32xsubf64.c b/sysdeps/i386/fpu/s_f32xsubf64.c new file mode 100644 index 0000000000..3f41acfdc9 --- /dev/null +++ b/sysdeps/i386/fpu/s_f32xsubf64.c @@ -0,0 +1,42 @@ +/* Subtract _Float64 values, converting the result to _Float32x. i386 version. + Copyright (C) 2018 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#include <math.h> +#include <fpu_control.h> +#include <math-narrow-eval.h> +#include <math_private.h> +#include <math-narrow.h> + +_Float32x +__f32xsubf64 (_Float64 x, _Float64 y) +{ + /* To avoid double rounding, set double precision for the subtraction. + math_narrow_eval is still needed to eliminate excess range in the + case of overflow. If the result of the subtraction is in the + subnormal range for double, it is exact, so no issues of double + rounding for subnormals arise. */ + fpu_control_t cw, cw_double; + _FPU_GETCW (cw); + cw_double = (cw & ~_FPU_EXTENDED) | _FPU_DOUBLE; + _FPU_SETCW (cw_double); + _Float32x ret = math_narrow_eval (x - y); + _FPU_SETCW (cw); + CHECK_NARROW_SUB (ret, x, y); + return ret; +} +libm_alias_float32x_float64 (sub) diff --git a/sysdeps/i386/fpu/s_fabs.S b/sysdeps/i386/fpu/s_fabs.S index 23ae9dccb9..c623eb526c 100644 --- a/sysdeps/i386/fpu/s_fabs.S +++ b/sysdeps/i386/fpu/s_fabs.S @@ -1,4 +1,5 @@ #include <sysdep.h> +#include <libm-alias-double.h> .text ENTRY(__fabs) @@ -6,4 +7,4 @@ ENTRY(__fabs) fabs ret END(__fabs) -weak_alias (__fabs, fabs) +libm_alias_double (__fabs, fabs) diff --git a/sysdeps/i386/fpu/s_fabsf.S b/sysdeps/i386/fpu/s_fabsf.S index c0407a8839..3185946ec1 100644 --- a/sysdeps/i386/fpu/s_fabsf.S +++ b/sysdeps/i386/fpu/s_fabsf.S @@ -1,4 +1,5 @@ #include <sysdep.h> +#include <libm-alias-float.h> .text ENTRY(__fabsf) @@ -6,4 +7,4 @@ ENTRY(__fabsf) fabs ret END(__fabsf) -weak_alias (__fabsf, fabsf) +libm_alias_float (__fabs, fabs) diff --git a/sysdeps/i386/fpu/s_fabsl.S b/sysdeps/i386/fpu/s_fabsl.S index a12a3e050b..6642ed4151 100644 --- a/sysdeps/i386/fpu/s_fabsl.S +++ b/sysdeps/i386/fpu/s_fabsl.S @@ -1,3 +1,4 @@ +#include <libm-alias-ldouble.h> #include <sysdep.h> .text @@ -6,4 +7,4 @@ ENTRY(__fabsl) fabs ret END(__fabsl) -weak_alias (__fabsl, fabsl) +libm_alias_ldouble (__fabs, fabs) diff --git a/sysdeps/i386/fpu/s_fdim.S b/sysdeps/i386/fpu/s_fdim.S deleted file mode 100644 index d62069b039..0000000000 --- a/sysdeps/i386/fpu/s_fdim.S +++ /dev/null @@ -1,51 +0,0 @@ -/* Compute positive difference. - Copyright (C) 1997-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#include <sysdep.h> - - .text -ENTRY(__fdim) - fldl 4(%esp) // x - fldl 12(%esp) // x : y - - fucom %st(1) - fnstsw - sahf - jp 1f - - jc 3f - - fstp %st(1) - fldz - jmp 2f - -3: fsubrp %st, %st(1) - ret - -1: fxam - fnstsw - andb $0x45, %ah - cmpb $0x01, %ah - je 2f - - fxch -2: fstp %st(1) - ret -END(__fdim) -weak_alias (__fdim, fdim) diff --git a/sysdeps/i386/fpu/s_fdim.c b/sysdeps/i386/fpu/s_fdim.c new file mode 100644 index 0000000000..b8fefe7d18 --- /dev/null +++ b/sysdeps/i386/fpu/s_fdim.c @@ -0,0 +1,48 @@ +/* Return positive difference between arguments. i386 version. + Copyright (C) 1997-2018 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <fpu_control.h> +#include <math.h> +#include <math-narrow-eval.h> +#include <math_private.h> +#include <libm-alias-double.h> + +double +__fdim (double x, double y) +{ + if (islessequal (x, y)) + return 0.0; + + /* To avoid double rounding, set double precision for the + subtraction. math_narrow_eval is still needed to eliminate + excess range in the case of overflow. If the result of the + subtraction is in the subnormal range for double, it is exact, so + no issues of double rounding for subnormals arise. */ + fpu_control_t cw, cw_double; + _FPU_GETCW (cw); + cw_double = (cw & ~_FPU_EXTENDED) | _FPU_DOUBLE; + _FPU_SETCW (cw_double); + double r = math_narrow_eval (x - y); + _FPU_SETCW (cw); + if (isinf (r) && !isinf (x) && !isinf (y)) + __set_errno (ERANGE); + + return r; +} +libm_alias_double (__fdim, fdim) diff --git a/sysdeps/i386/fpu/s_fdiml.S b/sysdeps/i386/fpu/s_fdiml.S deleted file mode 100644 index df6e9c047a..0000000000 --- a/sysdeps/i386/fpu/s_fdiml.S +++ /dev/null @@ -1,51 +0,0 @@ -/* Compute positive difference. - Copyright (C) 1997-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#include <sysdep.h> - - .text -ENTRY(__fdiml) - fldt 4(%esp) // x - fldt 16(%esp) // x : y - - fucom %st(1) - fnstsw - sahf - jp 1f - - jc 3f - - fstp %st(1) - fldz - jmp 2f - -3: fsubrp %st, %st(1) - ret - -1: fxam - fnstsw - andb $0x45, %ah - cmpb $0x01, %ah - je 2f - - fxch -2: fstp %st(1) - ret -END(__fdiml) -weak_alias (__fdiml, fdiml) diff --git a/sysdeps/i386/fpu/s_floor.S b/sysdeps/i386/fpu/s_floor.S index 2d6287dc79..f3cd66e77f 100644 --- a/sysdeps/i386/fpu/s_floor.S +++ b/sysdeps/i386/fpu/s_floor.S @@ -4,15 +4,16 @@ */ #include <machine/asm.h> +#include <libm-alias-double.h> RCSID("$NetBSD: s_floor.S,v 1.4 1995/05/09 00:01:59 jtc Exp $") ENTRY(__floor) fldl 4(%esp) - subl $8,%esp - cfi_adjust_cfa_offset (8) + subl $32,%esp + cfi_adjust_cfa_offset (32) - fstcw 4(%esp) /* store fpu control word */ + fnstenv 4(%esp) /* store fpu environment */ /* We use here %edx although only the low 1 bits are defined. But none of the operations should care and they are faster @@ -25,10 +26,10 @@ ENTRY(__floor) frndint /* round */ - fldcw 4(%esp) /* restore original control word */ + fldenv 4(%esp) /* restore original environment */ - addl $8,%esp - cfi_adjust_cfa_offset (-8) + addl $32,%esp + cfi_adjust_cfa_offset (-32) ret END (__floor) -weak_alias (__floor, floor) +libm_alias_double (__floor, floor) diff --git a/sysdeps/i386/fpu/s_floorf.S b/sysdeps/i386/fpu/s_floorf.S index e969fbe587..656eeb698f 100644 --- a/sysdeps/i386/fpu/s_floorf.S +++ b/sysdeps/i386/fpu/s_floorf.S @@ -4,15 +4,16 @@ */ #include <machine/asm.h> +#include <libm-alias-float.h> RCSID("$NetBSD: s_floorf.S,v 1.3 1995/05/09 00:04:32 jtc Exp $") ENTRY(__floorf) flds 4(%esp) - subl $8,%esp - cfi_adjust_cfa_offset (8) + subl $32,%esp + cfi_adjust_cfa_offset (32) - fstcw 4(%esp) /* store fpu control word */ + fnstenv 4(%esp) /* store fpu environment */ /* We use here %edx although only the low 1 bits are defined. But none of the operations should care and they are faster @@ -25,10 +26,10 @@ ENTRY(__floorf) frndint /* round */ - fldcw 4(%esp) /* restore original control word */ + fldenv 4(%esp) /* restore original environment */ - addl $8,%esp - cfi_adjust_cfa_offset (-8) + addl $32,%esp + cfi_adjust_cfa_offset (-32) ret END (__floorf) -weak_alias (__floorf, floorf) +libm_alias_float (__floor, floor) diff --git a/sysdeps/i386/fpu/s_floorl.S b/sysdeps/i386/fpu/s_floorl.S index 1206554c4a..f85b542f9b 100644 --- a/sysdeps/i386/fpu/s_floorl.S +++ b/sysdeps/i386/fpu/s_floorl.S @@ -4,16 +4,17 @@ * Public domain. */ +#include <libm-alias-ldouble.h> #include <machine/asm.h> RCSID("$NetBSD: $") ENTRY(__floorl) fldt 4(%esp) - subl $8,%esp - cfi_adjust_cfa_offset (8) + subl $32,%esp + cfi_adjust_cfa_offset (32) - fstcw 4(%esp) /* store fpu control word */ + fnstenv 4(%esp) /* store fpu environment */ /* We use here %edx although only the low 1 bits are defined. But none of the operations should care and they are faster @@ -26,10 +27,15 @@ ENTRY(__floorl) frndint /* round */ - fldcw 4(%esp) /* restore original control word */ + /* Preserve "invalid" exceptions from sNaN input. */ + fnstsw + andl $0x1, %eax + orl %eax, 8(%esp) - addl $8,%esp - cfi_adjust_cfa_offset (-8) + fldenv 4(%esp) /* restore original environment */ + + addl $32,%esp + cfi_adjust_cfa_offset (-32) ret END (__floorl) -weak_alias (__floorl, floorl) +libm_alias_ldouble (__floor, floor) diff --git a/sysdeps/i386/fpu/s_fmax.S b/sysdeps/i386/fpu/s_fmax.S index a6a236f1e1..91387da5d8 100644 --- a/sysdeps/i386/fpu/s_fmax.S +++ b/sysdeps/i386/fpu/s_fmax.S @@ -1,5 +1,5 @@ /* Compute maximum of two numbers, regarding NaN as missing argument. - Copyright (C) 1997-2016 Free Software Foundation, Inc. + Copyright (C) 1997-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -18,6 +18,7 @@ <http://www.gnu.org/licenses/>. */ #include <sysdep.h> +#include <libm-alias-double.h> .text ENTRY(__fmax) @@ -40,4 +41,4 @@ ENTRY(__fmax) ret END(__fmax) -weak_alias (__fmax, fmax) +libm_alias_double (__fmax, fmax) diff --git a/sysdeps/i386/fpu/s_fmaxf.S b/sysdeps/i386/fpu/s_fmaxf.S index 2cbdbccb87..dbedc96d7f 100644 --- a/sysdeps/i386/fpu/s_fmaxf.S +++ b/sysdeps/i386/fpu/s_fmaxf.S @@ -1,5 +1,5 @@ /* Compute maximum of two numbers, regarding NaN as missing argument. - Copyright (C) 1997-2016 Free Software Foundation, Inc. + Copyright (C) 1997-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -18,6 +18,7 @@ <http://www.gnu.org/licenses/>. */ #include <sysdep.h> +#include <libm-alias-float.h> .text ENTRY(__fmaxf) @@ -40,4 +41,4 @@ ENTRY(__fmaxf) ret END(__fmaxf) -weak_alias (__fmaxf, fmaxf) +libm_alias_float (__fmax, fmax) diff --git a/sysdeps/i386/fpu/s_fmaxl.S b/sysdeps/i386/fpu/s_fmaxl.S index a38a1946bc..4c6b64fb1d 100644 --- a/sysdeps/i386/fpu/s_fmaxl.S +++ b/sysdeps/i386/fpu/s_fmaxl.S @@ -1,5 +1,5 @@ /* Compute maximum of two numbers, regarding NaN as missing argument. - Copyright (C) 1997-2016 Free Software Foundation, Inc. + Copyright (C) 1997-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -17,6 +17,7 @@ License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ +#include <libm-alias-ldouble.h> #include <sysdep.h> .text @@ -28,7 +29,13 @@ ENTRY(__fmaxl) andb $0x45, %ah cmpb $0x01, %ah - je 1f // y == NaN + je 2f // y == NaN + + fxam + fnstsw + andb $0x45, %ah + cmpb $0x01, %ah + je 3f // x == NaN fucom %st(1) fnstsw @@ -39,5 +46,27 @@ ENTRY(__fmaxl) 1: fstp %st(1) ret + +2: // st(1) is a NaN; st(0) may or may not be. + fxam + fnstsw + andb $0x45, %ah + cmpb $0x01, %ah + je 4f + // st(1) is a NaN; st(0) is not. Test if st(1) is signaling. + testb $0x40, 23(%esp) + jz 4f + fstp %st(1) + ret + +3: // st(0) is a NaN; st(1) is not. Test if st(0) is signaling. + testb $0x40, 11(%esp) + jz 4f + fstp %st(0) + ret + +4: // Both arguments are NaNs, or one is a signaling NaN. + faddp + ret END(__fmaxl) -weak_alias (__fmaxl, fmaxl) +libm_alias_ldouble (__fmax, fmax) diff --git a/sysdeps/i386/fpu/s_fmin.S b/sysdeps/i386/fpu/s_fmin.S index 022d9cf9f6..7c07c07ae6 100644 --- a/sysdeps/i386/fpu/s_fmin.S +++ b/sysdeps/i386/fpu/s_fmin.S @@ -1,5 +1,5 @@ /* Compute minimum of two numbers, regarding NaN as missing argument. - Copyright (C) 1997-2016 Free Software Foundation, Inc. + Copyright (C) 1997-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -18,6 +18,7 @@ <http://www.gnu.org/licenses/>. */ #include <sysdep.h> +#include <libm-alias-double.h> .text ENTRY(__fmin) @@ -40,4 +41,4 @@ ENTRY(__fmin) ret END(__fmin) -weak_alias (__fmin, fmin) +libm_alias_double (__fmin, fmin) diff --git a/sysdeps/i386/fpu/s_fminf.S b/sysdeps/i386/fpu/s_fminf.S index 5ba4ddb138..b3b5cb63d6 100644 --- a/sysdeps/i386/fpu/s_fminf.S +++ b/sysdeps/i386/fpu/s_fminf.S @@ -1,5 +1,5 @@ /* Compute minimum of two numbers, regarding NaN as missing argument. - Copyright (C) 1997-2016 Free Software Foundation, Inc. + Copyright (C) 1997-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -18,6 +18,7 @@ <http://www.gnu.org/licenses/>. */ #include <sysdep.h> +#include <libm-alias-float.h> .text ENTRY(__fminf) @@ -40,4 +41,4 @@ ENTRY(__fminf) ret END(__fminf) -weak_alias (__fminf, fminf) +libm_alias_float (__fmin, fmin) diff --git a/sysdeps/i386/fpu/s_fminl.S b/sysdeps/i386/fpu/s_fminl.S index fb5169b8f2..b1f87005a2 100644 --- a/sysdeps/i386/fpu/s_fminl.S +++ b/sysdeps/i386/fpu/s_fminl.S @@ -1,5 +1,5 @@ /* Compute minimum of two numbers, regarding NaN as missing argument. - Copyright (C) 1997-2016 Free Software Foundation, Inc. + Copyright (C) 1997-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -17,27 +17,56 @@ License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ +#include <libm-alias-ldouble.h> #include <sysdep.h> .text ENTRY(__fminl) - fldt 4(%esp) // x - fldt 16(%esp) // x : y + fldt 16(%esp) // y + fxam + fnstsw + fldt 4(%esp) // y : x + + andb $0x45, %ah + cmpb $0x01, %ah + je 2f // y == NaN fxam fnstsw andb $0x45, %ah cmpb $0x01, %ah - je 1f // y == NaN + je 3f // x == NaN fucom %st(1) fnstsw sahf - jc 2f + jc 1f + + fxch %st(1) +1: fstp %st(1) + + ret -1: fxch %st(1) -2: fstp %st(1) +2: // st(1) is a NaN; st(0) may or may not be. + fxam + fnstsw + andb $0x45, %ah + cmpb $0x01, %ah + je 4f + // st(1) is a NaN; st(0) is not. Test if st(1) is signaling. + testb $0x40, 23(%esp) + jz 4f + fstp %st(1) + ret + +3: // st(0) is a NaN; st(1) is not. Test if st(0) is signaling. + testb $0x40, 11(%esp) + jz 4f + fstp %st(0) + ret +4: // Both arguments are NaNs, or one is a signaling NaN. + faddp ret END(__fminl) -weak_alias (__fminl, fminl) +libm_alias_ldouble (__fmin, fmin) diff --git a/sysdeps/i386/fpu/s_fpclassifyl.c b/sysdeps/i386/fpu/s_fpclassifyl.c index 4971f16fff..44110bbfca 100644 --- a/sysdeps/i386/fpu/s_fpclassifyl.c +++ b/sysdeps/i386/fpu/s_fpclassifyl.c @@ -1,5 +1,5 @@ /* Return classification value corresponding to argument. - Copyright (C) 1997-2016 Free Software Foundation, Inc. + Copyright (C) 1997-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -25,7 +25,7 @@ int __fpclassifyl (long double x) { - u_int32_t ex, hx, lx; + uint32_t ex, hx, lx; int retval = FP_NORMAL; GET_LDOUBLE_WORDS (ex, hx, lx, x); diff --git a/sysdeps/i386/fpu/s_frexp.S b/sysdeps/i386/fpu/s_frexp.S index 23f15dddb3..d5d9d5386c 100644 --- a/sysdeps/i386/fpu/s_frexp.S +++ b/sysdeps/i386/fpu/s_frexp.S @@ -1,5 +1,5 @@ /* ix87 specific frexp implementation for double. - Copyright (C) 1997-2016 Free Software Foundation, Inc. + Copyright (C) 1997-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -18,6 +18,7 @@ <http://www.gnu.org/licenses/>. */ #include <machine/asm.h> +#include <libm-alias-double.h> .section .rodata @@ -80,4 +81,4 @@ ENTRY (__frexp) ret END (__frexp) -weak_alias (__frexp, frexp) +libm_alias_double (__frexp, frexp) diff --git a/sysdeps/i386/fpu/s_frexpf.S b/sysdeps/i386/fpu/s_frexpf.S index 5e3288bede..e45185cdd4 100644 --- a/sysdeps/i386/fpu/s_frexpf.S +++ b/sysdeps/i386/fpu/s_frexpf.S @@ -1,5 +1,5 @@ /* ix87 specific frexp implementation for float. - Copyright (C) 1997-2016 Free Software Foundation, Inc. + Copyright (C) 1997-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -18,6 +18,7 @@ <http://www.gnu.org/licenses/>. */ #include <machine/asm.h> +#include <libm-alias-float.h> .section .rodata @@ -77,4 +78,4 @@ ENTRY (__frexpf) ret END (__frexpf) -weak_alias (__frexpf, frexpf) +libm_alias_float (__frexp, frexp) diff --git a/sysdeps/i386/fpu/s_frexpl.S b/sysdeps/i386/fpu/s_frexpl.S index f687ab3c2e..52e3e4627c 100644 --- a/sysdeps/i386/fpu/s_frexpl.S +++ b/sysdeps/i386/fpu/s_frexpl.S @@ -1,5 +1,5 @@ /* ix87 specific frexp implementation for long double. - Copyright (C) 1997-2016 Free Software Foundation, Inc. + Copyright (C) 1997-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -17,6 +17,7 @@ License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ +#include <libm-alias-ldouble.h> #include <machine/asm.h> .section .rodata @@ -50,7 +51,7 @@ ENTRY (__frexpl) jz 1f xorl %ecx, %ecx cmpl $0x7fff, %eax - je 1f + je 3f cmpl $0, %eax jne 2f @@ -81,5 +82,12 @@ ENTRY (__frexpl) movl %ecx, (%eax) ret + + /* Infinity or NaN; ensure signaling NaNs are quieted. */ +3: movl EXPP(%esp), %eax + fldt VAL0(%esp) + fadd %st + movl %ecx, (%eax) + ret END (__frexpl) -weak_alias (__frexpl, frexpl) +libm_alias_ldouble (__frexp, frexp) diff --git a/sysdeps/i386/fpu/s_isnanl.c b/sysdeps/i386/fpu/s_isnanl.c index 816396d8fb..fb97317bc9 100644 --- a/sysdeps/i386/fpu/s_isnanl.c +++ b/sysdeps/i386/fpu/s_isnanl.c @@ -35,9 +35,9 @@ int __isnanl(long double x) extended format has the normally implicit 1 explicit present. Sigh! */ lx |= hx & 0x7fffffff; - se |= (u_int32_t)(lx|(-lx))>>31; + se |= (uint32_t)(lx|(-lx))>>31; se = 0xfffe - se; - return (int)((u_int32_t)(se))>>16; + return (int)((uint32_t)(se))>>16; } hidden_def (__isnanl) weak_alias (__isnanl, isnanl) diff --git a/sysdeps/i386/fpu/s_llrint.S b/sysdeps/i386/fpu/s_llrint.S index 0c2b99ec0b..888d2a6231 100644 --- a/sysdeps/i386/fpu/s_llrint.S +++ b/sysdeps/i386/fpu/s_llrint.S @@ -1,6 +1,6 @@ /* Round argument to nearest integral value according to current rounding direction. - Copyright (C) 1997-2016 Free Software Foundation, Inc. + Copyright (C) 1997-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -19,6 +19,7 @@ <http://www.gnu.org/licenses/>. */ #include <sysdep.h> +#include <libm-alias-double.h> .text ENTRY(__llrint) @@ -33,4 +34,4 @@ ENTRY(__llrint) cfi_adjust_cfa_offset (-4) ret END(__llrint) -weak_alias (__llrint, llrint) +libm_alias_double (__llrint, llrint) diff --git a/sysdeps/i386/fpu/s_llrintf.S b/sysdeps/i386/fpu/s_llrintf.S index 72d1e69528..42a4ef1fb1 100644 --- a/sysdeps/i386/fpu/s_llrintf.S +++ b/sysdeps/i386/fpu/s_llrintf.S @@ -1,6 +1,6 @@ /* Round argument to nearest integral value according to current rounding direction. - Copyright (C) 1997-2016 Free Software Foundation, Inc. + Copyright (C) 1997-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -19,6 +19,7 @@ <http://www.gnu.org/licenses/>. */ #include <sysdep.h> +#include <libm-alias-float.h> .text ENTRY(__llrintf) @@ -33,4 +34,4 @@ ENTRY(__llrintf) cfi_adjust_cfa_offset (-4) ret END(__llrintf) -weak_alias (__llrintf, llrintf) +libm_alias_float (__llrint, llrint) diff --git a/sysdeps/i386/fpu/s_llrintl.S b/sysdeps/i386/fpu/s_llrintl.S index a256ca252b..6728e713b8 100644 --- a/sysdeps/i386/fpu/s_llrintl.S +++ b/sysdeps/i386/fpu/s_llrintl.S @@ -1,6 +1,6 @@ /* Round argument to nearest integral value according to current rounding direction. - Copyright (C) 1997-2016 Free Software Foundation, Inc. + Copyright (C) 1997-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -18,6 +18,7 @@ License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ +#include <libm-alias-ldouble.h> #include <sysdep.h> .text @@ -33,4 +34,4 @@ ENTRY(__llrintl) cfi_adjust_cfa_offset (-4) ret END(__llrintl) -weak_alias (__llrintl, llrintl) +libm_alias_ldouble (__llrint, llrint) diff --git a/sysdeps/i386/fpu/s_log1pl.S b/sysdeps/i386/fpu/s_log1pl.S index 98965fa48c..0fd05cbdb3 100644 --- a/sysdeps/i386/fpu/s_log1pl.S +++ b/sysdeps/i386/fpu/s_log1pl.S @@ -70,6 +70,7 @@ ENTRY(__log1pl) 3: jp 4b // in case x is ±Inf fstp %st(1) fstp %st(1) + fadd %st(0) ret END (__log1pl) diff --git a/sysdeps/i386/fpu/s_logb.S b/sysdeps/i386/fpu/s_logb.S index f78c091c8a..d4b3a4714f 100644 --- a/sysdeps/i386/fpu/s_logb.S +++ b/sysdeps/i386/fpu/s_logb.S @@ -4,6 +4,7 @@ */ #include <machine/asm.h> +#include <libm-alias-double.h> RCSID("$NetBSD: s_logb.S,v 1.4 1995/05/09 00:14:30 jtc Exp $") @@ -13,4 +14,4 @@ ENTRY(__logb) fstp %st ret END (__logb) -weak_alias (__logb, logb) +libm_alias_double (__logb, logb) diff --git a/sysdeps/i386/fpu/s_logbf.S b/sysdeps/i386/fpu/s_logbf.S index 91eb3d2925..175daf52a1 100644 --- a/sysdeps/i386/fpu/s_logbf.S +++ b/sysdeps/i386/fpu/s_logbf.S @@ -4,6 +4,7 @@ */ #include <machine/asm.h> +#include <libm-alias-float.h> RCSID("$NetBSD: s_logbf.S,v 1.3 1995/05/09 00:15:12 jtc Exp $") @@ -13,4 +14,4 @@ ENTRY(__logbf) fstp %st ret END (__logbf) -weak_alias (__logbf, logbf) +libm_alias_float (__logb, logb) diff --git a/sysdeps/i386/fpu/s_logbl.c b/sysdeps/i386/fpu/s_logbl.c index 391e2db489..601d873594 100644 --- a/sysdeps/i386/fpu/s_logbl.c +++ b/sysdeps/i386/fpu/s_logbl.c @@ -4,6 +4,7 @@ * Public domain. */ +#include <libm-alias-ldouble.h> #include <math_private.h> long double @@ -16,4 +17,4 @@ __logbl (long double x) return res; } -weak_alias (__logbl, logbl) +libm_alias_ldouble (__logb, logb) diff --git a/sysdeps/i386/fpu/s_lrint.S b/sysdeps/i386/fpu/s_lrint.S index 263248c7c2..8373b25bcd 100644 --- a/sysdeps/i386/fpu/s_lrint.S +++ b/sysdeps/i386/fpu/s_lrint.S @@ -1,6 +1,6 @@ /* Round argument to nearest integral value according to current rounding direction. - Copyright (C) 1997-2016 Free Software Foundation, Inc. + Copyright (C) 1997-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -19,6 +19,7 @@ <http://www.gnu.org/licenses/>. */ #include <sysdep.h> +#include <libm-alias-double.h> .text ENTRY(__lrint) @@ -31,4 +32,4 @@ ENTRY(__lrint) cfi_adjust_cfa_offset (-4) ret END(__lrint) -weak_alias (__lrint, lrint) +libm_alias_double (__lrint, lrint) diff --git a/sysdeps/i386/fpu/s_lrintf.S b/sysdeps/i386/fpu/s_lrintf.S index 1bd84fe10b..d2f0aa78e6 100644 --- a/sysdeps/i386/fpu/s_lrintf.S +++ b/sysdeps/i386/fpu/s_lrintf.S @@ -1,6 +1,6 @@ /* Round argument to nearest integral value according to current rounding direction. - Copyright (C) 1997-2016 Free Software Foundation, Inc. + Copyright (C) 1997-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -19,6 +19,7 @@ <http://www.gnu.org/licenses/>. */ #include <sysdep.h> +#include <libm-alias-float.h> .text ENTRY(__lrintf) @@ -31,4 +32,4 @@ ENTRY(__lrintf) cfi_adjust_cfa_offset (-4) ret END(__lrintf) -weak_alias (__lrintf, lrintf) +libm_alias_float (__lrint, lrint) diff --git a/sysdeps/i386/fpu/s_lrintl.S b/sysdeps/i386/fpu/s_lrintl.S index 31acc3e232..28b7219f6e 100644 --- a/sysdeps/i386/fpu/s_lrintl.S +++ b/sysdeps/i386/fpu/s_lrintl.S @@ -1,6 +1,6 @@ /* Round argument to nearest integral value according to current rounding direction. - Copyright (C) 1997-2016 Free Software Foundation, Inc. + Copyright (C) 1997-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -18,6 +18,7 @@ License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ +#include <libm-alias-ldouble.h> #include <sysdep.h> .text @@ -31,4 +32,4 @@ ENTRY(__lrintl) cfi_adjust_cfa_offset (-4) ret END(__lrintl) -weak_alias (__lrintl, lrintl) +libm_alias_ldouble (__lrint, lrint) diff --git a/sysdeps/i386/fpu/s_nearbyint.S b/sysdeps/i386/fpu/s_nearbyint.S index 8da8ae9792..11fb61b242 100644 --- a/sysdeps/i386/fpu/s_nearbyint.S +++ b/sysdeps/i386/fpu/s_nearbyint.S @@ -5,20 +5,17 @@ /* Adapted for use as nearbyint by Ulrich Drepper <drepper@cygnus.com>. */ #include <machine/asm.h> +#include <libm-alias-double.h> ENTRY(__nearbyint) fldl 4(%esp) subl $32, %esp cfi_adjust_cfa_offset (32) fnstenv 4(%esp) - movl 4(%esp), %eax - orl $0x20, %eax - movl %eax, (%esp) - fldcw (%esp) frndint fldenv 4(%esp) addl $32, %esp cfi_adjust_cfa_offset (-32) ret END (__nearbyint) -weak_alias (__nearbyint, nearbyint) +libm_alias_double (__nearbyint, nearbyint) diff --git a/sysdeps/i386/fpu/s_nearbyintf.S b/sysdeps/i386/fpu/s_nearbyintf.S index 0c51f72364..169d06d80b 100644 --- a/sysdeps/i386/fpu/s_nearbyintf.S +++ b/sysdeps/i386/fpu/s_nearbyintf.S @@ -5,20 +5,17 @@ /* Adapted for use as nearbyint by Ulrich Drepper <drepper@cygnus.com>. */ #include <machine/asm.h> +#include <libm-alias-float.h> ENTRY(__nearbyintf) flds 4(%esp) subl $32, %esp cfi_adjust_cfa_offset (32) fnstenv 4(%esp) - movl 4(%esp), %eax - orl $0x20, %eax - movl %eax, (%esp) - fldcw (%esp) frndint fldenv 4(%esp) addl $32, %esp cfi_adjust_cfa_offset (-32) ret END (__nearbyintf) -weak_alias (__nearbyintf, nearbyintf) +libm_alias_float (__nearbyint, nearbyint) diff --git a/sysdeps/i386/fpu/s_nearbyintl.S b/sysdeps/i386/fpu/s_nearbyintl.S index b260ab5914..852e1f6524 100644 --- a/sysdeps/i386/fpu/s_nearbyintl.S +++ b/sysdeps/i386/fpu/s_nearbyintl.S @@ -4,6 +4,7 @@ */ /* Adapted for use as nearbyint by Ulrich Drepper <drepper@cygnus.com>. */ +#include <libm-alias-ldouble.h> #include <machine/asm.h> ENTRY(__nearbyintl) @@ -11,10 +12,6 @@ ENTRY(__nearbyintl) subl $32, %esp cfi_adjust_cfa_offset (32) fnstenv 4(%esp) - movl 4(%esp), %eax - orl $0x20, %eax - movl %eax, (%esp) - fldcw (%esp) frndint fnstsw andl $0x1, %eax @@ -24,4 +21,4 @@ ENTRY(__nearbyintl) cfi_adjust_cfa_offset (-32) ret END (__nearbyintl) -weak_alias (__nearbyintl, nearbyintl) +libm_alias_ldouble (__nearbyint, nearbyint) diff --git a/sysdeps/i386/fpu/s_nextafterl.c b/sysdeps/i386/fpu/s_nextafterl.c index 188dc2129a..d6e3025bb2 100644 --- a/sysdeps/i386/fpu/s_nextafterl.c +++ b/sysdeps/i386/fpu/s_nextafterl.c @@ -28,12 +28,14 @@ static char rcsid[] = "$NetBSD: $"; #include <errno.h> #include <math.h> +#include <math-barriers.h> #include <math_private.h> +#include <libm-alias-ldouble.h> long double __nextafterl(long double x, long double y) { - u_int32_t hx,hy,ix,iy; - u_int32_t lx,ly; + uint32_t hx,hy,ix,iy; + uint32_t lx,ly; int32_t esx,esy; GET_LDOUBLE_WORDS(esx,hx,lx,x); @@ -86,7 +88,7 @@ long double __nextafterl(long double x, long double y) if(esy>=0||(esx>esy||((esx==esy)&&(hx>hy||((hx==hy)&&(lx>ly)))))){ /* x < y, x -= ulp */ if(lx==0) { - if (hx <= 0x80000000) { + if (hx <= 0x80000000 && esx != 0xffff8000) { esx -= 1; hx = hx - 1; if ((esx&0x7fff) > 0) @@ -120,6 +122,6 @@ long double __nextafterl(long double x, long double y) SET_LDOUBLE_WORDS(x,esx,hx,lx); return x; } -weak_alias (__nextafterl, nextafterl) +libm_alias_ldouble (__nextafter, nextafter) strong_alias (__nextafterl, __nexttowardl) weak_alias (__nextafterl, nexttowardl) diff --git a/sysdeps/i386/fpu/s_nexttoward.c b/sysdeps/i386/fpu/s_nexttoward.c index 0b47044760..3594db5a4c 100644 --- a/sysdeps/i386/fpu/s_nexttoward.c +++ b/sysdeps/i386/fpu/s_nexttoward.c @@ -28,13 +28,14 @@ static char rcsid[] = "$NetBSD: $"; #include <errno.h> #include <math.h> +#include <math-barriers.h> #include <math_private.h> #include <float.h> double __nexttoward(double x, long double y) { int32_t hx,ix,iy; - u_int32_t lx,hy,ly,esy; + uint32_t lx,hy,ly,esy; EXTRACT_WORDS(hx,lx,x); GET_LDOUBLE_WORDS(esy,hy,ly,y); diff --git a/sysdeps/i386/fpu/s_nexttowardf.c b/sysdeps/i386/fpu/s_nexttowardf.c index e1156d1e4f..6e11ace223 100644 --- a/sysdeps/i386/fpu/s_nexttowardf.c +++ b/sysdeps/i386/fpu/s_nexttowardf.c @@ -20,13 +20,14 @@ static char rcsid[] = "$NetBSD: $"; #include <errno.h> #include <math.h> +#include <math-barriers.h> #include <math_private.h> #include <float.h> float __nexttowardf(float x, long double y) { int32_t hx,ix,iy; - u_int32_t hy,ly,esy; + uint32_t hy,ly,esy; GET_FLOAT_WORD(hx,x); GET_LDOUBLE_WORDS(esy,hy,ly,y); diff --git a/sysdeps/i386/fpu/s_remquo.S b/sysdeps/i386/fpu/s_remquo.S index 341285db30..ac911727a8 100644 --- a/sysdeps/i386/fpu/s_remquo.S +++ b/sysdeps/i386/fpu/s_remquo.S @@ -5,6 +5,7 @@ */ #include <machine/asm.h> +#include <libm-alias-double.h> #define PARMS 4 /* no space for saved regs */ #define DVDND PARMS @@ -42,4 +43,4 @@ ENTRY (__remquo) ret END (__remquo) -weak_alias (__remquo, remquo) +libm_alias_double (__remquo, remquo) diff --git a/sysdeps/i386/fpu/s_remquof.S b/sysdeps/i386/fpu/s_remquof.S index 62063f068f..0b4a74596a 100644 --- a/sysdeps/i386/fpu/s_remquof.S +++ b/sysdeps/i386/fpu/s_remquof.S @@ -5,6 +5,7 @@ */ #include <machine/asm.h> +#include <libm-alias-float.h> #define PARMS 4 /* no space for saved regs */ #define DVDND PARMS @@ -42,4 +43,4 @@ ENTRY (__remquof) ret END (__remquof) -weak_alias (__remquof, remquof) +libm_alias_float (__remquo, remquo) diff --git a/sysdeps/i386/fpu/s_remquol.S b/sysdeps/i386/fpu/s_remquol.S index f3d84fc7c2..f02cc10465 100644 --- a/sysdeps/i386/fpu/s_remquol.S +++ b/sysdeps/i386/fpu/s_remquol.S @@ -4,6 +4,7 @@ * Public domain. */ +#include <libm-alias-ldouble.h> #include <machine/asm.h> #define PARMS 4 /* no space for saved regs */ @@ -42,4 +43,4 @@ ENTRY (__remquol) ret END (__remquol) -weak_alias (__remquol, remquol) +libm_alias_ldouble (__remquo, remquo) diff --git a/sysdeps/i386/fpu/s_rint.S b/sysdeps/i386/fpu/s_rint.S index be36c5f0ca..b4ab01940f 100644 --- a/sysdeps/i386/fpu/s_rint.S +++ b/sysdeps/i386/fpu/s_rint.S @@ -4,6 +4,7 @@ */ #include <machine/asm.h> +#include <libm-alias-double.h> RCSID("$NetBSD: s_rint.S,v 1.4 1995/05/09 00:16:08 jtc Exp $") @@ -12,4 +13,4 @@ ENTRY(__rint) frndint ret END (__rint) -weak_alias (__rint, rint) +libm_alias_double (__rint, rint) diff --git a/sysdeps/i386/fpu/s_rintf.S b/sysdeps/i386/fpu/s_rintf.S index 2b358c1cf1..f6d11047c7 100644 --- a/sysdeps/i386/fpu/s_rintf.S +++ b/sysdeps/i386/fpu/s_rintf.S @@ -4,6 +4,7 @@ */ #include <machine/asm.h> +#include <libm-alias-float.h> RCSID("$NetBSD: s_rintf.S,v 1.3 1995/05/09 00:17:22 jtc Exp $") @@ -12,4 +13,4 @@ ENTRY(__rintf) frndint ret END (__rintf) -weak_alias (__rintf, rintf) +libm_alias_float (__rint, rint) diff --git a/sysdeps/i386/fpu/s_rintl.c b/sysdeps/i386/fpu/s_rintl.c index 66af9cb675..5900435af9 100644 --- a/sysdeps/i386/fpu/s_rintl.c +++ b/sysdeps/i386/fpu/s_rintl.c @@ -4,6 +4,7 @@ * Public domain. */ +#include <libm-alias-ldouble.h> #include <math_private.h> long double @@ -15,4 +16,4 @@ __rintl (long double x) return res; } -weak_alias (__rintl, rintl) +libm_alias_ldouble (__rint, rint) diff --git a/sysdeps/i386/fpu/s_trunc.S b/sysdeps/i386/fpu/s_trunc.S index a15e5e5f16..a87687fe2b 100644 --- a/sysdeps/i386/fpu/s_trunc.S +++ b/sysdeps/i386/fpu/s_trunc.S @@ -1,5 +1,5 @@ /* Truncate double value. - Copyright (C) 1997-2016 Free Software Foundation, Inc. + Copyright (C) 1997-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -18,20 +18,21 @@ <http://www.gnu.org/licenses/>. */ #include <machine/asm.h> +#include <libm-alias-double.h> ENTRY(__trunc) fldl 4(%esp) - subl $8, %esp - cfi_adjust_cfa_offset (8) - fstcw 4(%esp) + subl $32, %esp + cfi_adjust_cfa_offset (32) + fnstenv 4(%esp) movl $0xc00, %edx orl 4(%esp), %edx movl %edx, (%esp) fldcw (%esp) frndint - fldcw 4(%esp) - addl $8, %esp - cfi_adjust_cfa_offset (-8) + fldenv 4(%esp) + addl $32, %esp + cfi_adjust_cfa_offset (-32) ret END(__trunc) -weak_alias (__trunc, trunc) +libm_alias_double (__trunc, trunc) diff --git a/sysdeps/i386/fpu/s_truncf.S b/sysdeps/i386/fpu/s_truncf.S index cbf257a949..14d2a81835 100644 --- a/sysdeps/i386/fpu/s_truncf.S +++ b/sysdeps/i386/fpu/s_truncf.S @@ -1,5 +1,5 @@ /* Truncate float value. - Copyright (C) 1997-2016 Free Software Foundation, Inc. + Copyright (C) 1997-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -18,20 +18,21 @@ <http://www.gnu.org/licenses/>. */ #include <machine/asm.h> +#include <libm-alias-float.h> ENTRY(__truncf) flds 4(%esp) - subl $8, %esp - cfi_adjust_cfa_offset (8) - fstcw 4(%esp) + subl $32, %esp + cfi_adjust_cfa_offset (32) + fnstenv 4(%esp) movl $0xc00, %edx orl 4(%esp), %edx movl %edx, (%esp) fldcw (%esp) frndint - fldcw 4(%esp) - addl $8, %esp - cfi_adjust_cfa_offset (-8) + fldenv 4(%esp) + addl $32, %esp + cfi_adjust_cfa_offset (-32) ret END(__truncf) -weak_alias (__truncf, truncf) +libm_alias_float (__trunc, trunc) diff --git a/sysdeps/i386/fpu/s_truncl.S b/sysdeps/i386/fpu/s_truncl.S index f92b474d49..98a14cdb37 100644 --- a/sysdeps/i386/fpu/s_truncl.S +++ b/sysdeps/i386/fpu/s_truncl.S @@ -1,5 +1,5 @@ /* Truncate long double value. - Copyright (C) 1997-2016 Free Software Foundation, Inc. + Copyright (C) 1997-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -17,21 +17,25 @@ License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ +#include <libm-alias-ldouble.h> #include <machine/asm.h> ENTRY(__truncl) fldt 4(%esp) - subl $8, %esp - cfi_adjust_cfa_offset (8) - fstcw 4(%esp) + subl $32, %esp + cfi_adjust_cfa_offset (32) + fnstenv 4(%esp) movl $0xc00, %edx orl 4(%esp), %edx movl %edx, (%esp) fldcw (%esp) frndint - fldcw 4(%esp) - addl $8, %esp - cfi_adjust_cfa_offset (-8) + fnstsw + andl $0x1, %eax + orl %eax, 8(%esp) + fldenv 4(%esp) + addl $32, %esp + cfi_adjust_cfa_offset (-32) ret END(__truncl) -weak_alias (__truncl, truncl) +libm_alias_ldouble (__trunc, trunc) diff --git a/sysdeps/i386/fpu/slowexp.c b/sysdeps/i386/fpu/slowexp.c deleted file mode 100644 index 1cc8931700..0000000000 --- a/sysdeps/i386/fpu/slowexp.c +++ /dev/null @@ -1 +0,0 @@ -/* Not needed. */ diff --git a/sysdeps/i386/fpu/slowpow.c b/sysdeps/i386/fpu/slowpow.c deleted file mode 100644 index 1cc8931700..0000000000 --- a/sysdeps/i386/fpu/slowpow.c +++ /dev/null @@ -1 +0,0 @@ -/* Not needed. */ diff --git a/sysdeps/i386/fpu/w_sqrt.c b/sysdeps/i386/fpu/w_sqrt.c index 19b5074179..8bef04e68a 100644 --- a/sysdeps/i386/fpu/w_sqrt.c +++ b/sysdeps/i386/fpu/w_sqrt.c @@ -1,8 +1,10 @@ /* The inline __ieee754_sqrt is not correctly rounding; it's OK for most internal uses in glibc, but not for sqrt itself. */ +#define NO_MATH_REDIRECT #define __ieee754_sqrt __avoid_ieee754_sqrt #include <math.h> #include <math_private.h> #undef __ieee754_sqrt extern double __ieee754_sqrt (double); -#include <math/w_sqrt.c> +#include <math-type-macros-double.h> +#include <w_sqrt_template.c> diff --git a/sysdeps/i386/fpu/w_sqrt_compat.c b/sysdeps/i386/fpu/w_sqrt_compat.c new file mode 100644 index 0000000000..dd485f4b88 --- /dev/null +++ b/sysdeps/i386/fpu/w_sqrt_compat.c @@ -0,0 +1,9 @@ +/* The inline __ieee754_sqrt is not correctly rounding; it's OK for + most internal uses in glibc, but not for sqrt itself. */ +#define NO_MATH_REDIRECT +#define __ieee754_sqrt __avoid_ieee754_sqrt +#include <math.h> +#include <math_private.h> +#undef __ieee754_sqrt +extern double __ieee754_sqrt (double); +#include <math/w_sqrt_compat.c> diff --git a/sysdeps/i386/gccframe.h b/sysdeps/i386/gccframe.h index 1145aee6f9..6935604092 100644 --- a/sysdeps/i386/gccframe.h +++ b/sysdeps/i386/gccframe.h @@ -1,5 +1,5 @@ /* Definition of object in frame unwind info. i386 version. - Copyright (C) 2001-2016 Free Software Foundation, Inc. + Copyright (C) 2001-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/sysdeps/i386/gmp-mparam.h b/sysdeps/i386/gmp-mparam.h index c72b1f9f11..695ab9fdc4 100644 --- a/sysdeps/i386/gmp-mparam.h +++ b/sysdeps/i386/gmp-mparam.h @@ -1,6 +1,6 @@ /* gmp-mparam.h -- Compiler/machine parameter header file. -Copyright (C) 1991-2016 Free Software Foundation, Inc. +Copyright (C) 1991-2018 Free Software Foundation, Inc. This file is part of the GNU MP Library. diff --git a/sysdeps/i386/htl/bits/pthreadtypes-arch.h b/sysdeps/i386/htl/bits/pthreadtypes-arch.h new file mode 100644 index 0000000000..75ba63223f --- /dev/null +++ b/sysdeps/i386/htl/bits/pthreadtypes-arch.h @@ -0,0 +1,22 @@ +/* Machine-specific pthread type layouts. Hurd i386 version. + Copyright (C) 2002-2018 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#ifndef _BITS_PTHREADTYPES_ARCH_H +#define _BITS_PTHREADTYPES_ARCH_H 1 + +#endif /* bits/pthreadtypes.h */ diff --git a/sysdeps/i386/htl/machine-sp.h b/sysdeps/i386/htl/machine-sp.h new file mode 100644 index 0000000000..8470f2fa97 --- /dev/null +++ b/sysdeps/i386/htl/machine-sp.h @@ -0,0 +1,29 @@ +/* Machine-specific function to return the stack pointer. i386 version. + Copyright (C) 1994-2018 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#ifndef _MACHINE_SP_H +#define _MACHINE_SP_H + +/* Return the current stack pointer. */ + +#define __thread_stack_pointer() ({ \ + register void *__sp__ asm("esp"); \ + __sp__; \ +}) + +#endif /* machine-sp.h */ diff --git a/sysdeps/i386/htl/pt-machdep.h b/sysdeps/i386/htl/pt-machdep.h new file mode 100644 index 0000000000..e99d3476d6 --- /dev/null +++ b/sysdeps/i386/htl/pt-machdep.h @@ -0,0 +1,28 @@ +/* Machine dependent pthreads internal defenitions. i386 version. + Copyright (C) 2000-2018 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#ifndef _PT_MACHDEP_H +#define _PT_MACHDEP_H 1 + +struct pthread_mcontext +{ + void *pc; + void *sp; +}; + +#endif /* pt-machdep.h */ diff --git a/sysdeps/i386/htonl.S b/sysdeps/i386/htonl.S index cab81f5cb3..52ef295f9b 100644 --- a/sysdeps/i386/htonl.S +++ b/sysdeps/i386/htonl.S @@ -1,5 +1,5 @@ /* Change byte order in word. For Intel 80x86, x >= 4. - Copyright (C) 1997-2016 Free Software Foundation, Inc. + Copyright (C) 1997-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/sysdeps/i386/htons.S b/sysdeps/i386/htons.S index 0ca108266f..5b572737da 100644 --- a/sysdeps/i386/htons.S +++ b/sysdeps/i386/htons.S @@ -1,5 +1,5 @@ /* Change byte order in word. For Intel 80x86, x >= 3. - Copyright (C) 1997-2016 Free Software Foundation, Inc. + Copyright (C) 1997-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/sysdeps/i386/i386-mcount.S b/sysdeps/i386/i386-mcount.S index 94fb95e7ed..3db2fcdf6b 100644 --- a/sysdeps/i386/i386-mcount.S +++ b/sysdeps/i386/i386-mcount.S @@ -1,5 +1,5 @@ -/* i386-specific implemetation of profiling support. - Copyright (C) 1997-2016 Free Software Foundation, Inc. +/* i386-specific implementation of profiling support. + Copyright (C) 1997-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. diff --git a/sysdeps/i386/i586/add_n.S b/sysdeps/i386/i586/add_n.S index 22e9c41f5c..1d4a7412c6 100644 --- a/sysdeps/i386/i586/add_n.S +++ b/sysdeps/i386/i586/add_n.S @@ -1,6 +1,6 @@ /* Pentium __mpn_add_n -- Add two limb vectors of the same length > 0 and store sum in a third limb vector. - Copyright (C) 1992-2016 Free Software Foundation, Inc. + Copyright (C) 1992-2018 Free Software Foundation, Inc. This file is part of the GNU MP Library. The GNU MP Library is free software; you can redistribute it and/or modify diff --git a/sysdeps/i386/i586/addmul_1.S b/sysdeps/i386/i586/addmul_1.S index 9ab4d7d94b..2acd5a7791 100644 --- a/sysdeps/i386/i586/addmul_1.S +++ b/sysdeps/i386/i586/addmul_1.S @@ -1,6 +1,6 @@ /* Pentium __mpn_addmul_1 -- Multiply a limb vector with a limb and add the result to a second limb vector. - Copyright (C) 1992-2016 Free Software Foundation, Inc. + Copyright (C) 1992-2018 Free Software Foundation, Inc. This file is part of the GNU MP Library. The GNU MP Library is free software; you can redistribute it and/or modify diff --git a/sysdeps/i386/i586/init-arch.h b/sysdeps/i386/i586/init-arch.h index 756c0d7895..72fb46c61e 100644 --- a/sysdeps/i386/i586/init-arch.h +++ b/sysdeps/i386/i586/init-arch.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2015-2016 Free Software Foundation, Inc. +/* Copyright (C) 2015-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/sysdeps/i386/i586/lshift.S b/sysdeps/i386/i586/lshift.S index 66d9233d8a..04ea65a7c4 100644 --- a/sysdeps/i386/i586/lshift.S +++ b/sysdeps/i386/i586/lshift.S @@ -1,5 +1,5 @@ /* Pentium optimized __mpn_lshift -- - Copyright (C) 1992-2016 Free Software Foundation, Inc. + Copyright (C) 1992-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/sysdeps/i386/i586/memcopy.h b/sysdeps/i386/i586/memcopy.h index 78f628b89e..65420b0421 100644 --- a/sysdeps/i386/i586/memcopy.h +++ b/sysdeps/i386/i586/memcopy.h @@ -1,5 +1,5 @@ /* memcopy.h -- definitions for memory copy functions. Pentium version. - Copyright (C) 1994-2016 Free Software Foundation, Inc. + Copyright (C) 1994-2018 Free Software Foundation, Inc. Contributed by Torbjorn Granlund (tege@sics.se). This file is part of the GNU C Library. diff --git a/sysdeps/i386/i586/memcpy.S b/sysdeps/i386/i586/memcpy.S index 25cf98da09..7e3dee69d8 100644 --- a/sysdeps/i386/i586/memcpy.S +++ b/sysdeps/i386/i586/memcpy.S @@ -1,5 +1,5 @@ /* Highly optimized version for i586. - Copyright (C) 1997-2016 Free Software Foundation, Inc. + Copyright (C) 1997-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. diff --git a/sysdeps/i386/i586/memset.S b/sysdeps/i386/i586/memset.S index 3590ad1183..480fc70a50 100644 --- a/sysdeps/i386/i586/memset.S +++ b/sysdeps/i386/i586/memset.S @@ -1,6 +1,6 @@ /* memset/bzero -- set memory area to CH/0 Highly optimized version for ix86, x>=5. - Copyright (C) 1996-2016 Free Software Foundation, Inc. + Copyright (C) 1996-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Torbjorn Granlund, <tege@matematik.su.se> @@ -112,10 +112,3 @@ L(2): shrl $2, %ecx /* convert byte count to longword count */ ret END (memset) libc_hidden_builtin_def (memset) - -#if defined SHARED && IS_IN (libc) && !defined __memset_chk \ - && !defined USE_AS_BZERO -strong_alias (__memset_chk, __memset_zero_constant_len_parameter) - .section .gnu.warning.__memset_zero_constant_len_parameter - .string "memset used with constant zero length parameter; this could be due to transposed parameters" -#endif diff --git a/sysdeps/i386/i586/mul_1.S b/sysdeps/i386/i586/mul_1.S index b7958b5e7e..d75d767e6b 100644 --- a/sysdeps/i386/i586/mul_1.S +++ b/sysdeps/i386/i586/mul_1.S @@ -1,6 +1,6 @@ /* Pentium __mpn_mul_1 -- Multiply a limb vector with a limb and store the result in a second limb vector. - Copyright (C) 1992-2016 Free Software Foundation, Inc. + Copyright (C) 1992-2018 Free Software Foundation, Inc. This file is part of the GNU MP Library. The GNU MP Library is free software; you can redistribute it and/or modify diff --git a/sysdeps/i386/i586/rshift.S b/sysdeps/i386/i586/rshift.S index 3bb9b49c80..929dfd67a4 100644 --- a/sysdeps/i386/i586/rshift.S +++ b/sysdeps/i386/i586/rshift.S @@ -1,5 +1,5 @@ /* Pentium optimized __mpn_rshift -- - Copyright (C) 1992-2016 Free Software Foundation, Inc. + Copyright (C) 1992-2018 Free Software Foundation, Inc. This file is part of the GNU MP Library. The GNU MP Library is free software; you can redistribute it and/or modify diff --git a/sysdeps/i386/i586/strchr.S b/sysdeps/i386/i586/strchr.S index 497e32133d..ac3afb6d95 100644 --- a/sysdeps/i386/i586/strchr.S +++ b/sysdeps/i386/i586/strchr.S @@ -1,6 +1,6 @@ /* Find character CH in a NUL terminated string. Highly optimized version for ix85, x>=5. - Copyright (C) 1995-2016 Free Software Foundation, Inc. + Copyright (C) 1995-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper, <drepper@gnu.ai.mit.edu>. diff --git a/sysdeps/i386/i586/strcpy.S b/sysdeps/i386/i586/strcpy.S index 93ff5ac74d..19bed86b45 100644 --- a/sysdeps/i386/i586/strcpy.S +++ b/sysdeps/i386/i586/strcpy.S @@ -1,5 +1,5 @@ /* strcpy/stpcpy implementation for i586. - Copyright (C) 1997-2016 Free Software Foundation, Inc. + Copyright (C) 1997-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -53,41 +53,35 @@ ENTRY (STRCPY) cfi_rel_offset (ebx, 0) andl $3, %ecx -#ifdef PIC - call 2f - cfi_adjust_cfa_offset (4) -2: popl %edx - cfi_adjust_cfa_offset (-4) - /* 0xb is the distance between 2: and 1: but we avoid writing - 1f-2b because the assembler generates worse code. */ - leal 0xb(%edx,%ecx,8), %ecx -#else - leal 1f(,%ecx,8), %ecx -#endif - - jmp *%ecx + cmpb $2, %cl + je L(Src2) + ja L(Src3) + cmpb $1, %cl + je L(Src1) - .align 8 -1: +L(Src0): orb (%esi), %al jz L(end) stosb xorl %eax, %eax incl %esi +L(Src1): orb (%esi), %al jz L(end) stosb xorl %eax, %eax incl %esi +L(Src2): orb (%esi), %al jz L(end) stosb xorl %eax, %eax incl %esi -L(1): movl (%esi), %ecx +L(Src3): + movl (%esi), %ecx leal 4(%esi),%esi subl %ecx, %eax @@ -107,7 +101,7 @@ L(1): movl (%esi), %ecx movl %edx, (%edi) leal 4(%edi),%edi - jmp L(1) + jmp L(Src3) L(3): movl %ecx, %edx diff --git a/sysdeps/i386/i586/strlen.S b/sysdeps/i386/i586/strlen.S index 707b6888f9..da05d2b494 100644 --- a/sysdeps/i386/i586/strlen.S +++ b/sysdeps/i386/i586/strlen.S @@ -1,6 +1,6 @@ /* strlen -- Compute length of NUL terminated string. Highly optimized version for ix86, x>=5. - Copyright (C) 1995-2016 Free Software Foundation, Inc. + Copyright (C) 1995-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper, <drepper@gnu.ai.mit.edu>. diff --git a/sysdeps/i386/i586/sub_n.S b/sysdeps/i386/i586/sub_n.S index 671abca018..7c3b8fcac3 100644 --- a/sysdeps/i386/i586/sub_n.S +++ b/sysdeps/i386/i586/sub_n.S @@ -1,6 +1,6 @@ /* Pentium __mpn_sub_n -- Subtract two limb vectors of the same length > 0 and store difference in a third limb vector. - Copyright (C) 1992-2016 Free Software Foundation, Inc. + Copyright (C) 1992-2018 Free Software Foundation, Inc. This file is part of the GNU MP Library. The GNU MP Library is free software; you can redistribute it and/or modify diff --git a/sysdeps/i386/i586/submul_1.S b/sysdeps/i386/i586/submul_1.S index cf9208b3d8..cd213e8234 100644 --- a/sysdeps/i386/i586/submul_1.S +++ b/sysdeps/i386/i586/submul_1.S @@ -1,6 +1,6 @@ /* Pentium __mpn_submul_1 -- Multiply a limb vector with a limb and subtract the result from a second limb vector. - Copyright (C) 1992-2016 Free Software Foundation, Inc. + Copyright (C) 1992-2018 Free Software Foundation, Inc. This file is part of the GNU MP Library. The GNU MP Library is free software; you can redistribute it and/or modify diff --git a/sysdeps/i386/i686/Makefile b/sysdeps/i386/i686/Makefile index e3a3201c4b..311042787b 100644 --- a/sysdeps/i386/i686/Makefile +++ b/sysdeps/i386/i686/Makefile @@ -4,11 +4,9 @@ stack-align-test-flags += -msse CFLAGS-.o += -Wa,-mtune=i686 CFLAGS-.os += -Wa,-mtune=i686 CFLAGS-.op += -Wa,-mtune=i686 -CFLAGS-.og += -Wa,-mtune=i686 CFLAGS-.oS += -Wa,-mtune=i686 ASFLAGS-.o += -Wa,-mtune=i686 ASFLAGS-.os += -Wa,-mtune=i686 ASFLAGS-.op += -Wa,-mtune=i686 -ASFLAGS-.og += -Wa,-mtune=i686 ASFLAGS-.oS += -Wa,-mtune=i686 diff --git a/sysdeps/i386/i686/add_n.S b/sysdeps/i386/i686/add_n.S index 9c89cc02cc..0c95919d30 100644 --- a/sysdeps/i386/i686/add_n.S +++ b/sysdeps/i386/i686/add_n.S @@ -1,6 +1,6 @@ /* Add two limb vectors of the same length > 0 and store sum in a third limb vector. - Copyright (C) 1992-2016 Free Software Foundation, Inc. + Copyright (C) 1992-2018 Free Software Foundation, Inc. This file is part of the GNU MP Library. The GNU MP Library is free software; you can redistribute it and/or modify @@ -17,7 +17,7 @@ along with the GNU MP Library; see the file COPYING.LIB. If not, see <http://www.gnu.org/licenses/>. */ -#include "sysdep.h" +#include <sysdep.h> #include "asm-syntax.h" #define PARMS 4+8 /* space for 2 saved regs */ @@ -44,6 +44,13 @@ ENTRY (__mpn_add_n) cfi_rel_offset (esi, 0) movl S2(%esp),%edx movl SIZE(%esp),%ecx + +#if IBT_ENABLED + pushl %ebx + cfi_adjust_cfa_offset (4) + cfi_rel_offset (ebx, 0) +#endif + movl %ecx,%eax shrl $3,%ecx /* compute count for unrolled loop */ negl %eax @@ -55,6 +62,9 @@ ENTRY (__mpn_add_n) subl %eax,%esi /* ... by a constant when we ... */ subl %eax,%edx /* ... enter the loop */ shrl $2,%eax /* restore previous value */ +#if IBT_ENABLED + leal -4(,%eax,4),%ebx /* Count for 4-byte endbr32 */ +#endif #ifdef PIC /* Calculate start address in loop for PIC. */ leal (L(oop)-L(0)-3)(%eax,%eax,8),%eax @@ -64,29 +74,39 @@ L(0): /* Calculate start address in loop for non-PIC. */ leal (L(oop) - 3)(%eax,%eax,8),%eax #endif +#if IBT_ENABLED + addl %ebx,%eax /* Adjust for endbr32 */ +#endif jmp *%eax /* jump into loop */ ALIGN (3) L(oop): movl (%esi),%eax adcl (%edx),%eax movl %eax,(%edi) + _CET_ENDBR movl 4(%esi),%eax adcl 4(%edx),%eax movl %eax,4(%edi) + _CET_ENDBR movl 8(%esi),%eax adcl 8(%edx),%eax movl %eax,8(%edi) + _CET_ENDBR movl 12(%esi),%eax adcl 12(%edx),%eax movl %eax,12(%edi) + _CET_ENDBR movl 16(%esi),%eax adcl 16(%edx),%eax movl %eax,16(%edi) + _CET_ENDBR movl 20(%esi),%eax adcl 20(%edx),%eax movl %eax,20(%edi) + _CET_ENDBR movl 24(%esi),%eax adcl 24(%edx),%eax movl %eax,24(%edi) + _CET_ENDBR movl 28(%esi),%eax adcl 28(%edx),%eax movl %eax,28(%edi) @@ -99,6 +119,11 @@ L(oop): movl (%esi),%eax sbbl %eax,%eax negl %eax +#if IBT_ENABLED + popl %ebx + cfi_adjust_cfa_offset (-4) + cfi_restore (ebx) +#endif popl %esi cfi_adjust_cfa_offset (-4) cfi_restore (esi) diff --git a/sysdeps/i386/i686/dl-hash.h b/sysdeps/i386/i686/dl-hash.h index 8ba85d2a71..34b625450a 100644 --- a/sysdeps/i386/i686/dl-hash.h +++ b/sysdeps/i386/i686/dl-hash.h @@ -1,5 +1,5 @@ /* Compute hash alue for given string according to ELF standard. - Copyright (C) 1998-2016 Free Software Foundation, Inc. + Copyright (C) 1998-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998. @@ -26,6 +26,7 @@ would be much slower than the generic C implementation. So don't use it. */ static unsigned int +__attribute__ ((unused)) _dl_elf_hash (const char *name) { unsigned int result; diff --git a/sysdeps/i386/i686/ffs.c b/sysdeps/i386/i686/ffs.c index b5da4d4266..540c8bde62 100644 --- a/sysdeps/i386/i686/ffs.c +++ b/sysdeps/i386/i686/ffs.c @@ -1,7 +1,7 @@ /* ffs -- find first set bit in a word, counted from least significant end. For Intel 80x86, x>=6. This file is part of the GNU C Library. - Copyright (C) 1991-2016 Free Software Foundation, Inc. + Copyright (C) 1991-2018 Free Software Foundation, Inc. Contributed by Ulrich Drepper <drepper@cygnus.com>. The GNU C Library is free software; you can redistribute it and/or diff --git a/sysdeps/i386/i686/fpu/e_logf.S b/sysdeps/i386/i686/fpu/e_logf.S deleted file mode 100644 index 6fd39d50d3..0000000000 --- a/sysdeps/i386/i686/fpu/e_logf.S +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Written by J.T. Conklin <jtc@netbsd.org>. - * Public domain. - * Adapted for float by Ulrich Drepper <drepper@cygnus.com>. - * - * Adapted for i686 instructions. - */ - -#include <machine/asm.h> - - - .text -ENTRY(__ieee754_logf) - fldln2 // log(2) - flds 4(%esp) // x : log(2) - fucomi %st - jp 3f - fyl2x // log(x) - ret - -3: fstp %st(1) - ret -END (__ieee754_logf) - -ENTRY(__logf_finite) - fldln2 // log(2) - flds 4(%esp) // x : log(2) - fyl2x // log(x) - ret -END(__logf_finite) diff --git a/sysdeps/i386/i686/fpu/e_logl.S b/sysdeps/i386/i686/fpu/e_logl.S index e9ecbcd472..7e3bc8d817 100644 --- a/sysdeps/i386/i686/fpu/e_logl.S +++ b/sysdeps/i386/i686/fpu/e_logl.S @@ -64,6 +64,7 @@ ENTRY(__ieee754_logl) ret 3: fstp %st(1) + fadd %st(0) ret END (__ieee754_logl) diff --git a/sysdeps/i386/i686/fpu/multiarch/Makefile b/sysdeps/i386/i686/fpu/multiarch/Makefile index 7d9089232f..c0fa9761d3 100644 --- a/sysdeps/i386/i686/fpu/multiarch/Makefile +++ b/sysdeps/i386/i686/fpu/multiarch/Makefile @@ -1,4 +1,10 @@ ifeq ($(subdir),math) -libm-sysdep_routines += e_expf-sse2 e_expf-ia32 s_sinf-sse2 s_cosf-sse2 \ - s_sincosf-sse2 +libm-sysdep_routines += e_exp2f-sse2 e_expf-sse2 e_logf-sse2 e_log2f-sse2 \ + e_powf-sse2 s_sinf-sse2 s_cosf-sse2 s_sincosf-sse2 + +CFLAGS-e_exp2f-sse2.c = -msse2 -mfpmath=sse +CFLAGS-e_expf-sse2.c = -msse2 -mfpmath=sse +CFLAGS-e_log2f-sse2.c = -msse2 -mfpmath=sse +CFLAGS-e_logf-sse2.c = -msse2 -mfpmath=sse +CFLAGS-e_powf-sse2.c = -msse2 -mfpmath=sse endif diff --git a/sysdeps/i386/i686/fpu/multiarch/e_exp2f-sse2.c b/sysdeps/i386/i686/fpu/multiarch/e_exp2f-sse2.c new file mode 100644 index 0000000000..dc3138dc24 --- /dev/null +++ b/sysdeps/i386/i686/fpu/multiarch/e_exp2f-sse2.c @@ -0,0 +1,3 @@ +#define __exp2f __exp2f_sse2 + +#include <sysdeps/ieee754/flt-32/e_exp2f.c> diff --git a/sysdeps/i386/i686/fpu/multiarch/e_exp2f.c b/sysdeps/i386/i686/fpu/multiarch/e_exp2f.c new file mode 100644 index 0000000000..d656414990 --- /dev/null +++ b/sysdeps/i386/i686/fpu/multiarch/e_exp2f.c @@ -0,0 +1,39 @@ +/* Multiple versions of exp2f. + Copyright (C) 2017-2018 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +extern float __redirect_exp2f (float); + +#define SYMBOL_NAME exp2f +#include "ifunc-sse2.h" + +libc_ifunc_redirected (__redirect_exp2f, __exp2f, IFUNC_SELECTOR ()); + +#include <libm-alias-float.h> +#ifdef SHARED +# include <shlib-compat.h> +versioned_symbol (libm, __exp2f, exp2f, GLIBC_2_27); +libm_alias_float_other (__exp2, exp2) +#else +libm_alias_float (__exp2, exp2) +#endif + +strong_alias (__exp2f, __ieee754_exp2f) +strong_alias (__exp2f, __exp2f_finite) + +#define __exp2f __exp2f_ia32 +#include <sysdeps/ieee754/flt-32/e_exp2f.c> diff --git a/sysdeps/i386/i686/fpu/multiarch/e_expf-sse2.S b/sysdeps/i386/i686/fpu/multiarch/e_expf-sse2.S deleted file mode 100644 index caedc1fdb0..0000000000 --- a/sysdeps/i386/i686/fpu/multiarch/e_expf-sse2.S +++ /dev/null @@ -1,325 +0,0 @@ -/* SSE2 version of __ieee754_expf and __expf_finite - Copyright (C) 2012-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - - -#include <sysdep.h> - -/* Short algorithm description: - * - * Let K = 64 (table size). - * e^x = 2^(x/log(2)) = 2^n * T[j] * (1 + P(y)) - * where - * x = m*log(2)/K + y, y in [0.0..log(2)/K] - * m = n*K + j, m,n,j - signed integer, j in [0..K-1] - * values of 2^(j/K) are tabulated as T[j]. - * - * P(y) is a minimax polynomial approximation of expf(x)-1 - * on small interval [0.0..log(2)/K]. - * - * P(y) = P3*y*y*y*y + P2*y*y*y + P1*y*y + P0*y, calculated as - * z = y*y; P(y) = (P3*z + P1)*z + (P2*z + P0)*y - * - * Special cases: - * __ieee754_expf_sse2(NaN) = NaN - * __ieee754_expf_sse2(+INF) = +INF - * __ieee754_expf_sse2(-INF) = 0 - * __ieee754_expf_sse2(x) = 1 for subnormals - * for finite argument, only __ieee754_expf_sse2(0)=1 is exact - * __ieee754_expf_sse2(x) overflows if x>700 - * __ieee754_expf_sse2(x) underflows if x<-700 - * - * Note: - * For |x|<700, __ieee754_expf_sse2 computes result in double precision, - * with accuracy a bit more than needed for expf, and does not round it - * to single precision. - */ - - -#ifdef PIC -# define MO1(symbol) L(symbol)##@GOTOFF(%edx) -# define MO2(symbol,reg2,_scale) L(symbol)##@GOTOFF(%edx,reg2,_scale) -#else -# define MO1(symbol) L(symbol) -# define MO2(symbol,reg2,_scale) L(symbol)(,reg2,_scale) -#endif - - .text -ENTRY(__ieee754_expf_sse2) - /* Input: single precision x on stack at address 4(%esp) */ - -#ifdef PIC - LOAD_PIC_REG(dx) -#endif - - cvtss2sd 4(%esp), %xmm1 /* Convert x to double precision */ - mov 4(%esp), %ecx /* Copy x */ - movsd MO1(DP_KLN2), %xmm2 /* DP K/log(2) */ - movsd MO1(DP_P2), %xmm3 /* DP P2 */ - movl %ecx, %eax /* x */ - mulsd %xmm1, %xmm2 /* DP x*K/log(2) */ - andl $0x7fffffff, %ecx /* |x| */ - cmpl $0x442f0000, %ecx /* |x|<700 ? */ - movsd MO1(DP_P3), %xmm4 /* DP P3 */ - addsd MO1(DP_RS), %xmm2 /* DP x*K/log(2)+RS */ - jae L(special_paths) - - /* Here if |x|<700 */ - cmpl $0x31800000, %ecx /* |x|<2^(-28) ? */ - jb L(small_arg) - - /* Main path: here if 2^(-28)<=|x|<700 */ - cvtsd2ss %xmm2, %xmm2 /* SP x*K/log(2)+RS */ - movd %xmm2, %eax /* bits of n*K+j with trash */ - subss MO1(SP_RS), %xmm2 /* SP t=round(x*K/log(2)) */ - movl %eax, %ecx /* n*K+j with trash */ - cvtss2sd %xmm2, %xmm2 /* DP t */ - andl $0x3f, %eax /* bits of j */ - mulsd MO1(DP_NLN2K), %xmm2 /* DP -t*log(2)/K */ - andl $0xffffffc0, %ecx /* bits of n */ -#ifdef __AVX__ - vaddsd %xmm1, %xmm2, %xmm0 /* DP y=x-t*log(2)/K */ - vmulsd %xmm0, %xmm0, %xmm2 /* DP z=y*y */ -#else - addsd %xmm1, %xmm2 /* DP y=x-t*log(2)/K */ - movaps %xmm2, %xmm0 /* DP y */ - mulsd %xmm2, %xmm2 /* DP z=y*y */ -#endif - mulsd %xmm2, %xmm4 /* DP P3*z */ - addl $0xffc0, %ecx /* bits of n + DP exponent bias */ - mulsd %xmm2, %xmm3 /* DP P2*z */ - shrl $2, %ecx /* High 2 bytes of DP 2^n */ - pxor %xmm1, %xmm1 /* clear %xmm1 */ - addsd MO1(DP_P1), %xmm4 /* DP P3*z+P1 */ - addsd MO1(DP_P0), %xmm3 /* DP P2*z+P0 */ - pinsrw $3, %ecx, %xmm1 /* DP 2^n */ - mulsd %xmm2, %xmm4 /* DP (P3*z+P1)*z */ - mulsd %xmm3, %xmm0 /* DP (P2*z+P0)*y */ - addsd %xmm4, %xmm0 /* DP P(y) */ - mulsd MO2(DP_T,%eax,8), %xmm0 /* DP P(y)*T[j] */ - addsd MO2(DP_T,%eax,8), %xmm0 /* DP T[j]*(P(y)+1) */ - mulsd %xmm1, %xmm0 /* DP result=2^n*(T[j]*(P(y)+1)) */ - cvtsd2ss %xmm0, %xmm1 - - lea -4(%esp), %esp /* Borrow 4 bytes of stack frame */ - movss %xmm1, 0(%esp) /* Move result from sse... */ - flds 0(%esp) /* ...to FPU. */ - lea 4(%esp), %esp /* Return back 4 bytes of stack frame */ - ret - - .p2align 4 -L(small_arg): - /* Here if 0<=|x|<2^(-28) */ - movss 4(%esp), %xmm0 /* load x */ - addss MO1(SP_ONE), %xmm0 /* 1.0 + x */ - /* Return 1.0 with inexact raised, except for x==0 */ - jmp L(epilogue) - - .p2align 4 -L(special_paths): - /* Here if x is NaN, or Inf, or finite |x|>=700 */ - movss 4(%esp), %xmm0 /* load x */ - - cmpl $0x7f800000, %ecx /* |x| is finite ? */ - jae L(arg_inf_or_nan) - - /* Here if finite |x|>=700 */ - testl $0x80000000, %eax /* sign of x nonzero ? */ - je L(res_overflow) - - /* Here if finite x<=-700 */ - movss MO1(SP_SMALL), %xmm0 /* load small value 2^(-100) */ - mulss %xmm0, %xmm0 /* Return underflowed result (zero or subnormal) */ - jmp L(epilogue) - - .p2align 4 -L(res_overflow): - /* Here if finite x>=700 */ - movss MO1(SP_LARGE), %xmm0 /* load large value 2^100 */ - mulss %xmm0, %xmm0 /* Return overflowed result (Inf or max normal) */ - jmp L(epilogue) - - .p2align 4 -L(arg_inf_or_nan): - /* Here if |x| is Inf or NAN */ - jne L(arg_nan) /* |x| is Inf ? */ - - /* Here if |x| is Inf */ - shrl $31, %eax /* Get sign bit of x */ - movss MO2(SP_INF_0,%eax,4), %xmm0/* return zero or Inf, depending on sign of x */ - jmp L(epilogue) - - .p2align 4 -L(arg_nan): - /* Here if |x| is NaN */ - addss %xmm0, %xmm0 /* Return x+x (raise invalid) */ - - .p2align 4 -L(epilogue): - lea -4(%esp), %esp /* Borrow 4 bytes of stack frame */ - movss %xmm0, 0(%esp) /* Move result from sse... */ - flds 0(%esp) /* ...to FPU. */ - lea 4(%esp), %esp /* Return back 4 bytes of stack frame */ - ret -END(__ieee754_expf_sse2) - - .section .rodata, "a" - .p2align 3 -L(DP_T): /* table of double precision values 2^(j/K) for j=[0..K-1] */ - .long 0x00000000, 0x3ff00000 - .long 0x3e778061, 0x3ff02c9a - .long 0xd3158574, 0x3ff059b0 - .long 0x18759bc8, 0x3ff08745 - .long 0x6cf9890f, 0x3ff0b558 - .long 0x32d3d1a2, 0x3ff0e3ec - .long 0xd0125b51, 0x3ff11301 - .long 0xaea92de0, 0x3ff1429a - .long 0x3c7d517b, 0x3ff172b8 - .long 0xeb6fcb75, 0x3ff1a35b - .long 0x3168b9aa, 0x3ff1d487 - .long 0x88628cd6, 0x3ff2063b - .long 0x6e756238, 0x3ff2387a - .long 0x65e27cdd, 0x3ff26b45 - .long 0xf51fdee1, 0x3ff29e9d - .long 0xa6e4030b, 0x3ff2d285 - .long 0x0a31b715, 0x3ff306fe - .long 0xb26416ff, 0x3ff33c08 - .long 0x373aa9cb, 0x3ff371a7 - .long 0x34e59ff7, 0x3ff3a7db - .long 0x4c123422, 0x3ff3dea6 - .long 0x21f72e2a, 0x3ff4160a - .long 0x6061892d, 0x3ff44e08 - .long 0xb5c13cd0, 0x3ff486a2 - .long 0xd5362a27, 0x3ff4bfda - .long 0x769d2ca7, 0x3ff4f9b2 - .long 0x569d4f82, 0x3ff5342b - .long 0x36b527da, 0x3ff56f47 - .long 0xdd485429, 0x3ff5ab07 - .long 0x15ad2148, 0x3ff5e76f - .long 0xb03a5585, 0x3ff6247e - .long 0x82552225, 0x3ff66238 - .long 0x667f3bcd, 0x3ff6a09e - .long 0x3c651a2f, 0x3ff6dfb2 - .long 0xe8ec5f74, 0x3ff71f75 - .long 0x564267c9, 0x3ff75feb - .long 0x73eb0187, 0x3ff7a114 - .long 0x36cf4e62, 0x3ff7e2f3 - .long 0x994cce13, 0x3ff82589 - .long 0x9b4492ed, 0x3ff868d9 - .long 0x422aa0db, 0x3ff8ace5 - .long 0x99157736, 0x3ff8f1ae - .long 0xb0cdc5e5, 0x3ff93737 - .long 0x9fde4e50, 0x3ff97d82 - .long 0x82a3f090, 0x3ff9c491 - .long 0x7b5de565, 0x3ffa0c66 - .long 0xb23e255d, 0x3ffa5503 - .long 0x5579fdbf, 0x3ffa9e6b - .long 0x995ad3ad, 0x3ffae89f - .long 0xb84f15fb, 0x3ffb33a2 - .long 0xf2fb5e47, 0x3ffb7f76 - .long 0x904bc1d2, 0x3ffbcc1e - .long 0xdd85529c, 0x3ffc199b - .long 0x2e57d14b, 0x3ffc67f1 - .long 0xdcef9069, 0x3ffcb720 - .long 0x4a07897c, 0x3ffd072d - .long 0xdcfba487, 0x3ffd5818 - .long 0x03db3285, 0x3ffda9e6 - .long 0x337b9b5f, 0x3ffdfc97 - .long 0xe78b3ff6, 0x3ffe502e - .long 0xa2a490da, 0x3ffea4af - .long 0xee615a27, 0x3ffefa1b - .long 0x5b6e4540, 0x3fff5076 - .long 0x819e90d8, 0x3fffa7c1 - .type L(DP_T), @object - ASM_SIZE_DIRECTIVE(L(DP_T)) - - .section .rodata.cst8,"aM",@progbits,8 - .p2align 3 -L(DP_KLN2): /* double precision K/log(2) */ - .long 0x652b82fe, 0x40571547 - .type L(DP_KLN2), @object - ASM_SIZE_DIRECTIVE(L(DP_KLN2)) - - .p2align 3 -L(DP_NLN2K): /* double precision -log(2)/K */ - .long 0xfefa39ef, 0xbf862e42 - .type L(DP_NLN2K), @object - ASM_SIZE_DIRECTIVE(L(DP_NLN2K)) - - .p2align 3 -L(DP_RS): /* double precision 2^23+2^22 */ - .long 0x00000000, 0x41680000 - .type L(DP_RS), @object - ASM_SIZE_DIRECTIVE(L(DP_RS)) - - .p2align 3 -L(DP_P3): /* double precision polynomial coefficient P3 */ - .long 0xeb78fa85, 0x3fa56420 - .type L(DP_P3), @object - ASM_SIZE_DIRECTIVE(L(DP_P3)) - - .p2align 3 -L(DP_P1): /* double precision polynomial coefficient P1 */ - .long 0x008d6118, 0x3fe00000 - .type L(DP_P1), @object - ASM_SIZE_DIRECTIVE(L(DP_P1)) - - .p2align 3 -L(DP_P2): /* double precision polynomial coefficient P2 */ - .long 0xda752d4f, 0x3fc55550 - .type L(DP_P2), @object - ASM_SIZE_DIRECTIVE(L(DP_P2)) - - .p2align 3 -L(DP_P0): /* double precision polynomial coefficient P0 */ - .long 0xffffe7c6, 0x3fefffff - .type L(DP_P0), @object - ASM_SIZE_DIRECTIVE(L(DP_P0)) - - .p2align 2 -L(SP_INF_0): - .long 0x7f800000 /* single precision Inf */ - .long 0 /* single precision zero */ - .type L(SP_INF_0), @object - ASM_SIZE_DIRECTIVE(L(SP_INF_0)) - - .section .rodata.cst4,"aM",@progbits,4 - .p2align 2 -L(SP_RS): /* single precision 2^23+2^22 */ - .long 0x4b400000 - .type L(SP_RS), @object - ASM_SIZE_DIRECTIVE(L(SP_RS)) - - .p2align 2 -L(SP_SMALL): /* single precision small value 2^(-100) */ - .long 0x0d800000 - .type L(SP_SMALL), @object - ASM_SIZE_DIRECTIVE(L(SP_SMALL)) - - .p2align 2 -L(SP_LARGE): /* single precision large value 2^100 */ - .long 0x71800000 - .type L(SP_LARGE), @object - ASM_SIZE_DIRECTIVE(L(SP_LARGE)) - - .p2align 2 -L(SP_ONE): /* single precision 1.0 */ - .long 0x3f800000 - .type L(SP_ONE), @object - ASM_SIZE_DIRECTIVE(L(SP_ONE)) - -strong_alias (__ieee754_expf_sse2, __expf_finite_sse2) diff --git a/sysdeps/i386/i686/fpu/multiarch/e_expf-sse2.c b/sysdeps/i386/i686/fpu/multiarch/e_expf-sse2.c new file mode 100644 index 0000000000..7c758e6556 --- /dev/null +++ b/sysdeps/i386/i686/fpu/multiarch/e_expf-sse2.c @@ -0,0 +1,3 @@ +#define __expf __expf_sse2 + +#include <sysdeps/ieee754/flt-32/e_expf.c> diff --git a/sysdeps/i386/i686/fpu/multiarch/e_expf.c b/sysdeps/i386/i686/fpu/multiarch/e_expf.c index aebd491967..1f7c35701b 100644 --- a/sysdeps/i386/i686/fpu/multiarch/e_expf.c +++ b/sysdeps/i386/i686/fpu/multiarch/e_expf.c @@ -1,5 +1,5 @@ -/* Multiple versions of expf - Copyright (C) 2012-2016 Free Software Foundation, Inc. +/* Multiple versions of expf. + Copyright (C) 2012-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -16,22 +16,27 @@ License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ -#include <init-arch.h> +extern float __redirect_expf (float); -extern double __ieee754_expf_sse2 (double); -extern double __ieee754_expf_ia32 (double); +#define SYMBOL_NAME expf +#include "ifunc-sse2.h" -double __ieee754_expf (double); -libm_ifunc (__ieee754_expf, - HAS_CPU_FEATURE (SSE2) - ? __ieee754_expf_sse2 - : __ieee754_expf_ia32); +libc_ifunc_redirected (__redirect_expf, __expf, IFUNC_SELECTOR ()); -extern double __expf_finite_sse2 (double); -extern double __expf_finite_ia32 (double); +#include <libm-alias-float.h> +#ifdef SHARED +__hidden_ver1 (__expf_ia32, __GI___expf, __redirect_expf) + __attribute__ ((visibility ("hidden"))); -double __expf_finite (double); -libm_ifunc (__expf_finite, - HAS_CPU_FEATURE (SSE2) - ? __expf_finite_sse2 - : __expf_finite_ia32); +# include <shlib-compat.h> +versioned_symbol (libm, __expf, expf, GLIBC_2_27); +libm_alias_float_other (__exp, exp) +#else +libm_alias_float (__exp, exp) +#endif + +strong_alias (__expf, __ieee754_expf) +strong_alias (__expf, __expf_finite) + +#define __expf __expf_ia32 +#include <sysdeps/ieee754/flt-32/e_expf.c> diff --git a/sysdeps/i386/i686/fpu/multiarch/e_log2f-sse2.c b/sysdeps/i386/i686/fpu/multiarch/e_log2f-sse2.c new file mode 100644 index 0000000000..a9ed25e399 --- /dev/null +++ b/sysdeps/i386/i686/fpu/multiarch/e_log2f-sse2.c @@ -0,0 +1,3 @@ +#define __log2f __log2f_sse2 + +#include <sysdeps/ieee754/flt-32/e_log2f.c> diff --git a/sysdeps/i386/i686/fpu/multiarch/e_log2f.c b/sysdeps/i386/i686/fpu/multiarch/e_log2f.c new file mode 100644 index 0000000000..3dacaa609e --- /dev/null +++ b/sysdeps/i386/i686/fpu/multiarch/e_log2f.c @@ -0,0 +1,42 @@ +/* Multiple versions of log2f. + Copyright (C) 2017-2018 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +extern float __redirect_log2f (float); + +#define SYMBOL_NAME log2f +#include "ifunc-sse2.h" + +libc_ifunc_redirected (__redirect_log2f, __log2f, IFUNC_SELECTOR ()); + +#include <libm-alias-float.h> +#ifdef SHARED +__hidden_ver1 (__log2f_ia32, __GI___log2f, __redirect_log2f) + __attribute__ ((visibility ("hidden"))); + +# include <shlib-compat.h> +versioned_symbol (libm, __log2f, log2f, GLIBC_2_27); +libm_alias_float_other (__log2, log2) +#else +libm_alias_float (__log2, log2) +#endif + +strong_alias (__log2f, __ieee754_log2f) +strong_alias (__log2f, __log2f_finite) + +#define __log2f __log2f_ia32 +#include <sysdeps/ieee754/flt-32/e_log2f.c> diff --git a/sysdeps/i386/i686/fpu/multiarch/e_logf-sse2.c b/sysdeps/i386/i686/fpu/multiarch/e_logf-sse2.c new file mode 100644 index 0000000000..11621fc122 --- /dev/null +++ b/sysdeps/i386/i686/fpu/multiarch/e_logf-sse2.c @@ -0,0 +1,3 @@ +#define __logf __logf_sse2 + +#include <sysdeps/ieee754/flt-32/e_logf.c> diff --git a/sysdeps/i386/i686/fpu/multiarch/e_logf.c b/sysdeps/i386/i686/fpu/multiarch/e_logf.c new file mode 100644 index 0000000000..1ce90e2e05 --- /dev/null +++ b/sysdeps/i386/i686/fpu/multiarch/e_logf.c @@ -0,0 +1,42 @@ +/* Multiple versions of logf. + Copyright (C) 2017-2018 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +extern float __redirect_logf (float); + +#define SYMBOL_NAME logf +#include "ifunc-sse2.h" + +libc_ifunc_redirected (__redirect_logf, __logf, IFUNC_SELECTOR ()); + +#include <libm-alias-float.h> +#ifdef SHARED +__hidden_ver1 (__logf_ia32, __GI___logf, __redirect_logf) + __attribute__ ((visibility ("hidden"))); + +# include <shlib-compat.h> +versioned_symbol (libm, __logf, logf, GLIBC_2_27); +libm_alias_float_other (__log, log) +#else +libm_alias_float (__log, log) +#endif + +strong_alias (__logf, __ieee754_logf) +strong_alias (__logf, __logf_finite) + +#define __logf __logf_ia32 +#include <sysdeps/ieee754/flt-32/e_logf.c> diff --git a/sysdeps/i386/i686/fpu/multiarch/e_powf-sse2.c b/sysdeps/i386/i686/fpu/multiarch/e_powf-sse2.c new file mode 100644 index 0000000000..c56f6ee89f --- /dev/null +++ b/sysdeps/i386/i686/fpu/multiarch/e_powf-sse2.c @@ -0,0 +1,3 @@ +#define __powf __powf_sse2 + +#include <sysdeps/ieee754/flt-32/e_powf.c> diff --git a/sysdeps/i386/ldsodefs.h b/sysdeps/i386/i686/fpu/multiarch/e_powf.c index 8933ebd02e..edec68eac6 100644 --- a/sysdeps/i386/ldsodefs.h +++ b/sysdeps/i386/i686/fpu/multiarch/e_powf.c @@ -1,5 +1,5 @@ -/* Run-time dynamic linker data structures for loaded ELF shared objects. - Copyright (C) 1995-2016 Free Software Foundation, Inc. +/* Multiple versions of powf. + Copyright (C) 2017-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -16,26 +16,30 @@ License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ -#ifndef _I386_LDSODEFS_H -#define _I386_LDSODEFS_H 1 +#define powf __redirect_powf +#define __DECL_SIMD___redirect_powf +#include <math.h> +#undef powf -#include <elf.h> -#include <cpu-features.h> +#define SYMBOL_NAME powf +#include "ifunc-sse2.h" -struct La_i86_regs; -struct La_i86_retval; +libc_ifunc_redirected (__redirect_powf, __powf, IFUNC_SELECTOR ()); -#define ARCH_PLTENTER_MEMBERS \ - Elf32_Addr (*i86_gnu_pltenter) (Elf32_Sym *, unsigned int, uintptr_t *, \ - uintptr_t *, struct La_i86_regs *, \ - unsigned int *, const char *name, \ - long int *framesizep) +#include <libm-alias-float.h> +#ifdef SHARED +__hidden_ver1 (__powf_ia32, __GI___powf, __redirect_powf) + __attribute__ ((visibility ("hidden"))); -#define ARCH_PLTEXIT_MEMBERS \ - unsigned int (*i86_gnu_pltexit) (Elf32_Sym *, unsigned int, uintptr_t *, \ - uintptr_t *, const struct La_i86_regs *, \ - struct La_i86_retval *, const char *) +# include <shlib-compat.h> +versioned_symbol (libm, __powf, powf, GLIBC_2_27); +libm_alias_float_other (__pow, pow) +#else +libm_alias_float (__pow, pow) +#endif -#include_next <ldsodefs.h> +strong_alias (__powf, __ieee754_powf) +strong_alias (__powf, __powf_finite) -#endif +#define __powf __powf_ia32 +#include <sysdeps/ieee754/flt-32/e_powf.c> diff --git a/sysdeps/i386/i686/fpu/multiarch/libm-test-ulps b/sysdeps/i386/i686/fpu/multiarch/libm-test-ulps index bbb644a591..8a51503bc5 100644 --- a/sysdeps/i386/i686/fpu/multiarch/libm-test-ulps +++ b/sysdeps/i386/i686/fpu/multiarch/libm-test-ulps @@ -3,1524 +3,1953 @@ # Maximal error of functions: Function: "acos": double: 1 +float128: 1 idouble: 1 +ifloat128: 1 ildouble: 1 ldouble: 1 Function: "acos_downward": +float128: 1 +ifloat128: 1 ildouble: 2 ldouble: 2 Function: "acos_towardzero": +float128: 1 +ifloat128: 1 ildouble: 2 ldouble: 2 Function: "acos_upward": double: 1 +float128: 1 idouble: 1 +ifloat128: 1 ildouble: 2 ldouble: 2 Function: "acosh": double: 1 +float128: 2 idouble: 1 +ifloat128: 2 ildouble: 4 ldouble: 2 Function: "acosh_downward": double: 1 +float128: 3 idouble: 1 +ifloat128: 3 ildouble: 6 ldouble: 4 Function: "acosh_towardzero": double: 1 +float128: 2 idouble: 1 +ifloat128: 2 ildouble: 6 ldouble: 4 Function: "acosh_upward": double: 1 +float128: 2 idouble: 1 -ildouble: 4 +ifloat128: 2 +ildouble: 5 ldouble: 3 Function: "asin": double: 1 +float128: 1 idouble: 1 +ifloat128: 1 ildouble: 1 ldouble: 1 Function: "asin_downward": double: 1 +float128: 2 idouble: 1 +ifloat128: 2 ildouble: 2 ldouble: 2 Function: "asin_towardzero": double: 1 +float128: 1 idouble: 1 +ifloat128: 1 ildouble: 1 ldouble: 1 Function: "asin_upward": double: 1 float: 1 +float128: 2 idouble: 1 ifloat: 1 +ifloat128: 2 ildouble: 1 ldouble: 1 Function: "asinh": double: 1 +float128: 3 idouble: 1 +ifloat128: 3 ildouble: 3 ldouble: 3 Function: "asinh_downward": double: 1 float: 1 +float128: 4 idouble: 1 +ifloat: 1 +ifloat128: 4 ildouble: 5 ldouble: 5 Function: "asinh_towardzero": double: 1 float: 1 +float128: 2 idouble: 1 +ifloat: 1 +ifloat128: 2 ildouble: 4 ldouble: 4 Function: "asinh_upward": double: 1 float: 1 +float128: 4 idouble: 1 ifloat: 1 +ifloat128: 4 ildouble: 5 ldouble: 5 Function: "atan": double: 1 +float128: 1 idouble: 1 +ifloat128: 1 ildouble: 1 ldouble: 1 Function: "atan2": double: 1 +float128: 1 idouble: 1 +ifloat128: 1 ildouble: 1 ldouble: 1 Function: "atan2_downward": double: 1 float: 1 +float128: 2 idouble: 1 ifloat: 1 +ifloat128: 2 ildouble: 1 ldouble: 1 Function: "atan2_towardzero": double: 1 float: 1 +float128: 3 idouble: 1 ifloat: 1 +ifloat128: 3 ildouble: 1 ldouble: 1 Function: "atan2_upward": double: 1 float: 1 +float128: 2 idouble: 1 ifloat: 1 +ifloat128: 2 ildouble: 1 ldouble: 1 Function: "atan_downward": double: 1 float: 1 +float128: 2 idouble: 1 ifloat: 1 +ifloat128: 2 ildouble: 1 ldouble: 1 Function: "atan_towardzero": double: 1 float: 1 +float128: 1 idouble: 1 ifloat: 1 +ifloat128: 1 ildouble: 1 ldouble: 1 Function: "atan_upward": double: 1 float: 1 +float128: 2 idouble: 1 ifloat: 1 +ifloat128: 2 ildouble: 1 ldouble: 1 Function: "atanh": double: 1 +float128: 3 idouble: 1 +ifloat128: 3 ildouble: 3 ldouble: 3 Function: "atanh_downward": double: 1 float: 1 +float128: 4 idouble: 1 ifloat: 1 -ildouble: 3 +ifloat128: 4 +ildouble: 4 ldouble: 4 Function: "atanh_towardzero": double: 1 float: 1 +float128: 2 idouble: 1 ifloat: 1 +ifloat128: 2 ildouble: 5 ldouble: 3 Function: "atanh_upward": double: 1 float: 1 +float128: 4 idouble: 1 ifloat: 1 +ifloat128: 4 ildouble: 5 ldouble: 5 Function: "cabs": double: 1 +float128: 1 idouble: 1 +ifloat128: 1 ildouble: 1 ldouble: 1 Function: "cabs_downward": double: 1 +float128: 1 idouble: 1 +ifloat128: 1 ildouble: 1 ldouble: 1 Function: "cabs_towardzero": double: 1 +float128: 1 idouble: 1 +ifloat128: 1 ildouble: 1 ldouble: 1 Function: "cabs_upward": double: 1 +float128: 1 idouble: 1 +ifloat128: 1 ildouble: 1 ldouble: 1 Function: Real part of "cacos": double: 1 -float: 1 +float: 2 +float128: 2 idouble: 1 -ifloat: 1 +ifloat: 2 +ifloat128: 2 ildouble: 1 ldouble: 1 Function: Imaginary part of "cacos": -double: 1 -float: 1 -idouble: 1 -ifloat: 1 +double: 2 +float: 2 +float128: 2 +idouble: 2 +ifloat: 2 +ifloat128: 2 ildouble: 2 ldouble: 2 Function: Real part of "cacos_downward": -double: 1 +double: 2 float: 1 -idouble: 1 +float128: 3 +idouble: 2 ifloat: 1 +ifloat128: 3 ildouble: 2 ldouble: 2 Function: Imaginary part of "cacos_downward": -double: 4 +double: 5 float: 3 -idouble: 4 +float128: 6 +idouble: 5 ifloat: 3 -ildouble: 5 -ldouble: 5 +ifloat128: 6 +ildouble: 6 +ldouble: 6 Function: Real part of "cacos_towardzero": -double: 1 +double: 2 float: 1 -idouble: 1 +float128: 3 +idouble: 2 ifloat: 1 +ifloat128: 3 ildouble: 2 ldouble: 2 Function: Imaginary part of "cacos_towardzero": double: 4 float: 3 +float128: 5 idouble: 4 ifloat: 3 +ifloat128: 5 ildouble: 5 ldouble: 5 Function: Real part of "cacos_upward": double: 2 float: 2 +float128: 3 idouble: 2 ifloat: 2 +ifloat128: 3 ildouble: 2 ldouble: 2 Function: Imaginary part of "cacos_upward": -double: 4 -float: 4 -idouble: 4 -ifloat: 4 -ildouble: 5 -ldouble: 5 +double: 7 +float: 7 +float128: 7 +idouble: 7 +ifloat: 7 +ifloat128: 7 +ildouble: 7 +ldouble: 7 Function: Real part of "cacosh": -double: 1 -float: 1 -idouble: 1 -ifloat: 1 +double: 2 +float: 2 +float128: 2 +idouble: 2 +ifloat: 2 +ifloat128: 2 ildouble: 2 ldouble: 2 Function: Imaginary part of "cacosh": double: 1 -float: 1 +float: 2 +float128: 2 idouble: 1 -ifloat: 1 +ifloat: 2 +ifloat128: 2 ildouble: 1 ldouble: 1 Function: Real part of "cacosh_downward": double: 4 float: 3 +float128: 5 idouble: 4 ifloat: 3 +ifloat128: 5 ildouble: 5 ldouble: 5 Function: Imaginary part of "cacosh_downward": -double: 1 -float: 1 -idouble: 1 -ifloat: 1 -ildouble: 2 -ldouble: 2 +double: 2 +float: 2 +float128: 4 +idouble: 2 +ifloat: 2 +ifloat128: 4 +ildouble: 3 +ldouble: 3 Function: Real part of "cacosh_towardzero": double: 4 float: 3 +float128: 5 idouble: 4 ifloat: 3 +ifloat128: 5 ildouble: 5 ldouble: 5 Function: Imaginary part of "cacosh_towardzero": -double: 1 +double: 2 float: 1 -idouble: 1 +float128: 3 +idouble: 2 ifloat: 1 +ifloat128: 3 ildouble: 2 ldouble: 2 Function: Real part of "cacosh_upward": -double: 4 +double: 5 float: 4 -idouble: 4 +float128: 6 +idouble: 5 ifloat: 4 +ifloat128: 6 ildouble: 5 ldouble: 5 Function: Imaginary part of "cacosh_upward": -double: 2 +double: 3 float: 2 -idouble: 2 +float128: 4 +idouble: 3 ifloat: 2 -ildouble: 2 -ldouble: 2 +ifloat128: 4 +ildouble: 3 +ldouble: 3 Function: "carg": double: 1 +float128: 2 idouble: 1 +ifloat128: 2 ildouble: 1 ldouble: 1 Function: "carg_downward": double: 1 float: 1 +float128: 2 idouble: 1 ifloat: 1 +ifloat128: 2 ildouble: 1 ldouble: 1 Function: "carg_towardzero": double: 1 float: 1 +float128: 3 idouble: 1 ifloat: 1 +ifloat128: 3 ildouble: 1 ldouble: 1 Function: "carg_upward": double: 1 float: 1 +float128: 2 idouble: 1 ifloat: 1 +ifloat128: 2 ildouble: 1 ldouble: 1 Function: Real part of "casin": double: 1 float: 1 +float128: 2 idouble: 1 ifloat: 1 +ifloat128: 2 ildouble: 1 ldouble: 1 Function: Imaginary part of "casin": -double: 1 -float: 1 -idouble: 1 -ifloat: 1 -ildouble: 2 -ldouble: 2 - -Function: Real part of "casin_downward": double: 2 float: 2 +float128: 2 idouble: 2 ifloat: 2 +ifloat128: 2 ildouble: 2 ldouble: 2 +Function: Real part of "casin_downward": +double: 3 +float: 2 +float128: 3 +idouble: 3 +ifloat: 2 +ifloat128: 3 +ildouble: 3 +ldouble: 3 + Function: Imaginary part of "casin_downward": -double: 4 +double: 5 float: 3 -idouble: 4 +float128: 6 +idouble: 5 ifloat: 3 -ildouble: 5 -ldouble: 5 +ifloat128: 6 +ildouble: 6 +ldouble: 6 Function: Real part of "casin_towardzero": -double: 1 +double: 3 float: 1 -idouble: 1 +float128: 3 +idouble: 3 ifloat: 1 -ildouble: 2 -ldouble: 2 +ifloat128: 3 +ildouble: 3 +ldouble: 3 Function: Imaginary part of "casin_towardzero": double: 4 float: 3 +float128: 5 idouble: 4 ifloat: 3 +ifloat128: 5 ildouble: 5 ldouble: 5 Function: Real part of "casin_upward": double: 2 float: 2 +float128: 3 idouble: 2 ifloat: 2 +ifloat128: 3 ildouble: 2 ldouble: 2 Function: Imaginary part of "casin_upward": -double: 4 -float: 4 -idouble: 4 -ifloat: 4 -ildouble: 5 -ldouble: 5 +double: 7 +float: 7 +float128: 7 +idouble: 7 +ifloat: 7 +ifloat128: 7 +ildouble: 7 +ldouble: 7 Function: Real part of "casinh": -double: 1 -float: 1 -idouble: 1 -ifloat: 1 +double: 2 +float: 2 +float128: 2 +idouble: 2 +ifloat: 2 +ifloat128: 2 ildouble: 2 ldouble: 2 Function: Imaginary part of "casinh": double: 1 float: 1 +float128: 2 idouble: 1 ifloat: 1 +ifloat128: 2 ildouble: 1 ldouble: 1 Function: Real part of "casinh_downward": -double: 4 +double: 5 float: 3 -idouble: 4 +float128: 6 +idouble: 5 ifloat: 3 -ildouble: 5 -ldouble: 5 +ifloat128: 6 +ildouble: 6 +ldouble: 6 Function: Imaginary part of "casinh_downward": -double: 2 +double: 3 float: 2 -idouble: 2 +float128: 3 +idouble: 3 ifloat: 2 -ildouble: 2 -ldouble: 2 +ifloat128: 3 +ildouble: 3 +ldouble: 3 Function: Real part of "casinh_towardzero": double: 4 float: 3 +float128: 5 idouble: 4 ifloat: 3 +ifloat128: 5 ildouble: 5 ldouble: 5 Function: Imaginary part of "casinh_towardzero": -double: 1 +double: 3 float: 1 -idouble: 1 +float128: 3 +idouble: 3 ifloat: 1 -ildouble: 2 -ldouble: 2 +ifloat128: 3 +ildouble: 3 +ldouble: 3 Function: Real part of "casinh_upward": -double: 4 -float: 4 -idouble: 4 -ifloat: 4 -ildouble: 5 -ldouble: 5 +double: 7 +float: 7 +float128: 7 +idouble: 7 +ifloat: 7 +ifloat128: 7 +ildouble: 7 +ldouble: 7 Function: Imaginary part of "casinh_upward": double: 2 float: 2 +float128: 3 idouble: 2 ifloat: 2 +ifloat128: 3 ildouble: 2 ldouble: 2 +Function: Real part of "catan": +double: 1 +float128: 1 +idouble: 1 +ifloat128: 1 +ildouble: 1 +ldouble: 1 + Function: Imaginary part of "catan": double: 1 float: 1 +float128: 1 idouble: 1 ifloat: 1 +ifloat128: 1 ildouble: 1 ldouble: 1 Function: Real part of "catan_downward": double: 1 float: 1 +float128: 2 idouble: 1 ifloat: 1 +ifloat128: 2 ildouble: 1 ldouble: 1 Function: Imaginary part of "catan_downward": double: 2 float: 1 +float128: 2 idouble: 2 ifloat: 1 +ifloat128: 2 ildouble: 4 ldouble: 4 Function: Real part of "catan_towardzero": double: 1 float: 1 +float128: 2 idouble: 1 ifloat: 1 +ifloat128: 2 ildouble: 1 ldouble: 1 Function: Imaginary part of "catan_towardzero": double: 2 float: 1 +float128: 2 idouble: 2 ifloat: 1 +ifloat128: 2 ildouble: 4 ldouble: 4 Function: Real part of "catan_upward": double: 1 float: 1 +float128: 2 idouble: 1 ifloat: 1 +ifloat128: 2 ildouble: 1 ldouble: 1 Function: Imaginary part of "catan_upward": double: 2 float: 2 +float128: 3 idouble: 2 ifloat: 2 +ifloat128: 3 ildouble: 3 ldouble: 3 Function: Real part of "catanh": double: 1 float: 1 +float128: 1 idouble: 1 ifloat: 1 +ifloat128: 1 +ildouble: 1 +ldouble: 1 + +Function: Imaginary part of "catanh": +double: 1 +float128: 1 +idouble: 1 +ifloat128: 1 ildouble: 1 ldouble: 1 Function: Real part of "catanh_downward": double: 2 float: 1 +float128: 2 idouble: 2 ifloat: 1 +ifloat128: 2 ildouble: 4 ldouble: 4 Function: Imaginary part of "catanh_downward": double: 1 float: 1 +float128: 2 idouble: 1 ifloat: 1 +ifloat128: 2 ildouble: 1 ldouble: 1 Function: Real part of "catanh_towardzero": double: 2 float: 1 +float128: 2 idouble: 2 ifloat: 1 +ifloat128: 2 ildouble: 4 ldouble: 4 Function: Imaginary part of "catanh_towardzero": double: 1 float: 1 +float128: 2 idouble: 1 ifloat: 1 +ifloat128: 2 ildouble: 1 ldouble: 1 Function: Real part of "catanh_upward": -double: 2 -float: 2 -idouble: 2 -ifloat: 2 +double: 4 +float: 4 +float128: 4 +idouble: 4 +ifloat: 4 +ifloat128: 4 ildouble: 4 ldouble: 4 Function: Imaginary part of "catanh_upward": double: 1 float: 1 +float128: 2 idouble: 1 ifloat: 1 +ifloat128: 2 ildouble: 1 ldouble: 1 Function: "cbrt": double: 1 float: 1 +float128: 1 idouble: 1 ifloat: 1 +ifloat128: 1 ildouble: 3 ldouble: 3 Function: "cbrt_downward": double: 1 float: 1 +float128: 1 idouble: 1 ifloat: 1 +ifloat128: 1 ildouble: 4 ldouble: 4 Function: "cbrt_towardzero": double: 1 float: 1 +float128: 1 idouble: 1 ifloat: 1 +ifloat128: 1 ildouble: 3 ldouble: 3 Function: "cbrt_upward": double: 1 float: 1 +float128: 1 idouble: 1 ifloat: 1 +ifloat128: 1 ildouble: 4 ldouble: 4 Function: Real part of "ccos": double: 1 float: 1 +float128: 1 idouble: 1 ifloat: 1 +ifloat128: 1 ildouble: 1 ldouble: 1 Function: Imaginary part of "ccos": double: 1 float: 1 +float128: 1 idouble: 1 ifloat: 1 +ifloat128: 1 ildouble: 1 ldouble: 1 Function: Real part of "ccos_downward": double: 1 float: 1 +float128: 2 idouble: 1 ifloat: 1 +ifloat128: 2 ildouble: 3 ldouble: 3 Function: Imaginary part of "ccos_downward": double: 3 float: 3 +float128: 2 idouble: 3 ifloat: 3 +ifloat128: 2 ildouble: 3 ldouble: 3 Function: Real part of "ccos_towardzero": double: 1 -float: 1 +float: 2 +float128: 2 idouble: 1 -ifloat: 1 +ifloat: 2 +ifloat128: 2 ildouble: 3 ldouble: 3 Function: Imaginary part of "ccos_towardzero": double: 3 float: 3 +float128: 2 idouble: 3 ifloat: 3 +ifloat128: 2 ildouble: 3 ldouble: 3 Function: Real part of "ccos_upward": double: 2 float: 2 +float128: 3 idouble: 2 ifloat: 2 +ifloat128: 3 ildouble: 2 ldouble: 2 Function: Imaginary part of "ccos_upward": double: 2 float: 2 +float128: 2 idouble: 2 ifloat: 2 +ifloat128: 2 ildouble: 2 ldouble: 2 Function: Real part of "ccosh": double: 1 float: 1 +float128: 1 idouble: 1 ifloat: 1 +ifloat128: 1 ildouble: 1 ldouble: 1 Function: Imaginary part of "ccosh": double: 1 float: 1 +float128: 1 idouble: 1 ifloat: 1 +ifloat128: 1 ildouble: 1 ldouble: 1 Function: Real part of "ccosh_downward": -double: 1 +double: 2 float: 2 -idouble: 1 +float128: 2 +idouble: 2 ifloat: 2 +ifloat128: 2 ildouble: 3 ldouble: 3 Function: Imaginary part of "ccosh_downward": double: 3 float: 3 +float128: 2 idouble: 3 ifloat: 3 +ifloat128: 2 ildouble: 3 ldouble: 3 Function: Real part of "ccosh_towardzero": -double: 1 -float: 2 -idouble: 1 -ifloat: 2 +double: 2 +float: 3 +float128: 2 +idouble: 2 +ifloat: 3 +ifloat128: 2 ildouble: 3 ldouble: 3 Function: Imaginary part of "ccosh_towardzero": double: 3 float: 3 +float128: 2 idouble: 3 ifloat: 3 +ifloat128: 2 ildouble: 3 ldouble: 3 Function: Real part of "ccosh_upward": double: 2 float: 2 +float128: 3 idouble: 2 ifloat: 2 +ifloat128: 3 ildouble: 2 ldouble: 2 Function: Imaginary part of "ccosh_upward": double: 3 float: 2 +float128: 2 idouble: 3 ifloat: 2 +ifloat128: 2 ildouble: 2 ldouble: 2 Function: Real part of "cexp": double: 2 float: 1 +float128: 1 idouble: 2 ifloat: 1 +ifloat128: 1 ildouble: 1 ldouble: 1 Function: Imaginary part of "cexp": double: 1 float: 2 +float128: 1 idouble: 1 ifloat: 2 +ifloat128: 1 ildouble: 1 ldouble: 1 Function: Real part of "cexp_downward": double: 2 float: 2 +float128: 2 idouble: 2 ifloat: 2 +ifloat128: 2 ildouble: 3 ldouble: 3 Function: Imaginary part of "cexp_downward": double: 3 float: 3 +float128: 2 idouble: 3 ifloat: 3 +ifloat128: 2 ildouble: 3 ldouble: 3 Function: Real part of "cexp_towardzero": double: 2 float: 2 +float128: 2 idouble: 2 ifloat: 2 +ifloat128: 2 ildouble: 3 ldouble: 3 Function: Imaginary part of "cexp_towardzero": double: 3 float: 3 +float128: 2 idouble: 3 ifloat: 3 +ifloat128: 2 ildouble: 3 ldouble: 3 Function: Real part of "cexp_upward": double: 1 float: 2 +float128: 3 idouble: 1 ifloat: 2 +ifloat128: 3 ildouble: 2 ldouble: 2 Function: Imaginary part of "cexp_upward": double: 3 float: 2 +float128: 3 idouble: 3 ifloat: 2 +ifloat128: 3 ildouble: 3 ldouble: 3 Function: Real part of "clog": double: 2 -float: 1 +float: 3 +float128: 2 idouble: 2 -ifloat: 1 +ifloat: 3 +ifloat128: 2 ildouble: 3 ldouble: 3 Function: Imaginary part of "clog": double: 1 +float128: 1 idouble: 1 +ifloat128: 1 ildouble: 1 ldouble: 1 Function: Real part of "clog10": -double: 2 -float: 2 -idouble: 2 -ifloat: 2 +double: 3 +float: 4 +float128: 2 +idouble: 3 +ifloat: 4 +ifloat128: 2 ildouble: 4 ldouble: 4 Function: Imaginary part of "clog10": -double: 1 -idouble: 1 +double: 2 +float: 1 +float128: 2 +idouble: 2 +ifloat: 1 +ifloat128: 2 ildouble: 2 ldouble: 2 Function: Real part of "clog10_downward": -double: 3 -float: 3 -idouble: 3 -ifloat: 3 +double: 4 +float: 4 +float128: 3 +idouble: 4 +ifloat: 4 +ifloat128: 3 ildouble: 8 ldouble: 8 Function: Imaginary part of "clog10_downward": -double: 1 -float: 1 -idouble: 1 -ifloat: 1 +double: 2 +float: 2 +float128: 3 +idouble: 2 +ifloat: 2 +ifloat128: 3 ildouble: 3 ldouble: 3 Function: Real part of "clog10_towardzero": -double: 3 -float: 3 -idouble: 3 -ifloat: 3 +double: 5 +float: 5 +float128: 4 +idouble: 5 +ifloat: 5 +ifloat128: 4 ildouble: 8 ldouble: 8 Function: Imaginary part of "clog10_towardzero": -double: 1 -float: 1 -idouble: 1 -ifloat: 1 +double: 2 +float: 2 +float128: 3 +idouble: 2 +ifloat: 2 +ifloat128: 3 ildouble: 3 ldouble: 3 Function: Real part of "clog10_upward": -double: 3 -float: 3 -idouble: 3 -ifloat: 3 -ildouble: 7 -ldouble: 7 +double: 4 +float: 5 +float128: 4 +idouble: 4 +ifloat: 5 +ifloat128: 4 +ildouble: 8 +ldouble: 8 Function: Imaginary part of "clog10_upward": -double: 1 -float: 1 -idouble: 1 -ifloat: 1 +double: 2 +float: 2 +float128: 3 +idouble: 2 +ifloat: 2 +ifloat128: 3 ildouble: 3 ldouble: 3 Function: Real part of "clog_downward": double: 3 float: 3 +float128: 3 idouble: 3 ifloat: 3 +ifloat128: 3 ildouble: 5 ldouble: 5 Function: Imaginary part of "clog_downward": double: 1 float: 1 +float128: 2 idouble: 1 ifloat: 1 +ifloat128: 2 ildouble: 1 ldouble: 1 Function: Real part of "clog_towardzero": double: 3 -float: 3 +float: 4 +float128: 3 idouble: 3 -ifloat: 3 +ifloat: 4 +ifloat128: 3 ildouble: 5 ldouble: 5 Function: Imaginary part of "clog_towardzero": double: 1 float: 1 +float128: 2 idouble: 1 ifloat: 1 +ifloat128: 2 ildouble: 1 ldouble: 1 Function: Real part of "clog_upward": double: 2 float: 3 +float128: 4 idouble: 2 ifloat: 3 +ifloat128: 4 ildouble: 4 ldouble: 4 Function: Imaginary part of "clog_upward": double: 1 float: 1 +float128: 2 idouble: 1 ifloat: 1 +ifloat128: 2 ildouble: 1 ldouble: 1 Function: "cos": +double: 1 +float128: 1 +idouble: 1 +ifloat128: 1 ildouble: 1 ldouble: 1 Function: "cos_downward": double: 1 +float128: 3 idouble: 1 +ifloat128: 3 ildouble: 3 ldouble: 3 Function: "cos_towardzero": double: 1 +float128: 1 idouble: 1 +ifloat128: 1 ildouble: 2 ldouble: 2 Function: "cos_upward": double: 1 +float128: 2 idouble: 1 +ifloat128: 2 ildouble: 2 ldouble: 2 Function: "cosh": double: 1 float: 1 +float128: 1 idouble: 1 +ifloat: 1 +ifloat128: 1 ildouble: 2 ldouble: 2 Function: "cosh_downward": double: 2 float: 1 -idouble: 1 +float128: 2 +idouble: 2 ifloat: 1 +ifloat128: 1 ildouble: 2 ldouble: 3 Function: "cosh_towardzero": double: 2 float: 1 -idouble: 1 +float128: 2 +idouble: 2 ifloat: 1 +ifloat128: 1 ildouble: 2 ldouble: 2 Function: "cosh_upward": double: 4 float: 2 -idouble: 1 -ifloat: 1 +float128: 3 +idouble: 4 +ifloat: 2 +ifloat128: 1 ildouble: 2 ldouble: 3 Function: Real part of "cpow": double: 2 float: 5 +float128: 4 idouble: 2 ifloat: 5 +ifloat128: 4 ildouble: 3 ldouble: 3 Function: Imaginary part of "cpow": double: 1 float: 2 +float128: 1 idouble: 1 ifloat: 2 +ifloat128: 1 ildouble: 4 ldouble: 4 Function: Real part of "cpow_downward": double: 5 float: 8 +float128: 6 idouble: 5 ifloat: 8 +ifloat128: 6 ildouble: 7 ldouble: 7 Function: Imaginary part of "cpow_downward": double: 2 float: 2 +float128: 2 idouble: 2 ifloat: 2 +ifloat128: 2 ildouble: 2 ldouble: 2 Function: Real part of "cpow_towardzero": double: 5 float: 8 +float128: 6 idouble: 5 ifloat: 8 +ifloat128: 6 ildouble: 7 ldouble: 7 Function: Imaginary part of "cpow_towardzero": double: 2 float: 2 +float128: 2 idouble: 2 ifloat: 2 +ifloat128: 2 ildouble: 1 ldouble: 1 Function: Real part of "cpow_upward": double: 4 float: 1 +float128: 3 idouble: 4 ifloat: 1 +ifloat128: 3 ildouble: 2 ldouble: 2 Function: Imaginary part of "cpow_upward": double: 1 float: 2 +float128: 2 idouble: 1 ifloat: 2 +ifloat128: 2 ildouble: 2 ldouble: 2 Function: Real part of "csin": double: 1 float: 1 +float128: 1 idouble: 1 ifloat: 1 +ifloat128: 1 ildouble: 1 ldouble: 1 Function: Imaginary part of "csin": double: 1 float: 1 +float128: 1 idouble: 1 ifloat: 1 +ifloat128: 1 Function: Real part of "csin_downward": double: 3 float: 3 +float128: 2 idouble: 3 ifloat: 3 +ifloat128: 2 ildouble: 3 ldouble: 3 Function: Imaginary part of "csin_downward": double: 1 float: 1 +float128: 2 idouble: 1 ifloat: 1 +ifloat128: 2 ildouble: 3 ldouble: 3 Function: Real part of "csin_towardzero": double: 3 float: 3 +float128: 2 idouble: 3 ifloat: 3 +ifloat128: 2 ildouble: 3 ldouble: 3 Function: Imaginary part of "csin_towardzero": double: 1 float: 1 +float128: 2 idouble: 1 ifloat: 1 +ifloat128: 2 ildouble: 3 ldouble: 3 Function: Real part of "csin_upward": double: 3 float: 2 +float128: 2 idouble: 3 ifloat: 2 +ifloat128: 2 ildouble: 3 ldouble: 3 Function: Imaginary part of "csin_upward": double: 2 float: 2 +float128: 3 idouble: 2 ifloat: 2 +ifloat128: 3 ildouble: 3 ldouble: 3 Function: Real part of "csinh": double: 1 float: 1 +float128: 1 idouble: 1 ifloat: 1 +ifloat128: 1 ildouble: 1 ldouble: 1 Function: Imaginary part of "csinh": double: 1 float: 1 +float128: 1 idouble: 1 ifloat: 1 +ifloat128: 1 ildouble: 1 ldouble: 1 Function: Real part of "csinh_downward": -double: 1 +double: 2 float: 2 -idouble: 1 +float128: 2 +idouble: 2 ifloat: 2 +ifloat128: 2 ildouble: 3 ldouble: 3 Function: Imaginary part of "csinh_downward": double: 3 float: 3 +float128: 2 idouble: 3 ifloat: 3 +ifloat128: 2 ildouble: 3 ldouble: 3 Function: Real part of "csinh_towardzero": -double: 1 +double: 2 float: 2 -idouble: 1 +float128: 2 +idouble: 2 ifloat: 2 +ifloat128: 2 ildouble: 3 ldouble: 3 Function: Imaginary part of "csinh_towardzero": double: 3 float: 3 +float128: 2 idouble: 3 ifloat: 3 +ifloat128: 2 ildouble: 3 ldouble: 3 Function: Real part of "csinh_upward": double: 2 float: 2 +float128: 3 idouble: 2 ifloat: 2 +ifloat128: 3 ildouble: 3 ldouble: 3 Function: Imaginary part of "csinh_upward": double: 3 float: 2 +float128: 2 idouble: 3 ifloat: 2 +ifloat128: 2 ildouble: 3 ldouble: 3 Function: Real part of "csqrt": -double: 1 -idouble: 1 +double: 2 +float: 2 +float128: 2 +idouble: 2 +ifloat: 2 +ifloat128: 2 ildouble: 2 ldouble: 2 Function: Imaginary part of "csqrt": -double: 1 -float: 1 -idouble: 1 -ifloat: 1 +double: 2 +float: 2 +float128: 2 +idouble: 2 +ifloat: 2 +ifloat128: 2 ildouble: 2 ldouble: 2 Function: Real part of "csqrt_downward": -double: 1 -float: 1 -idouble: 1 -ifloat: 1 +double: 4 +float: 4 +float128: 4 +idouble: 4 +ifloat: 4 +ifloat128: 4 ildouble: 5 ldouble: 5 Function: Imaginary part of "csqrt_downward": -double: 1 -float: 1 -idouble: 1 -ifloat: 1 +double: 3 +float: 3 +float128: 3 +idouble: 3 +ifloat: 3 +ifloat128: 3 ildouble: 4 ldouble: 4 Function: Real part of "csqrt_towardzero": -double: 1 -float: 1 -idouble: 1 -ifloat: 1 +double: 3 +float: 3 +float128: 3 +idouble: 3 +ifloat: 3 +ifloat128: 3 ildouble: 4 ldouble: 4 Function: Imaginary part of "csqrt_towardzero": -double: 1 -float: 1 -idouble: 1 -ifloat: 1 +double: 3 +float: 3 +float128: 3 +idouble: 3 +ifloat: 3 +ifloat128: 3 ildouble: 4 ldouble: 4 Function: Real part of "csqrt_upward": -double: 1 -float: 1 -idouble: 1 -ifloat: 1 +double: 4 +float: 4 +float128: 4 +idouble: 4 +ifloat: 4 +ifloat128: 4 ildouble: 5 ldouble: 5 Function: Imaginary part of "csqrt_upward": -double: 1 -float: 2 -idouble: 1 -ifloat: 2 +double: 3 +float: 3 +float128: 3 +idouble: 3 +ifloat: 3 +ifloat128: 3 ildouble: 4 ldouble: 4 Function: Real part of "ctan": double: 1 float: 1 +float128: 3 idouble: 1 ifloat: 1 +ifloat128: 3 ildouble: 2 ldouble: 2 Function: Imaginary part of "ctan": -double: 1 -float: 1 -idouble: 1 -ifloat: 1 +double: 2 +float: 2 +float128: 3 +idouble: 2 +ifloat: 2 +ifloat128: 3 ildouble: 1 ldouble: 1 Function: Real part of "ctan_downward": -double: 1 -float: 2 -idouble: 1 -ifloat: 2 +double: 6 +float: 5 +float128: 4 +idouble: 6 +ifloat: 5 +ifloat128: 4 ildouble: 5 ldouble: 5 Function: Imaginary part of "ctan_downward": double: 2 float: 2 +float128: 5 idouble: 2 ifloat: 2 +ifloat128: 5 ildouble: 4 ldouble: 4 Function: Real part of "ctan_towardzero": -double: 3 -float: 1 -idouble: 3 -ifloat: 1 +double: 5 +float: 3 +float128: 4 +idouble: 5 +ifloat: 3 +ifloat128: 4 ildouble: 5 ldouble: 5 Function: Imaginary part of "ctan_towardzero": double: 2 -float: 1 +float: 2 +float128: 5 idouble: 2 -ifloat: 1 +ifloat: 2 +ifloat128: 5 ildouble: 4 ldouble: 4 Function: Real part of "ctan_upward": double: 3 -float: 2 +float: 4 +float128: 5 idouble: 3 -ifloat: 2 +ifloat: 4 +ifloat128: 5 ildouble: 3 ldouble: 3 Function: Imaginary part of "ctan_upward": double: 2 float: 1 +float128: 5 idouble: 2 ifloat: 1 +ifloat128: 5 ildouble: 3 ldouble: 3 Function: Real part of "ctanh": -double: 1 -float: 1 -idouble: 1 -ifloat: 1 +double: 2 +float: 2 +float128: 3 +idouble: 2 +ifloat: 2 +ifloat128: 3 ildouble: 1 ldouble: 1 Function: Imaginary part of "ctanh": -double: 1 -float: 1 -idouble: 1 -ifloat: 1 +double: 2 +float: 2 +float128: 3 +idouble: 2 +ifloat: 2 +ifloat128: 3 ildouble: 2 ldouble: 2 Function: Real part of "ctanh_downward": double: 2 float: 2 +float128: 5 idouble: 2 ifloat: 2 +ifloat128: 5 ildouble: 4 ldouble: 4 Function: Imaginary part of "ctanh_downward": -double: 2 -float: 1 -idouble: 2 -ifloat: 1 +double: 6 +float: 5 +float128: 4 +idouble: 6 +ifloat: 5 +ifloat128: 4 ildouble: 4 ldouble: 4 Function: Real part of "ctanh_towardzero": double: 2 -float: 1 +float: 2 +float128: 5 idouble: 2 -ifloat: 1 +ifloat: 2 +ifloat128: 5 ildouble: 4 ldouble: 4 Function: Imaginary part of "ctanh_towardzero": -double: 2 -float: 1 -idouble: 2 -ifloat: 1 +double: 5 +float: 3 +float128: 3 +idouble: 5 +ifloat: 3 +ifloat128: 3 ildouble: 3 ldouble: 3 Function: Real part of "ctanh_upward": double: 2 -float: 1 +float: 2 +float128: 5 idouble: 2 -ifloat: 1 +ifloat: 2 +ifloat128: 5 ildouble: 3 ldouble: 3 Function: Imaginary part of "ctanh_upward": double: 3 -float: 2 +float: 3 +float128: 5 idouble: 3 -ifloat: 2 +ifloat: 3 +ifloat128: 5 ildouble: 3 ldouble: 3 Function: "erf": double: 1 float: 1 +float128: 1 idouble: 1 ifloat: 1 +ifloat128: 1 ildouble: 1 ldouble: 1 Function: "erf_downward": double: 1 float: 1 +float128: 2 idouble: 1 ifloat: 1 +ifloat128: 2 ildouble: 1 ldouble: 1 Function: "erf_towardzero": double: 1 float: 1 +float128: 1 idouble: 1 ifloat: 1 +ifloat128: 1 ildouble: 1 ldouble: 1 Function: "erf_upward": double: 1 float: 1 +float128: 2 idouble: 1 ifloat: 1 +ifloat128: 2 ildouble: 1 ldouble: 1 Function: "erfc": -double: 1 -float: 1 -idouble: 1 -ifloat: 1 +double: 3 +float: 2 +float128: 2 +idouble: 3 +ifloat: 2 +ifloat128: 2 ildouble: 3 ldouble: 3 Function: "erfc_downward": -double: 2 -float: 3 -idouble: 2 -ifloat: 3 +double: 5 +float: 6 +float128: 5 +idouble: 5 +ifloat: 6 +ifloat128: 5 ildouble: 4 ldouble: 4 Function: "erfc_towardzero": -double: 2 -float: 2 -idouble: 2 -ifloat: 2 +double: 3 +float: 4 +float128: 4 +idouble: 3 +ifloat: 4 +ifloat128: 4 ildouble: 4 ldouble: 4 Function: "erfc_upward": -double: 2 -float: 3 -idouble: 2 -ifloat: 3 +double: 5 +float: 6 +float128: 5 +idouble: 5 +ifloat: 6 +ifloat128: 5 ildouble: 5 ldouble: 5 Function: "exp": double: 1 +float128: 1 idouble: 1 +ifloat128: 1 ildouble: 1 ldouble: 1 Function: "exp10": double: 1 +float128: 2 idouble: 1 +ifloat128: 2 ildouble: 1 ldouble: 1 Function: "exp10_downward": double: 1 float: 1 +float128: 3 idouble: 1 ifloat: 1 +ifloat128: 3 ildouble: 2 ldouble: 2 Function: "exp10_towardzero": double: 1 float: 1 +float128: 3 idouble: 1 ifloat: 1 +ifloat128: 3 ildouble: 2 ldouble: 2 Function: "exp10_upward": double: 1 float: 1 +float128: 3 idouble: 1 ifloat: 1 +ifloat128: 3 ildouble: 2 ldouble: 2 Function: "exp2": double: 1 +float128: 1 idouble: 1 +ifloat128: 1 ildouble: 1 ldouble: 1 Function: "exp2_downward": +float128: 1 +ifloat128: 1 ildouble: 1 ldouble: 1 Function: "exp2_towardzero": double: 1 +float128: 1 idouble: 1 +ifloat128: 1 ildouble: 1 ldouble: 1 Function: "exp2_upward": +float: 1 +float128: 2 +ifloat: 1 +ifloat128: 2 ildouble: 1 ldouble: 1 Function: "exp_downward": double: 1 +float: 1 idouble: 1 +ifloat: 1 ildouble: 1 ldouble: 1 Function: "exp_towardzero": double: 1 +float: 1 idouble: 1 +ifloat: 1 ildouble: 2 ldouble: 2 @@ -1534,642 +1963,789 @@ ldouble: 1 Function: "expm1": double: 1 +float128: 1 idouble: 1 +ifloat128: 1 ildouble: 2 ldouble: 2 Function: "expm1_downward": double: 1 float: 1 +float128: 2 idouble: 1 ifloat: 1 +ifloat128: 2 ildouble: 4 ldouble: 4 Function: "expm1_towardzero": double: 1 float: 1 +float128: 4 idouble: 1 ifloat: 1 +ifloat128: 4 ildouble: 4 ldouble: 4 Function: "expm1_upward": double: 1 float: 1 +float128: 3 idouble: 1 ifloat: 1 +ifloat128: 3 ildouble: 4 ldouble: 4 Function: "gamma": -double: 3 +double: 4 float: 3 -idouble: 3 +idouble: 4 ifloat: 3 ildouble: 4 ldouble: 4 Function: "gamma_downward": -double: 4 -float: 4 -idouble: 4 -ifloat: 4 +double: 5 +float: 5 +idouble: 5 +ifloat: 5 ildouble: 7 ldouble: 7 Function: "gamma_towardzero": -double: 4 +double: 5 float: 4 -idouble: 4 +idouble: 5 ifloat: 4 ildouble: 7 ldouble: 7 Function: "gamma_upward": -double: 3 -float: 4 -idouble: 3 -ifloat: 4 -ildouble: 5 -ldouble: 5 +double: 5 +float: 5 +idouble: 5 +ifloat: 5 +ildouble: 6 +ldouble: 6 Function: "hypot": double: 1 +float128: 1 idouble: 1 +ifloat128: 1 ildouble: 1 ldouble: 1 Function: "hypot_downward": double: 1 +float128: 1 idouble: 1 +ifloat128: 1 ildouble: 1 ldouble: 1 Function: "hypot_towardzero": double: 1 +float128: 1 idouble: 1 +ifloat128: 1 ildouble: 1 ldouble: 1 Function: "hypot_upward": double: 1 +float128: 1 idouble: 1 +ifloat128: 1 ildouble: 1 ldouble: 1 Function: "j0": -double: 1 -float: 1 -idouble: 1 -ifloat: 1 +double: 2 +float: 2 +float128: 2 +idouble: 2 +ifloat: 2 +ifloat128: 2 ildouble: 2 ldouble: 2 Function: "j0_downward": -double: 1 -float: 2 -idouble: 1 -ifloat: 2 +double: 2 +float: 4 +float128: 4 +idouble: 2 +ifloat: 4 +ifloat128: 4 ildouble: 4 ldouble: 4 Function: "j0_towardzero": -double: 2 -float: 1 -idouble: 2 -ifloat: 1 +double: 3 +float: 2 +float128: 2 +idouble: 3 +ifloat: 2 +ifloat128: 2 ildouble: 5 ldouble: 5 Function: "j0_upward": -double: 1 +double: 3 float: 3 -idouble: 1 +float128: 5 +idouble: 3 ifloat: 3 +ifloat128: 5 ildouble: 4 ldouble: 4 Function: "j1": double: 2 -float: 1 +float: 2 +float128: 4 idouble: 2 -ifloat: 1 +ifloat: 2 +ifloat128: 4 ildouble: 1 ldouble: 1 Function: "j1_downward": -double: 2 -float: 2 -idouble: 2 -ifloat: 2 +double: 3 +float: 3 +float128: 4 +idouble: 3 +ifloat: 3 +ifloat128: 4 ildouble: 4 ldouble: 4 Function: "j1_towardzero": -double: 2 -float: 1 -idouble: 2 -ifloat: 1 +double: 3 +float: 2 +float128: 4 +idouble: 3 +ifloat: 2 +ifloat128: 4 ildouble: 4 ldouble: 4 Function: "j1_upward": -double: 2 -float: 3 -idouble: 2 -ifloat: 3 +double: 3 +float: 5 +float128: 3 +idouble: 3 +ifloat: 5 +ifloat128: 3 ildouble: 3 ldouble: 3 Function: "jn": -double: 2 -float: 3 -idouble: 2 -ifloat: 3 +double: 4 +float: 4 +float128: 7 +idouble: 4 +ifloat: 4 +ifloat128: 7 ildouble: 4 ldouble: 4 Function: "jn_downward": -double: 2 -float: 3 -idouble: 2 -ifloat: 3 +double: 5 +float: 5 +float128: 8 +idouble: 5 +ifloat: 5 +ifloat128: 8 ildouble: 4 ldouble: 4 Function: "jn_towardzero": -double: 2 -float: 3 -idouble: 2 -ifloat: 3 +double: 5 +float: 5 +float128: 8 +idouble: 5 +ifloat: 5 +ifloat128: 8 ildouble: 5 ldouble: 5 Function: "jn_upward": -double: 2 -float: 3 -idouble: 2 -ifloat: 3 +double: 5 +float: 5 +float128: 7 +idouble: 5 +ifloat: 5 +ifloat128: 7 ildouble: 5 ldouble: 5 Function: "lgamma": -double: 3 +double: 4 float: 3 -idouble: 3 +float128: 5 +idouble: 4 ifloat: 3 +ifloat128: 5 ildouble: 4 ldouble: 4 Function: "lgamma_downward": -double: 4 -float: 4 -idouble: 4 -ifloat: 4 +double: 5 +float: 5 +float128: 8 +idouble: 5 +ifloat: 5 +ifloat128: 8 ildouble: 7 ldouble: 7 Function: "lgamma_towardzero": -double: 4 +double: 5 float: 4 -idouble: 4 +float128: 5 +idouble: 5 ifloat: 4 +ifloat128: 5 ildouble: 7 ldouble: 7 Function: "lgamma_upward": -double: 3 -float: 4 -idouble: 3 -ifloat: 4 -ildouble: 5 -ldouble: 5 +double: 5 +float: 5 +float128: 8 +idouble: 5 +ifloat: 5 +ifloat128: 8 +ildouble: 6 +ldouble: 6 Function: "log": double: 1 +float128: 1 idouble: 1 +ifloat128: 1 ildouble: 1 ldouble: 1 Function: "log10": double: 1 +float128: 1 idouble: 1 +ifloat128: 1 ildouble: 1 ldouble: 1 Function: "log10_downward": double: 1 float: 1 +float128: 1 idouble: 1 ifloat: 1 +ifloat128: 1 ildouble: 2 ldouble: 2 Function: "log10_towardzero": double: 1 float: 1 +float128: 1 idouble: 1 ifloat: 1 +ifloat128: 1 ildouble: 2 ldouble: 2 Function: "log10_upward": double: 1 float: 1 +float128: 1 idouble: 1 ifloat: 1 +ifloat128: 1 ildouble: 1 ldouble: 1 Function: "log1p": double: 1 +float128: 2 idouble: 1 +ifloat128: 2 ildouble: 2 ldouble: 2 Function: "log1p_downward": double: 1 float: 1 +float128: 3 idouble: 1 ifloat: 1 +ifloat128: 3 ildouble: 4 ldouble: 4 Function: "log1p_towardzero": double: 1 float: 1 +float128: 3 idouble: 1 ifloat: 1 +ifloat128: 3 ildouble: 4 ldouble: 4 Function: "log1p_upward": double: 1 float: 1 +float128: 2 idouble: 1 ifloat: 1 +ifloat128: 2 ildouble: 3 ldouble: 3 Function: "log2": double: 1 +float: 1 +float128: 2 idouble: 1 +ifloat: 1 +ifloat128: 2 ildouble: 1 ldouble: 1 Function: "log2_downward": double: 1 +float128: 3 idouble: 1 +ifloat128: 3 ildouble: 1 ldouble: 1 Function: "log2_towardzero": double: 1 float: 1 +float128: 1 idouble: 1 ifloat: 1 +ifloat128: 1 ildouble: 1 ldouble: 1 Function: "log2_upward": double: 1 float: 1 +float128: 1 idouble: 1 ifloat: 1 +ifloat128: 1 ildouble: 1 ldouble: 1 Function: "log_downward": double: 1 +float128: 1 idouble: 1 +ifloat128: 1 ildouble: 2 ldouble: 2 Function: "log_towardzero": double: 1 +float128: 2 idouble: 1 +ifloat128: 2 ildouble: 2 ldouble: 2 Function: "log_upward": double: 1 +float128: 1 idouble: 1 +ifloat128: 1 ildouble: 1 ldouble: 1 Function: "pow": double: 1 +float128: 2 idouble: 1 +ifloat128: 2 ildouble: 1 ldouble: 1 -Function: "pow10": -double: 1 -idouble: 1 -ildouble: 1 -ldouble: 1 - -Function: "pow10_downward": +Function: "pow_downward": double: 1 float: 1 +float128: 2 idouble: 1 ifloat: 1 -ildouble: 2 -ldouble: 2 +ifloat128: 2 +ildouble: 4 +ldouble: 4 -Function: "pow10_towardzero": +Function: "pow_towardzero": double: 1 float: 1 +float128: 2 idouble: 1 ifloat: 1 -ildouble: 2 -ldouble: 2 +ifloat128: 2 +ildouble: 4 +ldouble: 4 -Function: "pow10_upward": +Function: "pow_upward": double: 1 float: 1 +float128: 2 idouble: 1 ifloat: 1 -ildouble: 2 -ldouble: 2 - -Function: "pow_downward": -double: 1 -idouble: 1 +ifloat128: 2 ildouble: 4 ldouble: 4 -Function: "pow_towardzero": -double: 1 -idouble: 1 -ildouble: 1 -ldouble: 1 - -Function: "pow_upward": +Function: "sin": double: 1 +float128: 1 idouble: 1 -ildouble: 2 -ldouble: 2 - -Function: "sin": +ifloat128: 1 ildouble: 1 ldouble: 1 Function: "sin_downward": double: 1 +float128: 3 idouble: 1 +ifloat128: 3 ildouble: 3 ldouble: 3 Function: "sin_towardzero": double: 1 +float128: 2 idouble: 1 +ifloat128: 2 ildouble: 2 ldouble: 2 Function: "sin_upward": double: 1 +float128: 3 idouble: 1 +ifloat128: 3 ildouble: 3 ldouble: 3 Function: "sincos": +double: 1 +float128: 1 +idouble: 1 +ifloat128: 1 ildouble: 1 ldouble: 1 Function: "sincos_downward": double: 1 +float128: 3 idouble: 1 +ifloat128: 3 ildouble: 3 ldouble: 3 Function: "sincos_towardzero": double: 1 +float128: 2 idouble: 1 +ifloat128: 2 ildouble: 2 ldouble: 2 Function: "sincos_upward": double: 1 +float128: 3 idouble: 1 +ifloat128: 3 ildouble: 3 ldouble: 3 Function: "sinh": -double: 1 +double: 2 +float: 2 +float128: 2 +idouble: 2 +ifloat: 2 +ifloat128: 2 ildouble: 2 ldouble: 2 Function: "sinh_downward": -double: 2 -float: 1 -idouble: 1 -ifloat: 1 -ildouble: 4 +double: 3 +float: 3 +float128: 3 +idouble: 3 +ifloat: 3 +ifloat128: 3 +ildouble: 5 ldouble: 5 Function: "sinh_towardzero": double: 2 -float: 1 -idouble: 1 -ifloat: 1 -ildouble: 3 +float: 2 +float128: 3 +idouble: 2 +ifloat: 2 +ifloat128: 3 +ildouble: 4 ldouble: 4 Function: "sinh_upward": double: 4 -float: 2 -idouble: 1 -ifloat: 1 -ildouble: 4 +float: 3 +float128: 4 +idouble: 4 +ifloat: 3 +ifloat128: 4 +ildouble: 5 ldouble: 5 Function: "tan": float: 1 +float128: 1 ifloat: 1 +ifloat128: 1 ildouble: 2 ldouble: 2 Function: "tan_downward": double: 1 float: 2 +float128: 1 idouble: 1 ifloat: 2 +ifloat128: 1 ildouble: 3 ldouble: 3 Function: "tan_towardzero": double: 1 float: 2 +float128: 1 idouble: 1 ifloat: 2 +ifloat128: 1 ildouble: 3 ldouble: 3 Function: "tan_upward": double: 1 float: 2 +float128: 1 idouble: 1 ifloat: 2 +ifloat128: 1 ildouble: 2 ldouble: 2 Function: "tanh": -double: 1 -idouble: 1 +double: 2 +float: 2 +float128: 2 +idouble: 2 +ifloat: 2 +ifloat128: 2 ildouble: 3 ldouble: 3 Function: "tanh_downward": -double: 1 -float: 1 -idouble: 1 -ifloat: 1 +double: 3 +float: 3 +float128: 4 +idouble: 3 +ifloat: 3 +ifloat128: 4 ildouble: 7 ldouble: 4 Function: "tanh_towardzero": -double: 1 -float: 1 -idouble: 1 -ifloat: 1 +double: 2 +float: 2 +float128: 3 +idouble: 2 +ifloat: 2 +ifloat128: 3 ildouble: 3 ldouble: 3 Function: "tanh_upward": -double: 1 -float: 1 -idouble: 1 -ifloat: 1 -ildouble: 5 -ldouble: 4 - -Function: "tgamma": double: 3 float: 3 +float128: 3 idouble: 3 ifloat: 3 +ifloat128: 3 ildouble: 5 -ldouble: 5 +ldouble: 4 -Function: "tgamma_downward": -double: 3 +Function: "tgamma": +double: 5 float: 4 -idouble: 3 +float128: 4 +idouble: 5 ifloat: 4 +ifloat128: 4 +ildouble: 5 +ldouble: 5 + +Function: "tgamma_downward": +double: 6 +float: 5 +float128: 5 +idouble: 6 +ifloat: 5 +ifloat128: 5 ildouble: 5 ldouble: 5 Function: "tgamma_towardzero": -double: 4 -float: 4 -idouble: 4 -ifloat: 4 +double: 6 +float: 5 +float128: 5 +idouble: 6 +ifloat: 5 +ifloat128: 5 ildouble: 5 ldouble: 5 Function: "tgamma_upward": -double: 4 -float: 4 -idouble: 4 -ifloat: 4 +double: 5 +float: 6 +float128: 4 +idouble: 5 +ifloat: 6 +ifloat128: 4 ildouble: 5 ldouble: 5 Function: "y0": -double: 1 +double: 2 float: 1 -idouble: 1 +float128: 3 +idouble: 2 ifloat: 1 +ifloat128: 3 ildouble: 1 ldouble: 1 Function: "y0_downward": -double: 2 -float: 2 -idouble: 2 -ifloat: 2 +double: 3 +float: 4 +float128: 4 +idouble: 3 +ifloat: 4 +ifloat128: 4 ildouble: 5 ldouble: 5 Function: "y0_towardzero": -double: 2 -float: 2 -idouble: 2 -ifloat: 2 +double: 3 +float: 3 +float128: 3 +idouble: 3 +ifloat: 3 +ifloat128: 3 ildouble: 5 ldouble: 5 Function: "y0_upward": -double: 1 -float: 2 -idouble: 1 -ifloat: 2 +double: 3 +float: 5 +float128: 3 +idouble: 3 +ifloat: 5 +ifloat128: 3 ildouble: 3 ldouble: 3 Function: "y1": -double: 2 +double: 3 float: 2 -idouble: 2 +float128: 2 +idouble: 3 ifloat: 2 +ifloat128: 2 ildouble: 2 ldouble: 2 Function: "y1_downward": -double: 2 -float: 2 -idouble: 2 -ifloat: 2 +double: 3 +float: 4 +float128: 4 +idouble: 3 +ifloat: 4 +ifloat128: 4 ildouble: 7 ldouble: 7 Function: "y1_towardzero": -double: 2 +double: 3 float: 2 -idouble: 2 +float128: 2 +idouble: 3 ifloat: 2 +ifloat128: 2 ildouble: 5 ldouble: 5 Function: "y1_upward": -double: 1 +double: 7 float: 3 -idouble: 1 +float128: 5 +idouble: 7 ifloat: 3 +ifloat128: 5 ildouble: 7 ldouble: 7 Function: "yn": -double: 2 +double: 3 float: 3 -idouble: 2 +float128: 5 +idouble: 3 ifloat: 3 +ifloat128: 5 ildouble: 4 ldouble: 4 Function: "yn_downward": -double: 2 -float: 2 -idouble: 2 -ifloat: 2 +double: 3 +float: 4 +float128: 5 +idouble: 3 +ifloat: 4 +ifloat128: 5 ildouble: 5 ldouble: 5 Function: "yn_towardzero": double: 3 float: 3 +float128: 5 idouble: 3 ifloat: 3 +ifloat128: 5 ildouble: 5 ldouble: 5 Function: "yn_upward": -double: 3 -float: 3 -idouble: 3 -ifloat: 3 +double: 4 +float: 5 +float128: 5 +idouble: 4 +ifloat: 5 +ifloat128: 5 ildouble: 4 ldouble: 4 diff --git a/sysdeps/i386/i686/fpu/multiarch/libm-test-ulps-name b/sysdeps/i386/i686/fpu/multiarch/libm-test-ulps-name new file mode 100644 index 0000000000..193dd704b3 --- /dev/null +++ b/sysdeps/i386/i686/fpu/multiarch/libm-test-ulps-name @@ -0,0 +1 @@ +i686 diff --git a/sysdeps/i386/i686/fpu/multiarch/s_cosf-sse2.S b/sysdeps/i386/i686/fpu/multiarch/s_cosf-sse2.S index 66c247e9d0..ffd639e70b 100644 --- a/sysdeps/i386/i686/fpu/multiarch/s_cosf-sse2.S +++ b/sysdeps/i386/i686/fpu/multiarch/s_cosf-sse2.S @@ -1,5 +1,5 @@ /* Optimized with sse2 version of cosf - Copyright (C) 2012-2016 Free Software Foundation, Inc. + Copyright (C) 2012-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -17,8 +17,7 @@ <http://www.gnu.org/licenses/>. */ #include <sysdep.h> -#define __need_Emath -#include <bits/errno.h> +#include <errno.h> /* Short algorithm description: * diff --git a/sysdeps/i386/i686/fpu/multiarch/s_cosf.c b/sysdeps/i386/i686/fpu/multiarch/s_cosf.c index f46695a2e7..a4556a478d 100644 --- a/sysdeps/i386/i686/fpu/multiarch/s_cosf.c +++ b/sysdeps/i386/i686/fpu/multiarch/s_cosf.c @@ -1,5 +1,5 @@ /* Multiple versions of cosf - Copyright (C) 2012-2016 Free Software Foundation, Inc. + Copyright (C) 2012-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -17,13 +17,14 @@ <http://www.gnu.org/licenses/>. */ #include <init-arch.h> +#include <libm-alias-float.h> extern float __cosf_sse2 (float); extern float __cosf_ia32 (float); float __cosf (float); libm_ifunc (__cosf, HAS_CPU_FEATURE (SSE2) ? __cosf_sse2 : __cosf_ia32); -weak_alias (__cosf, cosf); +libm_alias_float (__cos, cos); #define COSF __cosf_ia32 #include <sysdeps/ieee754/flt-32/s_cosf.c> diff --git a/sysdeps/i386/i686/fpu/multiarch/s_sincosf-sse2.S b/sysdeps/i386/i686/fpu/multiarch/s_sincosf-sse2.S index 93c6dd65b4..67855395bb 100644 --- a/sysdeps/i386/i686/fpu/multiarch/s_sincosf-sse2.S +++ b/sysdeps/i386/i686/fpu/multiarch/s_sincosf-sse2.S @@ -1,5 +1,5 @@ /* Optimized with sse2 version of sincosf - Copyright (C) 2012-2016 Free Software Foundation, Inc. + Copyright (C) 2012-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -17,8 +17,7 @@ <http://www.gnu.org/licenses/>. */ #include <sysdep.h> -#define __need_Emath -#include <bits/errno.h> +#include <errno.h> /* Short algorithm description: * diff --git a/sysdeps/i386/i686/fpu/multiarch/s_sincosf.c b/sysdeps/i386/i686/fpu/multiarch/s_sincosf.c index 7338793e9c..5f21f5c0ed 100644 --- a/sysdeps/i386/i686/fpu/multiarch/s_sincosf.c +++ b/sysdeps/i386/i686/fpu/multiarch/s_sincosf.c @@ -1,5 +1,5 @@ /* Multiple versions of sincosf - Copyright (C) 2012-2016 Free Software Foundation, Inc. + Copyright (C) 2012-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -17,6 +17,7 @@ <http://www.gnu.org/licenses/>. */ #include <init-arch.h> +#include <libm-alias-float.h> extern void __sincosf_sse2 (float, float *, float *); extern void __sincosf_ia32 (float, float *, float *); @@ -24,7 +25,7 @@ void __sincosf (float, float *, float *); libm_ifunc (__sincosf, HAS_CPU_FEATURE (SSE2) ? __sincosf_sse2 : __sincosf_ia32); -weak_alias (__sincosf, sincosf); +libm_alias_float (__sincos, sincos); #define SINCOSF __sincosf_ia32 #include <sysdeps/ieee754/flt-32/s_sincosf.c> diff --git a/sysdeps/i386/i686/fpu/multiarch/s_sinf-sse2.S b/sysdeps/i386/i686/fpu/multiarch/s_sinf-sse2.S index fbcce73d03..4d20fdbead 100644 --- a/sysdeps/i386/i686/fpu/multiarch/s_sinf-sse2.S +++ b/sysdeps/i386/i686/fpu/multiarch/s_sinf-sse2.S @@ -1,5 +1,5 @@ /* Optimized with sse2 version of sinf - Copyright (C) 2012-2016 Free Software Foundation, Inc. + Copyright (C) 2012-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -17,8 +17,7 @@ <http://www.gnu.org/licenses/>. */ #include <sysdep.h> -#define __need_Emath -#include <bits/errno.h> +#include <errno.h> /* Short algorithm description: * diff --git a/sysdeps/i386/i686/fpu/multiarch/s_sinf.c b/sysdeps/i386/i686/fpu/multiarch/s_sinf.c index 4d1d2f41f1..80a7ffaa1e 100644 --- a/sysdeps/i386/i686/fpu/multiarch/s_sinf.c +++ b/sysdeps/i386/i686/fpu/multiarch/s_sinf.c @@ -1,5 +1,5 @@ /* Multiple versions of sinf - Copyright (C) 2012-2016 Free Software Foundation, Inc. + Copyright (C) 2012-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -17,12 +17,13 @@ <http://www.gnu.org/licenses/>. */ #include <init-arch.h> +#include <libm-alias-float.h> extern float __sinf_sse2 (float); extern float __sinf_ia32 (float); float __sinf (float); libm_ifunc (__sinf, HAS_CPU_FEATURE (SSE2) ? __sinf_sse2 : __sinf_ia32); -weak_alias (__sinf, sinf); +libm_alias_float (__sin, sin); #define SINF __sinf_ia32 #include <sysdeps/ieee754/flt-32/s_sinf.c> diff --git a/sysdeps/i386/i686/fpu/s_fmax.S b/sysdeps/i386/i686/fpu/s_fmax.S index 71be4a5db1..501573edc2 100644 --- a/sysdeps/i386/i686/fpu/s_fmax.S +++ b/sysdeps/i386/i686/fpu/s_fmax.S @@ -1,5 +1,5 @@ /* Compute maximum of two numbers, regarding NaN as missing argument. - Copyright (C) 1997-2016 Free Software Foundation, Inc. + Copyright (C) 1997-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -18,6 +18,7 @@ <http://www.gnu.org/licenses/>. */ #include <sysdep.h> +#include <libm-alias-double.h> .text ENTRY(__fmax) @@ -36,4 +37,4 @@ ENTRY(__fmax) ret END(__fmax) -weak_alias (__fmax, fmax) +libm_alias_double (__fmax, fmax) diff --git a/sysdeps/i386/i686/fpu/s_fmaxf.S b/sysdeps/i386/i686/fpu/s_fmaxf.S index 8fa796a8a3..a167b6c73d 100644 --- a/sysdeps/i386/i686/fpu/s_fmaxf.S +++ b/sysdeps/i386/i686/fpu/s_fmaxf.S @@ -1,5 +1,5 @@ /* Compute maximum of two numbers, regarding NaN as missing argument. - Copyright (C) 1997-2016 Free Software Foundation, Inc. + Copyright (C) 1997-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -18,6 +18,7 @@ <http://www.gnu.org/licenses/>. */ #include <sysdep.h> +#include <libm-alias-float.h> .text ENTRY(__fmaxf) @@ -36,4 +37,4 @@ ENTRY(__fmaxf) ret END(__fmaxf) -weak_alias (__fmaxf, fmaxf) +libm_alias_float (__fmax, fmax) diff --git a/sysdeps/i386/i686/fpu/s_fmaxl.S b/sysdeps/i386/i686/fpu/s_fmaxl.S index e5dcd26923..c9c62c71c8 100644 --- a/sysdeps/i386/i686/fpu/s_fmaxl.S +++ b/sysdeps/i386/i686/fpu/s_fmaxl.S @@ -1,5 +1,5 @@ /* Compute maximum of two numbers, regarding NaN as missing argument. - Copyright (C) 1997-2016 Free Software Foundation, Inc. + Copyright (C) 1997-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -18,22 +18,42 @@ <http://www.gnu.org/licenses/>. */ #include <sysdep.h> +#include <libm-alias-ldouble.h> .text ENTRY(__fmaxl) fldt 4(%esp) // x fldt 16(%esp) // x : y - fucomi %st(0), %st - fcmovu %st(1), %st // now %st contains y if not NaN, x otherwise - - fxch - fucomi %st(1), %st + jp 2f fcmovb %st(1), %st fstp %st(1) ret + +2: // Unordered. + fucomi %st(0), %st + jp 3f + // st(1) is a NaN; st(0) is not. Test if st(1) is signaling. + testb $0x40, 11(%esp) + jz 4f + fstp %st(1) + ret + +3: // st(0) is a NaN; st(1) may or may not be. + fxch + fucomi %st(0), %st + jp 4f + // st(1) is a NaN; st(0) is not. Test if st(1) is signaling. + testb $0x40, 23(%esp) + jz 4f + fstp %st(1) + ret + +4: // Both arguments are NaNs, or one is a signaling NaN. + faddp + ret END(__fmaxl) -weak_alias (__fmaxl, fmaxl) +libm_alias_ldouble (__fmax, fmax) diff --git a/sysdeps/i386/i686/fpu/s_fmin.S b/sysdeps/i386/i686/fpu/s_fmin.S index 9c8f5af050..26208279bb 100644 --- a/sysdeps/i386/i686/fpu/s_fmin.S +++ b/sysdeps/i386/i686/fpu/s_fmin.S @@ -1,5 +1,5 @@ /* Compute minimum of two numbers, regarding NaN as missing argument. - Copyright (C) 1997-2016 Free Software Foundation, Inc. + Copyright (C) 1997-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -18,6 +18,7 @@ <http://www.gnu.org/licenses/>. */ #include <sysdep.h> +#include <libm-alias-double.h> .text ENTRY(__fmin) @@ -34,4 +35,4 @@ ENTRY(__fmin) ret END(__fmin) -weak_alias (__fmin, fmin) +libm_alias_double (__fmin, fmin) diff --git a/sysdeps/i386/i686/fpu/s_fminf.S b/sysdeps/i386/i686/fpu/s_fminf.S index b071915399..d9b6d0d4be 100644 --- a/sysdeps/i386/i686/fpu/s_fminf.S +++ b/sysdeps/i386/i686/fpu/s_fminf.S @@ -1,5 +1,5 @@ /* Compute minimum of two numbers, regarding NaN as missing argument. - Copyright (C) 1997-2016 Free Software Foundation, Inc. + Copyright (C) 1997-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -18,6 +18,7 @@ <http://www.gnu.org/licenses/>. */ #include <sysdep.h> +#include <libm-alias-float.h> .text ENTRY(__fminf) @@ -34,4 +35,4 @@ ENTRY(__fminf) ret END(__fminf) -weak_alias (__fminf, fminf) +libm_alias_float (__fmin, fmin) diff --git a/sysdeps/i386/i686/fpu/s_fminl.S b/sysdeps/i386/i686/fpu/s_fminl.S index ddbd81115e..a22d0d7c1b 100644 --- a/sysdeps/i386/i686/fpu/s_fminl.S +++ b/sysdeps/i386/i686/fpu/s_fminl.S @@ -1,5 +1,5 @@ /* Compute minimum of two numbers, regarding NaN as missing argument. - Copyright (C) 1997-2016 Free Software Foundation, Inc. + Copyright (C) 1997-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -17,6 +17,7 @@ License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ +#include <libm-alias-ldouble.h> #include <sysdep.h> .text @@ -24,14 +25,35 @@ ENTRY(__fminl) fldt 4(%esp) // x fldt 16(%esp) // x : y - fucomi %st(0), %st - fcmovu %st(1), %st // now %st contains y if not NaN, x otherwise - fucomi %st(1), %st + jp 2f fcmovnb %st(1), %st fstp %st(1) ret + +2: // Unordered. + fucomi %st(0), %st + jp 3f + // st(1) is a NaN; st(0) is not. Test if st(1) is signaling. + testb $0x40, 11(%esp) + jz 4f + fstp %st(1) + ret + +3: // st(0) is a NaN; st(1) may or may not be. + fxch + fucomi %st(0), %st + jp 4f + // st(1) is a NaN; st(0) is not. Test if st(1) is signaling. + testb $0x40, 23(%esp) + jz 4f + fstp %st(1) + ret + +4: // Both arguments are NaNs, or one is a signaling NaN. + faddp + ret END(__fminl) -weak_alias (__fminl, fminl) +libm_alias_ldouble (__fmin, fmin) diff --git a/sysdeps/i386/i686/hp-timing.h b/sysdeps/i386/i686/hp-timing.h index 58e53c395f..59af526fdb 100644 --- a/sysdeps/i386/i686/hp-timing.h +++ b/sysdeps/i386/i686/hp-timing.h @@ -1,5 +1,5 @@ /* High precision, low overhead timing functions. i686 version. - Copyright (C) 1998-2016 Free Software Foundation, Inc. + Copyright (C) 1998-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998. diff --git a/sysdeps/i386/i686/init-arch.h b/sysdeps/i386/i686/init-arch.h index 36c83738d8..ab99392b58 100644 --- a/sysdeps/i386/i686/init-arch.h +++ b/sysdeps/i386/i686/init-arch.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2015-2016 Free Software Foundation, Inc. +/* Copyright (C) 2015-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/sysdeps/i386/i686/memcmp.S b/sysdeps/i386/i686/memcmp.S index 1dbeadffc3..3259076cd7 100644 --- a/sysdeps/i386/i686/memcmp.S +++ b/sysdeps/i386/i686/memcmp.S @@ -1,5 +1,5 @@ /* Compare two memory blocks for differences in the first COUNT bytes. - Copyright (C) 2004-2016 Free Software Foundation, Inc. + Copyright (C) 2004-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -80,7 +80,7 @@ L(not_1): LOAD_JUMP_TABLE_ENTRY (L(table_32bytes), %ecx) addl %ecx, %edx addl %ecx, %esi - jmp *%ebx + _CET_NOTRACK jmp *%ebx ALIGN (4) L(28bytes): @@ -326,7 +326,7 @@ L(32bytesormore): LOAD_JUMP_TABLE_ENTRY (L(table_32bytes), %ecx) addl %ecx, %edx addl %ecx, %esi - jmp *%ebx + _CET_NOTRACK jmp *%ebx L(load_ecx_28): addl $0x4, %edx diff --git a/sysdeps/i386/i686/memcpy.S b/sysdeps/i386/i686/memcpy.S index 7346b3f16f..a0f1f5efe7 100644 --- a/sysdeps/i386/i686/memcpy.S +++ b/sysdeps/i386/i686/memcpy.S @@ -1,7 +1,7 @@ /* Copy memory block and return pointer to beginning of destination block For Intel 80x86, x>=6. This file is part of the GNU C Library. - Copyright (C) 1999-2016 Free Software Foundation, Inc. + Copyright (C) 1999-2018 Free Software Foundation, Inc. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1999. The GNU C Library is free software; you can redistribute it and/or diff --git a/sysdeps/i386/i686/memmove.S b/sysdeps/i386/i686/memmove.S index 3b2e34628a..014c9f0ec1 100644 --- a/sysdeps/i386/i686/memmove.S +++ b/sysdeps/i386/i686/memmove.S @@ -1,7 +1,7 @@ /* Copy memory block and return pointer to beginning of destination block For Intel 80x86, x>=6. This file is part of the GNU C Library. - Copyright (C) 2003-2016 Free Software Foundation, Inc. + Copyright (C) 2003-2018 Free Software Foundation, Inc. Contributed by Ulrich Drepper <drepper@cygnus.com>, 2003. The GNU C Library is free software; you can redistribute it and/or diff --git a/sysdeps/i386/i686/mempcpy.S b/sysdeps/i386/i686/mempcpy.S index 9661ce30d6..1051ea5cc8 100644 --- a/sysdeps/i386/i686/mempcpy.S +++ b/sysdeps/i386/i686/mempcpy.S @@ -1,7 +1,7 @@ /* Copy memory block and return pointer to following byte. For Intel 80x86, x>=6. This file is part of the GNU C Library. - Copyright (C) 1998-2016 Free Software Foundation, Inc. + Copyright (C) 1998-2018 Free Software Foundation, Inc. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998. The GNU C Library is free software; you can redistribute it and/or diff --git a/sysdeps/i386/i686/memset.S b/sysdeps/i386/i686/memset.S index 9d1c1739f8..63826e8828 100644 --- a/sysdeps/i386/i686/memset.S +++ b/sysdeps/i386/i686/memset.S @@ -1,6 +1,6 @@ /* memset/bzero -- set memory area to CH/0 Highly optimized version for ix86, x>=6. - Copyright (C) 1999-2016 Free Software Foundation, Inc. + Copyright (C) 1999-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1999. @@ -91,10 +91,3 @@ ENTRY (memset) ret END (memset) libc_hidden_builtin_def (memset) - -#if defined SHARED && IS_IN (libc) && !defined __memset_chk \ - && !defined USE_AS_BZERO -strong_alias (__memset_chk, __memset_zero_constant_len_parameter) - .section .gnu.warning.__memset_zero_constant_len_parameter - .string "memset used with constant zero length parameter; this could be due to transposed parameters" -#endif diff --git a/sysdeps/i386/i686/memusage.h b/sysdeps/i386/i686/memusage.h index 72e5d9cd67..a359fc6561 100644 --- a/sysdeps/i386/i686/memusage.h +++ b/sysdeps/i386/i686/memusage.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2016 Free Software Foundation, Inc. +/* Copyright (C) 2000-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/sysdeps/i386/i686/multiarch/Makefile b/sysdeps/i386/i686/multiarch/Makefile index 700010d969..bf75a9947f 100644 --- a/sysdeps/i386/i686/multiarch/Makefile +++ b/sysdeps/i386/i686/multiarch/Makefile @@ -1,6 +1,5 @@ ifeq ($(subdir),csu) tests += test-multiarch -gen-as-const-headers += ifunc-defines.sym endif ifeq ($(subdir),string) @@ -25,7 +24,13 @@ sysdep_routines += bzero-sse2 memset-sse2 memcpy-ssse3 mempcpy-ssse3 \ strcasecmp_l-sse4 strncase_l-sse4 \ bcopy-sse2-unaligned memcpy-sse2-unaligned \ mempcpy-sse2-unaligned memmove-sse2-unaligned \ - strcspn-c strpbrk-c strspn-c + strcspn-c strpbrk-c strspn-c \ + bcopy-ia32 bzero-ia32 rawmemchr-ia32 \ + memchr-ia32 memcmp-ia32 memcpy-ia32 memmove-ia32 \ + mempcpy-ia32 memset-ia32 strcat-ia32 strchr-ia32 \ + strrchr-ia32 strcpy-ia32 strcmp-ia32 strcspn-ia32 \ + strpbrk-ia32 strspn-ia32 strlen-ia32 stpcpy-ia32 \ + stpncpy-ia32 CFLAGS-varshift.c += -msse4 CFLAGS-strcspn-c.c += -msse4 CFLAGS-strpbrk-c.c += -msse4 @@ -43,3 +48,8 @@ libm-sysdep_routines += s_fma-fma s_fmaf-fma CFLAGS-s_fma-fma.c += -mavx -mfpmath=sse CFLAGS-s_fmaf-fma.c += -mavx -mfpmath=sse endif + +ifeq ($(subdir),debug) +sysdep_routines += memcpy_chk-nonshared mempcpy_chk-nonshared \ + memmove_chk-nonshared memset_chk-nonshared +endif diff --git a/sysdeps/i386/i686/fpu/multiarch/e_expf-ia32.S b/sysdeps/i386/i686/multiarch/bcopy-ia32.S index 2f679f5d72..5809cad860 100644 --- a/sysdeps/i386/i686/fpu/multiarch/e_expf-ia32.S +++ b/sysdeps/i386/i686/multiarch/bcopy-ia32.S @@ -1,5 +1,5 @@ -/* - Copyright (C) 2012-2016 Free Software Foundation, Inc. +/* bcopy optimized for i686. + Copyright (C) 2017-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -16,7 +16,5 @@ License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ -#define __ieee754_expf __ieee754_expf_ia32 -#define __expf_finite __expf_finite_ia32 - -#include <sysdeps/i386/fpu/e_expf.S> +#define bcopy __bcopy_ia32 +#include <sysdeps/i386/i686/bcopy.S> diff --git a/sysdeps/i386/i686/multiarch/bcopy.S b/sysdeps/i386/i686/multiarch/bcopy.S deleted file mode 100644 index d5b408dfb8..0000000000 --- a/sysdeps/i386/i686/multiarch/bcopy.S +++ /dev/null @@ -1,59 +0,0 @@ -/* Multiple versions of bcopy - All versions must be listed in ifunc-impl-list.c. - Copyright (C) 2010-2016 Free Software Foundation, Inc. - Contributed by Intel Corporation. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#include <sysdep.h> -#include <init-arch.h> - -/* Define multiple versions only for the definition in lib. */ -#if IS_IN (libc) - .text -ENTRY(bcopy) - .type bcopy, @gnu_indirect_function - LOAD_GOT_AND_RTLD_GLOBAL_RO - LOAD_FUNC_GOT_EAX (__bcopy_ia32) - HAS_CPU_FEATURE (SSE2) - jz 2f - LOAD_FUNC_GOT_EAX (__bcopy_sse2_unaligned) - HAS_ARCH_FEATURE (Fast_Unaligned_Load) - jnz 2f - HAS_CPU_FEATURE (SSSE3) - jz 2f - LOAD_FUNC_GOT_EAX (__bcopy_ssse3) - HAS_CPU_FEATURE (Fast_Rep_String) - jz 2f - LOAD_FUNC_GOT_EAX (__bcopy_ssse3_rep) -2: ret -END(bcopy) - -# undef ENTRY -# define ENTRY(name) \ - .type __bcopy_ia32, @function; \ - .p2align 4; \ - .globl __bcopy_ia32; \ - .hidden __bcopy_ia32; \ - __bcopy_ia32: cfi_startproc; \ - CALL_MCOUNT -# undef END -# define END(name) \ - cfi_endproc; .size __bcopy_ia32, .-__bcopy_ia32 - -#endif - -#include "../bcopy.S" diff --git a/sysdeps/i386/i686/multiarch/wcsrchr.S b/sysdeps/i386/i686/multiarch/bcopy.c index 5c9d8f7b5d..e27a02d1a5 100644 --- a/sysdeps/i386/i686/multiarch/wcsrchr.S +++ b/sysdeps/i386/i686/multiarch/bcopy.c @@ -1,7 +1,6 @@ -/* Multiple versions of wcsrchr +/* Multiple versions of bcopy. All versions must be listed in ifunc-impl-list.c. - Copyright (C) 2011-2016 Free Software Foundation, Inc. - Contributed by Intel Corporation. + Copyright (C) 2017-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -18,18 +17,14 @@ License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ -#include <sysdep.h> -#include <init-arch.h> - +/* Define multiple versions only for the definition in libc. */ #if IS_IN (libc) - .text -ENTRY(wcsrchr) - .type wcsrchr, @gnu_indirect_function - LOAD_GOT_AND_RTLD_GLOBAL_RO - LOAD_FUNC_GOT_EAX (__wcsrchr_ia32) - HAS_CPU_FEATURE (SSE2) - jz 2f - LOAD_FUNC_GOT_EAX (__wcsrchr_sse2) -2: ret -END(wcsrchr) +# define bcopy __redirect_bcopy +# include <string.h> +# undef bcopy + +# define SYMBOL_NAME bcopy +# include "ifunc-memmove.h" + +libc_ifunc_redirected (__redirect_bcopy, bcopy, IFUNC_SELECTOR ()); #endif diff --git a/sysdeps/i386/i686/multiarch/bzero-ia32.S b/sysdeps/i386/i686/multiarch/bzero-ia32.S new file mode 100644 index 0000000000..68ff9e1e90 --- /dev/null +++ b/sysdeps/i386/i686/multiarch/bzero-ia32.S @@ -0,0 +1,38 @@ +/* bzero optimized for i686. + Copyright (C) 2017-2018 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#include <sysdep.h> +#include <init-arch.h> + +#if IS_IN (libc) +# define __bzero __bzero_ia32 + +# ifdef SHARED +# undef libc_hidden_builtin_def +/* IFUNC doesn't work with the hidden functions in shared library since + they will be called without setting up EBX needed for PLT which is + used by IFUNC. */ +# define libc_hidden_builtin_def(name) \ + .globl __GI___bzero; __GI___bzero = __bzero +# endif + +# undef weak_alias +# define weak_alias(original, alias) + +# include <sysdeps/i386/i686/bzero.S> +#endif diff --git a/sysdeps/i386/i686/multiarch/bzero.S b/sysdeps/i386/i686/multiarch/bzero.S deleted file mode 100644 index 3bad4178eb..0000000000 --- a/sysdeps/i386/i686/multiarch/bzero.S +++ /dev/null @@ -1,62 +0,0 @@ -/* Multiple versions of bzero - All versions must be listed in ifunc-impl-list.c. - Copyright (C) 2010-2016 Free Software Foundation, Inc. - Contributed by Intel Corporation. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#include <sysdep.h> -#include <init-arch.h> - -/* Define multiple versions only for the definition in lib. */ -#if IS_IN (libc) - .text -ENTRY(__bzero) - .type __bzero, @gnu_indirect_function - LOAD_GOT_AND_RTLD_GLOBAL_RO - LOAD_FUNC_GOT_EAX (__bzero_ia32) - HAS_CPU_FEATURE (SSE2) - jz 2f - LOAD_FUNC_GOT_EAX ( __bzero_sse2) - HAS_CPU_FEATURE (Fast_Rep_String) - jz 2f - LOAD_FUNC_GOT_EAX (__bzero_sse2_rep) -2: ret -END(__bzero) - -# undef ENTRY -# define ENTRY(name) \ - .type __bzero_ia32, @function; \ - .p2align 4; \ - .globl __bzero_ia32; \ - .hidden __bzero_ia32; \ - __bzero_ia32: cfi_startproc; \ - CALL_MCOUNT -# undef END -# define END(name) \ - cfi_endproc; .size __bzero_ia32, .-__bzero_ia32 - -# ifdef SHARED -# undef libc_hidden_builtin_def -/* IFUNC doesn't work with the hidden functions in shared library since - they will be called without setting up EBX needed for PLT which is - used by IFUNC. */ -# define libc_hidden_builtin_def(name) \ - .globl __GI___bzero; __GI___bzero = __bzero_ia32 -# endif -#endif - -#include "../bzero.S" diff --git a/sysdeps/i386/i686/multiarch/wcschr.S b/sysdeps/i386/i686/multiarch/bzero.c index b7f50e46ea..4f1d739f28 100644 --- a/sysdeps/i386/i686/multiarch/wcschr.S +++ b/sysdeps/i386/i686/multiarch/bzero.c @@ -1,7 +1,6 @@ -/* Multiple versions of wcschr +/* Multiple versions of bzero. All versions must be listed in ifunc-impl-list.c. - Copyright (C) 2011-2016 Free Software Foundation, Inc. - Contributed by Intel Corporation. + Copyright (C) 2017-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -18,19 +17,16 @@ License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ -#include <sysdep.h> -#include <init-arch.h> - +/* Define multiple versions only for the definition in libc. */ #if IS_IN (libc) - .text -ENTRY(__wcschr) - .type wcschr, @gnu_indirect_function - LOAD_GOT_AND_RTLD_GLOBAL_RO - LOAD_FUNC_GOT_EAX (__wcschr_ia32) - HAS_CPU_FEATURE (SSE2) - jz 2f - LOAD_FUNC_GOT_EAX (__wcschr_sse2) -2: ret -END(__wcschr) -weak_alias (__wcschr, wcschr) +# define bzero __redirect_bzero +# include <string.h> +# undef bzero + +# define SYMBOL_NAME bzero +# include "ifunc-memset.h" + +libc_ifunc_redirected (__redirect_bzero, __bzero, IFUNC_SELECTOR ()); + +weak_alias (__bzero, bzero) #endif diff --git a/sysdeps/i386/i686/multiarch/ifunc-defines.sym b/sysdeps/i386/i686/multiarch/ifunc-defines.sym deleted file mode 100644 index 96e9cfaf61..0000000000 --- a/sysdeps/i386/i686/multiarch/ifunc-defines.sym +++ /dev/null @@ -1,19 +0,0 @@ -#include "init-arch.h" -#include <stddef.h> - --- - -CPU_FEATURES_SIZE sizeof (struct cpu_features) -CPUID_OFFSET offsetof (struct cpu_features, cpuid) -CPUID_SIZE sizeof (struct cpuid_registers) -CPUID_EAX_OFFSET offsetof (struct cpuid_registers, eax) -CPUID_EBX_OFFSET offsetof (struct cpuid_registers, ebx) -CPUID_ECX_OFFSET offsetof (struct cpuid_registers, ecx) -CPUID_EDX_OFFSET offsetof (struct cpuid_registers, edx) -FAMILY_OFFSET offsetof (struct cpu_features, family) -MODEL_OFFSET offsetof (struct cpu_features, model) -FEATURE_OFFSET offsetof (struct cpu_features, feature) -FEATURE_SIZE sizeof (unsigned int) - -COMMON_CPUID_INDEX_1 -FEATURE_INDEX_1 diff --git a/sysdeps/i386/i686/multiarch/ifunc-impl-list.c b/sysdeps/i386/i686/multiarch/ifunc-impl-list.c index ef30a95432..a926b04acd 100644 --- a/sysdeps/i386/i686/multiarch/ifunc-impl-list.c +++ b/sysdeps/i386/i686/multiarch/ifunc-impl-list.c @@ -1,5 +1,5 @@ /* Enumerate available IFUNC implementations of a function. i686 version. - Copyright (C) 2012-2016 Free Software Foundation, Inc. + Copyright (C) 2012-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -70,6 +70,7 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array, __memcmp_ssse3) IFUNC_IMPL_ADD (array, i, memcmp, 1, __memcmp_ia32)) +#ifdef SHARED /* Support sysdeps/i386/i686/multiarch/memmove_chk.S. */ IFUNC_IMPL (i, name, __memmove_chk, IFUNC_IMPL_ADD (array, i, __memmove_chk, @@ -83,6 +84,7 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array, __memmove_chk_sse2_unaligned) IFUNC_IMPL_ADD (array, i, __memmove_chk, 1, __memmove_chk_ia32)) +#endif /* Support sysdeps/i386/i686/multiarch/memmove.S. */ IFUNC_IMPL (i, name, memmove, @@ -102,6 +104,7 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array, __memrchr_sse2) IFUNC_IMPL_ADD (array, i, memrchr, 1, __memrchr_ia32)) +#ifdef SHARED /* Support sysdeps/i386/i686/multiarch/memset_chk.S. */ IFUNC_IMPL (i, name, __memset_chk, IFUNC_IMPL_ADD (array, i, __memset_chk, @@ -112,6 +115,7 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array, __memset_chk_sse2) IFUNC_IMPL_ADD (array, i, __memset_chk, 1, __memset_chk_ia32)) +#endif /* Support sysdeps/i386/i686/multiarch/memset.S. */ IFUNC_IMPL (i, name, memset, diff --git a/sysdeps/i386/i686/multiarch/ifunc-memmove.h b/sysdeps/i386/i686/multiarch/ifunc-memmove.h new file mode 100644 index 0000000000..f0e9756178 --- /dev/null +++ b/sysdeps/i386/i686/multiarch/ifunc-memmove.h @@ -0,0 +1,45 @@ +/* Common definition for memmove/memmove_chk ifunc selections. + All versions must be listed in ifunc-impl-list.c. + Copyright (C) 2017-2018 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#include <init-arch.h> + +extern __typeof (REDIRECT_NAME) OPTIMIZE (ia32) attribute_hidden; +extern __typeof (REDIRECT_NAME) OPTIMIZE (sse2_unaligned) + attribute_hidden; +extern __typeof (REDIRECT_NAME) OPTIMIZE (ssse3) attribute_hidden; +extern __typeof (REDIRECT_NAME) OPTIMIZE (ssse3_rep) attribute_hidden; + +static inline void * +IFUNC_SELECTOR (void) +{ + const struct cpu_features* cpu_features = __get_cpu_features (); + + if (CPU_FEATURES_ARCH_P (cpu_features, Fast_Unaligned_Load)) + return OPTIMIZE (sse2_unaligned); + + if (CPU_FEATURES_CPU_P (cpu_features, SSSE3)) + { + if (CPU_FEATURES_ARCH_P (cpu_features, Fast_Rep_String)) + return OPTIMIZE (ssse3_rep); + + return OPTIMIZE (ssse3); + } + + return OPTIMIZE (ia32); +} diff --git a/sysdeps/i386/i686/multiarch/ifunc-memset.h b/sysdeps/i386/i686/multiarch/ifunc-memset.h new file mode 100644 index 0000000000..e96609439a --- /dev/null +++ b/sysdeps/i386/i686/multiarch/ifunc-memset.h @@ -0,0 +1,40 @@ +/* Common definition for memset/memset_chk ifunc selections. + All versions must be listed in ifunc-impl-list.c. + Copyright (C) 2017-2018 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#include <init-arch.h> + +extern __typeof (REDIRECT_NAME) OPTIMIZE (ia32) attribute_hidden; +extern __typeof (REDIRECT_NAME) OPTIMIZE (sse2) attribute_hidden; +extern __typeof (REDIRECT_NAME) OPTIMIZE (sse2_rep) attribute_hidden; + +static inline void * +IFUNC_SELECTOR (void) +{ + const struct cpu_features* cpu_features = __get_cpu_features (); + + if (CPU_FEATURES_CPU_P (cpu_features, SSE2)) + { + if (CPU_FEATURES_ARCH_P (cpu_features, Fast_Rep_String)) + return OPTIMIZE (sse2_rep); + + return OPTIMIZE (sse2); + } + + return OPTIMIZE (ia32); +} diff --git a/sysdeps/i386/i686/multiarch/ifunc-sse2-bsf.h b/sysdeps/i386/i686/multiarch/ifunc-sse2-bsf.h new file mode 100644 index 0000000000..f5e7f1b846 --- /dev/null +++ b/sysdeps/i386/i686/multiarch/ifunc-sse2-bsf.h @@ -0,0 +1,40 @@ +/* Common definition for ifunc selections optimized with SSE2 and BSF. + All versions must be listed in ifunc-impl-list.c. + Copyright (C) 2017-2018 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#include <init-arch.h> + +extern __typeof (REDIRECT_NAME) OPTIMIZE (ia32) attribute_hidden; +extern __typeof (REDIRECT_NAME) OPTIMIZE (sse2) attribute_hidden; +extern __typeof (REDIRECT_NAME) OPTIMIZE (sse2_bsf) attribute_hidden; + +static inline void * +IFUNC_SELECTOR (void) +{ + const struct cpu_features* cpu_features = __get_cpu_features (); + + if (CPU_FEATURES_CPU_P (cpu_features, SSE2)) + { + if (CPU_FEATURES_ARCH_P (cpu_features, Slow_BSF)) + return OPTIMIZE (sse2); + + return OPTIMIZE (sse2_bsf); + } + + return OPTIMIZE (ia32); +} diff --git a/sysdeps/i386/i686/multiarch/ifunc-sse2-ssse3.h b/sysdeps/i386/i686/multiarch/ifunc-sse2-ssse3.h new file mode 100644 index 0000000000..a33fe44f50 --- /dev/null +++ b/sysdeps/i386/i686/multiarch/ifunc-sse2-ssse3.h @@ -0,0 +1,40 @@ +/* Common definition for ifunc selections optimized with SSE2 and + SSSE3. + All versions must be listed in ifunc-impl-list.c. + Copyright (C) 2017-2018 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#include <init-arch.h> + +extern __typeof (REDIRECT_NAME) OPTIMIZE (ia32) attribute_hidden; +extern __typeof (REDIRECT_NAME) OPTIMIZE (sse2) attribute_hidden; +extern __typeof (REDIRECT_NAME) OPTIMIZE (ssse3) attribute_hidden; + +static inline void * +IFUNC_SELECTOR (void) +{ + const struct cpu_features* cpu_features = __get_cpu_features (); + + if (CPU_FEATURES_CPU_P (cpu_features, SSE2) + && CPU_FEATURES_ARCH_P (cpu_features, Fast_Rep_String)) + return OPTIMIZE (sse2); + + if (CPU_FEATURES_CPU_P (cpu_features, SSSE3)) + return OPTIMIZE (ssse3); + + return OPTIMIZE (ia32); +} diff --git a/sysdeps/i386/i686/multiarch/ifunc-sse2.h b/sysdeps/i386/i686/multiarch/ifunc-sse2.h new file mode 100644 index 0000000000..706c0329c9 --- /dev/null +++ b/sysdeps/i386/i686/multiarch/ifunc-sse2.h @@ -0,0 +1,34 @@ +/* Common definition for ifunc selections optimized with SSE2. + All versions must be listed in ifunc-impl-list.c. + Copyright (C) 2017-2018 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#include <init-arch.h> + +extern __typeof (REDIRECT_NAME) OPTIMIZE (ia32) attribute_hidden; +extern __typeof (REDIRECT_NAME) OPTIMIZE (sse2) attribute_hidden; + +static inline void * +IFUNC_SELECTOR (void) +{ + const struct cpu_features* cpu_features = __get_cpu_features (); + + if (CPU_FEATURES_CPU_P (cpu_features, SSE2)) + return OPTIMIZE (sse2); + + return OPTIMIZE (ia32); +} diff --git a/sysdeps/i386/i686/multiarch/ifunc-sse4_2.h b/sysdeps/i386/i686/multiarch/ifunc-sse4_2.h new file mode 100644 index 0000000000..de7fa2f185 --- /dev/null +++ b/sysdeps/i386/i686/multiarch/ifunc-sse4_2.h @@ -0,0 +1,34 @@ +/* Common definition for ifunc selections optimized with SSE4_2. + All versions must be listed in ifunc-impl-list.c. + Copyright (C) 2017-2018 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#include <init-arch.h> + +extern __typeof (REDIRECT_NAME) OPTIMIZE (ia32) attribute_hidden; +extern __typeof (REDIRECT_NAME) OPTIMIZE (sse42) attribute_hidden; + +static inline void * +IFUNC_SELECTOR (void) +{ + const struct cpu_features* cpu_features = __get_cpu_features (); + + if (CPU_FEATURES_CPU_P (cpu_features, SSE4_2)) + return OPTIMIZE (sse42); + + return OPTIMIZE (ia32); +} diff --git a/sysdeps/i386/i686/multiarch/ifunc-ssse3-sse4_2.h b/sysdeps/i386/i686/multiarch/ifunc-ssse3-sse4_2.h new file mode 100644 index 0000000000..bd772a9298 --- /dev/null +++ b/sysdeps/i386/i686/multiarch/ifunc-ssse3-sse4_2.h @@ -0,0 +1,39 @@ +/* Common definition for ifunc selections optimized with SSSE3 and + SSE4_2. + All versions must be listed in ifunc-impl-list.c. + Copyright (C) 2017-2018 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#include <init-arch.h> + +extern __typeof (REDIRECT_NAME) OPTIMIZE (ia32) attribute_hidden; +extern __typeof (REDIRECT_NAME) OPTIMIZE (ssse3) attribute_hidden; +extern __typeof (REDIRECT_NAME) OPTIMIZE (sse4_2) attribute_hidden; + +static inline void * +IFUNC_SELECTOR (void) +{ + const struct cpu_features* cpu_features = __get_cpu_features (); + + if (CPU_FEATURES_CPU_P (cpu_features, SSE4_2)) + return OPTIMIZE (sse4_2); + + if (CPU_FEATURES_CPU_P (cpu_features, SSSE3)) + return OPTIMIZE (ssse3); + + return OPTIMIZE (ia32); +} diff --git a/sysdeps/i386/i686/multiarch/memchr-ia32.S b/sysdeps/i386/i686/multiarch/memchr-ia32.S new file mode 100644 index 0000000000..9c870e5b20 --- /dev/null +++ b/sysdeps/i386/i686/multiarch/memchr-ia32.S @@ -0,0 +1,35 @@ +/* memchr optimized for i686. + Copyright (C) 2017-2018 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#if IS_IN (libc) +# define __memchr __memchr_ia32 + +# ifdef SHARED +# undef libc_hidden_builtin_def +/* IFUNC doesn't work with the hidden functions in shared library since + they will be called without setting up EBX needed for PLT which is + used by IFUNC. */ +# define libc_hidden_builtin_def(name) \ + .globl __GI_memchr; __GI_memchr = __memchr +# endif + +# undef weak_alias +# define weak_alias(original, alias) +#endif + +#include <sysdeps/i386/memchr.S> diff --git a/sysdeps/i386/i686/multiarch/memchr-sse2-bsf.S b/sysdeps/i386/i686/multiarch/memchr-sse2-bsf.S index 5d48898ffa..c8278ba36d 100644 --- a/sysdeps/i386/i686/multiarch/memchr-sse2-bsf.S +++ b/sysdeps/i386/i686/multiarch/memchr-sse2-bsf.S @@ -1,5 +1,5 @@ /* Optimized memchr with sse2 - Copyright (C) 2011-2016 Free Software Foundation, Inc. + Copyright (C) 2011-2018 Free Software Foundation, Inc. Contributed by Intel Corporation. This file is part of the GNU C Library. @@ -149,9 +149,15 @@ L(crosscache): .p2align 4 L(unaligned_no_match): # ifndef USE_AS_RAWMEMCHR - sub $16, %edx + /* Calculate the last acceptable address and check for possible + addition overflow by using satured math: + edx = ecx + edx + edx |= -(edx < ecx) */ add %ecx, %edx - jle L(return_null) + sbb %eax, %eax + or %eax, %edx + sub $16, %edx + jbe L(return_null) add $16, %edi # else add $16, %edx diff --git a/sysdeps/i386/i686/multiarch/memchr-sse2.S b/sysdeps/i386/i686/multiarch/memchr-sse2.S index 83930b7d38..303242ceee 100644 --- a/sysdeps/i386/i686/multiarch/memchr-sse2.S +++ b/sysdeps/i386/i686/multiarch/memchr-sse2.S @@ -1,5 +1,5 @@ /* Optimized memchr with sse2 without bsf - Copyright (C) 2011-2016 Free Software Foundation, Inc. + Copyright (C) 2011-2018 Free Software Foundation, Inc. Contributed by Intel Corporation. This file is part of the GNU C Library. @@ -117,9 +117,13 @@ L(crosscache): # ifndef USE_AS_RAWMEMCHR jnz L(match_case2_prolog1) - lea -16(%edx), %edx - add %ecx, %edx - jle L(return_null) + /* "ecx" is less than 16. Calculate "edx + ecx - 16" by using + "edx - (16 - ecx)" instead of "(edx + ecx) - 16" to void + possible addition overflow. */ + neg %ecx + add $16, %ecx + sub %ecx, %edx + jbe L(return_null) lea 16(%edi), %edi # else jnz L(match_case1_prolog1) diff --git a/sysdeps/i386/i686/multiarch/memchr.S b/sysdeps/i386/i686/multiarch/memchr.S deleted file mode 100644 index 08e7489f3e..0000000000 --- a/sysdeps/i386/i686/multiarch/memchr.S +++ /dev/null @@ -1,65 +0,0 @@ -/* Multiple versions of memchr - All versions must be listed in ifunc-impl-list.c. - Copyright (C) 2011-2016 Free Software Foundation, Inc. - Contributed by Intel Corporation. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#include <sysdep.h> -#include <init-arch.h> - -#if IS_IN (libc) - .text -ENTRY(__memchr) - .type __memchr, @gnu_indirect_function - LOAD_GOT_AND_RTLD_GLOBAL_RO - HAS_CPU_FEATURE (SSE2) - jz 2f - HAS_ARCH_FEATURE (Slow_BSF) - jz 3f - - LOAD_FUNC_GOT_EAX ( __memchr_sse2) - ret - -2: LOAD_FUNC_GOT_EAX (__memchr_ia32) - ret - -3: LOAD_FUNC_GOT_EAX (__memchr_sse2_bsf) - ret -END(__memchr) - -weak_alias(__memchr, memchr) - -# undef ENTRY -# define ENTRY(name) \ - .type __memchr_ia32, @function; \ - .globl __memchr_ia32; \ - .p2align 4; \ - __memchr_ia32: cfi_startproc; \ - CALL_MCOUNT -# undef END -# define END(name) \ - cfi_endproc; .size __memchr_ia32, .-__memchr_ia32 - -# undef libc_hidden_builtin_def -/* IFUNC doesn't work with the hidden functions in shared library since - they will be called without setting up EBX needed for PLT which is - used by IFUNC. */ -# define libc_hidden_builtin_def(name) \ - .globl __GI_memchr; __GI_memchr = __memchr_ia32 - -#endif -#include "../../memchr.S" diff --git a/sysdeps/i386/i686/multiarch/wcslen.S b/sysdeps/i386/i686/multiarch/memchr.c index 42e0c6b2c0..32d10b9ed3 100644 --- a/sysdeps/i386/i686/multiarch/wcslen.S +++ b/sysdeps/i386/i686/multiarch/memchr.c @@ -1,7 +1,6 @@ -/* Multiple versions of wcslen +/* Multiple versions of memchr. All versions must be listed in ifunc-impl-list.c. - Copyright (C) 2011-2016 Free Software Foundation, Inc. - Contributed by Intel Corporation. + Copyright (C) 2017-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -18,20 +17,16 @@ License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ -#include <sysdep.h> -#include <init-arch.h> - +/* Define multiple versions only for the definition in libc. */ #if IS_IN (libc) - .text -ENTRY(__wcslen) - .type __wcslen, @gnu_indirect_function - LOAD_GOT_AND_RTLD_GLOBAL_RO - LOAD_FUNC_GOT_EAX (__wcslen_ia32) - HAS_CPU_FEATURE (SSE2) - jz 2f - LOAD_FUNC_GOT_EAX (__wcslen_sse2) -2: ret -END(__wcslen) +# define memchr __redirect_memchr +# include <string.h> +# undef memchr + +# define SYMBOL_NAME memchr +# include "ifunc-sse2-bsf.h" + +libc_ifunc_redirected (__redirect_memchr, __memchr, IFUNC_SELECTOR ()); -weak_alias(__wcslen, wcslen) +weak_alias (__memchr, memchr) #endif diff --git a/sysdeps/i386/i686/multiarch/memcmp-ia32.S b/sysdeps/i386/i686/multiarch/memcmp-ia32.S new file mode 100644 index 0000000000..b468350474 --- /dev/null +++ b/sysdeps/i386/i686/multiarch/memcmp-ia32.S @@ -0,0 +1,35 @@ +/* memcmp optimized for i686. + Copyright (C) 2017-2018 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#if IS_IN (libc) +# define memcmp __memcmp_ia32 + +# ifdef SHARED +# undef libc_hidden_builtin_def +/* IFUNC doesn't work with the hidden functions in shared library since + they will be called without setting up EBX needed for PLT which is + used by IFUNC. */ +# define libc_hidden_builtin_def(name) \ + .globl __GI_memcmp; __GI_memcmp = memcmp +# endif + +# undef weak_alias +# define weak_alias(original, alias) +#endif + +#include <sysdeps/i386/i686/memcmp.S> diff --git a/sysdeps/i386/i686/multiarch/memcmp-sse4.S b/sysdeps/i386/i686/multiarch/memcmp-sse4.S index e3e01600f8..bc2cb2729d 100644 --- a/sysdeps/i386/i686/multiarch/memcmp-sse4.S +++ b/sysdeps/i386/i686/multiarch/memcmp-sse4.S @@ -1,5 +1,5 @@ /* memcmp with SSE4.2, wmemcmp with SSE4.2 - Copyright (C) 2010-2016 Free Software Foundation, Inc. + Copyright (C) 2010-2018 Free Software Foundation, Inc. Contributed by Intel Corporation. This file is part of the GNU C Library. @@ -43,7 +43,7 @@ # define RETURN POP (%ebx); ret; CFI_PUSH (%ebx) -# ifdef SHARED +# ifdef PIC # define JMPTBL(I, B) I - B /* Load an entry in a jump table into EBX and branch to it. TABLE is a @@ -59,7 +59,7 @@ absolute address. */ \ addl (%ebx,INDEX,SCALE), %ebx; \ /* We loaded the jump table and adjusted EDX/ESI. Go. */ \ - jmp *%ebx + _CET_NOTRACK jmp *%ebx # else # define JMPTBL(I, B) I @@ -67,7 +67,7 @@ jump table with relative offsets. INDEX is a register contains the index into the jump table. SCALE is the scale of INDEX. */ # define BRANCH_TO_JMPTBL_ENTRY(TABLE, INDEX, SCALE) \ - jmp *TABLE(,INDEX,SCALE) + _CET_NOTRACK jmp *TABLE(,INDEX,SCALE) # endif diff --git a/sysdeps/i386/i686/multiarch/memcmp-ssse3.S b/sysdeps/i386/i686/multiarch/memcmp-ssse3.S index f59bfcb0c5..31a0b2908e 100644 --- a/sysdeps/i386/i686/multiarch/memcmp-ssse3.S +++ b/sysdeps/i386/i686/multiarch/memcmp-ssse3.S @@ -1,5 +1,5 @@ /* memcmp with SSSE3, wmemcmp with SSSE3 - Copyright (C) 2010-2016 Free Software Foundation, Inc. + Copyright (C) 2010-2018 Free Software Foundation, Inc. Contributed by Intel Corporation. This file is part of the GNU C Library. diff --git a/sysdeps/i386/i686/multiarch/memcmp.S b/sysdeps/i386/i686/multiarch/memcmp.S deleted file mode 100644 index 059a78baa7..0000000000 --- a/sysdeps/i386/i686/multiarch/memcmp.S +++ /dev/null @@ -1,62 +0,0 @@ -/* Multiple versions of memcmp - All versions must be listed in ifunc-impl-list.c. - Copyright (C) 2010-2016 Free Software Foundation, Inc. - Contributed by Intel Corporation. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#include <sysdep.h> -#include <init-arch.h> - -/* Define multiple versions only for the definition in libc. */ -#if IS_IN (libc) - .text -ENTRY(memcmp) - .type memcmp, @gnu_indirect_function - LOAD_GOT_AND_RTLD_GLOBAL_RO - LOAD_FUNC_GOT_EAX (__memcmp_ia32) - HAS_CPU_FEATURE (SSSE3) - jz 2f - LOAD_FUNC_GOT_EAX (__memcmp_ssse3) - HAS_CPU_FEATURE (SSE4_2) - jz 2f - LOAD_FUNC_GOT_EAX (__memcmp_sse4_2) -2: ret -END(memcmp) - -# undef ENTRY -# define ENTRY(name) \ - .type __memcmp_ia32, @function; \ - .p2align 4; \ - .globl __memcmp_ia32; \ - .hidden __memcmp_ia32; \ - __memcmp_ia32: cfi_startproc; \ - CALL_MCOUNT -# undef END -# define END(name) \ - cfi_endproc; .size __memcmp_ia32, .-__memcmp_ia32 - -# ifdef SHARED -# undef libc_hidden_builtin_def -/* IFUNC doesn't work with the hidden functions in shared library since - they will be called without setting up EBX needed for PLT which is - used by IFUNC. */ -# define libc_hidden_builtin_def(name) \ - .globl __GI_memcmp; __GI_memcmp = __memcmp_ia32 -# endif -#endif - -#include "../memcmp.S" diff --git a/sysdeps/i386/i686/multiarch/strnlen.S b/sysdeps/i386/i686/multiarch/memcmp.c index e77562d2cf..dd5a93a26c 100644 --- a/sysdeps/i386/i686/multiarch/strnlen.S +++ b/sysdeps/i386/i686/multiarch/memcmp.c @@ -1,7 +1,6 @@ -/* Multiple versions of strnlen +/* Multiple versions of memcmp. All versions must be listed in ifunc-impl-list.c. - Copyright (C) 2011-2016 Free Software Foundation, Inc. - Contributed by Intel Corporation. + Copyright (C) 2017-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -18,20 +17,16 @@ License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ -#include <sysdep.h> -#include <init-arch.h> - +/* Define multiple versions only for the definition in libc. */ #if IS_IN (libc) - .text -ENTRY(__strnlen) - .type __strnlen, @gnu_indirect_function - LOAD_GOT_AND_RTLD_GLOBAL_RO - LOAD_FUNC_GOT_EAX (__strnlen_ia32) - HAS_CPU_FEATURE (SSE2) - jz 2f - LOAD_FUNC_GOT_EAX (__strnlen_sse2) -2: ret -END(__strnlen) +# define memcmp __redirect_memcmp +# include <string.h> +# undef memcmp + +# define SYMBOL_NAME memcmp +# include "ifunc-ssse3-sse4_2.h" + +libc_ifunc_redirected (__redirect_memcmp, memcmp, IFUNC_SELECTOR ()); -weak_alias(__strnlen, strnlen) +weak_alias (memcmp, bcmp) #endif diff --git a/sysdeps/i386/i686/multiarch/memcpy-ia32.S b/sysdeps/i386/i686/multiarch/memcpy-ia32.S new file mode 100644 index 0000000000..fe772f0dac --- /dev/null +++ b/sysdeps/i386/i686/multiarch/memcpy-ia32.S @@ -0,0 +1,31 @@ +/* memcpy optimized for i686. + Copyright (C) 2017-2018 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#if defined SHARED && IS_IN (libc) +# define memcpy __memcpy_ia32 +# define __memcpy_chk __memcpy_chk_ia32 + +# undef libc_hidden_builtin_def +/* IFUNC doesn't work with the hidden functions in shared library since + they will be called without setting up EBX needed for PLT which is + used by IFUNC. */ +# define libc_hidden_builtin_def(name) \ + .globl __GI_memcpy; __GI_memcpy = memcpy +#endif + +#include <sysdeps/i386/i686/memcpy.S> diff --git a/sysdeps/i386/i686/multiarch/memcpy-sse2-unaligned.S b/sysdeps/i386/i686/multiarch/memcpy-sse2-unaligned.S index 76f34291a3..9aa17de99c 100644 --- a/sysdeps/i386/i686/multiarch/memcpy-sse2-unaligned.S +++ b/sysdeps/i386/i686/multiarch/memcpy-sse2-unaligned.S @@ -1,5 +1,5 @@ /* memcpy optimized with SSE2 unaligned memory access instructions. - Copyright (C) 2014-2016 Free Software Foundation, Inc. + Copyright (C) 2014-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -56,7 +56,7 @@ # define RETURN RETURN_END; CFI_PUSH (%ebx) .section .text.sse2,"ax",@progbits -# if !defined USE_AS_BCOPY +# if !defined USE_AS_BCOPY && defined SHARED ENTRY (MEMCPY_CHK) movl 12(%esp), %eax cmpl %eax, 16(%esp) @@ -72,7 +72,7 @@ ENTRY (MEMCPY) cmp %edx, %eax # ifdef USE_AS_MEMMOVE - jg L(check_forward) + ja L(check_forward) L(mm_len_0_or_more_backward): /* Now do checks for lengths. We do [0..16], [16..32], [32..64], [64..128] @@ -81,7 +81,7 @@ L(mm_len_0_or_more_backward): jbe L(mm_len_0_16_bytes_backward) cmpl $32, %ecx - jg L(mm_len_32_or_more_backward) + ja L(mm_len_32_or_more_backward) /* Copy [0..32] and return. */ movdqu (%eax), %xmm0 @@ -92,7 +92,7 @@ L(mm_len_0_or_more_backward): L(mm_len_32_or_more_backward): cmpl $64, %ecx - jg L(mm_len_64_or_more_backward) + ja L(mm_len_64_or_more_backward) /* Copy [0..64] and return. */ movdqu (%eax), %xmm0 @@ -107,7 +107,7 @@ L(mm_len_32_or_more_backward): L(mm_len_64_or_more_backward): cmpl $128, %ecx - jg L(mm_len_128_or_more_backward) + ja L(mm_len_128_or_more_backward) /* Copy [0..128] and return. */ movdqu (%eax), %xmm0 @@ -132,7 +132,7 @@ L(mm_len_128_or_more_backward): add %ecx, %eax cmp %edx, %eax movl SRC(%esp), %eax - jle L(forward) + jbe L(forward) PUSH (%esi) PUSH (%edi) PUSH (%ebx) @@ -157,7 +157,7 @@ L(mm_len_128_or_more_backward): # ifdef SHARED_CACHE_SIZE_HALF cmp $SHARED_CACHE_SIZE_HALF, %edi # else -# ifdef SHARED +# ifdef PIC PUSH (%ebx) SETUP_PIC_REG (bx) add $_GLOBAL_OFFSET_TABLE_, %ebx @@ -269,7 +269,7 @@ L(check_forward): add %edx, %ecx cmp %eax, %ecx movl LEN(%esp), %ecx - jle L(forward) + jbe L(forward) /* Now do checks for lengths. We do [0..16], [0..32], [0..64], [0..128] separately. */ @@ -351,7 +351,7 @@ L(mm_len_128_or_more_forward): # ifdef SHARED_CACHE_SIZE_HALF cmp $SHARED_CACHE_SIZE_HALF, %edi # else -# ifdef SHARED +# ifdef PIC PUSH (%ebx) SETUP_PIC_REG(bx) add $_GLOBAL_OFFSET_TABLE_, %ebx @@ -469,7 +469,7 @@ L(forward): # ifdef SHARED_CACHE_SIZE_HALF cmp $SHARED_CACHE_SIZE_HALF, %ecx # else -# ifdef SHARED +# ifdef PIC SETUP_PIC_REG(bx) add $_GLOBAL_OFFSET_TABLE_, %ebx cmp __x86_shared_cache_size_half@GOTOFF(%ebx), %ecx diff --git a/sysdeps/i386/i686/multiarch/memcpy-ssse3-rep.S b/sysdeps/i386/i686/multiarch/memcpy-ssse3-rep.S index 460c37e39a..129310bd8a 100644 --- a/sysdeps/i386/i686/multiarch/memcpy-ssse3-rep.S +++ b/sysdeps/i386/i686/multiarch/memcpy-ssse3-rep.S @@ -1,5 +1,5 @@ /* memcpy with SSSE3 and REP string. - Copyright (C) 2010-2016 Free Software Foundation, Inc. + Copyright (C) 2010-2018 Free Software Foundation, Inc. Contributed by Intel Corporation. This file is part of the GNU C Library. @@ -52,7 +52,7 @@ #define PUSH(REG) pushl REG; CFI_PUSH (REG) #define POP(REG) popl REG; CFI_POP (REG) -#ifdef SHARED +#ifdef PIC # define PARMS 8 /* Preserve EBX. */ # define ENTRANCE PUSH (%ebx); # define RETURN_END POP (%ebx); ret @@ -71,7 +71,7 @@ absolute address. */ \ addl (%ebx,INDEX,SCALE), %ebx; \ /* We loaded the jump table. Go. */ \ - jmp *%ebx + _CET_NOTRACK jmp *%ebx # define BRANCH_TO_JMPTBL_ENTRY_VALUE(TABLE) \ addl $(TABLE - .), %ebx @@ -79,7 +79,7 @@ # define BRANCH_TO_JMPTBL_ENTRY_TAIL(TABLE, INDEX, SCALE) \ addl (%ebx,INDEX,SCALE), %ebx; \ /* We loaded the jump table. Go. */ \ - jmp *%ebx + _CET_NOTRACK jmp *%ebx #else # define PARMS 4 # define ENTRANCE @@ -91,16 +91,16 @@ absolute offsets. INDEX is a register contains the index into the jump table. SCALE is the scale of INDEX. */ # define BRANCH_TO_JMPTBL_ENTRY(TABLE, INDEX, SCALE) \ - jmp *TABLE(,INDEX,SCALE) + _CET_NOTRACK jmp *TABLE(,INDEX,SCALE) # define BRANCH_TO_JMPTBL_ENTRY_VALUE(TABLE) # define BRANCH_TO_JMPTBL_ENTRY_TAIL(TABLE, INDEX, SCALE) \ - jmp *TABLE(,INDEX,SCALE) + _CET_NOTRACK jmp *TABLE(,INDEX,SCALE) #endif .section .text.ssse3,"ax",@progbits -#if !defined USE_AS_BCOPY +#if !defined USE_AS_BCOPY && defined SHARED ENTRY (MEMCPY_CHK) movl 12(%esp), %eax cmpl %eax, 16(%esp) @@ -160,7 +160,7 @@ L(48bytesormore): #ifdef SHARED_CACHE_SIZE_HALF cmp $SHARED_CACHE_SIZE_HALF, %ecx #else -# ifdef SHARED +# ifdef PIC SETUP_PIC_REG(bx) add $_GLOBAL_OFFSET_TABLE_, %ebx cmp __x86_shared_cache_size_half@GOTOFF(%ebx), %ecx @@ -230,7 +230,7 @@ L(shl_0_gobble): #ifdef DATA_CACHE_SIZE_HALF cmp $DATA_CACHE_SIZE_HALF, %ecx #else -# ifdef SHARED +# ifdef PIC SETUP_PIC_REG(bx) add $_GLOBAL_OFFSET_TABLE_, %ebx mov __x86_data_cache_size_half@GOTOFF(%ebx), %edi diff --git a/sysdeps/i386/i686/multiarch/memcpy-ssse3.S b/sysdeps/i386/i686/multiarch/memcpy-ssse3.S index c694dc3ca9..5ead569a5e 100644 --- a/sysdeps/i386/i686/multiarch/memcpy-ssse3.S +++ b/sysdeps/i386/i686/multiarch/memcpy-ssse3.S @@ -1,5 +1,5 @@ /* memcpy with SSSE3 - Copyright (C) 2010-2016 Free Software Foundation, Inc. + Copyright (C) 2010-2018 Free Software Foundation, Inc. Contributed by Intel Corporation. This file is part of the GNU C Library. @@ -51,7 +51,7 @@ # define PUSH(REG) pushl REG; CFI_PUSH (REG) # define POP(REG) popl REG; CFI_POP (REG) -# ifdef SHARED +# ifdef PIC # define PARMS 8 /* Preserve EBX. */ # define ENTRANCE PUSH (%ebx); # define RETURN_END POP (%ebx); ret @@ -71,7 +71,7 @@ absolute address. */ \ addl (%ebx, INDEX, SCALE), %ebx; \ /* We loaded the jump table. Go. */ \ - jmp *%ebx + _CET_NOTRACK jmp *%ebx # else # define PARMS 4 @@ -85,11 +85,11 @@ jump table. SCALE is the scale of INDEX. */ # define BRANCH_TO_JMPTBL_ENTRY(TABLE, INDEX, SCALE) \ - jmp *TABLE(, INDEX, SCALE) + _CET_NOTRACK jmp *TABLE(, INDEX, SCALE) # endif .section .text.ssse3,"ax",@progbits -# if !defined USE_AS_BCOPY +# if !defined USE_AS_BCOPY && defined SHARED ENTRY (MEMCPY_CHK) movl 12(%esp), %eax cmpl %eax, 16(%esp) @@ -157,7 +157,7 @@ L(48bytesormore): # ifdef SHARED_CACHE_SIZE_HALF cmp $SHARED_CACHE_SIZE_HALF, %ecx # else -# ifdef SHARED +# ifdef PIC SETUP_PIC_REG(bx) add $_GLOBAL_OFFSET_TABLE_, %ebx cmp __x86_shared_cache_size_half@GOTOFF(%ebx), %ecx @@ -231,7 +231,7 @@ L(shl_0_gobble): # ifdef DATA_CACHE_SIZE_HALF cmp $DATA_CACHE_SIZE_HALF, %ecx # else -# ifdef SHARED +# ifdef PIC SETUP_PIC_REG(bx) add $_GLOBAL_OFFSET_TABLE_, %ebx cmp __x86_data_cache_size_half@GOTOFF(%ebx), %ecx @@ -390,7 +390,7 @@ L(shl_1): # ifdef DATA_CACHE_SIZE_HALF cmp $DATA_CACHE_SIZE_HALF, %ecx # else -# ifdef SHARED +# ifdef PIC SETUP_PIC_REG(bx) add $_GLOBAL_OFFSET_TABLE_, %ebx cmp __x86_data_cache_size_half@GOTOFF(%ebx), %ecx @@ -494,7 +494,7 @@ L(shl_2): # ifdef DATA_CACHE_SIZE_HALF cmp $DATA_CACHE_SIZE_HALF, %ecx # else -# ifdef SHARED +# ifdef PIC SETUP_PIC_REG(bx) add $_GLOBAL_OFFSET_TABLE_, %ebx cmp __x86_data_cache_size_half@GOTOFF(%ebx), %ecx @@ -598,7 +598,7 @@ L(shl_3): # ifdef DATA_CACHE_SIZE_HALF cmp $DATA_CACHE_SIZE_HALF, %ecx # else -# ifdef SHARED +# ifdef PIC SETUP_PIC_REG(bx) add $_GLOBAL_OFFSET_TABLE_, %ebx cmp __x86_data_cache_size_half@GOTOFF(%ebx), %ecx @@ -704,7 +704,7 @@ L(shl_4): # ifdef DATA_CACHE_SIZE_HALF cmp $DATA_CACHE_SIZE_HALF, %ecx # else -# ifdef SHARED +# ifdef PIC SETUP_PIC_REG(bx) add $_GLOBAL_OFFSET_TABLE_, %ebx cmp __x86_data_cache_size_half@GOTOFF(%ebx), %ecx @@ -810,7 +810,7 @@ L(shl_5): # ifdef DATA_CACHE_SIZE_HALF cmp $DATA_CACHE_SIZE_HALF, %ecx # else -# ifdef SHARED +# ifdef PIC SETUP_PIC_REG(bx) add $_GLOBAL_OFFSET_TABLE_, %ebx cmp __x86_data_cache_size_half@GOTOFF(%ebx), %ecx @@ -916,7 +916,7 @@ L(shl_6): # ifdef DATA_CACHE_SIZE_HALF cmp $DATA_CACHE_SIZE_HALF, %ecx # else -# ifdef SHARED +# ifdef PIC SETUP_PIC_REG(bx) add $_GLOBAL_OFFSET_TABLE_, %ebx cmp __x86_data_cache_size_half@GOTOFF(%ebx), %ecx @@ -1022,7 +1022,7 @@ L(shl_7): # ifdef DATA_CACHE_SIZE_HALF cmp $DATA_CACHE_SIZE_HALF, %ecx # else -# ifdef SHARED +# ifdef PIC SETUP_PIC_REG(bx) add $_GLOBAL_OFFSET_TABLE_, %ebx cmp __x86_data_cache_size_half@GOTOFF(%ebx), %ecx @@ -1126,7 +1126,7 @@ L(shl_8): # ifdef DATA_CACHE_SIZE_HALF cmp $DATA_CACHE_SIZE_HALF, %ecx # else -# ifdef SHARED +# ifdef PIC SETUP_PIC_REG(bx) add $_GLOBAL_OFFSET_TABLE_, %ebx cmp __x86_data_cache_size_half@GOTOFF(%ebx), %ecx @@ -1230,7 +1230,7 @@ L(shl_9): # ifdef DATA_CACHE_SIZE_HALF cmp $DATA_CACHE_SIZE_HALF, %ecx # else -# ifdef SHARED +# ifdef PIC SETUP_PIC_REG(bx) add $_GLOBAL_OFFSET_TABLE_, %ebx cmp __x86_data_cache_size_half@GOTOFF(%ebx), %ecx @@ -1335,7 +1335,7 @@ L(shl_10): # ifdef DATA_CACHE_SIZE_HALF cmp $DATA_CACHE_SIZE_HALF, %ecx # else -# ifdef SHARED +# ifdef PIC SETUP_PIC_REG(bx) add $_GLOBAL_OFFSET_TABLE_, %ebx cmp __x86_data_cache_size_half@GOTOFF(%ebx), %ecx @@ -1440,7 +1440,7 @@ L(shl_11): # ifdef DATA_CACHE_SIZE_HALF cmp $DATA_CACHE_SIZE_HALF, %ecx # else -# ifdef SHARED +# ifdef PIC SETUP_PIC_REG(bx) add $_GLOBAL_OFFSET_TABLE_, %ebx cmp __x86_data_cache_size_half@GOTOFF(%ebx), %ecx @@ -1545,7 +1545,7 @@ L(shl_12): # ifdef DATA_CACHE_SIZE_HALF cmp $DATA_CACHE_SIZE_HALF, %ecx # else -# ifdef SHARED +# ifdef PIC SETUP_PIC_REG(bx) add $_GLOBAL_OFFSET_TABLE_, %ebx cmp __x86_data_cache_size_half@GOTOFF(%ebx), %ecx @@ -1650,7 +1650,7 @@ L(shl_13): # ifdef DATA_CACHE_SIZE_HALF cmp $DATA_CACHE_SIZE_HALF, %ecx # else -# ifdef SHARED +# ifdef PIC SETUP_PIC_REG(bx) add $_GLOBAL_OFFSET_TABLE_, %ebx cmp __x86_data_cache_size_half@GOTOFF(%ebx), %ecx @@ -1755,7 +1755,7 @@ L(shl_14): # ifdef DATA_CACHE_SIZE_HALF cmp $DATA_CACHE_SIZE_HALF, %ecx # else -# ifdef SHARED +# ifdef PIC SETUP_PIC_REG(bx) add $_GLOBAL_OFFSET_TABLE_, %ebx cmp __x86_data_cache_size_half@GOTOFF(%ebx), %ecx @@ -1860,7 +1860,7 @@ L(shl_15): # ifdef DATA_CACHE_SIZE_HALF cmp $DATA_CACHE_SIZE_HALF, %ecx # else -# ifdef SHARED +# ifdef PIC SETUP_PIC_REG(bx) add $_GLOBAL_OFFSET_TABLE_, %ebx cmp __x86_data_cache_size_half@GOTOFF(%ebx), %ecx diff --git a/sysdeps/i386/i686/multiarch/memcpy.S b/sysdeps/i386/i686/multiarch/memcpy.S deleted file mode 100644 index 27913ea37a..0000000000 --- a/sysdeps/i386/i686/multiarch/memcpy.S +++ /dev/null @@ -1,78 +0,0 @@ -/* Multiple versions of memcpy - All versions must be listed in ifunc-impl-list.c. - Copyright (C) 2010-2016 Free Software Foundation, Inc. - Contributed by Intel Corporation. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#include <sysdep.h> -#include <init-arch.h> - -/* Define multiple versions only for the definition in lib and for - DSO. In static binaries we need memcpy before the initialization - happened. */ -#if defined SHARED && IS_IN (libc) - .text -ENTRY(memcpy) - .type memcpy, @gnu_indirect_function - LOAD_GOT_AND_RTLD_GLOBAL_RO - LOAD_FUNC_GOT_EAX (__memcpy_ia32) - HAS_CPU_FEATURE (SSE2) - jz 2f - LOAD_FUNC_GOT_EAX (__memcpy_sse2_unaligned) - HAS_ARCH_FEATURE (Fast_Unaligned_Load) - jnz 2f - HAS_CPU_FEATURE (SSSE3) - jz 2f - LOAD_FUNC_GOT_EAX (__memcpy_ssse3) - HAS_CPU_FEATURE (Fast_Rep_String) - jz 2f - LOAD_FUNC_GOT_EAX (__memcpy_ssse3_rep) -2: ret -END(memcpy) - -# undef ENTRY -# define ENTRY(name) \ - .type __memcpy_ia32, @function; \ - .p2align 4; \ - .globl __memcpy_ia32; \ - .hidden __memcpy_ia32; \ - __memcpy_ia32: cfi_startproc; \ - CALL_MCOUNT -# undef END -# define END(name) \ - cfi_endproc; .size __memcpy_ia32, .-__memcpy_ia32 - -# undef ENTRY_CHK -# define ENTRY_CHK(name) \ - .type __memcpy_chk_ia32, @function; \ - .globl __memcpy_chk_ia32; \ - .p2align 4; \ - __memcpy_chk_ia32: cfi_startproc; \ - CALL_MCOUNT -# undef END_CHK -# define END_CHK(name) \ - cfi_endproc; .size __memcpy_chk_ia32, .-__memcpy_chk_ia32 - -# undef libc_hidden_builtin_def -/* IFUNC doesn't work with the hidden functions in shared library since - they will be called without setting up EBX needed for PLT which is - used by IFUNC. */ -# define libc_hidden_builtin_def(name) \ - .globl __GI_memcpy; __GI_memcpy = __memcpy_ia32 -#endif - -#include "../memcpy.S" diff --git a/sysdeps/i386/i686/multiarch/memcpy.c b/sysdeps/i386/i686/multiarch/memcpy.c new file mode 100644 index 0000000000..b4a195686d --- /dev/null +++ b/sysdeps/i386/i686/multiarch/memcpy.c @@ -0,0 +1,32 @@ +/* Multiple versions of memcpy. + All versions must be listed in ifunc-impl-list.c. + Copyright (C) 2017-2018 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +/* Define multiple versions only for the definition in lib and for + DSO. In static binaries we need memcpy before the initialization + happened. */ +#if defined SHARED && IS_IN (libc) +# define memcpy __redirect_memcpy +# include <string.h> +# undef memcpy + +# define SYMBOL_NAME memcpy +# include "ifunc-memmove.h" + +libc_ifunc_redirected (__redirect_memcpy, memcpy, IFUNC_SELECTOR ()); +#endif diff --git a/sysdeps/i386/i686/multiarch/memcpy_chk-nonshared.S b/sysdeps/i386/i686/multiarch/memcpy_chk-nonshared.S new file mode 100644 index 0000000000..03f5bd95eb --- /dev/null +++ b/sysdeps/i386/i686/multiarch/memcpy_chk-nonshared.S @@ -0,0 +1,21 @@ +/* Non-shared version of memcpy_chk for i686. + Copyright (C) 2017-2018 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#if IS_IN (libc) && !defined SHARED +# include <sysdeps/i386/memcpy_chk.S> +#endif diff --git a/sysdeps/i386/i686/multiarch/memcpy_chk.S b/sysdeps/i386/i686/multiarch/memcpy_chk.S deleted file mode 100644 index 39bc3c25be..0000000000 --- a/sysdeps/i386/i686/multiarch/memcpy_chk.S +++ /dev/null @@ -1,50 +0,0 @@ -/* Multiple versions of __memcpy_chk - All versions must be listed in ifunc-impl-list.c. - Copyright (C) 2010-2016 Free Software Foundation, Inc. - Contributed by Intel Corporation. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#include <sysdep.h> -#include <init-arch.h> - -/* Define multiple versions only for the definition in lib and for - DSO. There are no multiarch memcpy functions for static binaries. - */ -#if IS_IN (libc) -# ifdef SHARED - .text -ENTRY(__memcpy_chk) - .type __memcpy_chk, @gnu_indirect_function - LOAD_GOT_AND_RTLD_GLOBAL_RO - LOAD_FUNC_GOT_EAX (__memcpy_chk_ia32) - HAS_CPU_FEATURE (SSE2) - jz 2f - LOAD_FUNC_GOT_EAX (__memcpy_chk_sse2_unaligned) - HAS_ARCH_FEATURE (Fast_Unaligned_Load) - jnz 2f - HAS_CPU_FEATURE (SSSE3) - jz 2f - LOAD_FUNC_GOT_EAX (__memcpy_chk_ssse3) - HAS_CPU_FEATURE (Fast_Rep_String) - jz 2f - LOAD_FUNC_GOT_EAX (__memcpy_chk_ssse3_rep) -2: ret -END(__memcpy_chk) -# else -# include "../memcpy_chk.S" -# endif -#endif diff --git a/sysdeps/i386/i686/multiarch/memcpy_chk.c b/sysdeps/i386/i686/multiarch/memcpy_chk.c new file mode 100644 index 0000000000..c9b901a6dd --- /dev/null +++ b/sysdeps/i386/i686/multiarch/memcpy_chk.c @@ -0,0 +1,31 @@ +/* Multiple versions of __memcpy_chk + All versions must be listed in ifunc-impl-list.c. + Copyright (C) 2017-2018 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +/* Define multiple versions only for the definition in libc.so. */ +#if IS_IN (libc) && defined SHARED +# define __memcpy_chk __redirect_memcpy_chk +# include <string.h> +# undef __memcpy_chk + +# define SYMBOL_NAME memcpy_chk +# include "ifunc-memmove.h" + +libc_ifunc_redirected (__redirect_memcpy_chk, __memcpy_chk, + IFUNC_SELECTOR ()); +#endif diff --git a/sysdeps/i386/i686/multiarch/memmove-ia32.S b/sysdeps/i386/i686/multiarch/memmove-ia32.S new file mode 100644 index 0000000000..334daaf897 --- /dev/null +++ b/sysdeps/i386/i686/multiarch/memmove-ia32.S @@ -0,0 +1,31 @@ +/* memmove optimized for i686. + Copyright (C) 2017-2018 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#if defined SHARED && IS_IN (libc) +# define memmove __memmove_ia32 +# define __memmove_chk __memmove_chk_ia32 + +# undef libc_hidden_builtin_def +/* IFUNC doesn't work with the hidden functions in shared library since + they will be called without setting up EBX needed for PLT which is + used by IFUNC. */ +# define libc_hidden_builtin_def(name) \ + .globl __GI_memmove; __GI_memmove = memmove +#endif + +#include <sysdeps/i386/i686/memmove.S> diff --git a/sysdeps/i386/i686/multiarch/memmove.S b/sysdeps/i386/i686/multiarch/memmove.S deleted file mode 100644 index 725a421eab..0000000000 --- a/sysdeps/i386/i686/multiarch/memmove.S +++ /dev/null @@ -1,89 +0,0 @@ -/* Multiple versions of memmove - All versions must be listed in ifunc-impl-list.c. - Copyright (C) 2010-2016 Free Software Foundation, Inc. - Contributed by Intel Corporation. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#include <sysdep.h> -#include <init-arch.h> - -/* Define multiple versions only for the definition in lib. */ -#if IS_IN (libc) - .text -ENTRY(memmove) - .type memmove, @gnu_indirect_function - LOAD_GOT_AND_RTLD_GLOBAL_RO - LOAD_FUNC_GOT_EAX (__memmove_ia32) - HAS_CPU_FEATURE (SSE2) - jz 2f - LOAD_FUNC_GOT_EAX (__memmove_sse2_unaligned) - HAS_ARCH_FEATURE (Fast_Unaligned_Load) - jnz 2f - HAS_CPU_FEATURE (SSSE3) - jz 2f - LOAD_FUNC_GOT_EAX (__memmove_ssse3) - HAS_ARCH_FEATURE (Fast_Rep_String) - jz 2f - LOAD_FUNC_GOT_EAX (__memmove_ssse3_rep) -2: ret -END(memmove) - -# ifdef SHARED -# undef ENTRY -# define ENTRY(name) \ - .type __memmove_ia32, @function; \ - .p2align 4; \ - .globl __memmove_ia32; \ - .hidden __memmove_ia32; \ - __memmove_ia32: cfi_startproc; \ - CALL_MCOUNT -# else -# undef ENTRY -# define ENTRY(name) \ - .type __memmove_ia32, @function; \ - .globl __memmove_ia32; \ - .p2align 4; \ - __memmove_ia32: cfi_startproc; \ - CALL_MCOUNT -# endif - -# undef END -# define END(name) \ - cfi_endproc; .size __memmove_ia32, .-__memmove_ia32 - -# undef ENTRY_CHK -# define ENTRY_CHK(name) \ - .type __memmove_chk_ia32, @function; \ - .globl __memmove_chk_ia32; \ - .p2align 4; \ - __memmove_chk_ia32: cfi_startproc; \ - CALL_MCOUNT -# undef END_CHK -# define END_CHK(name) \ - cfi_endproc; .size __memmove_chk_ia32, .-__memmove_chk_ia32 - -# ifdef SHARED -# undef libc_hidden_builtin_def -/* IFUNC doesn't work with the hidden functions in shared library since - they will be called without setting up EBX needed for PLT which is - used by IFUNC. */ -# define libc_hidden_builtin_def(name) \ - .globl __GI_memmove; __GI_memmove = __memmove_ia32 -# endif -#endif - -#include "../memmove.S" diff --git a/sysdeps/i386/i686/multiarch/memmove.c b/sysdeps/i386/i686/multiarch/memmove.c new file mode 100644 index 0000000000..cdce982018 --- /dev/null +++ b/sysdeps/i386/i686/multiarch/memmove.c @@ -0,0 +1,32 @@ +/* Multiple versions of memmove. + All versions must be listed in ifunc-impl-list.c. + Copyright (C) 2017-2018 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +/* Define multiple versions only for the definition in lib and for + DSO. In static binaries we need memmove before the initialization + happened. */ +#if defined SHARED && IS_IN (libc) +# define memmove __redirect_memmove +# include <string.h> +# undef memmove + +# define SYMBOL_NAME memmove +# include "ifunc-memmove.h" + +libc_ifunc_redirected (__redirect_memmove, memmove, IFUNC_SELECTOR ()); +#endif diff --git a/sysdeps/i386/i686/multiarch/memmove_chk-nonshared.S b/sysdeps/i386/i686/multiarch/memmove_chk-nonshared.S new file mode 100644 index 0000000000..7212641792 --- /dev/null +++ b/sysdeps/i386/i686/multiarch/memmove_chk-nonshared.S @@ -0,0 +1,21 @@ +/* Non-shared version of memmmove_chk for i686. + Copyright (C) 2017-2018 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#if IS_IN (libc) && !defined SHARED +# include <sysdeps/i386/memmove_chk.S> +#endif diff --git a/sysdeps/i386/i686/multiarch/memmove_chk.S b/sysdeps/i386/i686/multiarch/memmove_chk.S deleted file mode 100644 index c27892d41b..0000000000 --- a/sysdeps/i386/i686/multiarch/memmove_chk.S +++ /dev/null @@ -1,94 +0,0 @@ -/* Multiple versions of __memmove_chk - All versions must be listed in ifunc-impl-list.c. - Copyright (C) 2010-2016 Free Software Foundation, Inc. - Contributed by Intel Corporation. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#include <sysdep.h> -#include <init-arch.h> - -/* Define multiple versions only for the definition in lib. */ -#if IS_IN (libc) - .text -ENTRY(__memmove_chk) - .type __memmove_chk, @gnu_indirect_function - LOAD_GOT_AND_RTLD_GLOBAL_RO - LOAD_FUNC_GOT_EAX (__memmove_chk_ia32) - HAS_CPU_FEATURE (SSE2) - jz 2f - LOAD_FUNC_GOT_EAX (__memmove_chk_sse2_unaligned) - HAS_ARCH_FEATURE (Fast_Unaligned_Load) - jnz 2f - HAS_CPU_FEATURE (SSSE3) - jz 2f - LOAD_FUNC_GOT_EAX (__memmove_chk_ssse3) - HAS_CPU_FEATURE (Fast_Rep_String) - jz 2f - LOAD_FUNC_GOT_EAX (__memmove_chk_ssse3_rep) -2: ret -END(__memmove_chk) - -# ifndef SHARED - .type __memmove_chk_sse2_unaligned, @function - .p2align 4; -__memmove_chk_sse2_unaligned: - cfi_startproc - CALL_MCOUNT - movl 12(%esp), %eax - cmpl %eax, 16(%esp) - jb __chk_fail - jmp __memmove_sse2_unaligned - cfi_endproc - .size __memmove_chk_sse2_unaligned, .-__memmove_chk_sse2_unaligned - - .type __memmove_chk_ssse3, @function - .p2align 4; -__memmove_chk_ssse3: - cfi_startproc - CALL_MCOUNT - movl 12(%esp), %eax - cmpl %eax, 16(%esp) - jb __chk_fail - jmp __memmove_ssse3 - cfi_endproc - .size __memmove_chk_ssse3, .-__memmove_chk_ssse3 - - .type __memmove_chk_ssse3_rep, @function - .p2align 4; -__memmove_chk_ssse3_rep: - cfi_startproc - CALL_MCOUNT - movl 12(%esp), %eax - cmpl %eax, 16(%esp) - jb __chk_fail - jmp __memmove_ssse3_rep - cfi_endproc - .size __memmove_chk_ssse3_rep, .-__memmove_chk_ssse3_rep - - .type __memmove_chk_ia32, @function - .p2align 4; -__memmove_chk_ia32: - cfi_startproc - CALL_MCOUNT - movl 12(%esp), %eax - cmpl %eax, 16(%esp) - jb __chk_fail - jmp __memmove_ia32 - cfi_endproc - .size __memmove_chk_ia32, .-__memmove_chk_ia32 -# endif -#endif diff --git a/sysdeps/i386/i686/multiarch/memmove_chk.c b/sysdeps/i386/i686/multiarch/memmove_chk.c new file mode 100644 index 0000000000..0e9dc7e07f --- /dev/null +++ b/sysdeps/i386/i686/multiarch/memmove_chk.c @@ -0,0 +1,31 @@ +/* Multiple versions of __memmove_chk + All versions must be listed in ifunc-impl-list.c. + Copyright (C) 2017-2018 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +/* Define multiple versions only for the definition in libc.so. */ +#if IS_IN (libc) && defined SHARED +# define __memmove_chk __redirect_memmove_chk +# include <string.h> +# undef __memmove_chk + +# define SYMBOL_NAME memmove_chk +# include "ifunc-memmove.h" + +libc_ifunc_redirected (__redirect_memmove_chk, __memmove_chk, + IFUNC_SELECTOR ()); +#endif diff --git a/sysdeps/i386/i686/multiarch/strchr.S b/sysdeps/i386/i686/multiarch/mempcpy-ia32.S index 18ea87209f..0de1ae21f5 100644 --- a/sysdeps/i386/i686/multiarch/strchr.S +++ b/sysdeps/i386/i686/multiarch/mempcpy-ia32.S @@ -1,7 +1,5 @@ -/* Multiple versions of strchr - All versions must be listed in ifunc-impl-list.c. - Copyright (C) 2011-2016 Free Software Foundation, Inc. - Contributed by Intel Corporation. +/* mempcpy optimized for i686. + Copyright (C) 2017-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -18,40 +16,22 @@ License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ -#include <sysdep.h> -#include <init-arch.h> +#if defined SHARED && IS_IN (libc) +# define __mempcpy __mempcpy_ia32 +# define __mempcpy_chk __mempcpy_chk_ia32 -#if IS_IN (libc) - .text -ENTRY(strchr) - .type strchr, @gnu_indirect_function - LOAD_GOT_AND_RTLD_GLOBAL_RO - LOAD_FUNC_GOT_EAX (__strchr_ia32) - HAS_CPU_FEATURE (SSE2) - jz 2f - LOAD_FUNC_GOT_EAX (__strchr_sse2_bsf) - HAS_ARCH_FEATURE (Slow_BSF) - jz 2f - LOAD_FUNC_GOT_EAX (__strchr_sse2) -2: ret -END(strchr) - -# undef ENTRY -# define ENTRY(name) \ - .type __strchr_ia32, @function; \ - .globl __strchr_ia32; \ - .p2align 4; \ - __strchr_ia32: cfi_startproc; \ - CALL_MCOUNT -# undef END -# define END(name) \ - cfi_endproc; .size __strchr_ia32, .-__strchr_ia32 +# undef libc_hidden_def # undef libc_hidden_builtin_def /* IFUNC doesn't work with the hidden functions in shared library since they will be called without setting up EBX needed for PLT which is used by IFUNC. */ +# define libc_hidden_def(name) \ + .globl __GI___mempcpy; __GI___mempcpy = __mempcpy # define libc_hidden_builtin_def(name) \ - .globl __GI_strchr; __GI_strchr = __strchr_ia32 + .globl __GI_mempcpy; __GI_mempcpy = __mempcpy + +# undef weak_alias +# define weak_alias(original, alias) #endif -#include "../../i586/strchr.S" +#include <sysdeps/i386/i686/mempcpy.S> diff --git a/sysdeps/i386/i686/multiarch/mempcpy.S b/sysdeps/i386/i686/multiarch/mempcpy.S deleted file mode 100644 index 141ff2e395..0000000000 --- a/sysdeps/i386/i686/multiarch/mempcpy.S +++ /dev/null @@ -1,81 +0,0 @@ -/* Multiple versions of mempcpy - All versions must be listed in ifunc-impl-list.c. - Copyright (C) 2010-2016 Free Software Foundation, Inc. - Contributed by Intel Corporation. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#include <sysdep.h> -#include <init-arch.h> - -/* Define multiple versions only for the definition in lib and for - DSO. In static binaries we need mempcpy before the initialization - happened. */ -#if defined SHARED && IS_IN (libc) - .text -ENTRY(__mempcpy) - .type __mempcpy, @gnu_indirect_function - LOAD_GOT_AND_RTLD_GLOBAL_RO - LOAD_FUNC_GOT_EAX (__mempcpy_ia32) - HAS_CPU_FEATURE (SSE2) - jz 2f - LOAD_FUNC_GOT_EAX (__mempcpy_sse2_unaligned) - HAS_ARCH_FEATURE (Fast_Unaligned_Load) - jnz 2f - HAS_CPU_FEATURE (SSSE3) - jz 2f - LOAD_FUNC_GOT_EAX (__mempcpy_ssse3) - HAS_CPU_FEATURE (Fast_Rep_String) - jz 2f - LOAD_FUNC_GOT_EAX (__mempcpy_ssse3_rep) -2: ret -END(__mempcpy) - -# undef ENTRY -# define ENTRY(name) \ - .type __mempcpy_ia32, @function; \ - .p2align 4; \ - .globl __mempcpy_ia32; \ - .hidden __mempcpy_ia32; \ - __mempcpy_ia32: cfi_startproc; \ - CALL_MCOUNT -# undef END -# define END(name) \ - cfi_endproc; .size __mempcpy_ia32, .-__mempcpy_ia32 - -# undef ENTRY_CHK -# define ENTRY_CHK(name) \ - .type __mempcpy_chk_ia32, @function; \ - .globl __mempcpy_chk_ia32; \ - .p2align 4; \ - __mempcpy_chk_ia32: cfi_startproc; \ - CALL_MCOUNT -# undef END_CHK -# define END_CHK(name) \ - cfi_endproc; .size __mempcpy_chk_ia32, .-__mempcpy_chk_ia32 - -# undef libc_hidden_def -# undef libc_hidden_builtin_def -/* IFUNC doesn't work with the hidden functions in shared library since - they will be called without setting up EBX needed for PLT which is - used by IFUNC. */ -# define libc_hidden_def(name) \ - .globl __GI_mempcpy; __GI_mempcpy = __mempcpy_ia32 -# define libc_hidden_builtin_def(name) \ - .globl __GI___mempcpy; __GI___mempcpy = __mempcpy_ia32 -#endif - -#include "../mempcpy.S" diff --git a/sysdeps/i386/i686/multiarch/wcscmp.S b/sysdeps/i386/i686/multiarch/mempcpy.c index c7d7d51bdd..36d9baaa4b 100644 --- a/sysdeps/i386/i686/multiarch/wcscmp.S +++ b/sysdeps/i386/i686/multiarch/mempcpy.c @@ -1,7 +1,6 @@ -/* Multiple versions of wcscmp +/* Multiple versions of mempcpy. All versions must be listed in ifunc-impl-list.c. - Copyright (C) 2011-2016 Free Software Foundation, Inc. - Contributed by Intel Corporation. + Copyright (C) 2017-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -18,22 +17,22 @@ License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ -#include <sysdep.h> -#include <init-arch.h> - -/* Define multiple versions only for the definition in libc and for the - DSO. In static binaries, we need wcscmp before the initialization +/* Define multiple versions only for the definition in lib and for + DSO. In static binaries we need memcpy before the initialization happened. */ -#if IS_IN (libc) - .text -ENTRY(__wcscmp) - .type __wcscmp, @gnu_indirect_function - LOAD_GOT_AND_RTLD_GLOBAL_RO - LOAD_FUNC_GOT_EAX (__wcscmp_ia32) - HAS_CPU_FEATURE (SSE2) - jz 2f - LOAD_FUNC_GOT_EAX (__wcscmp_sse2) -2: ret -END(__wcscmp) -weak_alias (__wcscmp, wcscmp) +#if defined SHARED && IS_IN (libc) +# define mempcpy __redirect_mempcpy +# define __mempcpy __redirect___mempcpy +# define NO_MEMPCPY_STPCPY_REDIRECT +# define __NO_STRING_INLINES +# include <string.h> +# undef mempcpy +# undef __mempcpy + +# define SYMBOL_NAME mempcpy +# include "ifunc-memmove.h" + +libc_ifunc_redirected (__redirect_mempcpy, __mempcpy, IFUNC_SELECTOR ()); + +weak_alias (__mempcpy, mempcpy) #endif diff --git a/sysdeps/i386/i686/multiarch/mempcpy_chk-nonshared.S b/sysdeps/i386/i686/multiarch/mempcpy_chk-nonshared.S new file mode 100644 index 0000000000..219faebd29 --- /dev/null +++ b/sysdeps/i386/i686/multiarch/mempcpy_chk-nonshared.S @@ -0,0 +1,21 @@ +/* Non-shared version of mempcpy_chk for i686. + Copyright (C) 2017-2018 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#if IS_IN (libc) && !defined SHARED +# include <sysdeps/i386/mempcpy_chk.S> +#endif diff --git a/sysdeps/i386/i686/multiarch/mempcpy_chk.S b/sysdeps/i386/i686/multiarch/mempcpy_chk.S deleted file mode 100644 index 2788b663c2..0000000000 --- a/sysdeps/i386/i686/multiarch/mempcpy_chk.S +++ /dev/null @@ -1,50 +0,0 @@ -/* Multiple versions of __mempcpy_chk - All versions must be listed in ifunc-impl-list.c. - Copyright (C) 2010-2016 Free Software Foundation, Inc. - Contributed by Intel Corporation. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#include <sysdep.h> -#include <init-arch.h> - -/* Define multiple versions only for the definition in lib and for - DSO. There are no multiarch mempcpy functions for static binaries. - */ -#if IS_IN (libc) -# ifdef SHARED - .text -ENTRY(__mempcpy_chk) - .type __mempcpy_chk, @gnu_indirect_function - LOAD_GOT_AND_RTLD_GLOBAL_RO - LOAD_FUNC_GOT_EAX (__mempcpy_chk_ia32) - HAS_CPU_FEATURE (SSE2) - jz 2f - LOAD_FUNC_GOT_EAX (__mempcpy_chk_sse2_unaligned) - HAS_ARCH_FEATURE (Fast_Unaligned_Load) - jnz 2f - HAS_CPU_FEATURE (SSSE3) - jz 2f - LOAD_FUNC_GOT_EAX (__mempcpy_chk_ssse3) - HAS_CPU_FEATURE (Fast_Rep_String) - jz 2f - LOAD_FUNC_GOT_EAX (__mempcpy_chk_ssse3_rep) -2: ret -END(__mempcpy_chk) -# else -# include "../mempcpy_chk.S" -# endif -#endif diff --git a/sysdeps/i386/i686/multiarch/mempcpy_chk.c b/sysdeps/i386/i686/multiarch/mempcpy_chk.c new file mode 100644 index 0000000000..956918b3a1 --- /dev/null +++ b/sysdeps/i386/i686/multiarch/mempcpy_chk.c @@ -0,0 +1,31 @@ +/* Multiple versions of __mempcpy_chk + All versions must be listed in ifunc-impl-list.c. + Copyright (C) 2017-2018 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +/* Define multiple versions only for the definition in libc.so. */ +#if IS_IN (libc) && defined SHARED +# define __mempcpy_chk __redirect_mempcpy_chk +# include <string.h> +# undef __mempcpy_chk + +# define SYMBOL_NAME mempcpy_chk +# include "ifunc-memmove.h" + +libc_ifunc_redirected (__redirect_mempcpy_chk, __mempcpy_chk, + IFUNC_SELECTOR ()); +#endif diff --git a/sysdeps/i386/i686/multiarch/memrchr-sse2-bsf.S b/sysdeps/i386/i686/multiarch/memrchr-sse2-bsf.S index cf5555cf62..4cd00617ff 100644 --- a/sysdeps/i386/i686/multiarch/memrchr-sse2-bsf.S +++ b/sysdeps/i386/i686/multiarch/memrchr-sse2-bsf.S @@ -1,5 +1,5 @@ /* Optimized memrchr with sse2 - Copyright (C) 2011-2016 Free Software Foundation, Inc. + Copyright (C) 2011-2018 Free Software Foundation, Inc. Contributed by Intel Corporation. This file is part of the GNU C Library. diff --git a/sysdeps/i386/i686/multiarch/memrchr-sse2.S b/sysdeps/i386/i686/multiarch/memrchr-sse2.S index 5be8332438..2185945a6c 100644 --- a/sysdeps/i386/i686/multiarch/memrchr-sse2.S +++ b/sysdeps/i386/i686/multiarch/memrchr-sse2.S @@ -1,5 +1,5 @@ /* Optimized memrchr with sse2 without bsf - Copyright (C) 2011-2016 Free Software Foundation, Inc. + Copyright (C) 2011-2018 Free Software Foundation, Inc. Contributed by Intel Corporation. This file is part of the GNU C Library. diff --git a/sysdeps/i386/i686/multiarch/memrchr.c b/sysdeps/i386/i686/multiarch/memrchr.c new file mode 100644 index 0000000000..1c0d9caf55 --- /dev/null +++ b/sysdeps/i386/i686/multiarch/memrchr.c @@ -0,0 +1,32 @@ +/* Multiple versions of memrchr. + All versions must be listed in ifunc-impl-list.c. + Copyright (C) 2017-2018 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +/* Define multiple versions only for the definition in libc. */ +#if IS_IN (libc) +# define memrchr __redirect_memrchr +# include <string.h> +# undef memrchr + +# define SYMBOL_NAME memrchr +# include "ifunc-sse2-bsf.h" + +libc_ifunc_redirected (__redirect_memrchr, __memrchr, IFUNC_SELECTOR ()); + +weak_alias (__memrchr, memrchr) +#endif diff --git a/sysdeps/i386/i686/multiarch/memset-ia32.S b/sysdeps/i386/i686/multiarch/memset-ia32.S new file mode 100644 index 0000000000..c66ccd3f5f --- /dev/null +++ b/sysdeps/i386/i686/multiarch/memset-ia32.S @@ -0,0 +1,33 @@ +/* memset optimized for i686. + Copyright (C) 2017-2018 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#if IS_IN (libc) +# define memset __memset_ia32 +# define __memset_chk __memset_chk_ia32 + +# ifdef SHARED +# undef libc_hidden_builtin_def +/* IFUNC doesn't work with the hidden functions in shared library since + they will be called without setting up EBX needed for PLT which is + used by IFUNC. */ +# define libc_hidden_builtin_def(name) \ + .globl __GI_memset; __GI_memset = memset +# endif +#endif + +#include <sysdeps/i386/i686/memset.S> diff --git a/sysdeps/i386/i686/multiarch/memset-sse2-rep.S b/sysdeps/i386/i686/multiarch/memset-sse2-rep.S index 153ae6fdaf..8732aac0b9 100644 --- a/sysdeps/i386/i686/multiarch/memset-sse2-rep.S +++ b/sysdeps/i386/i686/multiarch/memset-sse2-rep.S @@ -1,5 +1,5 @@ /* memset with SSE2 and REP string. - Copyright (C) 2010-2016 Free Software Foundation, Inc. + Copyright (C) 2010-2018 Free Software Foundation, Inc. Contributed by Intel Corporation. This file is part of the GNU C Library. @@ -44,7 +44,7 @@ # define SETRTNVAL movl DEST(%esp), %eax #endif -#ifdef SHARED +#ifdef PIC # define ENTRANCE PUSH (%ebx); # define RETURN_END POP (%ebx); ret # define RETURN RETURN_END; CFI_PUSH (%ebx) @@ -63,7 +63,7 @@ add (%ebx,%ecx,4), %ebx; \ add %ecx, %edx; \ /* We loaded the jump table and adjusted EDX. Go. */ \ - jmp *%ebx + _CET_NOTRACK jmp *%ebx #else # define ENTRANCE # define RETURN_END ret @@ -75,7 +75,7 @@ absolute offsets. */ # define BRANCH_TO_JMPTBL_ENTRY(TABLE) \ add %ecx, %edx; \ - jmp *TABLE(,%ecx,4) + _CET_NOTRACK jmp *TABLE(,%ecx,4) #endif .section .text.sse2,"ax",@progbits @@ -262,7 +262,7 @@ L(128bytesormore): PUSH (%ebx) mov $DATA_CACHE_SIZE, %ebx #else -# ifdef SHARED +# ifdef PIC SETUP_PIC_REG(bx) add $_GLOBAL_OFFSET_TABLE_, %ebx mov __x86_data_cache_size@GOTOFF(%ebx), %ebx @@ -274,7 +274,7 @@ L(128bytesormore): mov %ebx, %edi shr $4, %ebx sub %ebx, %edi -#if defined DATA_CACHE_SIZE || !defined SHARED +#if defined DATA_CACHE_SIZE || !defined PIC POP (%ebx) #endif /* diff --git a/sysdeps/i386/i686/multiarch/memset-sse2.S b/sysdeps/i386/i686/multiarch/memset-sse2.S index 4cac1c7b22..5c9eba1e65 100644 --- a/sysdeps/i386/i686/multiarch/memset-sse2.S +++ b/sysdeps/i386/i686/multiarch/memset-sse2.S @@ -1,5 +1,5 @@ /* memset with SSE2 - Copyright (C) 2010-2016 Free Software Foundation, Inc. + Copyright (C) 2010-2018 Free Software Foundation, Inc. Contributed by Intel Corporation. This file is part of the GNU C Library. @@ -44,7 +44,7 @@ # define SETRTNVAL movl DEST(%esp), %eax #endif -#ifdef SHARED +#ifdef PIC # define ENTRANCE PUSH (%ebx); # define RETURN_END POP (%ebx); ret # define RETURN RETURN_END; CFI_PUSH (%ebx) @@ -63,7 +63,7 @@ add (%ebx,%ecx,4), %ebx; \ add %ecx, %edx; \ /* We loaded the jump table and adjusted EDX. Go. */ \ - jmp *%ebx + _CET_NOTRACK jmp *%ebx #else # define ENTRANCE # define RETURN_END ret @@ -75,7 +75,7 @@ absolute offsets. */ # define BRANCH_TO_JMPTBL_ENTRY(TABLE) \ add %ecx, %edx; \ - jmp *TABLE(,%ecx,4) + _CET_NOTRACK jmp *TABLE(,%ecx,4) #endif .section .text.sse2,"ax",@progbits @@ -261,7 +261,7 @@ L(128bytesormore): PUSH (%ebx) mov $SHARED_CACHE_SIZE, %ebx #else -# ifdef SHARED +# ifdef PIC SETUP_PIC_REG(bx) add $_GLOBAL_OFFSET_TABLE_, %ebx mov __x86_shared_cache_size@GOTOFF(%ebx), %ebx @@ -279,7 +279,7 @@ L(128bytesormore): # define RESTORE_EBX_STATE CFI_PUSH (%ebx) cmp $DATA_CACHE_SIZE, %ecx #else -# ifdef SHARED +# ifdef PIC # define RESTORE_EBX_STATE SETUP_PIC_REG(bx) add $_GLOBAL_OFFSET_TABLE_, %ebx @@ -380,7 +380,7 @@ L(128bytesormore_nt): jae L(128bytesormore_nt) sfence L(shared_cache_loop_end): -#if defined DATA_CACHE_SIZE || !defined SHARED +#if defined DATA_CACHE_SIZE || !defined PIC POP (%ebx) #endif BRANCH_TO_JMPTBL_ENTRY (L(table_16_128bytes)) diff --git a/sysdeps/i386/i686/multiarch/memset.S b/sysdeps/i386/i686/multiarch/memset.S deleted file mode 100644 index 268df0c873..0000000000 --- a/sysdeps/i386/i686/multiarch/memset.S +++ /dev/null @@ -1,75 +0,0 @@ -/* Multiple versions of memset - All versions must be listed in ifunc-impl-list.c. - Copyright (C) 2010-2016 Free Software Foundation, Inc. - Contributed by Intel Corporation. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#include <sysdep.h> -#include <init-arch.h> - -/* Define multiple versions only for the definition in lib. */ -#if IS_IN (libc) - .text -ENTRY(memset) - .type memset, @gnu_indirect_function - LOAD_GOT_AND_RTLD_GLOBAL_RO - LOAD_FUNC_GOT_EAX (__memset_ia32) - HAS_CPU_FEATURE (SSE2) - jz 2f - LOAD_FUNC_GOT_EAX (__memset_sse2) - HAS_CPU_FEATURE (Fast_Rep_String) - jz 2f - LOAD_FUNC_GOT_EAX (__memset_sse2_rep) -2: ret -END(memset) - -# undef ENTRY -# define ENTRY(name) \ - .type __memset_ia32, @function; \ - .globl __memset_ia32; \ - .p2align 4; \ - __memset_ia32: cfi_startproc; \ - CALL_MCOUNT -# undef END -# define END(name) \ - cfi_endproc; .size __memset_ia32, .-__memset_ia32 - -# undef ENTRY_CHK -# define ENTRY_CHK(name) \ - .type __memset_chk_ia32, @function; \ - .globl __memset_chk_ia32; \ - .p2align 4; \ - __memset_chk_ia32: cfi_startproc; \ - CALL_MCOUNT -# undef END_CHK -# define END_CHK(name) \ - cfi_endproc; .size __memset_chk_ia32, .-__memset_chk_ia32 - -# ifdef SHARED -# undef libc_hidden_builtin_def -/* IFUNC doesn't work with the hidden functions in shared library since - they will be called without setting up EBX needed for PLT which is - used by IFUNC. */ -# define libc_hidden_builtin_def(name) \ - .globl __GI_memset; __GI_memset = __memset_ia32 -# endif - -# undef strong_alias -# define strong_alias(original, alias) -#endif - -#include "../memset.S" diff --git a/sysdeps/i386/i686/multiarch/memset.c b/sysdeps/i386/i686/multiarch/memset.c new file mode 100644 index 0000000000..5c870c9e00 --- /dev/null +++ b/sysdeps/i386/i686/multiarch/memset.c @@ -0,0 +1,30 @@ +/* Multiple versions of memset. + All versions must be listed in ifunc-impl-list.c. + Copyright (C) 2017-2018 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +/* Define multiple versions only for the definition in libc. */ +#if IS_IN (libc) +# define memset __redirect_memset +# include <string.h> +# undef memset + +# define SYMBOL_NAME memset +# include "ifunc-memset.h" + +libc_ifunc_redirected (__redirect_memset, memset, IFUNC_SELECTOR ()); +#endif diff --git a/sysdeps/i386/i686/multiarch/memset_chk-nonshared.S b/sysdeps/i386/i686/multiarch/memset_chk-nonshared.S new file mode 100644 index 0000000000..00e450ea0d --- /dev/null +++ b/sysdeps/i386/i686/multiarch/memset_chk-nonshared.S @@ -0,0 +1,21 @@ +/* Non-shared version of memset_chk for i686. + Copyright (C) 2017-2018 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#if IS_IN (libc) && !defined SHARED +# include <sysdeps/i386/memset_chk.S> +#endif diff --git a/sysdeps/i386/i686/multiarch/memset_chk.S b/sysdeps/i386/i686/multiarch/memset_chk.S deleted file mode 100644 index d18b53f7e3..0000000000 --- a/sysdeps/i386/i686/multiarch/memset_chk.S +++ /dev/null @@ -1,82 +0,0 @@ -/* Multiple versions of __memset_chk - All versions must be listed in ifunc-impl-list.c. - Copyright (C) 2010-2016 Free Software Foundation, Inc. - Contributed by Intel Corporation. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#include <sysdep.h> -#include <init-arch.h> - -/* Define multiple versions only for the definition in lib. */ -#if IS_IN (libc) - .text -ENTRY(__memset_chk) - .type __memset_chk, @gnu_indirect_function - LOAD_GOT_AND_RTLD_GLOBAL_RO - LOAD_FUNC_GOT_EAX (__memset_chk_ia32) - HAS_CPU_FEATURE (SSE2) - jz 2f - LOAD_FUNC_GOT_EAX (__memset_chk_sse2) - HAS_CPU_FEATURE (Fast_Rep_String) - jz 2f - LOAD_FUNC_GOT_EAX (__memset_chk_sse2_rep) -2: ret -END(__memset_chk) - -# ifdef SHARED -strong_alias (__memset_chk, __memset_zero_constant_len_parameter) - .section .gnu.warning.__memset_zero_constant_len_parameter - .string "memset used with constant zero length parameter; this could be due to transposed parameters" -# else - .text - .type __memset_chk_sse2, @function - .p2align 4; -__memset_chk_sse2: - cfi_startproc - CALL_MCOUNT - movl 12(%esp), %eax - cmpl %eax, 16(%esp) - jb __chk_fail - jmp __memset_sse2 - cfi_endproc - .size __memset_chk_sse2, .-__memset_chk_sse2 - - .type __memset_chk_sse2_rep, @function - .p2align 4; -__memset_chk_sse2_rep: - cfi_startproc - CALL_MCOUNT - movl 12(%esp), %eax - cmpl %eax, 16(%esp) - jb __chk_fail - jmp __memset_sse2_rep - cfi_endproc - .size __memset_chk_sse2_rep, .-__memset_chk_sse2_rep - - .type __memset_chk_ia32, @function - .p2align 4; -__memset_chk_ia32: - cfi_startproc - CALL_MCOUNT - movl 12(%esp), %eax - cmpl %eax, 16(%esp) - jb __chk_fail - jmp __memset_ia32 - cfi_endproc - .size __memset_chk_ia32, .-__memset_chk_ia32 -# endif -#endif diff --git a/sysdeps/i386/i686/multiarch/memset_chk.c b/sysdeps/i386/i686/multiarch/memset_chk.c new file mode 100644 index 0000000000..3bd580895d --- /dev/null +++ b/sysdeps/i386/i686/multiarch/memset_chk.c @@ -0,0 +1,32 @@ +/* Multiple versions of __memset_chk + All versions must be listed in ifunc-impl-list.c. + Copyright (C) 2017-2018 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +/* Define multiple versions only for the definition in libc.so. */ +#if IS_IN (libc) && defined SHARED +# define __memset_chk __redirect_memset_chk +# include <string.h> +# undef __memset_chk + +# define SYMBOL_NAME memset_chk +# include "ifunc-memset.h" + +libc_ifunc_redirected (__redirect_memset_chk, __memset_chk, + IFUNC_SELECTOR ()); + +#endif diff --git a/sysdeps/i386/i686/multiarch/rawmemchr-ia32.S b/sysdeps/i386/i686/multiarch/rawmemchr-ia32.S new file mode 100644 index 0000000000..de34daf19e --- /dev/null +++ b/sysdeps/i386/i686/multiarch/rawmemchr-ia32.S @@ -0,0 +1,35 @@ +/* rawmemchr optimized for i686. + Copyright (C) 2017-2018 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#if IS_IN (libc) +# define __rawmemchr __rawmemchr_ia32 + +# ifdef SHARED +# undef libc_hidden_def +/* IFUNC doesn't work with the hidden functions in shared library since + they will be called without setting up EBX needed for PLT which is + used by IFUNC. */ +# define libc_hidden_def(name) \ + .globl __GI___rawmemchr; __GI___rawmemchr = __rawmemchr +# endif + +# undef weak_alias +# define weak_alias(original, alias) +#endif + +#include <sysdeps/i386/rawmemchr.S> diff --git a/sysdeps/i386/i686/multiarch/rawmemchr.S b/sysdeps/i386/i686/multiarch/rawmemchr.S deleted file mode 100644 index f53978348d..0000000000 --- a/sysdeps/i386/i686/multiarch/rawmemchr.S +++ /dev/null @@ -1,65 +0,0 @@ -/* Multiple versions of rawmemchr - All versions must be listed in ifunc-impl-list.c. - Copyright (C) 2011-2016 Free Software Foundation, Inc. - Contributed by Intel Corporation. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#include <sysdep.h> -#include <init-arch.h> - -#if IS_IN (libc) - .text -ENTRY(__rawmemchr) - .type __rawmemchr, @gnu_indirect_function - LOAD_GOT_AND_RTLD_GLOBAL_RO - HAS_CPU_FEATURE (SSE2) - jz 2f - HAS_ARCH_FEATURE (Slow_BSF) - jz 3f - - LOAD_FUNC_GOT_EAX (__rawmemchr_sse2) - ret - -2: LOAD_FUNC_GOT_EAX (__rawmemchr_ia32) - ret - -3: LOAD_FUNC_GOT_EAX (__rawmemchr_sse2_bsf) - ret -END(__rawmemchr) - -weak_alias(__rawmemchr, rawmemchr) - -# undef ENTRY -# define ENTRY(name) \ - .type __rawmemchr_ia32, @function; \ - .globl __rawmemchr_ia32; \ - .p2align 4; \ - __rawmemchr_ia32: cfi_startproc; \ - CALL_MCOUNT -# undef END -# define END(name) \ - cfi_endproc; .size __rawmemchr_ia32, .-__rawmemchr_ia32 - -# undef libc_hidden_def -/* IFUNC doesn't work with the hidden functions in shared library since - they will be called without setting up EBX needed for PLT which is - used by IFUNC. */ -# define libc_hidden_def(name) \ - .globl __GI___rawmemchr; __GI___rawmemchr = __rawmemchr_ia32 - -#endif -#include "../../rawmemchr.S" diff --git a/sysdeps/i386/i686/multiarch/rawmemchr.c b/sysdeps/i386/i686/multiarch/rawmemchr.c new file mode 100644 index 0000000000..9ac2bcf491 --- /dev/null +++ b/sysdeps/i386/i686/multiarch/rawmemchr.c @@ -0,0 +1,35 @@ +/* Multiple versions of rawmemchr. + All versions must be listed in ifunc-impl-list.c. + Copyright (C) 2017-2018 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +/* Define multiple versions only for the definition in libc. */ +#if IS_IN (libc) +# define rawmemchr __redirect_rawmemchr +# define __rawmemchr __redirect___rawmemchr +# include <string.h> +# undef rawmemchr +# undef __rawmemchr + +# define SYMBOL_NAME rawmemchr +# include "ifunc-sse2-bsf.h" + +libc_ifunc_redirected (__redirect_rawmemchr, __rawmemchr, + IFUNC_SELECTOR ()); + +weak_alias (__rawmemchr, rawmemchr) +#endif diff --git a/sysdeps/i386/i686/multiarch/s_fma-fma.c b/sysdeps/i386/i686/multiarch/s_fma-fma.c index 60e5b9a32d..92daa48d18 100644 --- a/sysdeps/i386/i686/multiarch/s_fma-fma.c +++ b/sysdeps/i386/i686/multiarch/s_fma-fma.c @@ -1,5 +1,5 @@ /* FMA version of fma. - Copyright (C) 2010-2016 Free Software Foundation, Inc. + Copyright (C) 2010-2018 Free Software Foundation, Inc. Contributed by Intel Corporation. This file is part of the GNU C Library. diff --git a/sysdeps/i386/i686/multiarch/s_fma.c b/sysdeps/i386/i686/multiarch/s_fma.c index acc59a8c93..7f39f5fdc9 100644 --- a/sysdeps/i386/i686/multiarch/s_fma.c +++ b/sysdeps/i386/i686/multiarch/s_fma.c @@ -1,5 +1,5 @@ /* Multiple versions of fma. - Copyright (C) 2010-2016 Free Software Foundation, Inc. + Copyright (C) 2010-2018 Free Software Foundation, Inc. Contributed by Intel Corporation. This file is part of the GNU C Library. @@ -21,13 +21,14 @@ #include <math.h> #include <init-arch.h> +#include <libm-alias-double.h> extern double __fma_ia32 (double x, double y, double z) attribute_hidden; extern double __fma_fma (double x, double y, double z) attribute_hidden; libm_ifunc (__fma, HAS_ARCH_FEATURE (FMA_Usable) ? __fma_fma : __fma_ia32); -weak_alias (__fma, fma) +libm_alias_double (__fma, fma) #define __fma __fma_ia32 diff --git a/sysdeps/i386/i686/multiarch/s_fmaf-fma.c b/sysdeps/i386/i686/multiarch/s_fmaf-fma.c index ff2de65a80..f448ef7121 100644 --- a/sysdeps/i386/i686/multiarch/s_fmaf-fma.c +++ b/sysdeps/i386/i686/multiarch/s_fmaf-fma.c @@ -1,5 +1,5 @@ /* FMA version of fmaf. - Copyright (C) 2010-2016 Free Software Foundation, Inc. + Copyright (C) 2010-2018 Free Software Foundation, Inc. Contributed by Intel Corporation. This file is part of the GNU C Library. diff --git a/sysdeps/i386/i686/multiarch/s_fmaf.c b/sysdeps/i386/i686/multiarch/s_fmaf.c index a4b86cf39e..1ebb6e975e 100644 --- a/sysdeps/i386/i686/multiarch/s_fmaf.c +++ b/sysdeps/i386/i686/multiarch/s_fmaf.c @@ -1,5 +1,5 @@ /* Multiple versions of fmaf. - Copyright (C) 2010-2016 Free Software Foundation, Inc. + Copyright (C) 2010-2018 Free Software Foundation, Inc. Contributed by Intel Corporation. This file is part of the GNU C Library. @@ -21,13 +21,14 @@ #include <math.h> #include <init-arch.h> +#include <libm-alias-float.h> extern float __fmaf_ia32 (float x, float y, float z) attribute_hidden; extern float __fmaf_fma (float x, float y, float z) attribute_hidden; libm_ifunc (__fmaf, HAS_ARCH_FEATURE (FMA_Usable) ? __fmaf_fma : __fmaf_ia32); -weak_alias (__fmaf, fmaf) +libm_alias_float (__fma, fma) #define __fmaf __fmaf_ia32 diff --git a/sysdeps/i386/i686/multiarch/stpcpy-ia32.S b/sysdeps/i386/i686/multiarch/stpcpy-ia32.S new file mode 100644 index 0000000000..5274471841 --- /dev/null +++ b/sysdeps/i386/i686/multiarch/stpcpy-ia32.S @@ -0,0 +1,39 @@ +/* stpcpy optimized for i686. + All versions must be listed in ifunc-impl-list.c. + Copyright (C) 2017-2018 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#if IS_IN (libc) +# define __stpcpy __stpcpy_ia32 + +# ifdef SHARED +# undef libc_hidden_def +# undef libc_hidden_builtin_def +/* IFUNC doesn't work with the hidden functions in shared library since + they will be called without setting up EBX needed for PLT which is + used by IFUNC. */ +# define libc_hidden_def(name) \ + .globl __GI___stpcpy; __GI___stpcpy = __stpcpy +# define libc_hidden_builtin_def(name) \ + .globl __GI_stpcpy; __GI_stpcpy = __stpcpy +# endif + +# undef weak_alias +# define weak_alias(original, alias) +#endif + +#include <sysdeps/i386/i586/stpcpy.S> diff --git a/sysdeps/i386/i686/multiarch/stpcpy.S b/sysdeps/i386/i686/multiarch/stpcpy.S deleted file mode 100644 index ee81ab6ae3..0000000000 --- a/sysdeps/i386/i686/multiarch/stpcpy.S +++ /dev/null @@ -1,9 +0,0 @@ -/* Multiple versions of stpcpy - All versions must be listed in ifunc-impl-list.c. */ -#define USE_AS_STPCPY -#define STRCPY __stpcpy -#include "strcpy.S" - -weak_alias (__stpcpy, stpcpy) -libc_hidden_def (__stpcpy) -libc_hidden_builtin_def (stpcpy) diff --git a/sysdeps/i386/i686/multiarch/memrchr.S b/sysdeps/i386/i686/multiarch/stpcpy.c index bc1ff805af..cb0c3fc00d 100644 --- a/sysdeps/i386/i686/multiarch/memrchr.S +++ b/sysdeps/i386/i686/multiarch/stpcpy.c @@ -1,7 +1,6 @@ -/* Multiple versions of memrchr +/* Multiple versions of stpcpy. All versions must be listed in ifunc-impl-list.c. - Copyright (C) 2011-2016 Free Software Foundation, Inc. - Contributed by Intel Corporation. + Copyright (C) 2017-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -18,28 +17,20 @@ License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ -#include <sysdep.h> -#include <init-arch.h> - +/* Define multiple versions only for the definition in libc. */ #if IS_IN (libc) - .text -ENTRY(__memrchr) - .type __memrchr, @gnu_indirect_function - LOAD_GOT_AND_RTLD_GLOBAL_RO - HAS_CPU_FEATURE (SSE2) - jz 2f - HAS_ARCH_FEATURE (Slow_BSF) - jz 3f - - LOAD_FUNC_GOT_EAX (__memrchr_sse2) - ret +# define stpcpy __redirect_stpcpy +# define __stpcpy __redirect___stpcpy +# define NO_MEMPCPY_STPCPY_REDIRECT +# define __NO_STRING_INLINES +# include <string.h> +# undef stpcpy +# undef __stpcpy -2: LOAD_FUNC_GOT_EAX (__memrchr_ia32) - ret +# define SYMBOL_NAME stpcpy +# include "ifunc-sse2-ssse3.h" -3: LOAD_FUNC_GOT_EAX (__memrchr_sse2_bsf) - ret -END(__memrchr) +libc_ifunc_redirected (__redirect_stpcpy, __stpcpy, IFUNC_SELECTOR ()); -weak_alias(__memrchr, memrchr) +weak_alias (__stpcpy, stpcpy) #endif diff --git a/sysdeps/i386/i686/multiarch/stpncpy-ia32.S b/sysdeps/i386/i686/multiarch/stpncpy-ia32.S new file mode 100644 index 0000000000..f13349b681 --- /dev/null +++ b/sysdeps/i386/i686/multiarch/stpncpy-ia32.S @@ -0,0 +1,37 @@ +/* stpncpy optimized for i686. + All versions must be listed in ifunc-impl-list.c. + Copyright (C) 2017-2018 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#if IS_IN (libc) +# define __stpncpy __stpncpy_ia32 + +# ifdef SHARED +# undef libc_hidden_def +/* IFUNC doesn't work with the hidden functions in shared library since + they will be called without setting up EBX needed for PLT which is + used by IFUNC. */ +# define libc_hidden_def(name) \ + .globl __GI___stpncpy; __GI___stpncpy = __stpncpy + +# undef weak_alias +# define weak_alias(original, alias) +# endif + +#endif + +#include <sysdeps/i386/stpncpy.S> diff --git a/sysdeps/i386/i686/multiarch/stpncpy.S b/sysdeps/i386/i686/multiarch/stpncpy.S deleted file mode 100644 index 2698ca6a8c..0000000000 --- a/sysdeps/i386/i686/multiarch/stpncpy.S +++ /dev/null @@ -1,8 +0,0 @@ -/* Multiple versions of stpncpy - All versions must be listed in ifunc-impl-list.c. */ -#define STRCPY __stpncpy -#define USE_AS_STPCPY -#define USE_AS_STRNCPY -#include "strcpy.S" - -weak_alias (__stpncpy, stpncpy) diff --git a/sysdeps/i386/i686/multiarch/stpncpy.c b/sysdeps/i386/i686/multiarch/stpncpy.c new file mode 100644 index 0000000000..3558e09fd5 --- /dev/null +++ b/sysdeps/i386/i686/multiarch/stpncpy.c @@ -0,0 +1,34 @@ +/* Multiple versions of stpncpy. + All versions must be listed in ifunc-impl-list.c. + Copyright (C) 2017-2018 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +/* Define multiple versions only for the definition in libc. */ +#if IS_IN (libc) +# define stpncpy __redirect_stpncpy +# define __stpncpy __redirect___stpncpy +# include <string.h> +# undef stpncpy +# undef __stpncpy + +# define SYMBOL_NAME stpncpy +# include "ifunc-sse2-ssse3.h" + +libc_ifunc_redirected (__redirect_stpncpy, __stpncpy, IFUNC_SELECTOR ()); + +weak_alias (__stpncpy, stpncpy) +#endif diff --git a/sysdeps/i386/i686/multiarch/strcasecmp.S b/sysdeps/i386/i686/multiarch/strcasecmp.c index 61f17718bc..cccb1ff5ad 100644 --- a/sysdeps/i386/i686/multiarch/strcasecmp.S +++ b/sysdeps/i386/i686/multiarch/strcasecmp.c @@ -1,6 +1,6 @@ -/* Entry point for multi-version x86 strcasecmp. +/* Multiple versions of strcasecmp. All versions must be listed in ifunc-impl-list.c. - Copyright (C) 2011-2016 Free Software Foundation, Inc. + Copyright (C) 2017-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -17,23 +17,19 @@ License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ -#include <sysdep.h> -#include <init-arch.h> +/* Define multiple versions only for the definition in libc. */ +#if IS_IN (libc) +# define strcasecmp __redirect_strcasecmp +# define __strcasecmp __redirect___strcasecmp +# include <string.h> +# undef strcasecmp +# undef __strcasecmp - .text -ENTRY(__strcasecmp) - .type __strcasecmp, @gnu_indirect_function - LOAD_GOT_AND_RTLD_GLOBAL_RO - LOAD_FUNC_GOT_EAX (__strcasecmp_ia32) - HAS_CPU_FEATURE (SSSE3) - jz 2f - LOAD_FUNC_GOT_EAX (__strcasecmp_ssse3) - HAS_CPU_FEATURE (SSE4_2) - jz 2f - HAS_ARCH_FEATURE (Slow_SSE4_2) - jnz 2f - LOAD_FUNC_GOT_EAX (__strcasecmp_sse4_2) -2: ret -END(__strcasecmp) +# define SYMBOL_NAME strcasecmp +# include "ifunc-ssse3-sse4_2.h" + +libc_ifunc_redirected (__redirect_strcasecmp, __strcasecmp, + IFUNC_SELECTOR ()); weak_alias (__strcasecmp, strcasecmp) +#endif diff --git a/sysdeps/i386/i686/multiarch/strcasecmp_l.S b/sysdeps/i386/i686/multiarch/strcasecmp_l.S deleted file mode 100644 index 711c09b0dc..0000000000 --- a/sysdeps/i386/i686/multiarch/strcasecmp_l.S +++ /dev/null @@ -1,7 +0,0 @@ -/* Multiple versions of strcasecmp_l - All versions must be listed in ifunc-impl-list.c. */ -#define STRCMP __strcasecmp_l -#define USE_AS_STRCASECMP_L -#include "strcmp.S" - -weak_alias (__strcasecmp_l, strcasecmp_l) diff --git a/sysdeps/i386/i686/multiarch/wmemcmp.S b/sysdeps/i386/i686/multiarch/strcasecmp_l.c index ada6c693cb..87eb4960da 100644 --- a/sysdeps/i386/i686/multiarch/wmemcmp.S +++ b/sysdeps/i386/i686/multiarch/strcasecmp_l.c @@ -1,7 +1,6 @@ -/* Multiple versions of wmemcmp +/* Multiple versions of strcasecmp_l. All versions must be listed in ifunc-impl-list.c. - Copyright (C) 2011-2016 Free Software Foundation, Inc. - Contributed by Intel Corporation. + Copyright (C) 2017-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -18,23 +17,19 @@ License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ -#include <sysdep.h> -#include <init-arch.h> +/* Define multiple versions only for the definition in libc. */ +#if IS_IN (libc) +# define strcasecmp_l __redirect_strcasecmp_l +# define __strcasecmp_l __redirect___strcasecmp_l +# include <string.h> +# undef strcasecmp_l +# undef __strcasecmp_l -/* Define multiple versions only for the definition in libc. */ +# define SYMBOL_NAME strcasecmp_l +# include "ifunc-ssse3-sse4_2.h" -#if IS_IN (libc) - .text -ENTRY(wmemcmp) - .type wmemcmp, @gnu_indirect_function - LOAD_GOT_AND_RTLD_GLOBAL_RO - LOAD_FUNC_GOT_EAX (__wmemcmp_ia32) - HAS_CPU_FEATURE (SSSE3) - jz 2f - LOAD_FUNC_GOT_EAX (__wmemcmp_ssse3) - HAS_CPU_FEATURE (SSE4_2) - jz 2f - LOAD_FUNC_GOT_EAX (__wmemcmp_sse4_2) -2: ret -END(wmemcmp) +libc_ifunc_redirected (__redirect_strcasecmp_l, __strcasecmp_l, + IFUNC_SELECTOR ()); + +weak_alias (__strcasecmp_l, strcasecmp_l) #endif diff --git a/sysdeps/i386/i686/multiarch/strcat-ia32.S b/sysdeps/i386/i686/multiarch/strcat-ia32.S new file mode 100644 index 0000000000..40fb703c1e --- /dev/null +++ b/sysdeps/i386/i686/multiarch/strcat-ia32.S @@ -0,0 +1,33 @@ +/* strcat optimized for i686. + All versions must be listed in ifunc-impl-list.c. + Copyright (C) 2017-2018 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#if IS_IN (libc) +# define strcat __strcat_ia32 + +# ifdef SHARED +# undef libc_hidden_builtin_def +/* IFUNC doesn't work with the hidden functions in shared library since + they will be called without setting up EBX needed for PLT which is + used by IFUNC. */ +# define libc_hidden_builtin_def(name) \ + .globl __GI_strcat; __GI_strcat = strcat +# endif +#endif + +#include <sysdeps/i386/strcat.S> diff --git a/sysdeps/i386/i686/multiarch/strcat-sse2.S b/sysdeps/i386/i686/multiarch/strcat-sse2.S index 924d1663c6..19d5f5f65d 100644 --- a/sysdeps/i386/i686/multiarch/strcat-sse2.S +++ b/sysdeps/i386/i686/multiarch/strcat-sse2.S @@ -1,5 +1,5 @@ /* strcat with SSE2 - Copyright (C) 2011-2016 Free Software Foundation, Inc. + Copyright (C) 2011-2018 Free Software Foundation, Inc. Contributed by Intel Corporation. This file is part of the GNU C Library. @@ -34,7 +34,7 @@ # define PUSH(REG) pushl REG; CFI_PUSH (REG) # define POP(REG) popl REG; CFI_POP (REG) -# ifdef SHARED +# ifdef PIC # define JMPTBL(I, B) I - B /* Load an entry in a jump table into ECX and branch to it. TABLE is a @@ -50,7 +50,7 @@ absolute address. */ \ addl (%ecx,INDEX,SCALE), %ecx; \ /* We loaded the jump table and adjusted ECX. Go. */ \ - jmp *%ecx + _CET_NOTRACK jmp *%ecx # else # define JMPTBL(I, B) I @@ -59,7 +59,7 @@ jump table. SCALE is the scale of INDEX. */ # define BRANCH_TO_JMPTBL_ENTRY(TABLE, INDEX, SCALE) \ - jmp *TABLE(,INDEX,SCALE) + _CET_NOTRACK jmp *TABLE(,INDEX,SCALE) # endif # ifndef STRCAT @@ -227,6 +227,8 @@ L(StartStrcpyPart): pxor %xmm0, %xmm0 # ifdef USE_AS_STRNCAT add %ecx, %ebx + sbb %edx, %edx + or %edx, %ebx # endif sub %ecx, %eax jmp L(Unalign16Both) diff --git a/sysdeps/i386/i686/multiarch/strcat-ssse3.S b/sysdeps/i386/i686/multiarch/strcat-ssse3.S index ab2f8842a0..13ee7abf6d 100644 --- a/sysdeps/i386/i686/multiarch/strcat-ssse3.S +++ b/sysdeps/i386/i686/multiarch/strcat-ssse3.S @@ -1,5 +1,5 @@ /* strcat with SSSE3 - Copyright (C) 2011-2016 Free Software Foundation, Inc. + Copyright (C) 2011-2018 Free Software Foundation, Inc. Contributed by Intel Corporation. This file is part of the GNU C Library. diff --git a/sysdeps/i386/i686/multiarch/strcat.S b/sysdeps/i386/i686/multiarch/strcat.S deleted file mode 100644 index d8f4132cf3..0000000000 --- a/sysdeps/i386/i686/multiarch/strcat.S +++ /dev/null @@ -1,92 +0,0 @@ -/* Multiple versions of strcat - All versions must be listed in ifunc-impl-list.c. - Copyright (C) 2011-2016 Free Software Foundation, Inc. - Contributed by Intel Corporation. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#include <sysdep.h> -#include <init-arch.h> - -#ifndef USE_AS_STRNCAT -# ifndef STRCAT -# define STRCAT strcat -# endif -#endif - -#ifdef USE_AS_STRNCAT -# define STRCAT_SSSE3 __strncat_ssse3 -# define STRCAT_SSE2 __strncat_sse2 -# define STRCAT_IA32 __strncat_ia32 -# define __GI_STRCAT __GI_strncat -#else -# define STRCAT_SSSE3 __strcat_ssse3 -# define STRCAT_SSE2 __strcat_sse2 -# define STRCAT_IA32 __strcat_ia32 -# define __GI_STRCAT __GI_strcat -#endif - - -/* Define multiple versions only for the definition in libc. Don't - define multiple versions for strncat in static library since we - need strncat before the initialization happened. */ -#if IS_IN (libc) - - .text -ENTRY(STRCAT) - .type STRCAT, @gnu_indirect_function - LOAD_GOT_AND_RTLD_GLOBAL_RO - LOAD_FUNC_GOT_EAX (STRCAT_IA32) - HAS_CPU_FEATURE (SSE2) - jz 2f - LOAD_FUNC_GOT_EAX (STRCAT_SSE2) - HAS_ARCH_FEATURE (Fast_Unaligned_Load) - jnz 2f - HAS_CPU_FEATURE (SSSE3) - jz 2f - LOAD_FUNC_GOT_EAX (STRCAT_SSSE3) -2: ret -END(STRCAT) - -# undef ENTRY -# define ENTRY(name) \ - .type STRCAT_IA32, @function; \ - .align 16; \ - .globl STRCAT_IA32; \ - .hidden STRCAT_IA32; \ - STRCAT_IA32: cfi_startproc; \ - CALL_MCOUNT -# undef END -# define END(name) \ - cfi_endproc; .size STRCAT_IA32, .-STRCAT_IA32 - -# ifdef SHARED -# undef libc_hidden_builtin_def -/* It doesn't make sense to send libc-internal strcat calls through a PLT. - The speedup we get from using SSSE3 instruction is likely eaten away - by the indirect call in the PLT. */ -# define libc_hidden_builtin_def(name) \ - .globl __GI_STRCAT; __GI_STRCAT = STRCAT_IA32 -# undef libc_hidden_def -# define libc_hidden_def(name) \ - .globl __GI___STRCAT; __GI___STRCAT = STRCAT_IA32 - -# endif -#endif - -#ifndef USE_AS_STRNCAT -# include "../../strcat.S" -#endif diff --git a/sysdeps/i386/i686/multiarch/strcat.c b/sysdeps/i386/i686/multiarch/strcat.c new file mode 100644 index 0000000000..646539f5fc --- /dev/null +++ b/sysdeps/i386/i686/multiarch/strcat.c @@ -0,0 +1,30 @@ +/* Multiple versions of strcat. + All versions must be listed in ifunc-impl-list.c. + Copyright (C) 2017-2018 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +/* Define multiple versions only for the definition in libc. */ +#if IS_IN (libc) +# define strcat __redirect_strcat +# include <string.h> +# undef strcat + +# define SYMBOL_NAME strcat +# include "ifunc-sse2-ssse3.h" + +libc_ifunc_redirected (__redirect_strcat, strcat, IFUNC_SELECTOR ()); +#endif diff --git a/sysdeps/i386/i686/multiarch/strchr-ia32.S b/sysdeps/i386/i686/multiarch/strchr-ia32.S new file mode 100644 index 0000000000..fb6dfe70c9 --- /dev/null +++ b/sysdeps/i386/i686/multiarch/strchr-ia32.S @@ -0,0 +1,35 @@ +/* strchr optimized for i686. + Copyright (C) 2017-2018 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#if IS_IN (libc) +# define strchr __strchr_ia32 + +# ifdef SHARED +# undef libc_hidden_builtin_def +/* IFUNC doesn't work with the hidden functions in shared library since + they will be called without setting up EBX needed for PLT which is + used by IFUNC. */ +# define libc_hidden_builtin_def(name) \ + .globl __GI_strchr; __GI_strchr = strchr +# endif + +# undef weak_alias +# define weak_alias(original, alias) +#endif + +#include <sysdeps/i386/i586/strchr.S> diff --git a/sysdeps/i386/i686/multiarch/strchr-sse2-bsf.S b/sysdeps/i386/i686/multiarch/strchr-sse2-bsf.S index 1b48f3314d..20dffe9d09 100644 --- a/sysdeps/i386/i686/multiarch/strchr-sse2-bsf.S +++ b/sysdeps/i386/i686/multiarch/strchr-sse2-bsf.S @@ -1,5 +1,5 @@ /* strchr with SSE2 with bsf - Copyright (C) 2011-2016 Free Software Foundation, Inc. + Copyright (C) 2011-2018 Free Software Foundation, Inc. Contributed by Intel Corporation. This file is part of the GNU C Library. diff --git a/sysdeps/i386/i686/multiarch/strchr-sse2.S b/sysdeps/i386/i686/multiarch/strchr-sse2.S index b6680d1e7a..3aebeff0a0 100644 --- a/sysdeps/i386/i686/multiarch/strchr-sse2.S +++ b/sysdeps/i386/i686/multiarch/strchr-sse2.S @@ -1,5 +1,5 @@ /* strchr SSE2 without bsf - Copyright (C) 2011-2016 Free Software Foundation, Inc. + Copyright (C) 2011-2018 Free Software Foundation, Inc. Contributed by Intel Corporation. This file is part of the GNU C Library. diff --git a/sysdeps/i386/i686/multiarch/strchr.c b/sysdeps/i386/i686/multiarch/strchr.c new file mode 100644 index 0000000000..f5b462df2e --- /dev/null +++ b/sysdeps/i386/i686/multiarch/strchr.c @@ -0,0 +1,32 @@ +/* Multiple versions of strchr. + All versions must be listed in ifunc-impl-list.c. + Copyright (C) 2017-2018 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +/* Define multiple versions only for the definition in libc. */ +#if IS_IN (libc) +# define strchr __redirect_strchr +# include <string.h> +# undef strchr + +# define SYMBOL_NAME strchr +# include "ifunc-sse2-bsf.h" + +libc_ifunc_redirected (__redirect_strchr, strchr, IFUNC_SELECTOR ()); + +weak_alias (strchr, index) +#endif diff --git a/sysdeps/i386/i686/multiarch/strcmp-ia32.S b/sysdeps/i386/i686/multiarch/strcmp-ia32.S new file mode 100644 index 0000000000..92865591e4 --- /dev/null +++ b/sysdeps/i386/i686/multiarch/strcmp-ia32.S @@ -0,0 +1,33 @@ +/* strcmp optimized for i686. + All versions must be listed in ifunc-impl-list.c. + Copyright (C) 2017-2018 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#if IS_IN (libc) +# define strcmp __strcmp_ia32 + +# ifdef SHARED +# undef libc_hidden_builtin_def +/* IFUNC doesn't work with the hidden functions in shared library since + they will be called without setting up EBX needed for PLT which is + used by IFUNC. */ +# define libc_hidden_builtin_def(name) \ + .globl __GI_strcmp; __GI_strcmp = strcmp +# endif +#endif + +#include <sysdeps/i386/i686/strcmp.S> diff --git a/sysdeps/i386/i686/multiarch/strcmp-sse4.S b/sysdeps/i386/i686/multiarch/strcmp-sse4.S index 89efb38a40..2d189496b4 100644 --- a/sysdeps/i386/i686/multiarch/strcmp-sse4.S +++ b/sysdeps/i386/i686/multiarch/strcmp-sse4.S @@ -1,5 +1,5 @@ /* strcmp with SSE4.2 - Copyright (C) 2010-2016 Free Software Foundation, Inc. + Copyright (C) 2010-2018 Free Software Foundation, Inc. Contributed by Intel Corporation. This file is part of the GNU C Library. diff --git a/sysdeps/i386/i686/multiarch/strcmp-ssse3.S b/sysdeps/i386/i686/multiarch/strcmp-ssse3.S index 777f0b7edc..8847162d6e 100644 --- a/sysdeps/i386/i686/multiarch/strcmp-ssse3.S +++ b/sysdeps/i386/i686/multiarch/strcmp-ssse3.S @@ -1,5 +1,5 @@ /* strcmp with SSSE3 - Copyright (C) 2010-2016 Free Software Foundation, Inc. + Copyright (C) 2010-2018 Free Software Foundation, Inc. Contributed by Intel Corporation. This file is part of the GNU C Library. diff --git a/sysdeps/i386/i686/multiarch/strcmp.S b/sysdeps/i386/i686/multiarch/strcmp.S deleted file mode 100644 index 41d539ecb9..0000000000 --- a/sysdeps/i386/i686/multiarch/strcmp.S +++ /dev/null @@ -1,95 +0,0 @@ -/* Multiple versions of strcmp - All versions must be listed in ifunc-impl-list.c. - Copyright (C) 2010-2016 Free Software Foundation, Inc. - Contributed by Intel Corporation. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#include <sysdep.h> -#include <init-arch.h> - -#ifdef USE_AS_STRNCMP -# define STRCMP strncmp -# define __GI_STRCMP __GI_strncmp -# define __STRCMP_IA32 __strncmp_ia32 -# define __STRCMP_SSSE3 __strncmp_ssse3 -# define __STRCMP_SSE4_2 __strncmp_sse4_2 -#elif defined USE_AS_STRCASECMP_L -# define STRCMP __strcasecmp_l -# define __GI_STRCMP __GI_strcasecmp_l -# define __STRCMP_IA32 __strcasecmp_l_ia32 -# define __STRCMP_SSSE3 __strcasecmp_l_ssse3 -# define __STRCMP_SSE4_2 __strcasecmp_l_sse4_2 -#elif defined USE_AS_STRNCASECMP_L -# define STRCMP __strncasecmp_l -# define __GI_STRCMP __GI_strncasecmp_l -# define __STRCMP_IA32 __strncasecmp_l_ia32 -# define __STRCMP_SSSE3 __strncasecmp_l_ssse3 -# define __STRCMP_SSE4_2 __strncasecmp_l_sse4_2 -#else -# define STRCMP strcmp -# define __GI_STRCMP __GI_strcmp -# define __STRCMP_IA32 __strcmp_ia32 -# define __STRCMP_SSSE3 __strcmp_ssse3 -# define __STRCMP_SSE4_2 __strcmp_sse4_2 -#endif - -/* Define multiple versions only for the definition in libc. Don't - define multiple versions for strncmp in static library since we - need strncmp before the initialization happened. */ -#if (defined SHARED || !defined USE_AS_STRNCMP) && IS_IN (libc) - .text -ENTRY(STRCMP) - .type STRCMP, @gnu_indirect_function - LOAD_GOT_AND_RTLD_GLOBAL_RO - LOAD_FUNC_GOT_EAX (__STRCMP_IA32) - HAS_CPU_FEATURE (SSSE3) - jz 2f - LOAD_FUNC_GOT_EAX (__STRCMP_SSSE3) - HAS_CPU_FEATURE (SSE4_2) - jz 2f - HAS_ARCH_FEATURE (Slow_SSE4_2) - jnz 2f - LOAD_FUNC_GOT_EAX (__STRCMP_SSE4_2) -2: ret -END(STRCMP) - -# undef ENTRY -# define ENTRY(name) \ - .type __STRCMP_IA32, @function; \ - .p2align 4; \ - .globl __STRCMP_IA32; \ - .hidden __STRCMP_IA32; \ - __STRCMP_IA32: cfi_startproc; \ - CALL_MCOUNT -# undef END -# define END(name) \ - cfi_endproc; .size __STRCMP_IA32, .-__STRCMP_IA32 - -# ifdef SHARED -# undef libc_hidden_builtin_def -/* IFUNC doesn't work with the hidden functions in shared library since - they will be called without setting up EBX needed for PLT which is - used by IFUNC. */ -# define libc_hidden_builtin_def(name) \ - .globl __GI_STRCMP; __GI_STRCMP = __STRCMP_IA32 -# endif -#endif - -#if !defined USE_AS_STRNCMP && !defined USE_AS_STRCASECMP_L \ - && !defined USE_AS_STRNCASECMP_L -# include "../strcmp.S" -#endif diff --git a/sysdeps/i386/i686/multiarch/strcmp.c b/sysdeps/i386/i686/multiarch/strcmp.c new file mode 100644 index 0000000000..3268662518 --- /dev/null +++ b/sysdeps/i386/i686/multiarch/strcmp.c @@ -0,0 +1,30 @@ +/* Multiple versions of strcmp. + All versions must be listed in ifunc-impl-list.c. + Copyright (C) 2017-2018 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +/* Define multiple versions only for the definition in libc. */ +#if IS_IN (libc) +# define strcmp __redirect_strcmp +# include <string.h> +# undef strcmp + +# define SYMBOL_NAME strcmp +# include "ifunc-ssse3-sse4_2.h" + +libc_ifunc_redirected (__redirect_strcmp, strcmp, IFUNC_SELECTOR ()); +#endif diff --git a/sysdeps/i386/i686/multiarch/strcpy-ia32.S b/sysdeps/i386/i686/multiarch/strcpy-ia32.S new file mode 100644 index 0000000000..1c50edffc9 --- /dev/null +++ b/sysdeps/i386/i686/multiarch/strcpy-ia32.S @@ -0,0 +1,33 @@ +/* strcpy optimized for i686. + All versions must be listed in ifunc-impl-list.c. + Copyright (C) 2017-2018 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#if IS_IN (libc) +# define strcpy __strcpy_ia32 + +# ifdef SHARED +# undef libc_hidden_builtin_def +/* IFUNC doesn't work with the hidden functions in shared library since + they will be called without setting up EBX needed for PLT which is + used by IFUNC. */ +# define libc_hidden_builtin_def(name) \ + .globl __GI_strcpy; __GI_strcpy = strcpy +# endif +#endif + +#include <sysdeps/i386/i586/strcpy.S> diff --git a/sysdeps/i386/i686/multiarch/strcpy-sse2.S b/sysdeps/i386/i686/multiarch/strcpy-sse2.S index 3baa559e01..3fc27d93d4 100644 --- a/sysdeps/i386/i686/multiarch/strcpy-sse2.S +++ b/sysdeps/i386/i686/multiarch/strcpy-sse2.S @@ -1,5 +1,5 @@ /* strcpy with SSE2 and unaligned load - Copyright (C) 2011-2016 Free Software Foundation, Inc. + Copyright (C) 2011-2018 Free Software Foundation, Inc. Contributed by Intel Corporation. This file is part of the GNU C Library. @@ -48,7 +48,7 @@ # define RETURN POP(%edi); POP(%esi); POP(%ebx); ret; \ CFI_PUSH(%ebx); CFI_PUSH(%esi); CFI_PUSH(%edi); -# ifdef SHARED +# ifdef PIC # define JMPTBL(I, B) I - B /* Load an entry in a jump table into ECX and branch to it. TABLE is a @@ -65,7 +65,7 @@ absolute address. */ \ addl (%ecx,INDEX,SCALE), %ecx; \ /* We loaded the jump table and adjusted ECX. Go. */ \ - jmp *%ecx + _CET_NOTRACK jmp *%ecx # else # define JMPTBL(I, B) I @@ -74,7 +74,7 @@ jump table. SCALE is the scale of INDEX. */ # define BRANCH_TO_JMPTBL_ENTRY(TABLE, INDEX, SCALE) \ - jmp *TABLE(,INDEX,SCALE) + _CET_NOTRACK jmp *TABLE(,INDEX,SCALE) # endif .text diff --git a/sysdeps/i386/i686/multiarch/strcpy-ssse3.S b/sysdeps/i386/i686/multiarch/strcpy-ssse3.S index 10fda83e7b..5dda85530c 100644 --- a/sysdeps/i386/i686/multiarch/strcpy-ssse3.S +++ b/sysdeps/i386/i686/multiarch/strcpy-ssse3.S @@ -1,5 +1,5 @@ /* strcpy with SSSE3 - Copyright (C) 2011-2016 Free Software Foundation, Inc. + Copyright (C) 2011-2018 Free Software Foundation, Inc. Contributed by Intel Corporation. This file is part of the GNU C Library. diff --git a/sysdeps/i386/i686/multiarch/strcpy.S b/sysdeps/i386/i686/multiarch/strcpy.S deleted file mode 100644 index 51525bc091..0000000000 --- a/sysdeps/i386/i686/multiarch/strcpy.S +++ /dev/null @@ -1,116 +0,0 @@ -/* Multiple versions of strcpy - All versions must be listed in ifunc-impl-list.c. - Copyright (C) 2011-2016 Free Software Foundation, Inc. - Contributed by Intel Corporation. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#include <sysdep.h> -#include <init-arch.h> - -#if !defined (USE_AS_STPCPY) && !defined (USE_AS_STRNCPY) -# ifndef STRCPY -# define STRCPY strcpy -# endif -#endif - -#ifdef USE_AS_STPCPY -# ifdef USE_AS_STRNCPY -# define STRCPY_SSSE3 __stpncpy_ssse3 -# define STRCPY_SSE2 __stpncpy_sse2 -# define STRCPY_IA32 __stpncpy_ia32 -# define __GI_STRCPY __GI_stpncpy -# define __GI___STRCPY __GI___stpncpy -# else -# define STRCPY_SSSE3 __stpcpy_ssse3 -# define STRCPY_SSE2 __stpcpy_sse2 -# define STRCPY_IA32 __stpcpy_ia32 -# define __GI_STRCPY __GI_stpcpy -# define __GI___STRCPY __GI___stpcpy -# endif -#else -# ifdef USE_AS_STRNCPY -# define STRCPY_SSSE3 __strncpy_ssse3 -# define STRCPY_SSE2 __strncpy_sse2 -# define STRCPY_IA32 __strncpy_ia32 -# define __GI_STRCPY __GI_strncpy -# else -# define STRCPY_SSSE3 __strcpy_ssse3 -# define STRCPY_SSE2 __strcpy_sse2 -# define STRCPY_IA32 __strcpy_ia32 -# define __GI_STRCPY __GI_strcpy -# endif -#endif - - -/* Define multiple versions only for the definition in libc. Don't - define multiple versions for strncpy in static library since we - need strncpy before the initialization happened. */ -#if IS_IN (libc) - - .text -ENTRY(STRCPY) - .type STRCPY, @gnu_indirect_function - LOAD_GOT_AND_RTLD_GLOBAL_RO - LOAD_FUNC_GOT_EAX (STRCPY_IA32) - HAS_CPU_FEATURE (SSE2) - jz 2f - LOAD_FUNC_GOT_EAX (STRCPY_SSE2) - HAS_ARCH_FEATURE (Fast_Unaligned_Load) - jnz 2f - HAS_CPU_FEATURE (SSSE3) - jz 2f - LOAD_FUNC_GOT_EAX (STRCPY_SSSE3) -2: ret -END(STRCPY) - -# undef ENTRY -# define ENTRY(name) \ - .type STRCPY_IA32, @function; \ - .align 16; \ - .globl STRCPY_IA32; \ - .hidden STRCPY_IA32; \ - STRCPY_IA32: cfi_startproc; \ - CALL_MCOUNT -# undef END -# define END(name) \ - cfi_endproc; .size STRCPY_IA32, .-STRCPY_IA32 - -# ifdef SHARED -# undef libc_hidden_builtin_def -/* It doesn't make sense to send libc-internal strcpy calls through a PLT. - The speedup we get from using SSSE3 instruction is likely eaten away - by the indirect call in the PLT. */ -# define libc_hidden_builtin_def(name) \ - .globl __GI_STRCPY; __GI_STRCPY = STRCPY_IA32 -# undef libc_hidden_def -# define libc_hidden_def(name) \ - .globl __GI___STRCPY; __GI___STRCPY = STRCPY_IA32 - -# endif -#endif - -#ifdef USE_AS_STPCPY -# ifdef USE_AS_STRNCPY -# include "../../stpncpy.S" -# else -# include "../../i586/stpcpy.S" -# endif -#else -# ifndef USE_AS_STRNCPY -# include "../../i586/strcpy.S" -# endif -#endif diff --git a/sysdeps/i386/i686/multiarch/strcpy.c b/sysdeps/i386/i686/multiarch/strcpy.c new file mode 100644 index 0000000000..8c8769b152 --- /dev/null +++ b/sysdeps/i386/i686/multiarch/strcpy.c @@ -0,0 +1,30 @@ +/* Multiple versions of strcpy. + All versions must be listed in ifunc-impl-list.c. + Copyright (C) 2017-2018 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +/* Define multiple versions only for the definition in libc. */ +#if IS_IN (libc) +# define strcpy __redirect_strcpy +# include <string.h> +# undef strcpy + +# define SYMBOL_NAME strcpy +# include "ifunc-sse2-ssse3.h" + +libc_ifunc_redirected (__redirect_strcpy, strcpy, IFUNC_SELECTOR ()); +#endif diff --git a/sysdeps/i386/i686/multiarch/strcspn-c.c b/sysdeps/i386/i686/multiarch/strcspn-c.c index 6d61e190a8..ec230fb383 100644 --- a/sysdeps/i386/i686/multiarch/strcspn-c.c +++ b/sysdeps/i386/i686/multiarch/strcspn-c.c @@ -1,2 +1,4 @@ -#define __strcspn_sse2 __strcspn_ia32 -#include <sysdeps/x86_64/multiarch/strcspn-c.c> +#if IS_IN (libc) +# define __strcspn_sse2 __strcspn_ia32 +# include <sysdeps/x86_64/multiarch/strcspn-c.c> +#endif diff --git a/sysdeps/i386/i686/multiarch/strcspn-ia32.S b/sysdeps/i386/i686/multiarch/strcspn-ia32.S new file mode 100644 index 0000000000..b31f5943d0 --- /dev/null +++ b/sysdeps/i386/i686/multiarch/strcspn-ia32.S @@ -0,0 +1,33 @@ +/* strcspn optimized for i686. + All versions must be listed in ifunc-impl-list.c. + Copyright (C) 2017-2018 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#if IS_IN (libc) +# define strcspn __strcspn_ia32 + +# ifdef SHARED +# undef libc_hidden_builtin_def +/* IFUNC doesn't work with the hidden functions in shared library since + they will be called without setting up EBX needed for PLT which is + used by IFUNC. */ +# define libc_hidden_builtin_def(name) \ + .globl __GI_strcspn; __GI_strcspn = strcspn +# endif +#endif + +#include <sysdeps/i386/strcspn.S> diff --git a/sysdeps/i386/i686/multiarch/strcspn.S b/sysdeps/i386/i686/multiarch/strcspn.S deleted file mode 100644 index 4a7b177727..0000000000 --- a/sysdeps/i386/i686/multiarch/strcspn.S +++ /dev/null @@ -1,75 +0,0 @@ -/* Multiple versions of strcspn - All versions must be listed in ifunc-impl-list.c. - Copyright (C) 2009-2016 Free Software Foundation, Inc. - Contributed by Intel Corporation. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#include <config.h> -#include <sysdep.h> -#include <init-arch.h> - -#ifdef USE_AS_STRPBRK -#define STRCSPN_SSE42 __strpbrk_sse42 -#define STRCSPN_IA32 __strpbrk_ia32 -#define __GI_STRCSPN __GI_strpbrk -#else -#ifndef STRCSPN -#define STRCSPN strcspn -#define STRCSPN_SSE42 __strcspn_sse42 -#define STRCSPN_IA32 __strcspn_ia32 -#define __GI_STRCSPN __GI_strcspn -#endif -#endif - -/* Define multiple versions only for the definition in libc. Don't - define multiple versions for strpbrk in static library since we - need strpbrk before the initialization happened. */ -#if (defined SHARED || !defined USE_AS_STRPBRK) && IS_IN (libc) - .text -ENTRY(STRCSPN) - .type STRCSPN, @gnu_indirect_function - LOAD_GOT_AND_RTLD_GLOBAL_RO - LOAD_FUNC_GOT_EAX (STRCSPN_IA32) - HAS_CPU_FEATURE (SSE4_2) - jz 2f - LOAD_FUNC_GOT_EAX (STRCSPN_SSE42) -2: ret -END(STRCSPN) - -# undef ENTRY -# define ENTRY(name) \ - .type STRCSPN_IA32, @function; \ - .globl STRCSPN_IA32; \ - .p2align 4; \ - STRCSPN_IA32: cfi_startproc; \ - CALL_MCOUNT -# undef END -# define END(name) \ - cfi_endproc; .size STRCSPN_IA32, .-STRCSPN_IA32 -# undef libc_hidden_builtin_def -/* IFUNC doesn't work with the hidden functions in shared library since - they will be called without setting up EBX needed for PLT which is - used by IFUNC. */ -# define libc_hidden_builtin_def(name) \ - .globl __GI_STRCSPN; __GI_STRCSPN = STRCSPN_IA32 -#endif - -#ifdef USE_AS_STRPBRK -#include "../../strpbrk.S" -#else -#include "../../strcspn.S" -#endif diff --git a/sysdeps/i386/i686/multiarch/strcspn.c b/sysdeps/i386/i686/multiarch/strcspn.c new file mode 100644 index 0000000000..852773b268 --- /dev/null +++ b/sysdeps/i386/i686/multiarch/strcspn.c @@ -0,0 +1,30 @@ +/* Multiple versions of strcspn. + All versions must be listed in ifunc-impl-list.c. + Copyright (C) 2017-2018 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +/* Define multiple versions only for the definition in libc. */ +#if IS_IN (libc) +# define strcspn __redirect_strcspn +# include <string.h> +# undef strcspn + +# define SYMBOL_NAME strcspn +# include "ifunc-sse4_2.h" + +libc_ifunc_redirected (__redirect_strcspn, strcspn, IFUNC_SELECTOR ()); +#endif diff --git a/sysdeps/i386/fpu/s_fdimf.S b/sysdeps/i386/i686/multiarch/strlen-ia32.S index d2bd29a233..1f2ad355e8 100644 --- a/sysdeps/i386/fpu/s_fdimf.S +++ b/sysdeps/i386/i686/multiarch/strlen-ia32.S @@ -1,7 +1,6 @@ -/* Compute positive difference. - Copyright (C) 1997-2016 Free Software Foundation, Inc. +/* strlen optimized for i686. + Copyright (C) 2017-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. - Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -17,35 +16,15 @@ License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ -#include <sysdep.h> +#if defined SHARED && IS_IN (libc) +# define strlen __strlen_ia32 - .text -ENTRY(__fdimf) - flds 4(%esp) // x - flds 8(%esp) // x : y +# undef libc_hidden_builtin_def +/* IFUNC doesn't work with the hidden functions in shared library since + they will be called without setting up EBX needed for PLT which is + used by IFUNC. */ +# define libc_hidden_builtin_def(name) \ + .globl __GI_strlen; __GI_strlen = strlen +#endif - fucom %st(1) - fnstsw - sahf - jp 1f - - jc 3f - - fstp %st(1) - fldz - jmp 2f - -3: fsubrp %st, %st(1) - ret - -1: fxam - fnstsw - andb $0x45, %ah - cmpb $0x01, %ah - je 2f - - fxch -2: fstp %st(1) - ret -END(__fdimf) -weak_alias (__fdimf, fdimf) +#include <sysdeps/i386/i586/strlen.S> diff --git a/sysdeps/i386/i686/multiarch/strlen-sse2-bsf.S b/sysdeps/i386/i686/multiarch/strlen-sse2-bsf.S index e4a82495ec..52ec1fbf72 100644 --- a/sysdeps/i386/i686/multiarch/strlen-sse2-bsf.S +++ b/sysdeps/i386/i686/multiarch/strlen-sse2-bsf.S @@ -1,5 +1,5 @@ /* strlen with SSE2 and BSF - Copyright (C) 2010-2016 Free Software Foundation, Inc. + Copyright (C) 2010-2018 Free Software Foundation, Inc. Contributed by Intel Corporation. This file is part of the GNU C Library. diff --git a/sysdeps/i386/i686/multiarch/strlen-sse2.S b/sysdeps/i386/i686/multiarch/strlen-sse2.S index f7724f8a51..d5adf2810a 100644 --- a/sysdeps/i386/i686/multiarch/strlen-sse2.S +++ b/sysdeps/i386/i686/multiarch/strlen-sse2.S @@ -1,5 +1,5 @@ /* strlen with SSE2 - Copyright (C) 2010-2016 Free Software Foundation, Inc. + Copyright (C) 2010-2018 Free Software Foundation, Inc. Contributed by Intel Corporation. This file is part of the GNU C Library. diff --git a/sysdeps/i386/i686/multiarch/strlen.S b/sysdeps/i386/i686/multiarch/strlen.S deleted file mode 100644 index 0218947c49..0000000000 --- a/sysdeps/i386/i686/multiarch/strlen.S +++ /dev/null @@ -1,60 +0,0 @@ -/* Multiple versions of strlen - All versions must be listed in ifunc-impl-list.c. - Copyright (C) 2009-2016 Free Software Foundation, Inc. - Contributed by Intel Corporation. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#include <sysdep.h> -#include <init-arch.h> - -/* Define multiple versions only for the definition in libc and for the - DSO. In static binaries, we need strlen before the initialization - happened. */ -#if defined SHARED && IS_IN (libc) - .text -ENTRY(strlen) - .type strlen, @gnu_indirect_function - LOAD_GOT_AND_RTLD_GLOBAL_RO - LOAD_FUNC_GOT_EAX (__strlen_ia32) - HAS_CPU_FEATURE (SSE2) - jz 2f - LOAD_FUNC_GOT_EAX (__strlen_sse2_bsf) - HAS_ARCH_FEATURE (Slow_BSF) - jz 2f - LOAD_FUNC_GOT_EAX (__strlen_sse2) -2: ret -END(strlen) - -# undef ENTRY -# define ENTRY(name) \ - .type __strlen_ia32, @function; \ - .globl __strlen_ia32; \ - .p2align 4; \ - __strlen_ia32: cfi_startproc; \ - CALL_MCOUNT -# undef END -# define END(name) \ - cfi_endproc; .size __strlen_ia32, .-__strlen_ia32 -# undef libc_hidden_builtin_def -/* IFUNC doesn't work with the hidden functions in shared library since - they will be called without setting up EBX needed for PLT which is - used by IFUNC. */ -# define libc_hidden_builtin_def(name) \ - .globl __GI_strlen; __GI_strlen = __strlen_ia32 -#endif - -#include "../../i586/strlen.S" diff --git a/sysdeps/i386/i686/multiarch/strlen.c b/sysdeps/i386/i686/multiarch/strlen.c new file mode 100644 index 0000000000..02b97ddbb9 --- /dev/null +++ b/sysdeps/i386/i686/multiarch/strlen.c @@ -0,0 +1,30 @@ +/* Multiple versions of strlen. + All versions must be listed in ifunc-impl-list.c. + Copyright (C) 2017-2018 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +/* Define multiple versions only for the definition in libc.so. */ +#if defined SHARED && IS_IN (libc) +# define strlen __redirect_strlen +# include <string.h> +# undef strlen + +# define SYMBOL_NAME strlen +# include "ifunc-sse2-bsf.h" + +libc_ifunc_redirected (__redirect_strlen, strlen, IFUNC_SELECTOR ()); +#endif diff --git a/sysdeps/i386/i686/multiarch/strncase.S b/sysdeps/i386/i686/multiarch/strncase.c index 52d4ba5a2a..12c3b82e12 100644 --- a/sysdeps/i386/i686/multiarch/strncase.S +++ b/sysdeps/i386/i686/multiarch/strncase.c @@ -1,6 +1,6 @@ -/* Entry point for multi-version x86 strncasecmp. +/* Multiple versions of strncasecmp. All versions must be listed in ifunc-impl-list.c. - Copyright (C) 2011-2016 Free Software Foundation, Inc. + Copyright (C) 2017-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -17,23 +17,19 @@ License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ -#include <sysdep.h> -#include <init-arch.h> +/* Define multiple versions only for the definition in libc. */ +#if IS_IN (libc) +# define strncasecmp __redirect_strncasecmp +# define __strncasecmp __redirect___strncasecmp +# include <string.h> +# undef strncasecmp +# undef __strncasecmp - .text -ENTRY(__strncasecmp) - .type __strncasecmp, @gnu_indirect_function - LOAD_GOT_AND_RTLD_GLOBAL_RO - LOAD_FUNC_GOT_EAX (__strncasecmp_ia32) - HAS_CPU_FEATURE (SSSE3) - jz 2f - LOAD_FUNC_GOT_EAX (__strncasecmp_ssse3) - HAS_CPU_FEATURE (SSE4_2) - jz 2f - HAS_ARCH_FEATURE (Slow_SSE4_2) - jnz 2f - LOAD_FUNC_GOT_EAX (__strncasecmp_sse4_2) -2: ret -END(__strncasecmp) +# define SYMBOL_NAME strncasecmp +# include "ifunc-ssse3-sse4_2.h" + +libc_ifunc_redirected (__redirect_strncasecmp, __strncasecmp, + IFUNC_SELECTOR ()); weak_alias (__strncasecmp, strncasecmp) +#endif diff --git a/sysdeps/i386/i686/multiarch/strncase_l.S b/sysdeps/i386/i686/multiarch/strncase_l.S deleted file mode 100644 index 8a74ee8574..0000000000 --- a/sysdeps/i386/i686/multiarch/strncase_l.S +++ /dev/null @@ -1,7 +0,0 @@ -/* Multiple versions of strncasecmp_l - All versions must be listed in ifunc-impl-list.c. */ -#define STRCMP __strncasecmp_l -#define USE_AS_STRNCASECMP_L -#include "strcmp.S" - -weak_alias (__strncasecmp_l, strncasecmp_l) diff --git a/sysdeps/i386/i686/multiarch/strncase_l.c b/sysdeps/i386/i686/multiarch/strncase_l.c new file mode 100644 index 0000000000..fa4d47a2c9 --- /dev/null +++ b/sysdeps/i386/i686/multiarch/strncase_l.c @@ -0,0 +1,35 @@ +/* Multiple versions of strncasecmp_l. + All versions must be listed in ifunc-impl-list.c. + Copyright (C) 2017-2018 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +/* Define multiple versions only for the definition in libc. */ +#if IS_IN (libc) +# define strncasecmp_l __redirect_strncasecmp_l +# define __strncasecmp_l __redirect___strncasecmp_l +# include <string.h> +# undef strncasecmp_l +# undef __strncasecmp_l + +# define SYMBOL_NAME strncasecmp_l +# include "ifunc-ssse3-sse4_2.h" + +libc_ifunc_redirected (__redirect_strncasecmp_l, __strncasecmp_l, + IFUNC_SELECTOR ()); + +weak_alias (__strncasecmp_l, strncasecmp_l) +#endif diff --git a/sysdeps/i386/i686/multiarch/strncat-c.c b/sysdeps/i386/i686/multiarch/strncat-c.c index 132a000545..aa58a61846 100644 --- a/sysdeps/i386/i686/multiarch/strncat-c.c +++ b/sysdeps/i386/i686/multiarch/strncat-c.c @@ -1,8 +1,3 @@ #define STRNCAT __strncat_ia32 -#ifdef SHARED -#undef libc_hidden_def -#define libc_hidden_def(name) \ - __hidden_ver1 (__strncat_ia32, __GI___strncat, __strncat_ia32); -#endif - +#define STRNCAT_PRIMARY #include "string/strncat.c" diff --git a/sysdeps/i386/i686/multiarch/strncat.S b/sysdeps/i386/i686/multiarch/strncat.S deleted file mode 100644 index 5c1bf41453..0000000000 --- a/sysdeps/i386/i686/multiarch/strncat.S +++ /dev/null @@ -1,5 +0,0 @@ -/* Multiple versions of strncat - All versions must be listed in ifunc-impl-list.c. */ -#define STRCAT strncat -#define USE_AS_STRNCAT -#include "strcat.S" diff --git a/sysdeps/i386/i686/multiarch/strncat.c b/sysdeps/i386/i686/multiarch/strncat.c new file mode 100644 index 0000000000..479e74901b --- /dev/null +++ b/sysdeps/i386/i686/multiarch/strncat.c @@ -0,0 +1,30 @@ +/* Multiple versions of strcat. + All versions must be listed in ifunc-impl-list.c. + Copyright (C) 2017-2018 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +/* Define multiple versions only for the definition in libc. */ +#if IS_IN (libc) +# define strncat __redirect_strncat +# include <string.h> +# undef strncat + +# define SYMBOL_NAME strncat +# include "ifunc-sse2-ssse3.h" + +libc_ifunc_redirected (__redirect_strncat, strncat, IFUNC_SELECTOR ()); +#endif diff --git a/sysdeps/i386/i686/multiarch/strncmp-c.c b/sysdeps/i386/i686/multiarch/strncmp-c.c index cc059da494..2e3eca9b2b 100644 --- a/sysdeps/i386/i686/multiarch/strncmp-c.c +++ b/sysdeps/i386/i686/multiarch/strncmp-c.c @@ -1,4 +1,4 @@ -#ifdef SHARED +#if defined (SHARED) && IS_IN (libc) # define STRNCMP __strncmp_ia32 # undef libc_hidden_builtin_def # define libc_hidden_builtin_def(name) \ diff --git a/sysdeps/i386/i686/multiarch/strncmp.S b/sysdeps/i386/i686/multiarch/strncmp.S deleted file mode 100644 index 150d4786d2..0000000000 --- a/sysdeps/i386/i686/multiarch/strncmp.S +++ /dev/null @@ -1,5 +0,0 @@ -/* Multiple versions of strncmp - All versions must be listed in ifunc-impl-list.c. */ -#define USE_AS_STRNCMP -#define STRCMP strncmp -#include "strcmp.S" diff --git a/sysdeps/i386/i686/multiarch/strncmp.c b/sysdeps/i386/i686/multiarch/strncmp.c new file mode 100644 index 0000000000..b75c8dd557 --- /dev/null +++ b/sysdeps/i386/i686/multiarch/strncmp.c @@ -0,0 +1,30 @@ +/* Multiple versions of strncmp. + All versions must be listed in ifunc-impl-list.c. + Copyright (C) 2017-2018 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +/* Define multiple versions only for the definition in libc.so. */ +#if defined SHARED && IS_IN (libc) +# define strncmp __redirect_strncmp +# include <string.h> +# undef strncmp + +# define SYMBOL_NAME strncmp +# include "ifunc-ssse3-sse4_2.h" + +libc_ifunc_redirected (__redirect_strncmp, strncmp, IFUNC_SELECTOR ()); +#endif diff --git a/sysdeps/i386/i686/multiarch/strncpy.S b/sysdeps/i386/i686/multiarch/strncpy.S deleted file mode 100644 index 9c257efc6e..0000000000 --- a/sysdeps/i386/i686/multiarch/strncpy.S +++ /dev/null @@ -1,5 +0,0 @@ -/* Multiple versions of strncpy - All versions must be listed in ifunc-impl-list.c. */ -#define USE_AS_STRNCPY -#define STRCPY strncpy -#include "strcpy.S" diff --git a/sysdeps/i386/i686/multiarch/strncpy.c b/sysdeps/i386/i686/multiarch/strncpy.c new file mode 100644 index 0000000000..80165aa957 --- /dev/null +++ b/sysdeps/i386/i686/multiarch/strncpy.c @@ -0,0 +1,30 @@ +/* Multiple versions of strncpy. + All versions must be listed in ifunc-impl-list.c. + Copyright (C) 2017-2018 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +/* Define multiple versions only for the definition in libc. */ +#if IS_IN (libc) +# define strncpy __redirect_strncpy +# include <string.h> +# undef strncpy + +# define SYMBOL_NAME strncpy +# include "ifunc-sse2-ssse3.h" + +libc_ifunc_redirected (__redirect_strncpy, strncpy, IFUNC_SELECTOR ()); +#endif diff --git a/sysdeps/i386/i686/multiarch/wcscpy.S b/sysdeps/i386/i686/multiarch/strnlen.c index 345511530c..916cd6ebf0 100644 --- a/sysdeps/i386/i686/multiarch/wcscpy.S +++ b/sysdeps/i386/i686/multiarch/strnlen.c @@ -1,7 +1,6 @@ -/* Multiple versions of wcscpy +/* Multiple versions of strnlen. All versions must be listed in ifunc-impl-list.c. - Copyright (C) 2011-2016 Free Software Foundation, Inc. - Contributed by Intel Corporation. + Copyright (C) 2017-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -18,19 +17,18 @@ License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ -#include <sysdep.h> -#include <init-arch.h> - -/* Define multiple versions only for the definition in libc. */ +/* Define multiple versions only for the definition in libc. */ #if IS_IN (libc) - .text -ENTRY(wcscpy) - .type wcscpy, @gnu_indirect_function - LOAD_GOT_AND_RTLD_GLOBAL_RO - LOAD_FUNC_GOT_EAX (__wcscpy_ia32) - HAS_CPU_FEATURE (SSSE3) - jz 2f - LOAD_FUNC_GOT_EAX (__wcscpy_ssse3) -2: ret -END(wcscpy) +# define strnlen __redirect_strnlen +# define __strnlen __redirect___strnlen +# include <string.h> +# undef __strnlen +# undef strnlen + +# define SYMBOL_NAME strnlen +# include "ifunc-sse2.h" + +libc_ifunc_redirected (__redirect_strnlen, __strnlen, IFUNC_SELECTOR ()); + +weak_alias (__strnlen, strnlen); #endif diff --git a/sysdeps/i386/i686/multiarch/strpbrk-ia32.S b/sysdeps/i386/i686/multiarch/strpbrk-ia32.S new file mode 100644 index 0000000000..4c85c94f03 --- /dev/null +++ b/sysdeps/i386/i686/multiarch/strpbrk-ia32.S @@ -0,0 +1,33 @@ +/* strpbrk optimized for i686. + All versions must be listed in ifunc-impl-list.c. + Copyright (C) 2017-2018 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#if IS_IN (libc) +# define strpbrk __strpbrk_ia32 + +# ifdef SHARED +# undef libc_hidden_builtin_def +/* IFUNC doesn't work with the hidden functions in shared library since + they will be called without setting up EBX needed for PLT which is + used by IFUNC. */ +# define libc_hidden_builtin_def(name) \ + .globl __GI_strpbrk; __GI_strpbrk = strpbrk +# endif +#endif + +#include <sysdeps/i386/strpbrk.S> diff --git a/sysdeps/i386/i686/multiarch/strpbrk.S b/sysdeps/i386/i686/multiarch/strpbrk.S deleted file mode 100644 index 7201d6376f..0000000000 --- a/sysdeps/i386/i686/multiarch/strpbrk.S +++ /dev/null @@ -1,5 +0,0 @@ -/* Multiple versions of strpbrk - All versions must be listed in ifunc-impl-list.c. */ -#define STRCSPN strpbrk -#define USE_AS_STRPBRK -#include "strcspn.S" diff --git a/sysdeps/i386/i686/multiarch/strpbrk.c b/sysdeps/i386/i686/multiarch/strpbrk.c new file mode 100644 index 0000000000..af609f5d4b --- /dev/null +++ b/sysdeps/i386/i686/multiarch/strpbrk.c @@ -0,0 +1,30 @@ +/* Multiple versions of strpbrk. + All versions must be listed in ifunc-impl-list.c. + Copyright (C) 2017-2018 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +/* Define multiple versions only for the definition in libc. */ +#if IS_IN (libc) +# define strpbrk __redirect_strpbrk +# include <string.h> +# undef strpbrk + +# define SYMBOL_NAME strpbrk +# include "ifunc-sse4_2.h" + +libc_ifunc_redirected (__redirect_strpbrk, strpbrk, IFUNC_SELECTOR ()); +#endif diff --git a/sysdeps/i386/i686/multiarch/strrchr-ia32.S b/sysdeps/i386/i686/multiarch/strrchr-ia32.S new file mode 100644 index 0000000000..ada7248e28 --- /dev/null +++ b/sysdeps/i386/i686/multiarch/strrchr-ia32.S @@ -0,0 +1,35 @@ +/* strrchr optimized for i686. + Copyright (C) 2017-2018 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#if IS_IN (libc) +# define strrchr __strrchr_ia32 + +# ifdef SHARED +# undef libc_hidden_builtin_def +/* IFUNC doesn't work with the hidden functions in shared library since + they will be called without setting up EBX needed for PLT which is + used by IFUNC. */ +# define libc_hidden_builtin_def(name) \ + .globl __GI_strrchr; __GI_strrchr = strrchr +# endif + +# undef weak_alias +# define weak_alias(original, alias) +#endif + +#include <sysdeps/i386/strrchr.S> diff --git a/sysdeps/i386/i686/multiarch/strrchr-sse2-bsf.S b/sysdeps/i386/i686/multiarch/strrchr-sse2-bsf.S index e2713ca3fe..59e7abc7bd 100644 --- a/sysdeps/i386/i686/multiarch/strrchr-sse2-bsf.S +++ b/sysdeps/i386/i686/multiarch/strrchr-sse2-bsf.S @@ -1,5 +1,5 @@ /* strrchr with SSE2 with bsf and bsr - Copyright (C) 2011-2016 Free Software Foundation, Inc. + Copyright (C) 2011-2018 Free Software Foundation, Inc. Contributed by Intel Corporation. This file is part of the GNU C Library. diff --git a/sysdeps/i386/i686/multiarch/strrchr-sse2.S b/sysdeps/i386/i686/multiarch/strrchr-sse2.S index a0c536a5e2..bcb59bdb88 100644 --- a/sysdeps/i386/i686/multiarch/strrchr-sse2.S +++ b/sysdeps/i386/i686/multiarch/strrchr-sse2.S @@ -1,5 +1,5 @@ /* strrchr SSE2 without bsf and bsr - Copyright (C) 2011-2016 Free Software Foundation, Inc. + Copyright (C) 2011-2018 Free Software Foundation, Inc. Contributed by Intel Corporation. This file is part of the GNU C Library. diff --git a/sysdeps/i386/i686/multiarch/strrchr.S b/sysdeps/i386/i686/multiarch/strrchr.S deleted file mode 100644 index 39305760e9..0000000000 --- a/sysdeps/i386/i686/multiarch/strrchr.S +++ /dev/null @@ -1,57 +0,0 @@ -/* Multiple versions of strrchr - All versions must be listed in ifunc-impl-list.c. - Copyright (C) 2011-2016 Free Software Foundation, Inc. - Contributed by Intel Corporation. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#include <sysdep.h> -#include <init-arch.h> - -#if IS_IN (libc) - .text -ENTRY(strrchr) - .type strrchr, @gnu_indirect_function - LOAD_GOT_AND_RTLD_GLOBAL_RO - LOAD_FUNC_GOT_EAX (__strrchr_ia32) - HAS_CPU_FEATURE (SSE2) - jz 2f - LOAD_FUNC_GOT_EAX (__strrchr_sse2_bsf) - HAS_ARCH_FEATURE (Slow_BSF) - jz 2f - LOAD_FUNC_GOT_EAX (__strrchr_sse2) -2: ret -END(strrchr) - -# undef ENTRY -# define ENTRY(name) \ - .type __strrchr_ia32, @function; \ - .globl __strrchr_ia32; \ - .p2align 4; \ - __strrchr_ia32: cfi_startproc; \ - CALL_MCOUNT -# undef END -# define END(name) \ - cfi_endproc; .size __strrchr_ia32, .-__strrchr_ia32 -# undef libc_hidden_builtin_def -/* IFUNC doesn't work with the hidden functions in shared library since - they will be called without setting up EBX needed for PLT which is - used by IFUNC. */ -# define libc_hidden_builtin_def(name) \ - .globl __GI_strrchr; __GI_strrchr = __strrchr_ia32 -#endif - -#include "../../strrchr.S" diff --git a/sysdeps/i386/i686/multiarch/strrchr.c b/sysdeps/i386/i686/multiarch/strrchr.c new file mode 100644 index 0000000000..1edb7b90f1 --- /dev/null +++ b/sysdeps/i386/i686/multiarch/strrchr.c @@ -0,0 +1,32 @@ +/* Multiple versions of strrchr. + All versions must be listed in ifunc-impl-list.c. + Copyright (C) 2017-2018 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +/* Define multiple versions only for the definition in libc. */ +#if IS_IN (libc) +# define strrchr __redirect_strrchr +# include <string.h> +# undef strrchr + +# define SYMBOL_NAME strrchr +# include "ifunc-sse2-bsf.h" + +libc_ifunc_redirected (__redirect_strrchr, strrchr, IFUNC_SELECTOR ()); + +weak_alias (strrchr, rindex) +#endif diff --git a/sysdeps/i386/i686/multiarch/strspn-ia32.S b/sysdeps/i386/i686/multiarch/strspn-ia32.S new file mode 100644 index 0000000000..f3b60479dd --- /dev/null +++ b/sysdeps/i386/i686/multiarch/strspn-ia32.S @@ -0,0 +1,33 @@ +/* strspn optimized for i686. + All versions must be listed in ifunc-impl-list.c. + Copyright (C) 2017-2018 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#if IS_IN (libc) +# define strspn __strspn_ia32 + +# ifdef SHARED +# undef libc_hidden_builtin_def +/* IFUNC doesn't work with the hidden functions in shared library since + they will be called without setting up EBX needed for PLT which is + used by IFUNC. */ +# define libc_hidden_builtin_def(name) \ + .globl __GI_strspn; __GI_strspn = strspn +# endif +#endif + +#include <sysdeps/i386/strspn.S> diff --git a/sysdeps/i386/i686/multiarch/strspn.S b/sysdeps/i386/i686/multiarch/strspn.S deleted file mode 100644 index 6ed4861efe..0000000000 --- a/sysdeps/i386/i686/multiarch/strspn.S +++ /dev/null @@ -1,56 +0,0 @@ -/* Multiple versions of strspn - All versions must be listed in ifunc-impl-list.c. - Copyright (C) 2009-2016 Free Software Foundation, Inc. - Contributed by Intel Corporation. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#include <config.h> -#include <sysdep.h> -#include <init-arch.h> - -/* Define multiple versions only for the definition in libc. */ -#if IS_IN (libc) - .text -ENTRY(strspn) - .type strspn, @gnu_indirect_function - LOAD_GOT_AND_RTLD_GLOBAL_RO - LOAD_FUNC_GOT_EAX (__strspn_ia32) - HAS_CPU_FEATURE (SSE4_2) - jz 2f - LOAD_FUNC_GOT_EAX (__strspn_sse42) -2: ret -END(strspn) - -# undef ENTRY -# define ENTRY(name) \ - .type __strspn_ia32, @function; \ - .globl __strspn_ia32; \ - .p2align 4; \ -__strspn_ia32: cfi_startproc; \ - CALL_MCOUNT -# undef END -# define END(name) \ - cfi_endproc; .size __strspn_ia32, .-__strspn_ia32 -# undef libc_hidden_builtin_def -/* IFUNC doesn't work with the hidden functions in shared library since - they will be called without setting up EBX needed for PLT which is - used by IFUNC. */ -# define libc_hidden_builtin_def(name) \ - .globl __GI_strspn; __GI_strspn = __strspn_ia32 -#endif - -#include "../../strspn.S" diff --git a/sysdeps/i386/i686/multiarch/strspn.c b/sysdeps/i386/i686/multiarch/strspn.c new file mode 100644 index 0000000000..3f3f08d7a3 --- /dev/null +++ b/sysdeps/i386/i686/multiarch/strspn.c @@ -0,0 +1,30 @@ +/* Multiple versions of strspn. + All versions must be listed in ifunc-impl-list.c. + Copyright (C) 2017-2018 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +/* Define multiple versions only for the definition in libc. */ +#if IS_IN (libc) +# define strspn __redirect_strspn +# include <string.h> +# undef strspn + +# define SYMBOL_NAME strspn +# include "ifunc-sse4_2.h" + +libc_ifunc_redirected (__redirect_strspn, strspn, IFUNC_SELECTOR ()); +#endif diff --git a/sysdeps/i386/i686/multiarch/varshift.c b/sysdeps/i386/i686/multiarch/varshift.c index 7760b966e2..6742a35d41 100644 --- a/sysdeps/i386/i686/multiarch/varshift.c +++ b/sysdeps/i386/i686/multiarch/varshift.c @@ -1 +1,3 @@ -#include <sysdeps/x86_64/multiarch/varshift.c> +#if IS_IN (libc) +# include <sysdeps/x86_64/multiarch/varshift.c> +#endif diff --git a/sysdeps/i386/i686/multiarch/wcschr-sse2.S b/sysdeps/i386/i686/multiarch/wcschr-sse2.S index 4bcc553569..3b0f813617 100644 --- a/sysdeps/i386/i686/multiarch/wcschr-sse2.S +++ b/sysdeps/i386/i686/multiarch/wcschr-sse2.S @@ -1,5 +1,5 @@ /* wcschr with SSE2, without using bsf instructions - Copyright (C) 2011-2016 Free Software Foundation, Inc. + Copyright (C) 2011-2018 Free Software Foundation, Inc. Contributed by Intel Corporation. This file is part of the GNU C Library. diff --git a/sysdeps/i386/i686/multiarch/wcschr.c b/sysdeps/i386/i686/multiarch/wcschr.c new file mode 100644 index 0000000000..71446b4cf6 --- /dev/null +++ b/sysdeps/i386/i686/multiarch/wcschr.c @@ -0,0 +1,33 @@ +/* Multiple versions of wcschr. + All versions must be listed in ifunc-impl-list.c. + Copyright (C) 2017-2018 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +/* Define multiple versions only for the definition in libc. */ +#if IS_IN (libc) +# define wcschr __redirect_wcschr +# define __wcschr __redirect___wcschr +# include <wchar.h> +# undef wcschr +# undef __wcschr + +# define SYMBOL_NAME wcschr +# include "ifunc-sse2.h" + +libc_ifunc_redirected (__redirect_wcschr, __wcschr, IFUNC_SELECTOR ()); +weak_alias (__wcschr, wcschr); +#endif diff --git a/sysdeps/i386/i686/multiarch/wcscmp-sse2.S b/sysdeps/i386/i686/multiarch/wcscmp-sse2.S index ff57063b9b..00205b50fe 100644 --- a/sysdeps/i386/i686/multiarch/wcscmp-sse2.S +++ b/sysdeps/i386/i686/multiarch/wcscmp-sse2.S @@ -1,5 +1,5 @@ /* wcscmp with SSE2 - Copyright (C) 2011-2016 Free Software Foundation, Inc. + Copyright (C) 2011-2018 Free Software Foundation, Inc. Contributed by Intel Corporation. This file is part of the GNU C Library. diff --git a/sysdeps/i386/i686/multiarch/wcscmp.c b/sysdeps/i386/i686/multiarch/wcscmp.c new file mode 100644 index 0000000000..504806884b --- /dev/null +++ b/sysdeps/i386/i686/multiarch/wcscmp.c @@ -0,0 +1,33 @@ +/* Multiple versions of wcscmp. + All versions must be listed in ifunc-impl-list.c. + Copyright (C) 2017-2018 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +/* Define multiple versions only for the definition in libc. */ +#if IS_IN (libc) +# define wcscmp __redirect_wcscmp +# define __wcscmp __redirect___wcscmp +# include <wchar.h> +# undef wcscmp +# undef __wcscmp + +# define SYMBOL_NAME wcscmp +# include "ifunc-sse2.h" + +libc_ifunc_redirected (__redirect_wcscmp, __wcscmp, IFUNC_SELECTOR ()); +weak_alias (__wcscmp, wcscmp); +#endif diff --git a/sysdeps/i386/i686/multiarch/wcscpy-ssse3.S b/sysdeps/i386/i686/multiarch/wcscpy-ssse3.S index 09e538369f..f01b9f7c82 100644 --- a/sysdeps/i386/i686/multiarch/wcscpy-ssse3.S +++ b/sysdeps/i386/i686/multiarch/wcscpy-ssse3.S @@ -1,5 +1,5 @@ /* wcscpy with SSSE3 - Copyright (C) 2011-2016 Free Software Foundation, Inc. + Copyright (C) 2011-2018 Free Software Foundation, Inc. Contributed by Intel Corporation. This file is part of the GNU C Library. diff --git a/sysdeps/i386/i686/multiarch/wcscpy.c b/sysdeps/i386/i686/multiarch/wcscpy.c new file mode 100644 index 0000000000..be89ab81b0 --- /dev/null +++ b/sysdeps/i386/i686/multiarch/wcscpy.c @@ -0,0 +1,44 @@ +/* Multiple versions of wcscpy. + All versions must be listed in ifunc-impl-list.c. + Copyright (C) 2017-2018 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +/* Define multiple versions only for the definition in libc. */ +#if IS_IN (libc) +# define wcscpy __redirect_wcscpy +# include <wchar.h> +# undef wcscpy + +# define SYMBOL_NAME wcscpy +#include <init-arch.h> + +extern __typeof (REDIRECT_NAME) OPTIMIZE (ia32) attribute_hidden; +extern __typeof (REDIRECT_NAME) OPTIMIZE (ssse3) attribute_hidden; + +static inline void * +IFUNC_SELECTOR (void) +{ + const struct cpu_features* cpu_features = __get_cpu_features (); + + if (CPU_FEATURES_CPU_P (cpu_features, SSSE3)) + return OPTIMIZE (ssse3); + + return OPTIMIZE (ia32); +} + +libc_ifunc_redirected (__redirect_wcscpy, wcscpy, IFUNC_SELECTOR ()); +#endif diff --git a/sysdeps/i386/i686/multiarch/wcslen-sse2.S b/sysdeps/i386/i686/multiarch/wcslen-sse2.S index 897debb122..d0a0fbb3bf 100644 --- a/sysdeps/i386/i686/multiarch/wcslen-sse2.S +++ b/sysdeps/i386/i686/multiarch/wcslen-sse2.S @@ -1,5 +1,5 @@ /* wcslen with SSE2 - Copyright (C) 2011-2016 Free Software Foundation, Inc. + Copyright (C) 2011-2018 Free Software Foundation, Inc. Contributed by Intel Corporation. This file is part of the GNU C Library. diff --git a/sysdeps/i386/i686/multiarch/wcslen.c b/sysdeps/i386/i686/multiarch/wcslen.c new file mode 100644 index 0000000000..9f1b238a44 --- /dev/null +++ b/sysdeps/i386/i686/multiarch/wcslen.c @@ -0,0 +1,31 @@ +/* Multiple versions of wcslen. + All versions must be listed in ifunc-impl-list.c. + Copyright (C) 2017-2018 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +/* Define multiple versions only for the definition in libc. */ +#if IS_IN (libc) +# define __wcslen __redirect_wcslen +# include <wchar.h> +# undef __wcslen + +# define SYMBOL_NAME wcslen +# include "ifunc-sse2.h" + +libc_ifunc_redirected (__redirect_wcslen, __wcslen, IFUNC_SELECTOR ()); +weak_alias (__wcslen, wcslen); +#endif diff --git a/sysdeps/i386/i686/multiarch/wcsrchr-sse2.S b/sysdeps/i386/i686/multiarch/wcsrchr-sse2.S index e68004204a..7dfcd57b6d 100644 --- a/sysdeps/i386/i686/multiarch/wcsrchr-sse2.S +++ b/sysdeps/i386/i686/multiarch/wcsrchr-sse2.S @@ -1,5 +1,5 @@ /* wcsrchr with SSE2, without using bsf instructions. - Copyright (C) 2011-2016 Free Software Foundation, Inc. + Copyright (C) 2011-2018 Free Software Foundation, Inc. Contributed by Intel Corporation. This file is part of the GNU C Library. diff --git a/sysdeps/i386/i686/multiarch/wcsrchr.c b/sysdeps/i386/i686/multiarch/wcsrchr.c new file mode 100644 index 0000000000..4c39b5d906 --- /dev/null +++ b/sysdeps/i386/i686/multiarch/wcsrchr.c @@ -0,0 +1,30 @@ +/* Multiple versions of wcsrchr. + All versions must be listed in ifunc-impl-list.c. + Copyright (C) 2017-2018 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +/* Define multiple versions only for the definition in libc. */ +#if IS_IN (libc) +# define wcsrchr __redirect_wcsrchr +# include <wchar.h> +# undef wcsrchr + +# define SYMBOL_NAME wcsrchr +# include "ifunc-sse2.h" + +libc_ifunc_redirected (__redirect_wcsrchr, wcsrchr, IFUNC_SELECTOR ()); +#endif diff --git a/sysdeps/i386/i686/multiarch/wmemcmp.c b/sysdeps/i386/i686/multiarch/wmemcmp.c new file mode 100644 index 0000000000..47f133b50e --- /dev/null +++ b/sysdeps/i386/i686/multiarch/wmemcmp.c @@ -0,0 +1,30 @@ +/* Multiple versions of wmemcmp. + All versions must be listed in ifunc-impl-list.c. + Copyright (C) 2017-2018 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +/* Define multiple versions only for the definition in libc. */ +#if IS_IN (libc) +# define wmemcmp __redirect_wmemcmp +# include <wchar.h> +# undef wmemcmp + +# define SYMBOL_NAME wmemcmp +# include "ifunc-ssse3-sse4_2.h" + +libc_ifunc_redirected (__redirect_wmemcmp, wmemcmp, IFUNC_SELECTOR ()); +#endif diff --git a/sysdeps/i386/i686/nptl/tls.h b/sysdeps/i386/i686/nptl/tls.h index 06f425d5c1..b4945cbb42 100644 --- a/sysdeps/i386/i686/nptl/tls.h +++ b/sysdeps/i386/i686/nptl/tls.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2002-2016 Free Software Foundation, Inc. +/* Copyright (C) 2002-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. diff --git a/sysdeps/i386/i686/pthread_spin_trylock.S b/sysdeps/i386/i686/pthread_spin_trylock.S index 52af4b34d6..bb738f18e0 100644 --- a/sysdeps/i386/i686/pthread_spin_trylock.S +++ b/sysdeps/i386/i686/pthread_spin_trylock.S @@ -1,4 +1,4 @@ -/* Copyright (C) 2002-2016 Free Software Foundation, Inc. +/* Copyright (C) 2002-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. diff --git a/sysdeps/i386/i686/stack-aliasing.h b/sysdeps/i386/i686/stack-aliasing.h index cbe276dc76..9ccb9d07e9 100644 --- a/sysdeps/i386/i686/stack-aliasing.h +++ b/sysdeps/i386/i686/stack-aliasing.h @@ -1,5 +1,5 @@ /* Define macros for stack address aliasing issues for NPTL. i686 version. - Copyright (C) 2014-2016 Free Software Foundation, Inc. + Copyright (C) 2014-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -16,11 +16,6 @@ License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ -/* It turns out that stack coloring is in general not good on P4s. Some - applications will benefit. We will probably have a configuration option - at some point. To enable coloring, set this to 128. */ -#define COLORING_INCREMENT 0 - /* What is useful is to avoid the 64k aliasing problem which reliably happens if all stacks use sizes which are a multiple of 64k. Tell the stack allocator to disturb this by allocation one more page if diff --git a/sysdeps/i386/i686/strcmp.S b/sysdeps/i386/i686/strcmp.S index 0507bc4214..c98e175dcb 100644 --- a/sysdeps/i386/i686/strcmp.S +++ b/sysdeps/i386/i686/strcmp.S @@ -1,5 +1,5 @@ /* Highly optimized version for ix86, x>=6. - Copyright (C) 1999-2016 Free Software Foundation, Inc. + Copyright (C) 1999-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1999. diff --git a/sysdeps/i386/i686/strtok.S b/sysdeps/i386/i686/strtok.S deleted file mode 100644 index 90b2fd6301..0000000000 --- a/sysdeps/i386/i686/strtok.S +++ /dev/null @@ -1,244 +0,0 @@ -/* strtok (str, delim) -- Return next DELIM separated token from STR. - For Intel 80686. - Copyright (C) 1998-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#include <sysdep.h> -#include "asm-syntax.h" - -/* This file can be used for three variants of the strtok function: - - strtok: - INPUT PARAMETER: - str (sp + 4) - delim (sp + 8) - - strtok_r: - INPUT PARAMETER: - str (sp + 4) - delim (sp + 8) - save_ptr (sp + 12) - - We do a common implementation here. */ - -#ifdef USE_AS_STRTOK_R -# define SAVE_PTR 0(%ecx) -#else - .bss - .local save_ptr - .type save_ptr, @object - .size save_ptr, 4 -save_ptr: - .space 4 - -# ifdef PIC -# define SAVE_PTR save_ptr@GOTOFF(%ebx) -# else -# define SAVE_PTR save_ptr -# endif - -# define FUNCTION strtok -#endif - -#if !defined USE_AS_STRTOK_R && defined PIC -# define PARMS 4+256+4 /* space for table and saved PIC register */ -#else -# define PARMS 4+256 /* space for table */ -#endif -#define RTN PARMS -#define STR RTN -#define DELIM STR+4 -#ifdef USE_AS_STRTOK_R -# define SAVE DELIM+4 -#endif - - .text - -#if !defined USE_AS_STRTOK_R && defined PIC -0: movl (%esp), %ebx - ret -#endif - -ENTRY (FUNCTION) - -#if !defined USE_AS_STRTOK_R && defined PIC - pushl %ebx /* Save PIC register. */ - cfi_adjust_cfa_offset (4) - cfi_rel_offset (ebx, 0) - call 0b - addl $_GLOBAL_OFFSET_TABLE_, %ebx -#endif - - /* First we create a table with flags for all possible characters. - For the ASCII (7bit/8bit) or ISO-8859-X character sets which are - supported by the C string functions we have 256 characters. - Before inserting marks for the stop characters we clear the whole - table. */ - movl %edi, %edx - subl $256, %esp - cfi_adjust_cfa_offset (256) - movl $64, %ecx - movl %esp, %edi - xorl %eax, %eax - cld - rep - stosl - - /* Note: %ecx = 0 !!! */ - movl %edx, %edi - - movl STR(%esp), %edx /* Get start of string. */ - -#ifdef USE_AS_STRTOK_R - /* The value is stored in the third argument. */ - movl SAVE(%esp), %eax - movl (%eax), %eax -#else - /* The value is in the local variable defined above. But - we have to take care for PIC code. */ - movl SAVE_PTR, %eax -#endif - - /* If the pointer is NULL we have to use the stored value of - the last run. */ - cmpl $0, %edx - cmove %eax, %edx - testl %edx, %edx - jz L(returnNULL) - movl DELIM(%esp), %eax /* Get start of delimiter set. */ - -/* For understanding the following code remember that %ecx == 0 now. - Although all the following instruction only modify %cl we always - have a correct zero-extended 32-bit value in %ecx. */ - -L(2): movb (%eax), %cl /* get byte from stopset */ - testb %cl, %cl /* is NUL char? */ - jz L(1) /* yes => start compare loop */ - movb %cl, (%esp,%ecx) /* set corresponding byte in stopset table */ - - movb 1(%eax), %cl /* get byte from stopset */ - testb $0xff, %cl /* is NUL char? */ - jz L(1) /* yes => start compare loop */ - movb %cl, (%esp,%ecx) /* set corresponding byte in stopset table */ - - movb 2(%eax), %cl /* get byte from stopset */ - testb $0xff, %cl /* is NUL char? */ - jz L(1) /* yes => start compare loop */ - movb %cl, (%esp,%ecx) /* set corresponding byte in stopset table */ - - movb 3(%eax), %cl /* get byte from stopset */ - addl $4, %eax /* increment stopset pointer */ - movb %cl, (%esp,%ecx) /* set corresponding byte in stopset table */ - testb $0xff, %cl /* is NUL char? */ - jnz L(2) /* no => process next dword from stopset */ - -L(1): leal -4(%edx), %eax /* prepare loop */ - - /* We use a neat trick for the following loop. Normally we would - have to test for two termination conditions - 1. a character in the stopset was found - and - 2. the end of the string was found - As a sign that the character is in the stopset we store its - value in the table. The value of NUL is NUL so the loop - terminates for NUL in every case. */ - -L(3): addl $4, %eax /* adjust pointer for full loop round */ - - movb (%eax), %cl /* get byte from string */ - testb %cl, (%esp,%ecx) /* is it contained in stopset? */ - jz L(4) /* no => start of token */ - - movb 1(%eax), %cl /* get byte from string */ - testb %cl, (%esp,%ecx) /* is it contained in stopset? */ - jz L(5) /* no => start of token */ - - movb 2(%eax), %cl /* get byte from string */ - testb %cl, (%esp,%ecx) /* is it contained in stopset? */ - jz L(6) /* no => start of token */ - - movb 3(%eax), %cl /* get byte from string */ - testb %cl, (%esp,%ecx) /* is it contained in stopset? */ - jnz L(3) /* yes => start of loop */ - - incl %eax /* adjust pointer */ -L(6): incl %eax -L(5): incl %eax - - /* Now we have to terminate the string. */ - -L(4): leal -4(%eax), %edx /* We use %EDX for the next run. */ - -L(7): addl $4, %edx /* adjust pointer for full loop round */ - - movb (%edx), %cl /* get byte from string */ - cmpb %cl, (%esp,%ecx) /* is it contained in skipset? */ - je L(8) /* yes => return */ - - movb 1(%edx), %cl /* get byte from string */ - cmpb %cl, (%esp,%ecx) /* is it contained in skipset? */ - je L(9) /* yes => return */ - - movb 2(%edx), %cl /* get byte from string */ - cmpb %cl, (%esp,%ecx) /* is it contained in skipset? */ - je L(10) /* yes => return */ - - movb 3(%edx), %cl /* get byte from string */ - cmpb %cl, (%esp,%ecx) /* is it contained in skipset? */ - jne L(7) /* no => start loop again */ - - incl %edx /* adjust pointer */ -L(10): incl %edx -L(9): incl %edx - -L(8): cmpl %eax, %edx - je L(returnNULL) /* There was no token anymore. */ - - movb $0, (%edx) /* Terminate string. */ - - /* Are we at end of string? */ - cmpb $0, %cl - leal 1(%edx), %ecx - cmovne %ecx, %edx - - /* Store the pointer to the next character. */ -#ifdef USE_AS_STRTOK_R - movl SAVE(%esp), %ecx -#endif - movl %edx, SAVE_PTR - -L(epilogue): - /* Remove the stopset table. */ - addl $256, %esp - cfi_adjust_cfa_offset (-256) -#if !defined USE_AS_STRTOK_R && defined PIC - popl %ebx - cfi_adjust_cfa_offset (-4) - cfi_restore (ebx) -#endif - ret - -L(returnNULL): - xorl %eax, %eax -#ifdef USE_AS_STRTOK_R - movl SAVE(%esp), %ecx -#endif - movl %edx, SAVE_PTR - jmp L(epilogue) - -END (FUNCTION) diff --git a/sysdeps/i386/i686/strtok_r.S b/sysdeps/i386/i686/strtok_r.S deleted file mode 100644 index 353e076ba7..0000000000 --- a/sysdeps/i386/i686/strtok_r.S +++ /dev/null @@ -1,5 +0,0 @@ -#define FUNCTION __strtok_r -#define USE_AS_STRTOK_R 1 -#include <sysdeps/i386/i686/strtok.S> -weak_alias (__strtok_r, strtok_r) -strong_alias (__strtok_r, __GI___strtok_r) diff --git a/sysdeps/i386/i686/tst-stack-align.h b/sysdeps/i386/i686/tst-stack-align.h index 155d467ddb..975f26efd9 100644 --- a/sysdeps/i386/i686/tst-stack-align.h +++ b/sysdeps/i386/i686/tst-stack-align.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2003-2016 Free Software Foundation, Inc. +/* Copyright (C) 2003-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/sysdeps/i386/init-arch.h b/sysdeps/i386/init-arch.h index 945352f252..043089ceb9 100644 --- a/sysdeps/i386/init-arch.h +++ b/sysdeps/i386/init-arch.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2015-2016 Free Software Foundation, Inc. +/* Copyright (C) 2015-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/sysdeps/i386/jmpbuf-offsets.h b/sysdeps/i386/jmpbuf-offsets.h index 979d25c42f..7e1aed2224 100644 --- a/sysdeps/i386/jmpbuf-offsets.h +++ b/sysdeps/i386/jmpbuf-offsets.h @@ -1,5 +1,5 @@ /* Private macros for accessing __jmp_buf contents. i386 version. - Copyright (C) 2006-2016 Free Software Foundation, Inc. + Copyright (C) 2006-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/sysdeps/i386/jmpbuf-unwind.h b/sysdeps/i386/jmpbuf-unwind.h index 21c2191bcf..141a625c6a 100644 --- a/sysdeps/i386/jmpbuf-unwind.h +++ b/sysdeps/i386/jmpbuf-unwind.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2003-2016 Free Software Foundation, Inc. +/* Copyright (C) 2003-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Jakub Jelinek <jakub@redhat.com>, 2003. diff --git a/sysdeps/i386/ldbl2mpn.c b/sysdeps/i386/ldbl2mpn.c index bf3353e406..8217f40f26 100644 --- a/sysdeps/i386/ldbl2mpn.c +++ b/sysdeps/i386/ldbl2mpn.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1995-2016 Free Software Foundation, Inc. +/* Copyright (C) 1995-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/sysdeps/i386/lshift.S b/sysdeps/i386/lshift.S index ca292af979..2dce7c09dd 100644 --- a/sysdeps/i386/lshift.S +++ b/sysdeps/i386/lshift.S @@ -1,5 +1,5 @@ /* i80386 __mpn_lshift -- - Copyright (C) 1992-2016 Free Software Foundation, Inc. + Copyright (C) 1992-2018 Free Software Foundation, Inc. This file is part of the GNU MP Library. The GNU MP Library is free software; you can redistribute it and/or modify diff --git a/sysdeps/i386/machine-gmon.h b/sysdeps/i386/machine-gmon.h index c6a8a93431..2cfdc6ef01 100644 --- a/sysdeps/i386/machine-gmon.h +++ b/sysdeps/i386/machine-gmon.h @@ -1,5 +1,5 @@ /* i386-specific implementation of profiling support. - Copyright (C) 1997-2016 Free Software Foundation, Inc. + Copyright (C) 1997-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -29,10 +29,12 @@ /* We must not pollute the global namespace. */ #define mcount_internal __mcount_internal -extern void mcount_internal (u_long frompc, u_long selfpc) internal_function; +extern void mcount_internal (u_long frompc, u_long selfpc) + __attribute__ ((regparm (2))) attribute_hidden; -#define _MCOUNT_DECL(frompc, selfpc) \ -void internal_function mcount_internal (u_long frompc, u_long selfpc) +#define _MCOUNT_DECL(frompc, selfpc) \ + __attribute__ ((regparm (2))) \ +void mcount_internal (u_long frompc, u_long selfpc) /* Define MCOUNT as empty since we have the implementation in another diff --git a/sysdeps/i386/i686/fpu/s_fdiml.S b/sysdeps/i386/malloc-alignment.h index 8cdfedef0a..b938be023d 100644 --- a/sysdeps/i386/i686/fpu/s_fdiml.S +++ b/sysdeps/i386/malloc-alignment.h @@ -1,7 +1,6 @@ -/* Compute positive difference. - Copyright (C) 1997-2016 Free Software Foundation, Inc. +/* Define MALLOC_ALIGNMENT for malloc. i386 version. + Copyright (C) 2017-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. - Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -17,27 +16,9 @@ License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ -#include <sysdep.h> +#ifndef _I386_MALLOC_ALIGNMENT_H +#define _I386_MALLOC_ALIGNMENT_H - .text -ENTRY(__fdiml) - fldt 4(%esp) // x - fldt 16(%esp) // x : y +#define MALLOC_ALIGNMENT 16 - fucomi %st(1), %st - jp 1f - - jc 3f - fstp %st(1) - fldz - jmp 2f - -3: fsubrp %st, %st(1) - ret - -1: fucomi %st(0), %st - fcmovnu %st(1), %st -2: fstp %st(1) - ret -END(__fdiml) -weak_alias (__fdiml, fdiml) +#endif /* !defined(_I386_MALLOC_ALIGNMENT_H) */ diff --git a/sysdeps/i386/memchr.S b/sysdeps/i386/memchr.S index e8834349e6..ee5960a4cc 100644 --- a/sysdeps/i386/memchr.S +++ b/sysdeps/i386/memchr.S @@ -1,6 +1,6 @@ /* memchr (str, chr, len) -- Return pointer to first occurrence of CHR in STR less than LEN. For Intel 80x86, x>=3. - Copyright (C) 1994-2016 Free Software Foundation, Inc. + Copyright (C) 1994-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu> Optimised a little by Alan Modra <Alan@SPRI.Levels.UniSA.Edu.Au> diff --git a/sysdeps/i386/memcmp.S b/sysdeps/i386/memcmp.S index bc73005922..b57abacbe0 100644 --- a/sysdeps/i386/memcmp.S +++ b/sysdeps/i386/memcmp.S @@ -1,5 +1,5 @@ /* Compare two memory blocks for differences in the first COUNT bytes. - Copyright (C) 1995-2016 Free Software Foundation, Inc. + Copyright (C) 1995-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/sysdeps/i386/memcopy.h b/sysdeps/i386/memcopy.h index 2fe98fa98b..12bb39f945 100644 --- a/sysdeps/i386/memcopy.h +++ b/sysdeps/i386/memcopy.h @@ -1,5 +1,5 @@ /* memcopy.h -- definitions for memory copy functions. i386 version. - Copyright (C) 1991-2016 Free Software Foundation, Inc. + Copyright (C) 1991-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Torbjorn Granlund (tege@sics.se). diff --git a/sysdeps/i386/memcpy.S b/sysdeps/i386/memcpy.S index e6a8dd8a9d..0f8719087c 100644 --- a/sysdeps/i386/memcpy.S +++ b/sysdeps/i386/memcpy.S @@ -1,5 +1,5 @@ /* memcpy with REP MOVSB/STOSB - Copyright (C) 2015-2016 Free Software Foundation, Inc. + Copyright (C) 2015-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/sysdeps/i386/memcpy_chk.S b/sysdeps/i386/memcpy_chk.S index c40c3d70f5..53064e91a2 100644 --- a/sysdeps/i386/memcpy_chk.S +++ b/sysdeps/i386/memcpy_chk.S @@ -1,5 +1,5 @@ /* Checking memcpy for i386. - Copyright (C) 2004-2016 Free Software Foundation, Inc. + Copyright (C) 2004-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/sysdeps/i386/memmove_chk.S b/sysdeps/i386/memmove_chk.S index 2bf59b7093..7f64fa8944 100644 --- a/sysdeps/i386/memmove_chk.S +++ b/sysdeps/i386/memmove_chk.S @@ -1,5 +1,5 @@ /* Checking memmove for i386 - Copyright (C) 2004-2016 Free Software Foundation, Inc. + Copyright (C) 2004-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/sysdeps/i386/mempcpy_chk.S b/sysdeps/i386/mempcpy_chk.S index e0bac6eee7..7674f9cb19 100644 --- a/sysdeps/i386/mempcpy_chk.S +++ b/sysdeps/i386/mempcpy_chk.S @@ -1,5 +1,5 @@ /* Checking mempcpy for i386 - Copyright (C) 2004-2016 Free Software Foundation, Inc. + Copyright (C) 2004-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/sysdeps/i386/memset.S b/sysdeps/i386/memset.S index 07b0911988..13fdee1d7e 100644 --- a/sysdeps/i386/memset.S +++ b/sysdeps/i386/memset.S @@ -1,5 +1,5 @@ /* memset with REP MOVSB/STOSB - Copyright (C) 2015-2016 Free Software Foundation, Inc. + Copyright (C) 2015-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/sysdeps/i386/memset_chk.S b/sysdeps/i386/memset_chk.S index 5e593a2e84..d9cf5c04e3 100644 --- a/sysdeps/i386/memset_chk.S +++ b/sysdeps/i386/memset_chk.S @@ -1,5 +1,5 @@ /* Checking memset for i386. - Copyright (C) 2004-2016 Free Software Foundation, Inc. + Copyright (C) 2004-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/sysdeps/i386/memusage.h b/sysdeps/i386/memusage.h index 719275ca35..dd31dca423 100644 --- a/sysdeps/i386/memusage.h +++ b/sysdeps/i386/memusage.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2016 Free Software Foundation, Inc. +/* Copyright (C) 2000-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/sysdeps/i386/mul_1.S b/sysdeps/i386/mul_1.S index 6cb992b747..408bcdbaf9 100644 --- a/sysdeps/i386/mul_1.S +++ b/sysdeps/i386/mul_1.S @@ -1,6 +1,6 @@ /* i80386 __mpn_mul_1 -- Multiply a limb vector with a limb and store the result in a second limb vector. - Copyright (C) 1992-2016 Free Software Foundation, Inc. + Copyright (C) 1992-2018 Free Software Foundation, Inc. This file is part of the GNU MP Library. The GNU MP Library is free software; you can redistribute it and/or modify diff --git a/sysdeps/i386/nptl/Makefile b/sysdeps/i386/nptl/Makefile index eee3d75ed7..73024033ee 100644 --- a/sysdeps/i386/nptl/Makefile +++ b/sysdeps/i386/nptl/Makefile @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2016 Free Software Foundation, Inc. +# Copyright (C) 2002-2018 Free Software Foundation, Inc. # This file is part of the GNU C Library. # The GNU C Library is free software; you can redistribute it and/or @@ -18,9 +18,3 @@ ifeq ($(subdir),csu) gen-as-const-headers += tcb-offsets.sym endif - -ifeq ($(subdir),nptl) -CFLAGS-pthread_create.c += -mpreferred-stack-boundary=4 -CFLAGS-tst-align.c += -mpreferred-stack-boundary=4 -CFLAGS-tst-align2.c += -mpreferred-stack-boundary=4 -endif diff --git a/sysdeps/i386/nptl/pthread-offsets.h b/sysdeps/i386/nptl/pthread-offsets.h new file mode 100644 index 0000000000..9617354dc7 --- /dev/null +++ b/sysdeps/i386/nptl/pthread-offsets.h @@ -0,0 +1,5 @@ +#define __PTHREAD_MUTEX_NUSERS_OFFSET 16 +#define __PTHREAD_MUTEX_KIND_OFFSET 12 +#define __PTHREAD_MUTEX_SPINS_OFFSET 20 +#define __PTHREAD_MUTEX_ELISION_OFFSET 22 +#define __PTHREAD_MUTEX_LIST_OFFSET 20 diff --git a/sysdeps/i386/nptl/pthread_spin_init.c b/sysdeps/i386/nptl/pthread_spin_init.c index b9b33719fd..1c49df4f03 100644 --- a/sysdeps/i386/nptl/pthread_spin_init.c +++ b/sysdeps/i386/nptl/pthread_spin_init.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2002-2016 Free Software Foundation, Inc. +/* Copyright (C) 2002-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. diff --git a/sysdeps/i386/nptl/pthread_spin_lock.S b/sysdeps/i386/nptl/pthread_spin_lock.S index e311d957d4..1980fec75f 100644 --- a/sysdeps/i386/nptl/pthread_spin_lock.S +++ b/sysdeps/i386/nptl/pthread_spin_lock.S @@ -1,4 +1,4 @@ -/* Copyright (C) 2012-2016 Free Software Foundation, Inc. +/* Copyright (C) 2012-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/sysdeps/i386/nptl/pthread_spin_unlock.S b/sysdeps/i386/nptl/pthread_spin_unlock.S index a552cf92c1..2e7108604c 100644 --- a/sysdeps/i386/nptl/pthread_spin_unlock.S +++ b/sysdeps/i386/nptl/pthread_spin_unlock.S @@ -1,4 +1,4 @@ -/* Copyright (C) 2002-2016 Free Software Foundation, Inc. +/* Copyright (C) 2002-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. diff --git a/sysdeps/i386/nptl/pthreaddef.h b/sysdeps/i386/nptl/pthreaddef.h index c22a6e1d10..deacd92edf 100644 --- a/sysdeps/i386/nptl/pthreaddef.h +++ b/sysdeps/i386/nptl/pthreaddef.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2002-2016 Free Software Foundation, Inc. +/* Copyright (C) 2002-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. diff --git a/sysdeps/i386/nptl/tcb-offsets.sym b/sysdeps/i386/nptl/tcb-offsets.sym index 7bdf161b29..2ec9e787c1 100644 --- a/sysdeps/i386/nptl/tcb-offsets.sym +++ b/sysdeps/i386/nptl/tcb-offsets.sym @@ -4,7 +4,6 @@ RESULT offsetof (struct pthread, result) TID offsetof (struct pthread, tid) -PID offsetof (struct pthread, pid) CANCELHANDLING offsetof (struct pthread, cancelhandling) CLEANUP_JMP_BUF offsetof (struct pthread, cleanup_jmp_buf) MULTIPLE_THREADS_OFFSET offsetof (tcbhead_t, multiple_threads) @@ -13,6 +12,5 @@ CLEANUP offsetof (struct pthread, cleanup) CLEANUP_PREV offsetof (struct _pthread_cleanup_buffer, __prev) MUTEX_FUTEX offsetof (pthread_mutex_t, __data.__lock) POINTER_GUARD offsetof (tcbhead_t, pointer_guard) -#ifndef __ASSUME_PRIVATE_FUTEX -PRIVATE_FUTEX offsetof (tcbhead_t, private_futex) -#endif +FEATURE_1_OFFSET offsetof (tcbhead_t, feature_1) +SSP_BASE_OFFSET offsetof (tcbhead_t, ssp_base) diff --git a/sysdeps/i386/nptl/tls.h b/sysdeps/i386/nptl/tls.h index a6dfa9b377..12285d3217 100644 --- a/sysdeps/i386/nptl/tls.h +++ b/sysdeps/i386/nptl/tls.h @@ -1,5 +1,5 @@ /* Definition for thread-local data handling. nptl/i386 version. - Copyright (C) 2002-2016 Free Software Foundation, Inc. + Copyright (C) 2002-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -26,21 +26,9 @@ # include <stdint.h> # include <stdlib.h> # include <sysdep.h> -# include <libc-internal.h> +# include <libc-pointer-arith.h> /* For cast_to_integer. */ # include <kernel-features.h> - - -/* Type for the dtv. */ -typedef union dtv -{ - size_t counter; - struct - { - void *val; - bool is_static; - } pointer; -} dtv_t; - +# include <dl-dtv.h> typedef struct { @@ -53,17 +41,22 @@ typedef struct uintptr_t stack_guard; uintptr_t pointer_guard; int gscope_flag; -#ifndef __ASSUME_PRIVATE_FUTEX - int private_futex; -#else - int __glibc_reserved1; -#endif + /* Bit 0: X86_FEATURE_1_IBT. + Bit 1: X86_FEATURE_1_SHSTK. + */ + unsigned int feature_1; /* Reservation of some values for the TM ABI. */ - void *__private_tm[4]; + void *__private_tm[3]; /* GCC split stack support. */ void *__private_ss; + /* The lowest address of shadow stack, */ + unsigned long ssp_base; } tcbhead_t; +/* morestack.S in libgcc uses offset 0x30 to access __private_ss, */ +_Static_assert (offsetof (tcbhead_t, __private_ss) == 0x30, + "offset of __private_ss != 0x30"); + # define TLS_MULTIPLE_THREADS_IN_TCB 1 #else /* __ASSEMBLER__ */ @@ -406,22 +399,6 @@ tls_fill_user_desc (union user_desc_init *desc, abort (); }) -/* Call the user-provided thread function. */ -#define CALL_THREAD_FCT(descr) \ - ({ void *__res; \ - int __ignore1, __ignore2; \ - asm volatile ("pushl %%eax\n\t" \ - "pushl %%eax\n\t" \ - "pushl %%eax\n\t" \ - "pushl %%gs:%P4\n\t" \ - "call *%%gs:%P3\n\t" \ - "addl $16, %%esp" \ - : "=a" (__res), "=c" (__ignore1), "=d" (__ignore2) \ - : "i" (offsetof (struct pthread, start_routine)), \ - "i" (offsetof (struct pthread, arg))); \ - __res; }) - - /* Set the stack guard field in TCB head. */ #define THREAD_SET_STACK_GUARD(value) \ THREAD_SETMEM (THREAD_SELF, header.stack_guard, value) @@ -439,6 +416,7 @@ tls_fill_user_desc (union user_desc_init *desc, /* Get and set the global scope generation counter in the TCB head. */ +#define THREAD_GSCOPE_IN_TCB 1 #define THREAD_GSCOPE_FLAG_UNUSED 0 #define THREAD_GSCOPE_FLAG_USED 1 #define THREAD_GSCOPE_FLAG_WAIT 2 diff --git a/sysdeps/i386/pthread_spin_trylock.S b/sysdeps/i386/pthread_spin_trylock.S index 36979bdd1d..686dd8cd80 100644 --- a/sysdeps/i386/pthread_spin_trylock.S +++ b/sysdeps/i386/pthread_spin_trylock.S @@ -1,4 +1,4 @@ -/* Copyright (C) 2002-2016 Free Software Foundation, Inc. +/* Copyright (C) 2002-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. diff --git a/sysdeps/i386/rawmemchr.S b/sysdeps/i386/rawmemchr.S index 9696926bc7..89a0c18529 100644 --- a/sysdeps/i386/rawmemchr.S +++ b/sysdeps/i386/rawmemchr.S @@ -1,6 +1,6 @@ /* rawmemchr (str, ch) -- Return pointer to first occurrence of CH in STR. For Intel 80x86, x>=3. - Copyright (C) 1994-2016 Free Software Foundation, Inc. + Copyright (C) 1994-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu> Optimised a little by Alan Modra <Alan@SPRI.Levels.UniSA.Edu.Au> diff --git a/sysdeps/i386/rshift.S b/sysdeps/i386/rshift.S index d88979542f..532a7f5f70 100644 --- a/sysdeps/i386/rshift.S +++ b/sysdeps/i386/rshift.S @@ -1,5 +1,5 @@ /* i80386 __mpn_rshift -- - Copyright (C) 1992-2016 Free Software Foundation, Inc. + Copyright (C) 1992-2018 Free Software Foundation, Inc. This file is part of the GNU MP Library. The GNU MP Library is free software; you can redistribute it and/or modify diff --git a/sysdeps/i386/setfpucw.c b/sysdeps/i386/setfpucw.c index 497a37b23c..931302bcd0 100644 --- a/sysdeps/i386/setfpucw.c +++ b/sysdeps/i386/setfpucw.c @@ -1,5 +1,5 @@ /* Set the FPU control word for x86. - Copyright (C) 2003-2016 Free Software Foundation, Inc. + Copyright (C) 2003-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -39,7 +39,7 @@ __setfpucw (fpu_control_t set) __asm__ ("fldcw %0" : : "m" (*&cw)); /* If the CPU supports SSE, we set the MXCSR as well. */ - if ((GLRO(dl_hwcap) & HWCAP_I386_XMM) != 0) + if (HAS_CPU_FEATURE (SSE)) { unsigned int xnew_exc; diff --git a/sysdeps/i386/setjmp.S b/sysdeps/i386/setjmp.S index a29da15d45..889337b8ae 100644 --- a/sysdeps/i386/setjmp.S +++ b/sysdeps/i386/setjmp.S @@ -1,5 +1,5 @@ /* setjmp for i386. - Copyright (C) 1995-2016 Free Software Foundation, Inc. + Copyright (C) 1995-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -18,6 +18,7 @@ #include <sysdep.h> #include <jmpbuf-offsets.h> +#include <jmp_buf-ssp.h> #include <asm-syntax.h> #include <stap-probe.h> @@ -25,6 +26,11 @@ #define JMPBUF PARMS #define SIGMSK JMPBUF+4 +/* Don't save shadow stack register if shadow stack isn't enabled. */ +#if !SHSTK_ENABLED +# undef SHADOW_STACK_POINTER_OFFSET +#endif + ENTRY (__sigsetjmp) movl JMPBUF(%esp), %eax @@ -46,6 +52,21 @@ ENTRY (__sigsetjmp) movl %ecx, (JB_PC*4)(%eax) movl %ebp, (JB_BP*4)(%eax) /* Save caller's frame pointer. */ +#ifdef SHADOW_STACK_POINTER_OFFSET +# if IS_IN (libc) && defined SHARED && defined FEATURE_1_OFFSET + /* Check if Shadow Stack is enabled. */ + testl $X86_FEATURE_1_SHSTK, %gs:FEATURE_1_OFFSET + jz L(skip_ssp) +# else + xorl %ecx, %ecx +# endif + /* Get the current Shadow-Stack-Pointer and save it. */ + rdsspd %ecx + movl %ecx, SHADOW_STACK_POINTER_OFFSET(%eax) +# if IS_IN (libc) && defined SHARED && defined FEATURE_1_OFFSET +L(skip_ssp): +# endif +#endif #if IS_IN (rtld) /* In ld.so we never save the signal mask. */ xorl %eax, %eax diff --git a/sysdeps/i386/stackinfo.h b/sysdeps/i386/stackinfo.h index 074cd77246..c6d97c0fd4 100644 --- a/sysdeps/i386/stackinfo.h +++ b/sysdeps/i386/stackinfo.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1999-2016 Free Software Foundation, Inc. +/* Copyright (C) 1999-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/sysdeps/i386/start.S b/sysdeps/i386/start.S index 964e6d9e1e..91035fa83f 100644 --- a/sysdeps/i386/start.S +++ b/sysdeps/i386/start.S @@ -1,5 +1,5 @@ /* Startup code compliant to the ELF i386 ABI. - Copyright (C) 1995-2016 Free Software Foundation, Inc. + Copyright (C) 1995-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -81,7 +81,7 @@ _start: pushl %edx /* Push address of the shared library termination function. */ -#ifdef SHARED +#ifdef PIC /* Load PIC register. */ call 1f addl $_GLOBAL_OFFSET_TABLE_, %ebx @@ -95,7 +95,17 @@ _start: pushl %ecx /* Push second argument: argv. */ pushl %esi /* Push first argument: argc. */ +# ifdef SHARED pushl main@GOT(%ebx) +# else + /* Avoid relocation in static PIE since _start is called before + it is relocated. Don't use "leal main@GOTOFF(%ebx), %eax" + since main may be in a shared object. Linker will convert + "movl main@GOT(%ebx), %eax" to "leal main@GOTOFF(%ebx), %eax" + if main is defined locally. */ + movl main@GOT(%ebx), %eax + pushl %eax +# endif /* Call the user's main function, and exit with its value. But let the libc call main. */ @@ -117,7 +127,7 @@ _start: hlt /* Crash if somehow `exit' does return. */ -#ifdef SHARED +#ifdef PIC 1: movl (%esp), %ebx ret #endif diff --git a/sysdeps/i386/stpcpy.S b/sysdeps/i386/stpcpy.S index 7999e954aa..82ca409c1f 100644 --- a/sysdeps/i386/stpcpy.S +++ b/sysdeps/i386/stpcpy.S @@ -1,6 +1,6 @@ /* Copy SRC to DEST returning the address of the terminating '\0' in DEST. For Intel 80x86, x>=3. - Copyright (C) 1994-2016 Free Software Foundation, Inc. + Copyright (C) 1994-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper (drepper@gnu.ai.mit.edu). diff --git a/sysdeps/i386/stpncpy.S b/sysdeps/i386/stpncpy.S index db808ef984..f81c8a2dbd 100644 --- a/sysdeps/i386/stpncpy.S +++ b/sysdeps/i386/stpncpy.S @@ -1,7 +1,7 @@ /* copy no more than N bytes from SRC to DEST, returning the address of the terminating '\0' in DEST. For Intel 80x86, x>=3. - Copyright (C) 1994-2016 Free Software Foundation, Inc. + Copyright (C) 1994-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu> Some bug fixes by Alan Modra <Alan@SPRI.Levels.UniSA.Edu.Au> diff --git a/sysdeps/i386/strcat.S b/sysdeps/i386/strcat.S index 3abc35b072..059f74259e 100644 --- a/sysdeps/i386/strcat.S +++ b/sysdeps/i386/strcat.S @@ -1,6 +1,6 @@ /* strcat(dest, src) -- Append SRC on the end of DEST. For Intel 80x86, x>=4. - Copyright (C) 1994-2016 Free Software Foundation, Inc. + Copyright (C) 1994-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@ipd.info.uni-karlsruhe.de>. Optimised a little by Alan Modra <Alan@SPRI.Levels.UniSA.Edu.Au> diff --git a/sysdeps/i386/strchr.S b/sysdeps/i386/strchr.S index 34489f1104..ce0ece1106 100644 --- a/sysdeps/i386/strchr.S +++ b/sysdeps/i386/strchr.S @@ -1,6 +1,6 @@ /* strchr (str, ch) -- Return pointer to first occurrence of CH in STR. For Intel 80x86, x>=3. - Copyright (C) 1994-2016 Free Software Foundation, Inc. + Copyright (C) 1994-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu> Some optimisations by Alan Modra <Alan@SPRI.Levels.UniSA.Edu.Au> diff --git a/sysdeps/i386/strchrnul.S b/sysdeps/i386/strchrnul.S index 638f989f80..80a4d2a9ab 100644 --- a/sysdeps/i386/strchrnul.S +++ b/sysdeps/i386/strchrnul.S @@ -1,7 +1,7 @@ /* strchrnul (str, chr) -- Return pointer to first occurrence of CHR in STR or the final NUL byte. For Intel 80x86, x>=3. - Copyright (C) 1994-2016 Free Software Foundation, Inc. + Copyright (C) 1994-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@gnu.org> Some optimisations by Alan Modra <Alan@SPRI.Levels.UniSA.Edu.Au> diff --git a/sysdeps/i386/strcspn.S b/sysdeps/i386/strcspn.S index 88eb029c14..4125d1cfb7 100644 --- a/sysdeps/i386/strcspn.S +++ b/sysdeps/i386/strcspn.S @@ -1,7 +1,7 @@ /* strcspn (str, ss) -- Return the length of the initial segment of STR which contains no characters from SS. For Intel 80x86, x>=3. - Copyright (C) 1994-2016 Free Software Foundation, Inc. + Copyright (C) 1994-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu> Bug fixes by Alan Modra <Alan@SPRI.Levels.UniSA.Edu.Au> diff --git a/sysdeps/i386/string-inlines.c b/sysdeps/i386/string-inlines.c index c7de270c0a..2bfbd7fc7d 100644 --- a/sysdeps/i386/string-inlines.c +++ b/sysdeps/i386/string-inlines.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1999-2016 Free Software Foundation, Inc. +/* Copyright (C) 1999-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -15,50 +15,194 @@ License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ -/* <bits/string.h> and <bits/string2.h> declare some extern inline - functions. These functions are declared additionally here if - inlining is not possible. */ - -#undef __USE_STRING_INLINES -#define __USE_STRING_INLINES -#define _FORCE_INLINES -#define __STRING_INLINE /* empty */ -#define __NO_INLINE__ - -/* This is to avoid PLT entries for the x86 version. */ -#define __memcpy_g __memcpy_g_internal -#define __strchr_g __strchr_g_internal - -#include <string.h> -#undef index -#undef rindex - -#undef __NO_INLINE__ -#include <bits/string.h> -#include <bits/string2.h> +#include <string/string-inlines.c> +#if SHLIB_COMPAT (libc, GLIBC_2_1_1, GLIBC_2_26) +/* Additional compatibility shims for the former + sysdeps/x86/bits/string.h. */ void * -(__memcpy_c) (void *d, const void *s, size_t n) +__old_memcpy_c (void *d, const void *s, size_t n) { return memcpy (d, s, n); } +strong_alias (__old_memcpy_c, __old_memcpy_g); +strong_alias (__old_memcpy_c, __old_memcpy_by4); +strong_alias (__old_memcpy_c, __old_memcpy_by2); +compat_symbol (libc, __old_memcpy_c, __memcpy_c, GLIBC_2_1_1); +compat_symbol (libc, __old_memcpy_g, __memcpy_g, GLIBC_2_1_1); +compat_symbol (libc, __old_memcpy_by4, __memcpy_by4, GLIBC_2_1_1); +compat_symbol (libc, __old_memcpy_by2, __memcpy_by2, GLIBC_2_1_1); void * -__memset_cc (void *s, unsigned long int pattern, size_t n) +__old_memset_cc (void *s, unsigned long int pattern, size_t n) { return memset (s, pattern & 0xff, n); } -strong_alias (__memset_cc, __memset_cg) +strong_alias (__old_memset_cc, __old_memset_cg); +strong_alias (__old_memset_cc, __old_memset_ccn_by2); +strong_alias (__old_memset_cc, __old_memset_ccn_by4); +compat_symbol (libc, __old_memset_cc, __memset_cc, GLIBC_2_1_1); +compat_symbol (libc, __old_memset_cg, __memset_cg, GLIBC_2_1_1); +compat_symbol (libc, __old_memset_ccn_by4, __memset_ccn_by4, GLIBC_2_1_1); +compat_symbol (libc, __old_memset_ccn_by2, __memset_ccn_by2, GLIBC_2_1_1); void * -__memset_gg (void *s, char c, size_t n) +__old_memset_gg (void *s, char c, size_t n) { return memset (s, c, n); } +strong_alias (__old_memset_gg, __old_memset_gcn_by4); +strong_alias (__old_memset_gg, __old_memset_gcn_by2); +compat_symbol (libc, __old_memset_gg, __memset_gg, GLIBC_2_1_1); +compat_symbol (libc, __old_memset_gcn_by4, __memset_gcn_by4, GLIBC_2_1_1); +compat_symbol (libc, __old_memset_gcn_by2, __memset_gcn_by2, GLIBC_2_1_1); + +size_t +__old_strlen_g (const char *str) +{ + return strlen (str); +} +compat_symbol (libc, __old_strlen_g, __strlen_g, GLIBC_2_1_1); + +char * +__old_strcpy_g (char *dest, const char *src) +{ + return strcpy (dest, src); +} +compat_symbol (libc, __old_strcpy_g, __strcpy_g, GLIBC_2_1_1); + +void * +__old_mempcpy_byn (void *dest, const void *src, size_t len) +{ + return __mempcpy (dest, src, len); +} +strong_alias (__old_mempcpy_byn, __old_mempcpy_by4); +strong_alias (__old_mempcpy_byn, __old_mempcpy_by2); +compat_symbol (libc, __old_mempcpy_byn, __mempcpy_byn, GLIBC_2_1_1); +compat_symbol (libc, __old_mempcpy_by4, __mempcpy_by4, GLIBC_2_1_1); +compat_symbol (libc, __old_mempcpy_by2, __mempcpy_by2, GLIBC_2_1_1); + +char * +__old_stpcpy_g (char *dest, const char *src) +{ + return __stpcpy (dest, src); +} +compat_symbol (libc, __old_stpcpy_g, __stpcpy_g, GLIBC_2_1_1); + +char * +__old_strncpy_byn (char *dest, const char *src, size_t srclen, size_t n) +{ + return strncpy (dest, src, n); +} +strong_alias (__old_strncpy_byn, __old_strncpy_by4); +strong_alias (__old_strncpy_byn, __old_strncpy_by2); +compat_symbol (libc, __old_strncpy_byn, __strncpy_byn, GLIBC_2_1_1); +compat_symbol (libc, __old_strncpy_by4, __strncpy_by4, GLIBC_2_1_1); +compat_symbol (libc, __old_strncpy_by2, __strncpy_by2, GLIBC_2_1_1); + +char * +__old_strncpy_gg (char *dest, const char *src, size_t n) +{ + return strncpy (dest, src, n); +} +compat_symbol (libc, __old_strncpy_gg, __strncpy_gg, GLIBC_2_1_1); + +/* __strcat_c took a third argument, which we ignore. */ +char * +__old_strcat_g (char *dest, const char *src) +{ + return strcat (dest, src); +} +strong_alias (__old_strcat_g, __old_strcat_c); +compat_symbol (libc, __old_strcat_g, __strcat_g, GLIBC_2_1_1); +compat_symbol (libc, __old_strcat_c, __strcat_c, GLIBC_2_1_1); + +char * +__old_strncat_g (char *dest, const char *src, size_t n) +{ + return __strncat (dest, src, n); +} +compat_symbol (libc, __old_strncat_g, __strncat_g, GLIBC_2_1_1); + +int +__old_strcmp_gg (const char *s1, const char *s2) +{ + return strcmp (s1, s2); +} +compat_symbol (libc, __old_strcmp_gg, __strcmp_gg, GLIBC_2_1_1); + +int +__old_strncmp_g (const char *s1, const char *s2, size_t n) +{ + return strncmp (s1, s2, n); +} +compat_symbol (libc, __old_strncmp_g, __strncmp_g, GLIBC_2_1_1); + +char * +__old_strchr_g (const char *s, int c) +{ + return strchr (s, c); +} +strong_alias (__old_strchr_g, __old_strchr_c); +compat_symbol (libc, __old_strchr_g, __strchr_g, GLIBC_2_1_1); +compat_symbol (libc, __old_strchr_c, __strchr_c, GLIBC_2_1_1); + +char * +__old_strchrnul_g (const char *s, int c) +{ + return __strchrnul (s, c); +} +strong_alias (__old_strchrnul_g, __old_strchrnul_c); +compat_symbol (libc, __old_strchrnul_g, __strchrnul_g, GLIBC_2_1_1); +compat_symbol (libc, __old_strchrnul_c, __strchrnul_c, GLIBC_2_1_1); + +char * +__old_strrchr_g (const char *s, int c) +{ + return strrchr (s, c); +} +strong_alias (__old_strrchr_g, __old_strrchr_c); +compat_symbol (libc, __old_strrchr_g, __strrchr_g, GLIBC_2_1_1); +compat_symbol (libc, __old_strrchr_c, __strrchr_c, GLIBC_2_1_1); + +/* __strcspn_cg took a third argument, which we ignore. */ +size_t +__old_strcspn_g (const char *s, const char *reject) +{ + return strcspn (s, reject); +} +strong_alias (__old_strcspn_g, __old_strcspn_cg); +compat_symbol (libc, __old_strcspn_g, __strcspn_g, GLIBC_2_1_1); +compat_symbol (libc, __old_strcspn_cg, __strcspn_cg, GLIBC_2_1_1); + +/* __strspn_cg took a third argument, which we ignore. */ +size_t +__old_strspn_g (const char *s, const char *accept) +{ + return strspn (s, accept); +} +strong_alias (__old_strspn_g, __old_strspn_cg); +compat_symbol (libc, __old_strspn_g, __strspn_g, GLIBC_2_1_1); +compat_symbol (libc, __old_strspn_cg, __strspn_cg, GLIBC_2_1_1); + +/* __strpbrk_cg took a third argument, which we ignore. */ +const char * +__old_strpbrk_g (const char *s, const char *accept) +{ + return strpbrk (s, accept); +} +strong_alias (__old_strpbrk_g, __old_strpbrk_cg); +compat_symbol (libc, __old_strpbrk_g, __strpbrk_g, GLIBC_2_1_1); +compat_symbol (libc, __old_strpbrk_cg, __strpbrk_cg, GLIBC_2_1_1); + +/* __strstr_cg took a third argument, which we ignore. */ +const char * +__old_strstr_g (const char *s, const char *accept) +{ + return strstr (s, accept); +} +strong_alias (__old_strstr_g, __old_strstr_cg); +compat_symbol (libc, __old_strstr_g, __strstr_g, GLIBC_2_1_1); +compat_symbol (libc, __old_strstr_cg, __strstr_cg, GLIBC_2_1_1); -#ifdef __memcpy_c -# undef __memcpy_g -strong_alias (__memcpy_g_internal, __memcpy_g) -# undef __strchr_g -strong_alias (__strchr_g_internal, __strchr_g) #endif diff --git a/sysdeps/i386/strlen.S b/sysdeps/i386/strlen.S index 0d0326cefa..76e28f7375 100644 --- a/sysdeps/i386/strlen.S +++ b/sysdeps/i386/strlen.S @@ -1,6 +1,6 @@ /* strlen(str) -- determine the length of the string STR. Optimized for Intel 80x86, x>=4. - Copyright (C) 1991-2016 Free Software Foundation, Inc. + Copyright (C) 1991-2018 Free Software Foundation, Inc. Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>. This file is part of the GNU C Library. diff --git a/sysdeps/i386/strlen.c b/sysdeps/i386/strlen.c index 5506c8a40b..bcd1b7dae3 100644 --- a/sysdeps/i386/strlen.c +++ b/sysdeps/i386/strlen.c @@ -1,5 +1,5 @@ /* Determine the length of a string. For Intel 80x86, x>=3. - Copyright (C) 1991-2016 Free Software Foundation, Inc. + Copyright (C) 1991-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Torbjorn Granlund (tege@sics.se). diff --git a/sysdeps/i386/strpbrk.S b/sysdeps/i386/strpbrk.S index ad2f02c3b8..05890a3546 100644 --- a/sysdeps/i386/strpbrk.S +++ b/sysdeps/i386/strpbrk.S @@ -1,7 +1,7 @@ /* strcspn (str, ss) -- Return the length of the initial segement of STR which contains no characters from SS. For Intel 80x86, x>=3. - Copyright (C) 1994-2016 Free Software Foundation, Inc. + Copyright (C) 1994-2018 Free Software Foundation, Inc. Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu> Bug fixes by Alan Modra <Alan@SPRI.Levels.UniSA.Edu.Au> This file is part of the GNU C Library. diff --git a/sysdeps/i386/strrchr.S b/sysdeps/i386/strrchr.S index 91f02440a8..6f4b507f19 100644 --- a/sysdeps/i386/strrchr.S +++ b/sysdeps/i386/strrchr.S @@ -1,6 +1,6 @@ /* strrchr (str, ch) -- Return pointer to last occurrence of CH in STR. For Intel 80x86, x>=3. - Copyright (C) 1994-2016 Free Software Foundation, Inc. + Copyright (C) 1994-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu> Some optimisations by Alan Modra <Alan@SPRI.Levels.UniSA.Edu.Au> diff --git a/sysdeps/i386/strspn.S b/sysdeps/i386/strspn.S index fd8f555f48..d7eb7e8b93 100644 --- a/sysdeps/i386/strspn.S +++ b/sysdeps/i386/strspn.S @@ -1,7 +1,7 @@ /* strcspn (str, ss) -- Return the length of the initial segment of STR which contains only characters from SS. For Intel 80x86, x>=3. - Copyright (C) 1994-2016 Free Software Foundation, Inc. + Copyright (C) 1994-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu> Bug fixes by Alan Modra <Alan@SPRI.Levels.UniSA.Edu.Au> diff --git a/sysdeps/i386/strtok.S b/sysdeps/i386/strtok.S deleted file mode 100644 index a8a4fe45f2..0000000000 --- a/sysdeps/i386/strtok.S +++ /dev/null @@ -1,358 +0,0 @@ -/* strtok (str, delim) -- Return next DELIM separated token from STR. - For Intel 80x86, x>=3. - Copyright (C) 1996-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#include <sysdep.h> -#include "asm-syntax.h" - -/* This file can be used for three variants of the strtok function: - - strtok: - INPUT PARAMETER: - str (sp + 4) - delim (sp + 8) - - strtok_r: - INPUT PARAMETER: - str (sp + 4) - delim (sp + 8) - save_ptr (sp + 12) - - We do a common implementation here. */ - -#ifdef USE_AS_STRTOK_R -# define SAVE_PTR 0(%ecx) -#else - .bss - .local save_ptr - .type save_ptr, @object - .size save_ptr, 4 -save_ptr: - .space 4 - -# ifdef PIC -# define SAVE_PTR save_ptr@GOTOFF(%ebx) -# else -# define SAVE_PTR save_ptr -# endif - -# define FUNCTION strtok -#endif - -#define PARMS 4 /* no space for saved regs */ -#define RTN PARMS -#define STR RTN -#define DELIM STR+4 -#define SAVE DELIM+4 - - .text -ENTRY (FUNCTION) - - movl STR(%esp), %edx - movl DELIM(%esp), %eax - -#if !defined USE_AS_STRTOK_R && defined PIC - pushl %ebx /* Save PIC register. */ - cfi_adjust_cfa_offset (4) - call L(here) - cfi_adjust_cfa_offset (4) - cfi_rel_offset (ebx, 0) -L(here): - popl %ebx - cfi_adjust_cfa_offset (-4) - addl $_GLOBAL_OFFSET_TABLE_+[.-L(here)], %ebx -#endif - - /* If the pointer is NULL we have to use the stored value of - the last run. */ - cmpl $0, %edx - jne L(1) - -#ifdef USE_AS_STRTOK_R - /* The value is stored in the third argument. */ - movl SAVE(%esp), %edx - movl (%edx), %edx -#else - /* The value is in the local variable defined above. But - we have to take care for PIC code. */ - movl SAVE_PTR, %edx -#endif - testl %edx, %edx - jz L(returnNULL) - -L(1): - /* First we create a table with flags for all possible characters. - For the ASCII (7bit/8bit) or ISO-8859-X character sets which are - supported by the C string functions we have 256 characters. - Before inserting marks for the stop characters we clear the whole - table. The unrolled form is much faster than a loop. */ - xorl %ecx, %ecx /* %ecx = 0 !!! */ - - pushl %ecx /* make a 256 bytes long block filled with 0 */ - cfi_adjust_cfa_offset (4) - pushl %ecx - cfi_adjust_cfa_offset (4) - pushl %ecx - cfi_adjust_cfa_offset (4) - pushl %ecx - cfi_adjust_cfa_offset (4) - pushl %ecx - cfi_adjust_cfa_offset (4) - pushl %ecx - cfi_adjust_cfa_offset (4) - pushl %ecx - cfi_adjust_cfa_offset (4) - pushl %ecx - cfi_adjust_cfa_offset (4) - pushl %ecx - cfi_adjust_cfa_offset (4) - pushl %ecx - cfi_adjust_cfa_offset (4) - pushl %ecx - cfi_adjust_cfa_offset (4) - pushl %ecx - cfi_adjust_cfa_offset (4) - pushl %ecx - cfi_adjust_cfa_offset (4) - pushl %ecx - cfi_adjust_cfa_offset (4) - pushl %ecx - cfi_adjust_cfa_offset (4) - pushl %ecx - cfi_adjust_cfa_offset (4) - pushl %ecx - cfi_adjust_cfa_offset (4) - pushl %ecx - cfi_adjust_cfa_offset (4) - pushl %ecx - cfi_adjust_cfa_offset (4) - pushl %ecx - cfi_adjust_cfa_offset (4) - pushl %ecx - cfi_adjust_cfa_offset (4) - pushl %ecx - cfi_adjust_cfa_offset (4) - pushl %ecx - cfi_adjust_cfa_offset (4) - pushl %ecx - cfi_adjust_cfa_offset (4) - pushl %ecx - cfi_adjust_cfa_offset (4) - pushl %ecx - cfi_adjust_cfa_offset (4) - pushl %ecx - cfi_adjust_cfa_offset (4) - pushl %ecx - cfi_adjust_cfa_offset (4) - pushl %ecx - cfi_adjust_cfa_offset (4) - pushl %ecx - cfi_adjust_cfa_offset (4) - pushl %ecx - cfi_adjust_cfa_offset (4) - pushl %ecx - cfi_adjust_cfa_offset (4) - pushl %ecx - cfi_adjust_cfa_offset (4) - pushl %ecx - cfi_adjust_cfa_offset (4) - pushl %ecx - cfi_adjust_cfa_offset (4) - pushl %ecx - cfi_adjust_cfa_offset (4) - pushl %ecx - cfi_adjust_cfa_offset (4) - pushl %ecx - cfi_adjust_cfa_offset (4) - pushl %ecx - cfi_adjust_cfa_offset (4) - pushl %ecx - cfi_adjust_cfa_offset (4) - pushl %ecx - cfi_adjust_cfa_offset (4) - pushl %ecx - cfi_adjust_cfa_offset (4) - pushl %ecx - cfi_adjust_cfa_offset (4) - pushl %ecx - cfi_adjust_cfa_offset (4) - pushl %ecx - cfi_adjust_cfa_offset (4) - pushl %ecx - cfi_adjust_cfa_offset (4) - pushl %ecx - cfi_adjust_cfa_offset (4) - pushl %ecx - cfi_adjust_cfa_offset (4) - pushl %ecx - cfi_adjust_cfa_offset (4) - pushl %ecx - cfi_adjust_cfa_offset (4) - pushl %ecx - cfi_adjust_cfa_offset (4) - pushl %ecx - cfi_adjust_cfa_offset (4) - pushl %ecx - cfi_adjust_cfa_offset (4) - pushl %ecx - cfi_adjust_cfa_offset (4) - pushl %ecx - cfi_adjust_cfa_offset (4) - pushl %ecx - cfi_adjust_cfa_offset (4) - pushl %ecx - cfi_adjust_cfa_offset (4) - pushl %ecx - cfi_adjust_cfa_offset (4) - pushl $0 /* These immediate values make the label 2 */ - cfi_adjust_cfa_offset (4) - pushl $0 /* to be aligned on a 16 byte boundary to */ - cfi_adjust_cfa_offset (4) - pushl $0 /* get a better performance of the loop. */ - cfi_adjust_cfa_offset (4) - pushl $0 - cfi_adjust_cfa_offset (4) - pushl $0 - cfi_adjust_cfa_offset (4) - pushl $0 - cfi_adjust_cfa_offset (4) - -/* For understanding the following code remember that %ecx == 0 now. - Although all the following instruction only modify %cl we always - have a correct zero-extended 32-bit value in %ecx. */ - -L(2): movb (%eax), %cl /* get byte from stopset */ - testb %cl, %cl /* is NUL char? */ - jz L(1_1) /* yes => start compare loop */ - movb %cl, (%esp,%ecx) /* set corresponding byte in stopset table */ - - movb 1(%eax), %cl /* get byte from stopset */ - testb $0xff, %cl /* is NUL char? */ - jz L(1_1) /* yes => start compare loop */ - movb %cl, (%esp,%ecx) /* set corresponding byte in stopset table */ - - movb 2(%eax), %cl /* get byte from stopset */ - testb $0xff, %cl /* is NUL char? */ - jz L(1_1) /* yes => start compare loop */ - movb %cl, (%esp,%ecx) /* set corresponding byte in stopset table */ - - movb 3(%eax), %cl /* get byte from stopset */ - addl $4, %eax /* increment stopset pointer */ - movb %cl, (%esp,%ecx) /* set corresponding byte in stopset table */ - testb $0xff, %cl /* is NUL char? */ - jnz L(2) /* no => process next dword from stopset */ - -L(1_1): leal -4(%edx), %eax /* prepare loop */ - - /* We use a neat trick for the following loop. Normally we would - have to test for two termination conditions - 1. a character in the stopset was found - and - 2. the end of the string was found - As a sign that the character is in the stopset we store its - value in the table. The value of NUL is NUL so the loop - terminates for NUL in every case. */ - -L(3): addl $4, %eax /* adjust pointer for full loop round */ - - movb (%eax), %cl /* get byte from string */ - testb %cl, (%esp,%ecx) /* is it contained in stopset? */ - jz L(4) /* no => start of token */ - - movb 1(%eax), %cl /* get byte from string */ - testb %cl, (%esp,%ecx) /* is it contained in stopset? */ - jz L(5) /* no => start of token */ - - movb 2(%eax), %cl /* get byte from string */ - testb %cl, (%esp,%ecx) /* is it contained in stopset? */ - jz L(6) /* no => start of token */ - - movb 3(%eax), %cl /* get byte from string */ - testb %cl, (%esp,%ecx) /* is it contained in stopset? */ - jnz L(3) /* yes => start of loop */ - - incl %eax /* adjust pointer */ -L(6): incl %eax -L(5): incl %eax - - /* Now we have to terminate the string. */ - -L(4): leal -4(%eax), %edx /* We use %EDX for the next run. */ - -L(7): addl $4, %edx /* adjust pointer for full loop round */ - - movb (%edx), %cl /* get byte from string */ - cmpb %cl, (%esp,%ecx) /* is it contained in skipset? */ - je L(8) /* yes => return */ - - movb 1(%edx), %cl /* get byte from string */ - cmpb %cl, (%esp,%ecx) /* is it contained in skipset? */ - je L(9) /* yes => return */ - - movb 2(%edx), %cl /* get byte from string */ - cmpb %cl, (%esp,%ecx) /* is it contained in skipset? */ - je L(10) /* yes => return */ - - movb 3(%edx), %cl /* get byte from string */ - cmpb %cl, (%esp,%ecx) /* is it contained in skipset? */ - jne L(7) /* no => start loop again */ - - incl %edx /* adjust pointer */ -L(10): incl %edx -L(9): incl %edx - -L(8): /* Remove the stopset table. */ - addl $256, %esp - cfi_adjust_cfa_offset (-256) - - cmpl %eax, %edx - je L(returnNULL) /* There was no token anymore. */ - - movb $0, (%edx) /* Terminate string. */ - - /* Are we at end of string? */ - cmpb $0, %cl - je L(11) - - incl %edx -L(11): - - /* Store the pointer to the next character. */ -#ifdef USE_AS_STRTOK_R - movl SAVE(%esp), %ecx -#endif - movl %edx, SAVE_PTR - -L(epilogue): -#if !defined USE_AS_STRTOK_R && defined PIC - popl %ebx - cfi_adjust_cfa_offset (-4) - cfi_restore (ebx) -#endif - ret - -L(returnNULL): - xorl %eax, %eax -#ifdef USE_AS_STRTOK_R - movl SAVE(%esp), %ecx -#endif - movl %edx, SAVE_PTR - jmp L(epilogue) - -END (FUNCTION) diff --git a/sysdeps/i386/strtok_r.S b/sysdeps/i386/strtok_r.S deleted file mode 100644 index 508729370a..0000000000 --- a/sysdeps/i386/strtok_r.S +++ /dev/null @@ -1,5 +0,0 @@ -#define FUNCTION __strtok_r -#define USE_AS_STRTOK_R 1 -#include <sysdeps/i386/strtok.S> -weak_alias (__strtok_r, strtok_r) -strong_alias (__strtok_r, __GI___strtok_r) diff --git a/sysdeps/i386/sub_n.S b/sysdeps/i386/sub_n.S index 3b5340036a..ada0cf5ec9 100644 --- a/sysdeps/i386/sub_n.S +++ b/sysdeps/i386/sub_n.S @@ -1,6 +1,6 @@ /* i80386 __mpn_sub_n -- Add two limb vectors of the same length > 0 and store sum in a third limb vector. - Copyright (C) 1992-2016 Free Software Foundation, Inc. + Copyright (C) 1992-2018 Free Software Foundation, Inc. This file is part of the GNU MP Library. The GNU MP Library is free software; you can redistribute it and/or modify @@ -17,7 +17,7 @@ along with the GNU MP Library; see the file COPYING.LIB. If not, see <http://www.gnu.org/licenses/>. */ -#include "sysdep.h" +#include <sysdep.h> #include "asm-syntax.h" #define PARMS 4+8 /* space for 2 saved regs */ @@ -40,6 +40,13 @@ ENTRY (__mpn_sub_n) cfi_rel_offset (esi, 0) movl S2(%esp),%edx movl SIZE(%esp),%ecx + +#if IBT_ENABLED + pushl %ebx + cfi_adjust_cfa_offset (4) + cfi_rel_offset (ebx, 0) +#endif + movl %ecx,%eax shrl $3,%ecx /* compute count for unrolled loop */ negl %eax @@ -51,6 +58,9 @@ ENTRY (__mpn_sub_n) subl %eax,%esi /* ... by a constant when we ... */ subl %eax,%edx /* ... enter the loop */ shrl $2,%eax /* restore previous value */ +#if defined __CET__ && (__CET__ & 1) != 0 + leal -4(,%eax,4),%ebx /* Count for 4-byte endbr32 */ +#endif #ifdef PIC /* Calculate start address in loop for PIC. Due to limitations in some assemblers, Loop-L0-3 cannot be put into the leal */ @@ -65,29 +75,38 @@ L(0): leal (%eax,%eax,8),%eax /* Calculate start address in loop for non-PIC. */ leal (L(oop) - 3)(%eax,%eax,8),%eax #endif +#if defined __CET__ && (__CET__ & 1) != 0 + addl %ebx,%eax /* Adjust for endbr32 */ +#endif jmp *%eax /* jump into loop */ ALIGN (3) L(oop): movl (%esi),%eax sbbl (%edx),%eax movl %eax,(%edi) + _CET_ENDBR movl 4(%esi),%eax sbbl 4(%edx),%eax movl %eax,4(%edi) + _CET_ENDBR movl 8(%esi),%eax sbbl 8(%edx),%eax movl %eax,8(%edi) movl 12(%esi),%eax sbbl 12(%edx),%eax movl %eax,12(%edi) + _CET_ENDBR movl 16(%esi),%eax sbbl 16(%edx),%eax movl %eax,16(%edi) + _CET_ENDBR movl 20(%esi),%eax sbbl 20(%edx),%eax movl %eax,20(%edi) + _CET_ENDBR movl 24(%esi),%eax sbbl 24(%edx),%eax movl %eax,24(%edi) + _CET_ENDBR movl 28(%esi),%eax sbbl 28(%edx),%eax movl %eax,28(%edi) @@ -100,6 +119,11 @@ L(oop): movl (%esi),%eax sbbl %eax,%eax negl %eax +#if defined __CET__ && (__CET__ & 1) != 0 + popl %ebx + cfi_adjust_cfa_offset (-4) + cfi_restore (ebx) +#endif popl %esi cfi_adjust_cfa_offset (-4) cfi_restore (esi) diff --git a/sysdeps/i386/submul_1.S b/sysdeps/i386/submul_1.S index e1ae58f21f..17fbdcf539 100644 --- a/sysdeps/i386/submul_1.S +++ b/sysdeps/i386/submul_1.S @@ -1,6 +1,6 @@ /* i80386 __mpn_submul_1 -- Multiply a limb vector with a limb and subtract the result from a second limb vector. - Copyright (C) 1992-2016 Free Software Foundation, Inc. + Copyright (C) 1992-2018 Free Software Foundation, Inc. This file is part of the GNU MP Library. The GNU MP Library is free software; you can redistribute it and/or modify diff --git a/sysdeps/i386/symbol-hacks.h b/sysdeps/i386/symbol-hacks.h new file mode 100644 index 0000000000..c100fb902e --- /dev/null +++ b/sysdeps/i386/symbol-hacks.h @@ -0,0 +1,21 @@ +/* Hacks needed for symbol manipulation. i386 version. + Copyright (C) 2017-2018 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#include <sysdeps/wordsize-32/divdi3-symbol-hacks.h> + +#include_next "symbol-hacks.h" diff --git a/sysdeps/i386/sys/ucontext.h b/sysdeps/i386/sys/ucontext.h index d08e1a7f56..23cee16e80 100644 --- a/sysdeps/i386/sys/ucontext.h +++ b/sysdeps/i386/sys/ucontext.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997-2016 Free Software Foundation, Inc. +/* Copyright (C) 1997-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -21,99 +21,118 @@ #define _SYS_UCONTEXT_H 1 #include <features.h> -#include <signal.h> + +#include <bits/types/sigset_t.h> +#include <bits/types/stack_t.h> + /* Type for general register. */ typedef int greg_t; /* Number of general registers. */ -#define NGREG 19 +#define __NGREG 19 +#ifdef __USE_MISC +# define NGREG __NGREG +#endif /* Container for all general registers. */ -typedef greg_t gregset_t[NGREG]; +typedef greg_t gregset_t[__NGREG]; +#ifdef __USE_MISC /* Number of each register is the `gregset_t' array. */ enum { REG_GS = 0, -#define REG_GS REG_GS +# define REG_GS REG_GS REG_FS, -#define REG_FS REG_FS +# define REG_FS REG_FS REG_ES, -#define REG_ES REG_ES +# define REG_ES REG_ES REG_DS, -#define REG_DS REG_DS +# define REG_DS REG_DS REG_EDI, -#define REG_EDI REG_EDI +# define REG_EDI REG_EDI REG_ESI, -#define REG_ESI REG_ESI +# define REG_ESI REG_ESI REG_EBP, -#define REG_EBP REG_EBP +# define REG_EBP REG_EBP REG_ESP, -#define REG_ESP REG_ESP +# define REG_ESP REG_ESP REG_EBX, -#define REG_EBX REG_EBX +# define REG_EBX REG_EBX REG_EDX, -#define REG_EDX REG_EDX +# define REG_EDX REG_EDX REG_ECX, -#define REG_ECX REG_ECX +# define REG_ECX REG_ECX REG_EAX, -#define REG_EAX REG_EAX +# define REG_EAX REG_EAX REG_TRAPNO, -#define REG_TRAPNO REG_TRAPNO +# define REG_TRAPNO REG_TRAPNO REG_ERR, -#define REG_ERR REG_ERR +# define REG_ERR REG_ERR REG_EIP, -#define REG_EIP REG_EIP +# define REG_EIP REG_EIP REG_CS, -#define REG_CS REG_CS +# define REG_CS REG_CS REG_EFL, -#define REG_EFL REG_EFL +# define REG_EFL REG_EFL REG_UESP, -#define REG_UESP REG_UESP +# define REG_UESP REG_UESP REG_SS -#define REG_SS REG_SS +# define REG_SS REG_SS }; +#endif + +#ifdef __USE_MISC +# define __ctx(fld) fld +# define __ctxt(tag) tag +#else +# define __ctx(fld) __ ## fld +# define __ctxt(tag) /* Empty. */ +#endif /* Structure to describe FPU registers. */ -typedef struct fpregset +typedef struct { union { - struct fpchip_state + struct __ctxt(fpchip_state) { - int state[27]; - int status; - } fpchip_state; + int __ctx(state)[27]; + int __ctx(status); + } __ctx(fpchip_state); - struct fp_emul_space + struct __ctxt(fp_emul_space) { - char fp_emul[246]; - char fp_epad[2]; - } fp_emul_space; + char __ctx(fp_emul)[246]; + char __ctx(fp_epad)[2]; + } __ctx(fp_emul_space); - int f_fpregs[62]; - } fp_reg_set; + int __ctx(f_fpregs)[62]; + } __ctx(fp_reg_set); - long int f_wregs[33]; + long int __ctx(f_wregs)[33]; } fpregset_t; /* Context to describe whole processor state. */ typedef struct { - gregset_t gregs; - fpregset_t fpregs; + gregset_t __ctx(gregs); + fpregset_t __ctx(fpregs); } mcontext_t; /* Userlevel context. */ -typedef struct ucontext +typedef struct ucontext_t { - unsigned long int uc_flags; - struct ucontext *uc_link; - __sigset_t uc_sigmask; + unsigned long int __ctx(uc_flags); + struct ucontext_t *uc_link; + sigset_t uc_sigmask; stack_t uc_stack; mcontext_t uc_mcontext; - long int uc_filler[5]; + long int __glibc_reserved1[5]; } ucontext_t; +#undef __ctx +#undef __ctxt + #endif /* sys/ucontext.h */ diff --git a/sysdeps/i386/sysdep.h b/sysdeps/i386/sysdep.h index 95da385842..893a082602 100644 --- a/sysdeps/i386/sysdep.h +++ b/sysdeps/i386/sysdep.h @@ -1,5 +1,5 @@ /* Assembler macros for i386. - Copyright (C) 1991-2016 Free Software Foundation, Inc. + Copyright (C) 1991-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -16,7 +16,7 @@ License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ -#include <sysdeps/generic/sysdep.h> +#include <sysdeps/x86/sysdep.h> #include <features.h> /* For __GNUC_PREREQ. */ @@ -39,32 +39,6 @@ /* Syntactic details of assembler. */ -/* ELF uses byte-counts for .align, most others use log2 of count of bytes. */ -#define ALIGNARG(log2) 1<<log2 -#define ASM_SIZE_DIRECTIVE(name) .size name,.-name; - - -/* Define an entry point visible from C. - - There is currently a bug in gdb which prevents us from specifying - incomplete stabs information. Fake some entries here which specify - the current source file. */ -#define ENTRY(name) \ - .globl C_SYMBOL_NAME(name); \ - .type C_SYMBOL_NAME(name),@function; \ - .align ALIGNARG(4); \ - C_LABEL(name) \ - cfi_startproc; \ - CALL_MCOUNT - -#undef END -#define END(name) \ - cfi_endproc; \ - ASM_SIZE_DIRECTIVE(name) - -#define ENTRY_CHK(name) ENTRY (name) -#define END_CHK(name) END (name) - /* If compiled for profiling, call `mcount' at the start of each function. */ #ifdef PROF /* The mcount code relies on a normal frame pointer being on the stack @@ -77,12 +51,6 @@ #define CALL_MCOUNT /* Do nothing. */ #endif -/* Since C identifiers are not normally prefixed with an underscore - on this system, the asm identifier `syscall_error' intrudes on the - C name space. Make sure we use an innocuous name. */ -#define syscall_error __syscall_error -#define mcount _mcount - #define PSEUDO(name, syscall_name, args) \ .globl syscall_error; \ lose: SYSCALL_PIC_SETUP \ @@ -91,10 +59,6 @@ lose: SYSCALL_PIC_SETUP \ DO_CALL (syscall_name, args); \ jb lose -#undef PSEUDO_END -#define PSEUDO_END(name) \ - END (name) - # define SETUP_PIC_REG(reg) \ .ifndef GET_PC_THUNK(reg); \ .section .gnu.linkonce.t.GET_PC_THUNK(reg),"ax",@progbits; \ @@ -129,13 +93,6 @@ GET_PC_THUNK(reg): \ #define SYSCALL_PIC_SETUP /* Nothing. */ #endif -/* Local label name for asm code. */ -#ifndef L -#define L(name) .L##name -#endif - -#define atom_text_section .section ".text.atom", "ax" - #else /* __ASSEMBLER__ */ # define SETUP_PIC_REG_STR(reg) \ diff --git a/sysdeps/i386/tlsdesc.c b/sysdeps/i386/tlsdesc.c index 5b9a96f578..82fa8a1d35 100644 --- a/sysdeps/i386/tlsdesc.c +++ b/sysdeps/i386/tlsdesc.c @@ -1,5 +1,5 @@ /* Manage TLS descriptors. i386 version. - Copyright (C) 2005-2016 Free Software Foundation, Inc. + Copyright (C) 2005-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -256,7 +256,6 @@ _dl_tlsdesc_resolve_hold_fixup (struct tlsdesc volatile *td, if there is one. */ void -internal_function _dl_unmap (struct link_map *map) { _dl_unmap_segments (map); diff --git a/sysdeps/i386/tst-audit.h b/sysdeps/i386/tst-audit.h index ab5e090184..d1b3187fb9 100644 --- a/sysdeps/i386/tst-audit.h +++ b/sysdeps/i386/tst-audit.h @@ -1,6 +1,6 @@ /* Definitions for testing PLT entry/exit auditing. i386 version. - Copyright (C) 2012-2016 Free Software Foundation, Inc. + Copyright (C) 2012-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. diff --git a/sysdeps/i386/tst-audit3.c b/sysdeps/i386/tst-audit3.c index d4a08649b7..ef5e92b12a 100644 --- a/sysdeps/i386/tst-audit3.c +++ b/sysdeps/i386/tst-audit3.c @@ -1,5 +1,5 @@ /* Test case for i386 preserved registers in dynamic linker. - Copyright (C) 2015-2016 Free Software Foundation, Inc. + Copyright (C) 2015-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/sysdeps/i386/tst-audit3.h b/sysdeps/i386/tst-audit3.h index 26c443e23e..99a42091f8 100644 --- a/sysdeps/i386/tst-audit3.h +++ b/sysdeps/i386/tst-audit3.h @@ -1,5 +1,5 @@ /* Test case for i386 preserved registers in dynamic linker. - Copyright (C) 2015-2016 Free Software Foundation, Inc. + Copyright (C) 2015-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/sysdeps/i386/tst-auditmod3a.c b/sysdeps/i386/tst-auditmod3a.c index 36242137d7..7810649757 100644 --- a/sysdeps/i386/tst-auditmod3a.c +++ b/sysdeps/i386/tst-auditmod3a.c @@ -1,5 +1,5 @@ /* Test case for i386 preserved registers in dynamic linker. - Copyright (C) 2015-2016 Free Software Foundation, Inc. + Copyright (C) 2015-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/sysdeps/i386/tst-auditmod3b.c b/sysdeps/i386/tst-auditmod3b.c index 9cc733bdb8..9eefe7678d 100644 --- a/sysdeps/i386/tst-auditmod3b.c +++ b/sysdeps/i386/tst-auditmod3b.c @@ -1,5 +1,5 @@ /* Test case for i386 preserved registers in dynamic linker. - Copyright (C) 2015-2016 Free Software Foundation, Inc. + Copyright (C) 2015-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/sysdeps/i386/tst-ld-sse-use.sh b/sysdeps/i386/tst-ld-sse-use.sh index 2863de6f8b..208a42c71a 100755 --- a/sysdeps/i386/tst-ld-sse-use.sh +++ b/sysdeps/i386/tst-ld-sse-use.sh @@ -1,6 +1,6 @@ #!/bin/bash # Make sure no code in ld.so uses xmm/ymm/zmm registers on i386. -# Copyright (C) 2009-2016 Free Software Foundation, Inc. +# Copyright (C) 2009-2018 Free Software Foundation, Inc. # This file is part of the GNU C Library. # The GNU C Library is free software; you can redistribute it and/or diff --git a/sysdeps/i386/tst-stack-align.h b/sysdeps/i386/tst-stack-align.h index 821cec860b..394ff7735a 100644 --- a/sysdeps/i386/tst-stack-align.h +++ b/sysdeps/i386/tst-stack-align.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2004-2016 Free Software Foundation, Inc. +/* Copyright (C) 2004-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or |