diff options
author | Carlos Eduardo Seo <cseo@linux.vnet.ibm.com> | 2015-11-11 17:31:28 -0200 |
---|---|---|
committer | Tulio Magno Quites Machado Filho <tuliom@linux.vnet.ibm.com> | 2016-04-15 17:19:19 -0300 |
commit | 1b045ee53e0b8bed75745b931b33f27d21c9ed22 (patch) | |
tree | 43f5d8811c45e1b4fd33101f5f8ef76ca0404032 /sysdeps/powerpc/powerpc64/multiarch | |
parent | 223f17cf7b796e49e222caf287889e4b2793d8a2 (diff) | |
download | glibc-1b045ee53e0b8bed75745b931b33f27d21c9ed22.tar.gz glibc-1b045ee53e0b8bed75745b931b33f27d21c9ed22.tar.xz glibc-1b045ee53e0b8bed75745b931b33f27d21c9ed22.zip |
powerpc: Optimization for strlen for POWER8.
This implementation takes advantage of vectorization to improve performance of the loop over the current strlen implementation for POWER7.
Diffstat (limited to 'sysdeps/powerpc/powerpc64/multiarch')
-rw-r--r-- | sysdeps/powerpc/powerpc64/multiarch/Makefile | 2 | ||||
-rw-r--r-- | sysdeps/powerpc/powerpc64/multiarch/ifunc-impl-list.c | 2 | ||||
-rw-r--r-- | sysdeps/powerpc/powerpc64/multiarch/strlen-power8.S | 39 | ||||
-rw-r--r-- | sysdeps/powerpc/powerpc64/multiarch/strlen.c | 9 |
4 files changed, 48 insertions, 4 deletions
diff --git a/sysdeps/powerpc/powerpc64/multiarch/Makefile b/sysdeps/powerpc/powerpc64/multiarch/Makefile index 7ed56bf292..57abe8ff3c 100644 --- a/sysdeps/powerpc/powerpc64/multiarch/Makefile +++ b/sysdeps/powerpc/powerpc64/multiarch/Makefile @@ -20,7 +20,7 @@ sysdep_routines += memcpy-power7 memcpy-a2 memcpy-power6 memcpy-cell \ strcat-power8 strcat-power7 strcat-ppc64 \ memmove-power7 memmove-ppc64 wordcopy-ppc64 bcopy-ppc64 \ strncpy-power8 strstr-power7 strstr-ppc64 \ - strspn-power8 strspn-ppc64 + strspn-power8 strspn-ppc64 strlen-power8 CFLAGS-strncase-power7.c += -mcpu=power7 -funroll-loops CFLAGS-strncase_l-power7.c += -mcpu=power7 -funroll-loops diff --git a/sysdeps/powerpc/powerpc64/multiarch/ifunc-impl-list.c b/sysdeps/powerpc/powerpc64/multiarch/ifunc-impl-list.c index 3e1f099d71..d30a661caf 100644 --- a/sysdeps/powerpc/powerpc64/multiarch/ifunc-impl-list.c +++ b/sysdeps/powerpc/powerpc64/multiarch/ifunc-impl-list.c @@ -101,6 +101,8 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array, /* Support sysdeps/powerpc/powerpc64/multiarch/strlen.c. */ IFUNC_IMPL (i, name, strlen, + IFUNC_IMPL_ADD (array, i, strlen, hwcap2 & PPC_FEATURE2_ARCH_2_07, + __strlen_power8) IFUNC_IMPL_ADD (array, i, strlen, hwcap & PPC_FEATURE_HAS_VSX, __strlen_power7) IFUNC_IMPL_ADD (array, i, strlen, 1, diff --git a/sysdeps/powerpc/powerpc64/multiarch/strlen-power8.S b/sysdeps/powerpc/powerpc64/multiarch/strlen-power8.S new file mode 100644 index 0000000000..686dc3d7f6 --- /dev/null +++ b/sysdeps/powerpc/powerpc64/multiarch/strlen-power8.S @@ -0,0 +1,39 @@ +/* Optimized strlen implementation for POWER8. + Copyright (C) 2016 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/>. */ + +#include <sysdep.h> + +#undef EALIGN +#define EALIGN(name, alignt, words) \ + .section ".text"; \ + ENTRY_2(__strlen_power8) \ + .align ALIGNARG(alignt); \ + EALIGN_W_##words; \ + BODY_LABEL(__strlen_power8): \ + cfi_startproc; \ + LOCALENTRY(__strlen_power8) +#undef END +#define END(name) \ + cfi_endproc; \ + TRACEBACK(__strlen_power8) \ + END_2(__strlen_power8) + +#undef libc_hidden_builtin_def +#define libc_hidden_builtin_def(name) + +#include <sysdeps/powerpc/powerpc64/power8/strlen.S> diff --git a/sysdeps/powerpc/powerpc64/multiarch/strlen.c b/sysdeps/powerpc/powerpc64/multiarch/strlen.c index 94501fdf2f..609a87ec9f 100644 --- a/sysdeps/powerpc/powerpc64/multiarch/strlen.c +++ b/sysdeps/powerpc/powerpc64/multiarch/strlen.c @@ -29,11 +29,14 @@ extern __typeof (__redirect_strlen) __libc_strlen; extern __typeof (__redirect_strlen) __strlen_ppc attribute_hidden; extern __typeof (__redirect_strlen) __strlen_power7 attribute_hidden; +extern __typeof (__redirect_strlen) __strlen_power8 attribute_hidden; libc_ifunc (__libc_strlen, - (hwcap & PPC_FEATURE_HAS_VSX) - ? __strlen_power7 - : __strlen_ppc); + (hwcap2 & PPC_FEATURE2_ARCH_2_07) + ? __strlen_power8 : + (hwcap & PPC_FEATURE_HAS_VSX) + ? __strlen_power7 + : __strlen_ppc); #undef strlen strong_alias (__libc_strlen, strlen) |