diff options
-rw-r--r-- | sysdeps/i386/i686/multiarch/Makefile | 8 | ||||
-rw-r--r-- | sysdeps/i386/i686/multiarch/strcspn.S | 80 | ||||
-rw-r--r-- | sysdeps/i386/i686/multiarch/strpbrk.S | 5 | ||||
-rw-r--r-- | sysdeps/i386/i686/multiarch/varshift.h | 1 | ||||
-rw-r--r-- | sysdeps/i386/multiarch/Makefile | 9 | ||||
-rw-r--r-- | sysdeps/i386/multiarch/ifunc-impl-list.c | 8 | ||||
-rw-r--r-- | sysdeps/i386/multiarch/strcspn-i386.S | 8 | ||||
-rw-r--r-- | sysdeps/i386/multiarch/strcspn-sse4.c (renamed from sysdeps/i386/i686/multiarch/strcspn-c.c) | 2 | ||||
-rw-r--r-- | sysdeps/i386/multiarch/strcspn.c | 49 | ||||
-rw-r--r-- | sysdeps/i386/multiarch/strpbrk-i386.S | 13 | ||||
-rw-r--r-- | sysdeps/i386/multiarch/strpbrk-sse4.c (renamed from sysdeps/i386/i686/multiarch/strpbrk-c.c) | 2 | ||||
-rw-r--r-- | sysdeps/i386/multiarch/strpbrk.c | 51 | ||||
-rw-r--r-- | sysdeps/i386/multiarch/varshift.c (renamed from sysdeps/i386/i686/multiarch/varshift.c) | 0 |
13 files changed, 137 insertions, 99 deletions
diff --git a/sysdeps/i386/i686/multiarch/Makefile b/sysdeps/i386/i686/multiarch/Makefile index 788dccb2c9..8f8e4509b8 100644 --- a/sysdeps/i386/i686/multiarch/Makefile +++ b/sysdeps/i386/i686/multiarch/Makefile @@ -1,13 +1,9 @@ ifeq ($(subdir),string) -sysdep_routines += varshift \ - strlen-sse2 strlen-sse2-bsf \ +sysdep_routines += strlen-sse2 strlen-sse2-bsf \ strrchr-sse2 strrchr-sse2-bsf \ strnlen-sse2 strnlen-c ifeq (yes,$(config-cflags-sse4)) -sysdep_routines += strcspn-c strpbrk-c strspn-c -CFLAGS-varshift.c += -msse4 -CFLAGS-strcspn-c.c += -msse4 -CFLAGS-strpbrk-c.c += -msse4 +sysdep_routines += strspn-c CFLAGS-strspn-c.c += -msse4 endif endif diff --git a/sysdeps/i386/i686/multiarch/strcspn.S b/sysdeps/i386/i686/multiarch/strcspn.S deleted file mode 100644 index b669b9797a..0000000000 --- a/sysdeps/i386/i686/multiarch/strcspn.S +++ /dev/null @@ -1,80 +0,0 @@ -/* Multiple versions of strcspn - All versions must be listed in ifunc-impl-list.c. - Copyright (C) 2009-2015 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> - -#ifdef HAVE_SSE4_SUPPORT - -#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 - -#endif /* HAVE_SSE4_SUPPORT */ - -#ifdef USE_AS_STRPBRK -#include "../../strpbrk.S" -#else -#include "../../strcspn.S" -#endif 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/varshift.h b/sysdeps/i386/i686/multiarch/varshift.h deleted file mode 100644 index 7c72c70d67..0000000000 --- a/sysdeps/i386/i686/multiarch/varshift.h +++ /dev/null @@ -1 +0,0 @@ -#include <sysdeps/x86_64/multiarch/varshift.h> diff --git a/sysdeps/i386/multiarch/Makefile b/sysdeps/i386/multiarch/Makefile index 369a56665c..23c1f8b0de 100644 --- a/sysdeps/i386/multiarch/Makefile +++ b/sysdeps/i386/multiarch/Makefile @@ -34,7 +34,14 @@ sysdep_routines += bcopy-i386 bcopy-i686 bcopy-sse2-unaligned \ strncmp-i386 strncmp-ssse3 strncmp-sse4 \ strcat-i386 strcat-sse2 strcat-ssse3 \ strncat-i386 strncat-sse2 strncat-ssse3 \ - strchr-i386 strchr-i586 strchr-sse2-bsf strchr-sse2 + strchr-i386 strchr-i586 strchr-sse2-bsf strchr-sse2 \ + strcspn-i386 strpbrk-i386 +ifeq (yes,$(config-cflags-sse4)) +sysdep_routines += varshift strcspn-sse4 strpbrk-sse4 +CFLAGS-varshift.c += -msse4 +CFLAGS-strcspn-sse4.c += -msse4 +CFLAGS-strpbrk-sse4.c += -msse4 +endif endif ifeq (mathyes,$(subdir)$(config-cflags-avx)) diff --git a/sysdeps/i386/multiarch/ifunc-impl-list.c b/sysdeps/i386/multiarch/ifunc-impl-list.c index b938329a47..2fc97a31a4 100644 --- a/sysdeps/i386/multiarch/ifunc-impl-list.c +++ b/sysdeps/i386/multiarch/ifunc-impl-list.c @@ -246,13 +246,11 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array, #endif ) -#if 0 /* Support sysdeps/i386/i686/multiarch/strcspn.S. */ IFUNC_IMPL (i, name, strcspn, IFUNC_IMPL_ADD (array, i, strcspn, HAS_CPU_FEATURE (SSE4_2), __strcspn_sse42) - IFUNC_IMPL_ADD (array, i, strcspn, 1, __strcspn_ia32)) -#endif + IFUNC_IMPL_ADD (array, i, strcspn, 1, __strcspn_i386)) /* Support sysdeps/i386/i686/multiarch/strncase.S. */ IFUNC_IMPL (i, name, strncasecmp, @@ -298,13 +296,15 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array, IFUNC_IMPL_ADD (array, i, strnlen, HAS_CPU_FEATURE (SSE2), __strnlen_sse2) IFUNC_IMPL_ADD (array, i, strnlen, 1, __strnlen_ia32)) +#endif /* Support sysdeps/i386/i686/multiarch/strpbrk.S. */ IFUNC_IMPL (i, name, strpbrk, IFUNC_IMPL_ADD (array, i, strpbrk, HAS_CPU_FEATURE (SSE4_2), __strpbrk_sse42) - IFUNC_IMPL_ADD (array, i, strpbrk, 1, __strpbrk_ia32)) + IFUNC_IMPL_ADD (array, i, strpbrk, 1, __strpbrk_i386)) +#if 0 /* Support sysdeps/i386/i686/multiarch/strrchr.S. */ IFUNC_IMPL (i, name, strrchr, IFUNC_IMPL_ADD (array, i, strrchr, HAS_CPU_FEATURE (SSE2), diff --git a/sysdeps/i386/multiarch/strcspn-i386.S b/sysdeps/i386/multiarch/strcspn-i386.S new file mode 100644 index 0000000000..fd8d97b6df --- /dev/null +++ b/sysdeps/i386/multiarch/strcspn-i386.S @@ -0,0 +1,8 @@ +#define strcspn __strcspn_i386 +#undef libc_hidden_builtin_def +#define libc_hidden_builtin_def(name) +#include <sysdeps/i386/strcspn.S> + + .globl __GI_strcspn + .hidden __GI_strcspn + __GI_strcspn = __strcspn_i386 diff --git a/sysdeps/i386/i686/multiarch/strcspn-c.c b/sysdeps/i386/multiarch/strcspn-sse4.c index 6d61e190a8..920da4dc49 100644 --- a/sysdeps/i386/i686/multiarch/strcspn-c.c +++ b/sysdeps/i386/multiarch/strcspn-sse4.c @@ -1,2 +1,2 @@ -#define __strcspn_sse2 __strcspn_ia32 +#define __strcspn_sse2 __strcspn_i386 #include <sysdeps/x86_64/multiarch/strcspn-c.c> diff --git a/sysdeps/i386/multiarch/strcspn.c b/sysdeps/i386/multiarch/strcspn.c new file mode 100644 index 0000000000..6d8674b5df --- /dev/null +++ b/sysdeps/i386/multiarch/strcspn.c @@ -0,0 +1,49 @@ +/* Multiple versions of strcspn. + All versions must be listed in ifunc-impl-list.c. + Copyright (C) 2015 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 _HAVE_STRING_ARCH_strcspn +/* Redefine strcspn so that the compiler won't complain about the type + mismatch with the IFUNC selector in strong_alias, below. */ +# undef strcspn +# define strcspn __redirect_strcspn +# include <string.h> +# undef strcspn + +# include <init-arch.h> + +extern __typeof (__redirect_strcspn) __strcspn_i386 attribute_hidden; +extern __typeof (__redirect_strcspn) __strcspn_sse42 attribute_hidden; + +/* Avoid DWARF definition DIE on ifunc symbol so that GDB can handle + ifunc symbol properly. */ +extern __typeof (__redirect_strcspn) strcspn; +extern void *strcspn_ifunc (void) __asm__ ("strcspn"); + +void * +strcspn_ifunc (void) +{ + if (HAS_CPU_FEATURE (SSE4_2)) + return __strcspn_sse42; + + return __strcspn_i386; +} +__asm__ (".type strcspn, %gnu_indirect_function"); +#endif diff --git a/sysdeps/i386/multiarch/strpbrk-i386.S b/sysdeps/i386/multiarch/strpbrk-i386.S new file mode 100644 index 0000000000..94e91339f2 --- /dev/null +++ b/sysdeps/i386/multiarch/strpbrk-i386.S @@ -0,0 +1,13 @@ +#ifdef SHARED +# define strpbrk __strpbrk_i386 +# undef libc_hidden_builtin_def +# define libc_hidden_builtin_def(name) +#endif + +#include <sysdeps/i386/strpbrk.S> + +#ifdef SHARED + .globl __GI_strpbrk + .hidden __GI_strpbrk + __GI_strpbrk = __strpbrk_i386 +#endif diff --git a/sysdeps/i386/i686/multiarch/strpbrk-c.c b/sysdeps/i386/multiarch/strpbrk-sse4.c index 5db62053b3..a63afc136d 100644 --- a/sysdeps/i386/i686/multiarch/strpbrk-c.c +++ b/sysdeps/i386/multiarch/strpbrk-sse4.c @@ -1,2 +1,2 @@ -#define __strpbrk_sse2 __strpbrk_ia32 +#define __strpbrk_sse2 __strpbrk_i386 #include <sysdeps/x86_64/multiarch/strpbrk-c.c> diff --git a/sysdeps/i386/multiarch/strpbrk.c b/sysdeps/i386/multiarch/strpbrk.c new file mode 100644 index 0000000000..b857135978 --- /dev/null +++ b/sysdeps/i386/multiarch/strpbrk.c @@ -0,0 +1,51 @@ +/* Multiple versions of strpbrk. + All versions must be listed in ifunc-impl-list.c. + Copyright (C) 2015 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. Don't + define multiple versions for strpbrk in static library since we + need strpbrk before the initialization happened. */ +#if defined SHARED && IS_IN (libc) +# define _HAVE_STRING_ARCH_strpbrk +/* Redefine strpbrk so that the compiler won't complain about the type + mismatch with the IFUNC selector in strong_alias, below. */ +# undef strpbrk +# define strpbrk __redirect_strpbrk +# include <string.h> +# undef strpbrk + +# include <init-arch.h> + +extern __typeof (__redirect_strpbrk) __strpbrk_i386 attribute_hidden; +extern __typeof (__redirect_strpbrk) __strpbrk_sse42 attribute_hidden; + +/* Avoid DWARF definition DIE on ifunc symbol so that GDB can handle + ifunc symbol properly. */ +extern __typeof (__redirect_strpbrk) strpbrk; +extern void *strpbrk_ifunc (void) __asm__ ("strpbrk"); + +void * +strpbrk_ifunc (void) +{ + if (HAS_CPU_FEATURE (SSE4_2)) + return __strpbrk_sse42; + + return __strpbrk_i386; +} +__asm__ (".type strpbrk, %gnu_indirect_function"); +#endif diff --git a/sysdeps/i386/i686/multiarch/varshift.c b/sysdeps/i386/multiarch/varshift.c index 7760b966e2..7760b966e2 100644 --- a/sysdeps/i386/i686/multiarch/varshift.c +++ b/sysdeps/i386/multiarch/varshift.c |