diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2015-08-25 07:45:24 -0700 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2015-08-27 09:35:12 -0700 |
commit | 8988d795a0e71b3473f20eceafd44ae0b93f4bcd (patch) | |
tree | 95720283392b8618c6b04434f96423de3402e1e7 | |
parent | 39ecf822e2a5be93b2132d21aacfb7466073879e (diff) | |
download | glibc-8988d795a0e71b3473f20eceafd44ae0b93f4bcd.tar.gz glibc-8988d795a0e71b3473f20eceafd44ae0b93f4bcd.tar.xz glibc-8988d795a0e71b3473f20eceafd44ae0b93f4bcd.zip |
Add i386 wmemcmp multiarch functions
-rw-r--r-- | sysdeps/i386/i686/multiarch/Makefile | 3 | ||||
-rw-r--r-- | sysdeps/i386/i686/multiarch/wmemcmp-c.c | 9 | ||||
-rw-r--r-- | sysdeps/i386/i686/multiarch/wmemcmp.S | 40 | ||||
-rw-r--r-- | sysdeps/i386/multiarch/Makefile | 3 | ||||
-rw-r--r-- | sysdeps/i386/multiarch/ifunc-impl-list.c | 4 | ||||
-rw-r--r-- | sysdeps/i386/multiarch/wmemcmp-i386.c | 9 | ||||
-rw-r--r-- | sysdeps/i386/multiarch/wmemcmp-sse4.S (renamed from sysdeps/i386/i686/multiarch/wmemcmp-sse4.S) | 0 | ||||
-rw-r--r-- | sysdeps/i386/multiarch/wmemcmp-ssse3.S (renamed from sysdeps/i386/i686/multiarch/wmemcmp-ssse3.S) | 0 | ||||
-rw-r--r-- | sysdeps/i386/multiarch/wmemcmp.c | 54 |
9 files changed, 66 insertions, 56 deletions
diff --git a/sysdeps/i386/i686/multiarch/Makefile b/sysdeps/i386/i686/multiarch/Makefile deleted file mode 100644 index 3e078b7ec4..0000000000 --- a/sysdeps/i386/i686/multiarch/Makefile +++ /dev/null @@ -1,3 +0,0 @@ -ifeq ($(subdir),wcsmbs) -sysdep_routines += wmemcmp-sse4 wmemcmp-ssse3 wmemcmp-c -endif diff --git a/sysdeps/i386/i686/multiarch/wmemcmp-c.c b/sysdeps/i386/i686/multiarch/wmemcmp-c.c deleted file mode 100644 index 75ab4b94c1..0000000000 --- a/sysdeps/i386/i686/multiarch/wmemcmp-c.c +++ /dev/null @@ -1,9 +0,0 @@ -#include <wchar.h> - -#if IS_IN (libc) -# define WMEMCMP __wmemcmp_ia32 -#endif - -extern __typeof (wmemcmp) __wmemcmp_ia32; - -#include "wcsmbs/wmemcmp.c" diff --git a/sysdeps/i386/i686/multiarch/wmemcmp.S b/sysdeps/i386/i686/multiarch/wmemcmp.S deleted file mode 100644 index 6025942fb6..0000000000 --- a/sysdeps/i386/i686/multiarch/wmemcmp.S +++ /dev/null @@ -1,40 +0,0 @@ -/* Multiple versions of wmemcmp - 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> - -/* Define multiple versions only for the definition in libc. */ - -#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) -#endif diff --git a/sysdeps/i386/multiarch/Makefile b/sysdeps/i386/multiarch/Makefile index 6d594f8611..b638fa5b54 100644 --- a/sysdeps/i386/multiarch/Makefile +++ b/sysdeps/i386/multiarch/Makefile @@ -52,7 +52,8 @@ endif ifeq ($(subdir),wcsmbs) sysdep_routines += wcschr-i386 wcschr-sse2 wcsrchr-i386 wcsrchr-sse2 \ wcscmp-i386 wcscmp-sse2 wcscpy-i386 wcscpy-ssse3 \ - wcslen-i386 wcslen-sse2 + wcslen-i386 wcslen-sse2 \ + wmemcmp-i386 wmemcmp-sse4 wmemcmp-ssse3 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 a10e700649..df63c2ce0a 100644 --- a/sysdeps/i386/multiarch/ifunc-impl-list.c +++ b/sysdeps/i386/multiarch/ifunc-impl-list.c @@ -346,15 +346,13 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array, __wcsrchr_sse2) 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), __wmemcmp_sse4_2) IFUNC_IMPL_ADD (array, i, wmemcmp, HAS_CPU_FEATURE (SSSE3), __wmemcmp_ssse3) - IFUNC_IMPL_ADD (array, i, wmemcmp, 1, __wmemcmp_ia32)) -#endif + IFUNC_IMPL_ADD (array, i, wmemcmp, 1, __wmemcmp_i386)) #ifdef SHARED /* Support sysdeps/i386/i686/multiarch/memcpy_chk.S. */ diff --git a/sysdeps/i386/multiarch/wmemcmp-i386.c b/sysdeps/i386/multiarch/wmemcmp-i386.c new file mode 100644 index 0000000000..cb34db2b9a --- /dev/null +++ b/sysdeps/i386/multiarch/wmemcmp-i386.c @@ -0,0 +1,9 @@ +#include <wchar.h> + +#if IS_IN (libc) +# define WMEMCMP __wmemcmp_i386 +#endif + +extern __typeof (wmemcmp) __wmemcmp_i386; + +#include "wcsmbs/wmemcmp.c" diff --git a/sysdeps/i386/i686/multiarch/wmemcmp-sse4.S b/sysdeps/i386/multiarch/wmemcmp-sse4.S index 1a857c7e21..1a857c7e21 100644 --- a/sysdeps/i386/i686/multiarch/wmemcmp-sse4.S +++ b/sysdeps/i386/multiarch/wmemcmp-sse4.S diff --git a/sysdeps/i386/i686/multiarch/wmemcmp-ssse3.S b/sysdeps/i386/multiarch/wmemcmp-ssse3.S index a41ef95fc1..a41ef95fc1 100644 --- a/sysdeps/i386/i686/multiarch/wmemcmp-ssse3.S +++ b/sysdeps/i386/multiarch/wmemcmp-ssse3.S diff --git a/sysdeps/i386/multiarch/wmemcmp.c b/sysdeps/i386/multiarch/wmemcmp.c new file mode 100644 index 0000000000..94b1644b42 --- /dev/null +++ b/sysdeps/i386/multiarch/wmemcmp.c @@ -0,0 +1,54 @@ +/* Multiple versions of wmemcmp. + 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 wmemcmp so that the compiler won't complain about the type + mismatch with the IFUNC selector in strong_alias, below. */ +# undef wmemcmp +# define wmemcmp __redirect_wmemcmp +# include <wchar.h> +# undef wmemcmp + +# include <init-arch.h> + +extern __typeof (__redirect_wmemcmp) __wmemcmp_i386 attribute_hidden; +extern __typeof (__redirect_wmemcmp) __wmemcmp_ssse3 attribute_hidden; +extern __typeof (__redirect_wmemcmp) __wmemcmp_sse4_2 attribute_hidden; + +/* Avoid DWARF definition DIE on ifunc symbol so that GDB can handle + ifunc symbol properly. */ +extern __typeof (__redirect_wmemcmp) wmemcmp; +extern void *wmemcmp_ifunc (void) __asm__ ("wmemcmp"); + +void * +wmemcmp_ifunc (void) +{ + if (HAS_CPU_FEATURE (SSSE3)) + { + if (HAS_CPU_FEATURE (SSE4_2)) + return __wmemcmp_sse4_2; + else + return __wmemcmp_ssse3; + } + + return __wmemcmp_i386; +} +__asm__ (".type wmemcmp, %gnu_indirect_function"); +#endif |