diff options
author | Tulio Magno Quites Machado Filho <tuliom@linux.vnet.ibm.com> | 2013-03-07 16:14:19 -0300 |
---|---|---|
committer | Tulio Magno Quites Machado Filho <tuliom@linux.vnet.ibm.com> | 2013-03-12 17:51:20 -0300 |
commit | f57a67e2c6d445d4ab0df34a523e8951192ea536 (patch) | |
tree | e6fe2801995105241a8d474af16e7cfabcae184d | |
parent | 380bf3efccb6c4bad2d75546b68e950b2381ae33 (diff) | |
download | glibc-f57a67e2c6d445d4ab0df34a523e8951192ea536.tar.gz glibc-f57a67e2c6d445d4ab0df34a523e8951192ea536.tar.xz glibc-f57a67e2c6d445d4ab0df34a523e8951192ea536.zip |
PowerPC: Add 32-bit multilib implementation of strncmp
Move and rename specialized strncmp implementation to multilib folder and add IFUNC strncmp source.
-rw-r--r-- | ChangeLog | 11 | ||||
-rw-r--r-- | sysdeps/powerpc/powerpc32/multiarch/Makefile | 3 | ||||
-rw-r--r-- | sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c | 7 | ||||
-rw-r--r-- | sysdeps/powerpc/powerpc32/multiarch/strncmp-power4.S (renamed from sysdeps/powerpc/powerpc32/power4/strncmp.S) | 6 | ||||
-rw-r--r-- | sysdeps/powerpc/powerpc32/multiarch/strncmp-power7.S (renamed from sysdeps/powerpc/powerpc32/power7/strncmp.S) | 6 | ||||
-rw-r--r-- | sysdeps/powerpc/powerpc32/multiarch/strncmp.S | 92 |
6 files changed, 118 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog index 7969bc294f..d441895323 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,16 @@ 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 + * sysdeps/powerpc/powerpc32/power4/strncmp.S: Moved to... + * sysdeps/powerpc/powerpc32/multiarch/strncmp-power4.S: ... here. + * sysdeps/powerpc/powerpc32/power7/strncmp.S: Moved to... + * sysdeps/powerpc/powerpc32/multiarch/strncmp-power7.S: ... here. + +2013-03-07 Tulio Magno Quites Machado Filho <tuliom@linux.vnet.ibm.com> + * sysdeps/powerpc/powerpc32/bzero.S: Port to multilib. * sysdeps/powerpc/powerpc32/multiarch/Makefile (sysdep_routines): Add memset and bzero implementations. diff --git a/sysdeps/powerpc/powerpc32/multiarch/Makefile b/sysdeps/powerpc/powerpc32/multiarch/Makefile index 28d74f172e..42c39b215e 100644 --- a/sysdeps/powerpc/powerpc32/multiarch/Makefile +++ b/sysdeps/powerpc/powerpc32/multiarch/Makefile @@ -1,5 +1,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 + bzero-power4 bzero-power6 bzero-power7 \ + strncmp-power7 strncmp-power4 endif diff --git a/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c b/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c index 42b372a4e2..e5c6354663 100644 --- a/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c +++ b/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c @@ -77,6 +77,13 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array, hwcap & (PPC_FEATURE_CELL_BE >> 16), __memcpy_cell) IFUNC_IMPL_ADD (array, i, memcpy, 1, __memcpy_ppc32)) + + IFUNC_IMPL (i, name, strncmp, + IFUNC_IMPL_ADD (array, i, strncmp, hwcap & PPC_FEATURE_HAS_VSX, + __strncmp_power7) + IFUNC_IMPL_ADD (array, i, strncmp, hwcap & PPC_POWER4, + __strncmp_power4) + IFUNC_IMPL_ADD (array, i, strncmp, 1, __strncmp_ppc32)) #endif return i; diff --git a/sysdeps/powerpc/powerpc32/power4/strncmp.S b/sysdeps/powerpc/powerpc32/multiarch/strncmp-power4.S index 724d9084a9..ffbd11e0b4 100644 --- a/sysdeps/powerpc/powerpc32/power4/strncmp.S +++ b/sysdeps/powerpc/powerpc32/multiarch/strncmp-power4.S @@ -22,7 +22,8 @@ /* int [r3] strncmp (const char *s1 [r3], const char *s2 [r4], size_t size [r5]) */ -EALIGN (strncmp, 4, 0) + .machine power4 +EALIGN (__strncmp_power4, 4, 0) #define rTMP r0 #define rRTN r3 @@ -166,5 +167,4 @@ L(u4): sub rRTN, rWORD1, rWORD2 L(ux): li rRTN, 0 blr -END (strncmp) -libc_hidden_builtin_def (strncmp) +END (__strncmp_power4) diff --git a/sysdeps/powerpc/powerpc32/power7/strncmp.S b/sysdeps/powerpc/powerpc32/multiarch/strncmp-power7.S index fdae44d265..c2cb8cdf8f 100644 --- a/sysdeps/powerpc/powerpc32/power7/strncmp.S +++ b/sysdeps/powerpc/powerpc32/multiarch/strncmp-power7.S @@ -24,7 +24,8 @@ const char *s2 [r4], size_t size [r5]) */ -EALIGN (strncmp,5,0) + .machine power7 +EALIGN (__strncmp_power7,5,0) #define rTMP r0 #define rRTN r3 @@ -170,5 +171,4 @@ L(u4): sub rRTN,rWORD1,rWORD2 L(ux): li rRTN,0 blr -END (strncmp) -libc_hidden_builtin_def (strncmp) +END (__strncmp_power7) diff --git a/sysdeps/powerpc/powerpc32/multiarch/strncmp.S b/sysdeps/powerpc/powerpc32/multiarch/strncmp.S new file mode 100644 index 0000000000..5e7e5b7dbc --- /dev/null +++ b/sysdeps/powerpc/powerpc32/multiarch/strncmp.S @@ -0,0 +1,92 @@ +/* Optimized strncmp 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(strncmp) + .type strncmp, @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) + andis. r7,r6,(PPC_FEATURE_POWER4>>16) + bne- L(power4) +# ifdef PIC + lwz r3,__strncmp_ppc32@got(r5) +# else + lis r3,__strncmp_ppc32@ha + lwz r3,__strncmp_ppc32@l(r3) +# endif + blr +L(power7): +# ifdef PIC + lwz r3,__strncmp_power7@got(r5) +# else + lis r3,__strncmp_power7@ha + lwz r3,__strncmp_power7@l(r3) +# endif + blr +L(power4): +# ifdef PIC + lwz r3,__strncmp_power4@got(r5) +# else + lis r3,__strncmp_power4@ha + lwz r3,__strncmp_power4@l(r3) +# endif + blr +END(strncmp) + +# undef EALIGN +# define EALIGN(name, alignt, words) \ + .globl C_SYMBOL_NAME(__strncmp_ppc32); \ + .type C_SYMBOL_NAME(__strncmp_ppc32),@function ; \ + .align ALIGNARG(alignt); \ + EALIGN_W_##words; \ + C_LABEL(__strncmp_ppc32) \ + cfi_startproc; + +# undef END +# define END(name) \ + cfi_endproc; \ + ASM_SIZE_DIRECTIVE(__strncmp_ppc32) + +# undef libc_hidden_builtin_def +# define libc_hidden_builtin_def(name) \ + .globl __GI_strncmp; __GI_strncmp = __strncmp_ppc32 + +#endif + +#include "../strncmp.S" |