diff options
author | Adhemerval Zanella <azanella@linux.vnet.ibm.com> | 2013-04-09 07:55:41 -0500 |
---|---|---|
committer | Adhemerval Zanella <azanella@linux.vnet.ibm.com> | 2013-04-09 12:04:27 -0500 |
commit | e567462074d37067fac1d2f70ab9ef036f9d72f8 (patch) | |
tree | 475833fb7a29369e801ab0179d126651600a516a | |
parent | 39facb2f8d5e4a5d9ed0ddb45bc4253c518e55a3 (diff) | |
download | glibc-e567462074d37067fac1d2f70ab9ef036f9d72f8.tar.gz glibc-e567462074d37067fac1d2f70ab9ef036f9d72f8.tar.xz glibc-e567462074d37067fac1d2f70ab9ef036f9d72f8.zip |
PowerPC: wcsrchr ifunc for PowerPC32
-rw-r--r-- | sysdeps/powerpc/powerpc32/multiarch/Makefile | 3 | ||||
-rw-r--r-- | sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c | 10 | ||||
-rw-r--r-- | sysdeps/powerpc/powerpc32/multiarch/wcsrchr-c.c | 9 | ||||
-rw-r--r-- | sysdeps/powerpc/powerpc32/multiarch/wcsrchr-power6.c (renamed from sysdeps/powerpc/powerpc32/power6/wcsrchr.c) | 13 | ||||
-rw-r--r-- | sysdeps/powerpc/powerpc32/multiarch/wcsrchr-power7.c | 3 | ||||
-rw-r--r-- | sysdeps/powerpc/powerpc32/multiarch/wcsrchr.c | 36 | ||||
-rw-r--r-- | wcsmbs/wcsrchr.c | 4 |
7 files changed, 74 insertions, 4 deletions
diff --git a/sysdeps/powerpc/powerpc32/multiarch/Makefile b/sysdeps/powerpc/powerpc32/multiarch/Makefile index 4fe9bd04f3..19b11e1103 100644 --- a/sysdeps/powerpc/powerpc32/multiarch/Makefile +++ b/sysdeps/powerpc/powerpc32/multiarch/Makefile @@ -13,5 +13,6 @@ sysdep_routines += memcpy-power7 memcpy-a2 memcpy-power6 memcpy-cell \ strchrnul-power7 strchrnul-c \ wordcopy-power7 wordcopy-power6 wordcopy-power5 \ wordcopy-power4 wordcopy-c \ - wcschr-power7 wcschr-power6 wcschr-c + wcschr-power7 wcschr-power6 wcschr-c \ + wcsrchr-power7 wcsrchr-power6 wcsrchr-c endif diff --git a/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c b/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c index b92152eef4..0489e3d651 100644 --- a/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c +++ b/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c @@ -165,6 +165,16 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array, __wcschr_power6) IFUNC_IMPL_ADD (array, i, wcschr, 1, __wcschr_ppc32)) + + IFUNC_IMPL (i, name, wcsrchr, + IFUNC_IMPL_ADD (array, i, wcsrchr, + hwcap & PPC_FEATURE_HAS_VSX, + __wcsrchr_power7) + IFUNC_IMPL_ADD (array, i, wcsrchr, + hwcap & PPC_FEATURE_ARCH_2_05, + __wcsrchr_power6) + IFUNC_IMPL_ADD (array, i, wcsrchr, 1, + __wcsrchr_ppc32)) #endif return i; diff --git a/sysdeps/powerpc/powerpc32/multiarch/wcsrchr-c.c b/sysdeps/powerpc/powerpc32/multiarch/wcsrchr-c.c new file mode 100644 index 0000000000..6c893fe115 --- /dev/null +++ b/sysdeps/powerpc/powerpc32/multiarch/wcsrchr-c.c @@ -0,0 +1,9 @@ +#include <wchar.h> + +#ifndef NOT_IN_libc +# define WCSRCHR __wcsrchr_ppc32 +#endif + +extern __typeof (wcsrchr) __wcsrchr_ppc32; + +#include "wcsmbs/wcsrchr.c" diff --git a/sysdeps/powerpc/powerpc32/power6/wcsrchr.c b/sysdeps/powerpc/powerpc32/multiarch/wcsrchr-power6.c index d0ff9f69cf..9da8edcb90 100644 --- a/sysdeps/powerpc/powerpc32/power6/wcsrchr.c +++ b/sysdeps/powerpc/powerpc32/multiarch/wcsrchr-power6.c @@ -18,12 +18,19 @@ #include <wchar.h> +#ifdef WCSRCHR +# define __wcsrchr_power6 WCSRCHR +#endif +#ifndef WCSRCHR_ARCH +# define WCSRCHR_ARCH "power6" +#endif + +__typeof (wcsrchr) __wcsrchr_power6 + __attribute__ ((__target__ ("cpu=" WCSRCHR_ARCH))); /* Find the last occurrence of WC in WCS. */ wchar_t * -wcsrchr (wcs, wc) - register const wchar_t *wcs; - register const wchar_t wc; +__wcsrchr_power6 (register const wchar_t *wcs, register const wchar_t wc) { register const wchar_t *wcs2 = wcs + 1; const wchar_t *retval = NULL; diff --git a/sysdeps/powerpc/powerpc32/multiarch/wcsrchr-power7.c b/sysdeps/powerpc/powerpc32/multiarch/wcsrchr-power7.c new file mode 100644 index 0000000000..0c8fe9c1ed --- /dev/null +++ b/sysdeps/powerpc/powerpc32/multiarch/wcsrchr-power7.c @@ -0,0 +1,3 @@ +#define WCSRCHR __wcsrchr_power7 +#define WCSRCHR_ARCH "power7" +#include <sysdeps/powerpc/powerpc32/multiarch/wcsrchr-power6.c> diff --git a/sysdeps/powerpc/powerpc32/multiarch/wcsrchr.c b/sysdeps/powerpc/powerpc32/multiarch/wcsrchr.c new file mode 100644 index 0000000000..0b06c2825a --- /dev/null +++ b/sysdeps/powerpc/powerpc32/multiarch/wcsrchr.c @@ -0,0 +1,36 @@ +/* Multiple versions of wcsrchr + 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 +# include <wchar.h> +# include <shlib-compat.h> +# include "init-arch.h" + +extern __typeof (wcsrchr) __wcsrchr_ppc32 attribute_hidden; +extern __typeof (wcsrchr) __wcsrchr_power6 attribute_hidden; +extern __typeof (wcsrchr) __wcsrchr_power7 attribute_hidden; + +libc_ifunc (wcsrchr, + (hwcap & PPC_FEATURE_HAS_VSX) + ? __wcsrchr_power7 : + (hwcap & PPC_FEATURE_ARCH_2_05) + ? __wcsrchr_power6 + : __wcsrchr_ppc32); +#else +#include "wcsmbs/wcsrchr.c" +#endif diff --git a/wcsmbs/wcsrchr.c b/wcsmbs/wcsrchr.c index 7c3bc968e7..78479c7826 100644 --- a/wcsmbs/wcsrchr.c +++ b/wcsmbs/wcsrchr.c @@ -20,6 +20,10 @@ /* Find the last occurrence of WC in WCS. */ +#ifdef WCSRCHR +# define wcsrchr WCSRCHR +#endif + wchar_t * wcsrchr (wcs, wc) register const wchar_t *wcs; |