diff options
-rw-r--r-- | sysdeps/i386/i686/multiarch/Makefile | 4 | ||||
-rw-r--r-- | sysdeps/i386/i686/multiarch/wcschr.S | 36 | ||||
-rw-r--r-- | sysdeps/i386/i686/multiarch/wcsrchr.S | 35 | ||||
-rw-r--r-- | sysdeps/i386/multiarch/Makefile | 4 | ||||
-rw-r--r-- | sysdeps/i386/multiarch/ifunc-impl-list.c | 8 | ||||
-rw-r--r-- | sysdeps/i386/multiarch/wcschr-i386.c (renamed from sysdeps/i386/i686/multiarch/wcschr-c.c) | 10 | ||||
-rw-r--r-- | sysdeps/i386/multiarch/wcschr-sse2.S (renamed from sysdeps/i386/i686/multiarch/wcschr-sse2.S) | 0 | ||||
-rw-r--r-- | sysdeps/i386/multiarch/wcschr.c | 50 | ||||
-rw-r--r-- | sysdeps/i386/multiarch/wcsrchr-i386.c (renamed from sysdeps/i386/i686/multiarch/wcsrchr-c.c) | 2 | ||||
-rw-r--r-- | sysdeps/i386/multiarch/wcsrchr-sse2.S (renamed from sysdeps/i386/i686/multiarch/wcsrchr-sse2.S) | 0 | ||||
-rw-r--r-- | sysdeps/i386/multiarch/wcsrchr.c | 48 |
11 files changed, 115 insertions, 82 deletions
diff --git a/sysdeps/i386/i686/multiarch/Makefile b/sysdeps/i386/i686/multiarch/Makefile index ff54ee963b..289f0f9634 100644 --- a/sysdeps/i386/i686/multiarch/Makefile +++ b/sysdeps/i386/i686/multiarch/Makefile @@ -1,5 +1,5 @@ ifeq ($(subdir),wcsmbs) sysdep_routines += wcscmp-sse2 wcscmp-c wcslen-sse2 wcslen-c \ - wmemcmp-sse4 wmemcmp-ssse3 wmemcmp-c wcschr-sse2 \ - wcschr-c wcsrchr-sse2 wcsrchr-c wcscpy-ssse3 wcscpy-c + wmemcmp-sse4 wmemcmp-ssse3 wmemcmp-c \ + wcscpy-ssse3 wcscpy-c endif diff --git a/sysdeps/i386/i686/multiarch/wcschr.S b/sysdeps/i386/i686/multiarch/wcschr.S deleted file mode 100644 index 5918b127a6..0000000000 --- a/sysdeps/i386/i686/multiarch/wcschr.S +++ /dev/null @@ -1,36 +0,0 @@ -/* Multiple versions of wcschr - All versions must be listed in ifunc-impl-list.c. - Copyright (C) 2011-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 <sysdep.h> -#include <init-arch.h> - -#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) -#endif diff --git a/sysdeps/i386/i686/multiarch/wcsrchr.S b/sysdeps/i386/i686/multiarch/wcsrchr.S deleted file mode 100644 index 9ed68101e1..0000000000 --- a/sysdeps/i386/i686/multiarch/wcsrchr.S +++ /dev/null @@ -1,35 +0,0 @@ -/* Multiple versions of wcsrchr - All versions must be listed in ifunc-impl-list.c. - Copyright (C) 2011-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 <sysdep.h> -#include <init-arch.h> - -#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) -#endif diff --git a/sysdeps/i386/multiarch/Makefile b/sysdeps/i386/multiarch/Makefile index 89c86b49c4..3515759304 100644 --- a/sysdeps/i386/multiarch/Makefile +++ b/sysdeps/i386/multiarch/Makefile @@ -49,6 +49,10 @@ CFLAGS-strspn-sse4.c += -msse4 endif endif +ifeq ($(subdir),wcsmbs) +sysdep_routines += wcschr-i386 wcschr-sse2 wcsrchr-i386 wcsrchr-sse2 +endif + ifeq (mathyes,$(subdir)$(config-cflags-avx)) libm-sysdep_routines += s_fma-fma s_fmaf-fma CFLAGS-s_fma-fma.c += -mavx -mfpmath=sse diff --git a/sysdeps/i386/multiarch/ifunc-impl-list.c b/sysdeps/i386/multiarch/ifunc-impl-list.c index 94a376d4e6..851d231862 100644 --- a/sysdeps/i386/multiarch/ifunc-impl-list.c +++ b/sysdeps/i386/multiarch/ifunc-impl-list.c @@ -316,13 +316,13 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array, __strspn_sse42) IFUNC_IMPL_ADD (array, i, strspn, 1, __strspn_i386)) -#if 0 /* Support sysdeps/i386/i686/multiarch/wcschr.S. */ IFUNC_IMPL (i, name, wcschr, IFUNC_IMPL_ADD (array, i, wcschr, HAS_CPU_FEATURE (SSE2), __wcschr_sse2) - IFUNC_IMPL_ADD (array, i, wcschr, 1, __wcschr_ia32)) + IFUNC_IMPL_ADD (array, i, wcschr, 1, __wcschr_i386)) +#if 0 /* Support sysdeps/i386/i686/multiarch/wcscmp.S. */ IFUNC_IMPL (i, name, wcscmp, IFUNC_IMPL_ADD (array, i, wcscmp, HAS_CPU_FEATURE (SSE2), @@ -340,13 +340,15 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array, IFUNC_IMPL_ADD (array, i, wcslen, HAS_CPU_FEATURE (SSE2), __wcslen_sse2) IFUNC_IMPL_ADD (array, i, wcslen, 1, __wcslen_ia32)) +#endif /* Support sysdeps/i386/i686/multiarch/wcsrchr.S. */ IFUNC_IMPL (i, name, wcsrchr, IFUNC_IMPL_ADD (array, i, wcsrchr, HAS_CPU_FEATURE (SSE2), __wcsrchr_sse2) - IFUNC_IMPL_ADD (array, i, wcsrchr, 1, __wcsrchr_ia32)) + IFUNC_IMPL_ADD (array, i, wcsrchr, 1, __wcsrchr_i386)) +#if 0 /* Support sysdeps/i386/i686/multiarch/wmemcmp.S. */ IFUNC_IMPL (i, name, wmemcmp, IFUNC_IMPL_ADD (array, i, wmemcmp, HAS_CPU_FEATURE (SSE4_2), diff --git a/sysdeps/i386/i686/multiarch/wcschr-c.c b/sysdeps/i386/multiarch/wcschr-i386.c index 38d41d04de..de06c2409a 100644 --- a/sysdeps/i386/i686/multiarch/wcschr-c.c +++ b/sysdeps/i386/multiarch/wcschr-i386.c @@ -10,13 +10,13 @@ # ifdef SHARED # undef libc_hidden_def # define libc_hidden_def(name) \ - __hidden_ver1 (__wcschr_ia32, __GI_wcschr, __wcschr_ia32); \ - strong_alias (__wcschr_ia32, __wcschr_ia32_1); \ - __hidden_ver1 (__wcschr_ia32_1, __GI___wcschr, __wcschr_ia32_1); + __hidden_ver1 (__wcschr_i386, __GI_wcschr, __wcschr_i386); \ + strong_alias (__wcschr_i386, __wcschr_i386_1); \ + __hidden_ver1 (__wcschr_i386_1, __GI___wcschr, __wcschr_i386_1); # endif #endif -extern __typeof (wcschr) __wcschr_ia32; +extern __typeof (wcschr) __wcschr_i386; -#define WCSCHR __wcschr_ia32 +#define WCSCHR __wcschr_i386 #include <wcsmbs/wcschr.c> diff --git a/sysdeps/i386/i686/multiarch/wcschr-sse2.S b/sysdeps/i386/multiarch/wcschr-sse2.S index 818eaa3014..818eaa3014 100644 --- a/sysdeps/i386/i686/multiarch/wcschr-sse2.S +++ b/sysdeps/i386/multiarch/wcschr-sse2.S diff --git a/sysdeps/i386/multiarch/wcschr.c b/sysdeps/i386/multiarch/wcschr.c new file mode 100644 index 0000000000..25cc0db465 --- /dev/null +++ b/sysdeps/i386/multiarch/wcschr.c @@ -0,0 +1,50 @@ +/* Multiple versions of wcschr. + 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) +/* Redefine wcschr so that the compiler won't complain about the type + mismatch with the IFUNC selector in strong_alias, below. */ +# undef wcschr +# define wcschr __redirect_wcschr +# include <wchar.h> +# undef wcschr + +# include <init-arch.h> + +extern __typeof (__redirect_wcschr) __wcschr_i386 attribute_hidden; +extern __typeof (__redirect_wcschr) __wcschr_sse2 attribute_hidden; + +/* Avoid DWARF definition DIE on ifunc symbol so that GDB can handle + ifunc symbol properly. */ +extern __typeof (__redirect_wcschr) __wcschr; +extern void *wcschr_ifunc (void) __asm__ ("__wcschr"); + +void * +wcschr_ifunc (void) +{ + if (HAS_CPU_FEATURE (SSE2)) + return __wcschr_sse2; + + return __wcschr_i386; +} +__asm__ (".type __wcschr, %gnu_indirect_function"); + +weak_alias (__wcschr, wcschr) +#endif diff --git a/sysdeps/i386/i686/multiarch/wcsrchr-c.c b/sysdeps/i386/multiarch/wcsrchr-i386.c index 8d8a335b5b..1f7583a319 100644 --- a/sysdeps/i386/i686/multiarch/wcsrchr-c.c +++ b/sysdeps/i386/multiarch/wcsrchr-i386.c @@ -1,5 +1,5 @@ #if IS_IN (libc) -# define wcsrchr __wcsrchr_ia32 +# define wcsrchr __wcsrchr_i386 #endif #include "wcsmbs/wcsrchr.c" diff --git a/sysdeps/i386/i686/multiarch/wcsrchr-sse2.S b/sysdeps/i386/multiarch/wcsrchr-sse2.S index f897618a3a..f897618a3a 100644 --- a/sysdeps/i386/i686/multiarch/wcsrchr-sse2.S +++ b/sysdeps/i386/multiarch/wcsrchr-sse2.S diff --git a/sysdeps/i386/multiarch/wcsrchr.c b/sysdeps/i386/multiarch/wcsrchr.c new file mode 100644 index 0000000000..14206907b8 --- /dev/null +++ b/sysdeps/i386/multiarch/wcsrchr.c @@ -0,0 +1,48 @@ +/* Multiple versions of wcsrchr. + 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) +/* Redefine wcsrchr so that the compiler won't complain about the type + mismatch with the IFUNC selector in strong_alias, below. */ +# undef wcsrchr +# define wcsrchr __redirect_wcsrchr +# include <wchar.h> +# undef wcsrchr + +# include <init-arch.h> + +extern __typeof (__redirect_wcsrchr) __wcsrchr_i386 attribute_hidden; +extern __typeof (__redirect_wcsrchr) __wcsrchr_sse2 attribute_hidden; + +/* Avoid DWARF definition DIE on ifunc symbol so that GDB can handle + ifunc symbol properly. */ +extern __typeof (__redirect_wcsrchr) wcsrchr; +extern void *wcsrchr_ifunc (void) __asm__ ("wcsrchr"); + +void * +wcsrchr_ifunc (void) +{ + if (HAS_CPU_FEATURE (SSE2)) + return __wcsrchr_sse2; + + return __wcsrchr_i386; +} +__asm__ (".type wcsrchr, %gnu_indirect_function"); +#endif |