diff options
author | Tulio Magno Quites Machado Filho <tuliom@linux.vnet.ibm.com> | 2013-03-07 16:18:29 -0300 |
---|---|---|
committer | Tulio Magno Quites Machado Filho <tuliom@linux.vnet.ibm.com> | 2013-03-12 17:51:21 -0300 |
commit | ca7a6adf22bfc375452aba1f0606b97e89659edc (patch) | |
tree | d253af498de46cd09da34253223c799fc1f036f3 | |
parent | f57a67e2c6d445d4ab0df34a523e8951192ea536 (diff) | |
download | glibc-ca7a6adf22bfc375452aba1f0606b97e89659edc.tar.gz glibc-ca7a6adf22bfc375452aba1f0606b97e89659edc.tar.xz glibc-ca7a6adf22bfc375452aba1f0606b97e89659edc.zip |
PowerPC: Add 32-bit multilib implementation of strlen
Move and rename specialized strlen implementation to multilib folder and add IFUNC strlen source.
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | sysdeps/powerpc/powerpc32/multiarch/Makefile | 2 | ||||
-rw-r--r-- | sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c | 5 | ||||
-rw-r--r-- | sysdeps/powerpc/powerpc32/multiarch/strlen-power7.S (renamed from sysdeps/powerpc/powerpc32/power7/strlen.S) | 5 | ||||
-rw-r--r-- | sysdeps/powerpc/powerpc32/multiarch/strlen.S | 82 | ||||
-rw-r--r-- | sysdeps/powerpc/powerpc32/strlen.S | 2 |
6 files changed, 100 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog index d441895323..d4cb678638 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,15 @@ 2013-03-07 Tulio Magno Quites Machado Filho <tuliom@linux.vnet.ibm.com> * sysdeps/powerpc/powerpc32/multiarch/Makefile (sysdep_routines): + Add strlen implementations. + * sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c: Add strlen. + * sysdeps/powerpc/powerpc32/power7/strlen.S: Moved to... + * sysdeps/powerpc/powerpc32/multiarch/strlen-power7.S: ... here. + * sysdeps/powerpc/powerpc32/strlen.S: New file. + +2013-03-07 Tulio Magno Quites Machado Filho <tuliom@linux.vnet.ibm.com> + + * sysdeps/powerpc/powerpc32/multiarch/Makefile (sysdep_routines): Add strncmp implementations. * sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c: Add strncmp. * sysdeps/powerpc/powerpc32/multiarch/strncmp.S: New file diff --git a/sysdeps/powerpc/powerpc32/multiarch/Makefile b/sysdeps/powerpc/powerpc32/multiarch/Makefile index 42c39b215e..4d935fecff 100644 --- a/sysdeps/powerpc/powerpc32/multiarch/Makefile +++ b/sysdeps/powerpc/powerpc32/multiarch/Makefile @@ -2,5 +2,5 @@ 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 + strncmp-power7 strncmp-power4 strlen-power7 endif diff --git a/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c b/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c index e5c6354663..aae8d99c74 100644 --- a/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c +++ b/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c @@ -78,6 +78,11 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array, __memcpy_cell) IFUNC_IMPL_ADD (array, i, memcpy, 1, __memcpy_ppc32)) + IFUNC_IMPL (i, name, strlen, + IFUNC_IMPL_ADD (array, i, strlen, hwcap & PPC_FEATURE_HAS_VSX, + __strlen_power7) + IFUNC_IMPL_ADD (array, i, strlen, 1, __strlen_ppc32)) + IFUNC_IMPL (i, name, strncmp, IFUNC_IMPL_ADD (array, i, strncmp, hwcap & PPC_FEATURE_HAS_VSX, __strncmp_power7) diff --git a/sysdeps/powerpc/powerpc32/power7/strlen.S b/sysdeps/powerpc/powerpc32/multiarch/strlen-power7.S index b71a10f5c7..0a5ed8d2ed 100644 --- a/sysdeps/powerpc/powerpc32/power7/strlen.S +++ b/sysdeps/powerpc/powerpc32/multiarch/strlen-power7.S @@ -21,7 +21,7 @@ /* int [r3] strlen (char *s [r3]) */ .machine power7 -ENTRY (strlen) +EALIGN (__strlen_power7, 5, 0) CALL_MCOUNT dcbt 0,r3 clrrwi r4,r3,2 /* Align the address to word boundary. */ @@ -91,5 +91,4 @@ L(done): srwi r0,r0,3 /* Convert leading zeroes to bytes. */ add r3,r5,r0 /* Compute final length. */ blr -END (strlen) -libc_hidden_builtin_def (strlen) +END (__strlen_power7) diff --git a/sysdeps/powerpc/powerpc32/multiarch/strlen.S b/sysdeps/powerpc/powerpc32/multiarch/strlen.S new file mode 100644 index 0000000000..13cf8cdba6 --- /dev/null +++ b/sysdeps/powerpc/powerpc32/multiarch/strlen.S @@ -0,0 +1,82 @@ +/* Optimized strlen implementation for PowerPC32. + 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/>. */ + +#include <sysdep.h> +#include <rtld-global-offsets.h> + +/* Define multiple versions only for the definition in libc. */ +#if defined SHARED && !defined NOT_IN_libc + .text +ENTRY(strlen) + .type strlen, @gnu_indirect_function +# ifdef PIC + mflr r11 + cfi_register (lr,r11) + bcl 20,31,1f +1: mflr r5 + addis r5,r5,_GLOBAL_OFFSET_TABLE_-1b@ha + addi r5,r5,_GLOBAL_OFFSET_TABLE_-1b@l + lwz r6,_rtld_global_ro@got(r5) + mtlr r11 + cfi_same_value (lr) + lwz r6,RTLD_GLOBAL_RO_DL_HWCAP_OFFSET+4(r6) +# else + lis r6,(_dl_hwcap+4)@ha + lwz r6,(_dl_hwcap+4)@l(r6) +# endif + /* r5 - got pointer | r6 - _dl_hwcap */ + andi. r7,r6,PPC_FEATURE_HAS_VSX + bne- L(power7) +# ifdef PIC + lwz r3,__strlen_ppc32@got(r5) +# else + lis r3,__strlen_ppc32@ha + lwz r3,__strlen_ppc32@l(r3) +# endif + blr +L(power7): +# ifdef PIC + lwz r3,__strlen_power7@got(r5) +# else + lis r3,__strlen_power7@ha + lwz r3,__strlen_power7@l(r3) +# endif + blr +END(strlen) + +# undef EALIGN +# define EALIGN(name, alignt, words) \ + .globl C_SYMBOL_NAME(__strlen_ppc32); \ + .type C_SYMBOL_NAME(__strlen_ppc32),@function ; \ + .align ALIGNARG(alignt); \ + EALIGN_W_##words; \ + C_LABEL(__strlen_ppc32) \ + cfi_startproc; + +# undef END +# define END(name) \ + cfi_endproc; \ + ASM_SIZE_DIRECTIVE(__strlen_ppc32) + +# undef libc_hidden_builtin_def +# define libc_hidden_builtin_def(name) \ + .globl __GI_strlen; __GI_strlen = __strlen_ppc32 + +#endif + +#include "../strlen.S" diff --git a/sysdeps/powerpc/powerpc32/strlen.S b/sysdeps/powerpc/powerpc32/strlen.S index 9a6eafc382..58b875f2ac 100644 --- a/sysdeps/powerpc/powerpc32/strlen.S +++ b/sysdeps/powerpc/powerpc32/strlen.S @@ -70,7 +70,7 @@ /* int [r3] strlen (char *s [r3]) */ -ENTRY (strlen) +EALIGN (strlen, 5, 0) #define rTMP1 r0 #define rRTN r3 /* incoming STR arg, outgoing result */ |