diff options
author | Adhemerval Zanella <azanella@linux.vnet.ibm.com> | 2013-03-26 12:31:15 -0500 |
---|---|---|
committer | Adhemerval Zanella <azanella@linux.vnet.ibm.com> | 2013-03-26 12:31:15 -0500 |
commit | 9b5b34a1d57b68f93d26b3f5f2ce84d9b77131fd (patch) | |
tree | b37dc01d21a6ac2693738e25078904847e813718 | |
parent | 8aa649dd3cfe67bf59c2aedf8df2e9b6ed484c42 (diff) | |
download | glibc-9b5b34a1d57b68f93d26b3f5f2ce84d9b77131fd.zip glibc-9b5b34a1d57b68f93d26b3f5f2ce84d9b77131fd.tar.gz glibc-9b5b34a1d57b68f93d26b3f5f2ce84d9b77131fd.tar.bz2 |
PowerPC: strcasecmp ifunc implementation for PPC32
-rw-r--r-- | sysdeps/powerpc/powerpc32/multiarch/Makefile | 3 | ||||
-rw-r--r-- | sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c | 13 | ||||
-rw-r--r-- | sysdeps/powerpc/powerpc32/multiarch/init-arch.h | 21 | ||||
-rw-r--r-- | sysdeps/powerpc/powerpc32/multiarch/strcasecmp-power7.S (renamed from sysdeps/powerpc/powerpc32/power7/strcasecmp.S) | 4 | ||||
-rw-r--r-- | sysdeps/powerpc/powerpc32/multiarch/strcasecmp.c | 54 | ||||
-rw-r--r-- | sysdeps/powerpc/powerpc32/multiarch/strcasecmp_l-power7.S | 5 | ||||
-rw-r--r-- | sysdeps/powerpc/powerpc32/multiarch/strcasecmp_l.c | 54 | ||||
-rw-r--r-- | sysdeps/powerpc/powerpc32/power7/strcasecmp_l.S | 5 |
8 files changed, 151 insertions, 8 deletions
diff --git a/sysdeps/powerpc/powerpc32/multiarch/Makefile b/sysdeps/powerpc/powerpc32/multiarch/Makefile index 4d935fe..22deb17 100644 --- a/sysdeps/powerpc/powerpc32/multiarch/Makefile +++ b/sysdeps/powerpc/powerpc32/multiarch/Makefile @@ -2,5 +2,6 @@ ifeq ($(subdir),string) sysdep_routines += memcpy-power7 memcpy-a2 memcpy-power6 memcpy-cell \ memcmp-power7 memset-power4 memset-power6 memset-power7 \ bzero-power4 bzero-power6 bzero-power7 \ - strncmp-power7 strncmp-power4 strlen-power7 + strncmp-power7 strncmp-power4 strlen-power7 \ + strcasecmp-power7 strcasecmp_l-power7 endif diff --git a/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c b/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c index 3714676..7ca97ac 100644 --- a/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c +++ b/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c @@ -93,6 +93,19 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array, IFUNC_IMPL_ADD (array, i, strncmp, hwcap & PPC_FEATURE_POWER4, __strncmp_power4) IFUNC_IMPL_ADD (array, i, strncmp, 1, __strncmp_ppc32)) + + IFUNC_IMPL (i, name, strcasecmp, + IFUNC_IMPL_ADD (array, i, strcasecmp, + hwcap & PPC_FEATURE_HAS_VSX, + __strcasecmp_power7) + IFUNC_IMPL_ADD (array, i, strcasecmp, 1, __strcasecmp_ppc32)) + + IFUNC_IMPL (i, name, strcasecmp_l, + IFUNC_IMPL_ADD (array, i, strcasecmp_l, + hwcap & PPC_FEATURE_HAS_VSX, + __strcasecmp_l_power7) + IFUNC_IMPL_ADD (array, i, strcasecmp_l, 1, + __strcasecmp_l_ppc32)) #endif return i; diff --git a/sysdeps/powerpc/powerpc32/multiarch/init-arch.h b/sysdeps/powerpc/powerpc32/multiarch/init-arch.h new file mode 100644 index 0000000..17f8708 --- /dev/null +++ b/sysdeps/powerpc/powerpc32/multiarch/init-arch.h @@ -0,0 +1,21 @@ +/* This file is part of the GNU C Library. + Copyright (C) 2013 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/>. */ + +#include <ldsodefs.h> + +# define INIT_ARCH() \ + unsigned long int hwcap = GLRO(dl_hwcap); diff --git a/sysdeps/powerpc/powerpc32/power7/strcasecmp.S b/sysdeps/powerpc/powerpc32/multiarch/strcasecmp-power7.S index 7f0046c..5f48271 100644 --- a/sysdeps/powerpc/powerpc32/power7/strcasecmp.S +++ b/sysdeps/powerpc/powerpc32/multiarch/strcasecmp-power7.S @@ -27,8 +27,8 @@ __locale_t loc [r5]) */ #ifndef STRCMP -# define __STRCMP __strcasecmp -# define STRCMP strcasecmp +# define __STRCMP __strcasecmp_power7 +# define STRCMP strcasecmp_power7 #endif ENTRY (__STRCMP) diff --git a/sysdeps/powerpc/powerpc32/multiarch/strcasecmp.c b/sysdeps/powerpc/powerpc32/multiarch/strcasecmp.c new file mode 100644 index 0000000..1885ce9 --- /dev/null +++ b/sysdeps/powerpc/powerpc32/multiarch/strcasecmp.c @@ -0,0 +1,54 @@ +/* Multiple versions of strcasecmp. + Copyright (C) 2013 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 NOT_IN_libc +# ifdef SHARED +# undef libc_hidden_builtin_def +# define libc_hidden_builtin_def(name) \ + __hidden_ver1 (__strcasecmp_ppc32, __GI_strcasecmp, __strcasecmp_ppc32); +# endif + +/* Redefine memmove so that the compiler won't complain about the type + mismatch with the IFUNC selector in strong_alias, below. */ +# undef strcasecmp +# define strcasecmp __redirect_strcasecmp +# include <string.h> +# undef strcasecmp +# define strcasecmp __strcasecmp_ppc32 + +extern __typeof (__redirect_strcasecmp) __strcasecmp_ppc32 attribute_hidden; +extern __typeof (__redirect_strcasecmp) __strcasecmp_power7 attribute_hidden; +#endif + +#include "string/strcasecmp.c" +#undef strcasecmp + +#ifndef NOT_IN_libc +# include <shlib-compat.h> +# include "init-arch.h" + +/* Avoid DWARF definition DIE on ifunc symbol so that GDB can handle + ifunc symbol properly. */ +extern __typeof (__redirect_strcasecmp) __libc_strcasecmp; +libc_ifunc (__libc_strcasecmp, + (hwcap & PPC_FEATURE_HAS_VSX) + ? __strcasecmp_power7 + : __strcasecmp_ppc32); + +weak_alias (__libc_strcasecmp, strcasecmp) +#endif diff --git a/sysdeps/powerpc/powerpc32/multiarch/strcasecmp_l-power7.S b/sysdeps/powerpc/powerpc32/multiarch/strcasecmp_l-power7.S new file mode 100644 index 0000000..d07d4b8 --- /dev/null +++ b/sysdeps/powerpc/powerpc32/multiarch/strcasecmp_l-power7.S @@ -0,0 +1,5 @@ +#define USE_IN_EXTENDED_LOCALE_MODEL +#define STRCMP strcasecmp_l_power7 +#define __STRCMP __strcasecmp_l_power7 + +#include "strcasecmp-power7.S" diff --git a/sysdeps/powerpc/powerpc32/multiarch/strcasecmp_l.c b/sysdeps/powerpc/powerpc32/multiarch/strcasecmp_l.c new file mode 100644 index 0000000..71e37cf --- /dev/null +++ b/sysdeps/powerpc/powerpc32/multiarch/strcasecmp_l.c @@ -0,0 +1,54 @@ +/* Multiple versions of strcasecmp. + Copyright (C) 2013 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 NOT_IN_libc +# ifdef SHARED +# undef libc_hidden_builtin_def +# define libc_hidden_builtin_def(name) \ + __hidden_ver1 (__strcasecmp_l_ppc32, __GI_strcasecmp_l, __strcasecmp_l_ppc32); +# endif + +/* Redefine memmove so that the compiler won't complain about the type + mismatch with the IFUNC selector in strong_alias, below. */ +# undef strcasecmp_l +# define strcasecmp_l __redirect_strcasecmp_l +# include <string.h> +# undef strcasecmp_l +# define strcasecmp_l __strcasecmp_l_ppc32 + +extern __typeof (__redirect_strcasecmp_l) __strcasecmp_l_ppc32 attribute_hidden; +extern __typeof (__redirect_strcasecmp_l) __strcasecmp_l_power7 attribute_hidden; +#endif + +#include "string/strcasecmp_l.c" +#undef strcasecmp_l + +#ifndef NOT_IN_libc +# include <shlib-compat.h> +# include "init-arch.h" + +/* Avoid DWARF definition DIE on ifunc symbol so that GDB can handle + ifunc symbol properly. */ +extern __typeof (__redirect_strcasecmp_l) __libc_strcasecmp_l; +libc_ifunc (__libc_strcasecmp_l, + (hwcap & PPC_FEATURE_HAS_VSX) + ? __strcasecmp_l_power7 + : __strcasecmp_l_ppc32); + +weak_alias (__libc_strcasecmp_l, strcasecmp_l) +#endif diff --git a/sysdeps/powerpc/powerpc32/power7/strcasecmp_l.S b/sysdeps/powerpc/powerpc32/power7/strcasecmp_l.S deleted file mode 100644 index c13c4eb..0000000 --- a/sysdeps/powerpc/powerpc32/power7/strcasecmp_l.S +++ /dev/null @@ -1,5 +0,0 @@ -#define USE_IN_EXTENDED_LOCALE_MODEL -#define STRCMP strcasecmp_l -#define __STRCMP __strcasecmp_l - -#include "strcasecmp.S" |