diff options
author | Tulio Magno Quites Machado Filho <tuliom@linux.vnet.ibm.com> | 2013-03-07 14:46:08 -0300 |
---|---|---|
committer | Tulio Magno Quites Machado Filho <tuliom@linux.vnet.ibm.com> | 2013-03-07 14:46:08 -0300 |
commit | acacbda4c368576149800425fdd53905040762a5 (patch) | |
tree | c21f8a2973cceabb3039942b15d6014807005351 /sysdeps | |
parent | d929af5d898233d5115a35b1cb6048895645c8d0 (diff) | |
download | glibc-acacbda4c368576149800425fdd53905040762a5.tar.gz glibc-acacbda4c368576149800425fdd53905040762a5.tar.xz glibc-acacbda4c368576149800425fdd53905040762a5.zip |
PowerPC: Add 32-bit multilib implementation of memcmp
Move and rename specialized memcmp implementation to multilib folder and add IFUNC memcmp source.
Diffstat (limited to 'sysdeps')
-rw-r--r-- | sysdeps/powerpc/powerpc32/memcmp.S (renamed from sysdeps/powerpc/powerpc32/power4/memcmp.S) | 1 | ||||
-rw-r--r-- | sysdeps/powerpc/powerpc32/multiarch/Makefile | 3 | ||||
-rw-r--r-- | sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c | 5 | ||||
-rw-r--r-- | sysdeps/powerpc/powerpc32/multiarch/memcmp-power7.S (renamed from sysdeps/powerpc/powerpc32/power7/memcmp.S) | 5 | ||||
-rw-r--r-- | sysdeps/powerpc/powerpc32/multiarch/memcmp.S | 82 |
5 files changed, 91 insertions, 5 deletions
diff --git a/sysdeps/powerpc/powerpc32/power4/memcmp.S b/sysdeps/powerpc/powerpc32/memcmp.S index edec7ab274..f2850b025c 100644 --- a/sysdeps/powerpc/powerpc32/power4/memcmp.S +++ b/sysdeps/powerpc/powerpc32/memcmp.S @@ -20,7 +20,6 @@ /* int [r3] memcmp (const char *s1 [r3], const char *s2 [r4], size_t size [r5]) */ - .machine power4 EALIGN (memcmp, 4, 0) CALL_MCOUNT diff --git a/sysdeps/powerpc/powerpc32/multiarch/Makefile b/sysdeps/powerpc/powerpc32/multiarch/Makefile index 9c2789015a..fb0e53a393 100644 --- a/sysdeps/powerpc/powerpc32/multiarch/Makefile +++ b/sysdeps/powerpc/powerpc32/multiarch/Makefile @@ -1,3 +1,4 @@ ifeq ($(subdir),string) -sysdep_routines += memcpy-power7 memcpy-a2 memcpy-power6 memcpy-cell +sysdep_routines += memcpy-power7 memcpy-a2 memcpy-power6 memcpy-cell \ + memcmp-power7 endif diff --git a/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c b/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c index 2a23669f16..ca371beecd 100644 --- a/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c +++ b/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c @@ -38,6 +38,11 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array, hwcap = GLRO(dl_hwcap); #ifdef SHARED + IFUNC_IMPL (i, name, memcmp, + IFUNC_IMPL_ADD (array, i, memcmp, hwcap & PPC_FEATURE_HAS_VSX, + __memcmp_power7) + IFUNC_IMPL_ADD (array, i, memcmp, 1, __memcmp_ppc32)) + IFUNC_IMPL (i, name, memcpy, IFUNC_IMPL_ADD (array, i, memcpy, hwcap & PPC_FEATURE_HAS_VSX, __memcpy_power7) diff --git a/sysdeps/powerpc/powerpc32/power7/memcmp.S b/sysdeps/powerpc/powerpc32/multiarch/memcmp-power7.S index f764b7ce31..6f2c7f1e3f 100644 --- a/sysdeps/powerpc/powerpc32/power7/memcmp.S +++ b/sysdeps/powerpc/powerpc32/multiarch/memcmp-power7.S @@ -23,7 +23,7 @@ size_t size [r5]) */ .machine power7 -EALIGN (memcmp,4,0) +EALIGN (__memcmp_power7,4,0) CALL_MCOUNT #define rTMP r0 @@ -980,6 +980,5 @@ L(dureturn25): lwz r24,20(r1) lwz 1,0(1) blr -END (memcmp) -libc_hidden_builtin_def (memcmp) +END (__memcmp_power7) weak_alias (memcmp,bcmp) diff --git a/sysdeps/powerpc/powerpc32/multiarch/memcmp.S b/sysdeps/powerpc/powerpc32/multiarch/memcmp.S new file mode 100644 index 0000000000..09f8eb7242 --- /dev/null +++ b/sysdeps/powerpc/powerpc32/multiarch/memcmp.S @@ -0,0 +1,82 @@ +/* Optimized memcmp 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(memcmp) + .type memcmp, @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,__memcmp_ppc32@got(r5) +# else + lis r3,__memcmp_ppc32@ha + lwz r3,__memcmp_ppc32@l(r3) +# endif + blr +L(power7): +# ifdef PIC + lwz r3,__memcmp_power7@got(r5) +# else + lis r3,__memcmp_power7@ha + lwz r3,__memcmp_power7@l(r3) +# endif + blr +END(memcmp) + +# undef EALIGN +# define EALIGN(name, alignt, words) \ + .globl C_SYMBOL_NAME(__memcmp_ppc32); \ + .type C_SYMBOL_NAME(__memcmp_ppc32),@function ; \ + .align ALIGNARG(alignt); \ + EALIGN_W_##words; \ + C_LABEL(__memcmp_ppc32) \ + cfi_startproc; + +# undef END +# define END(name) \ + cfi_endproc; \ + ASM_SIZE_DIRECTIVE(__memcmp_ppc32) + +# undef libc_hidden_builtin_def +# define libc_hidden_builtin_def(name) \ + .globl __GI_memcmp; __GI_memcmp = __memcmp_ppc32 + +#endif + +#include "../memcmp.S" |