+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.
+ * sysdeps/powerpc/powerpc32/multiarch/memset.S: New file.
+ * sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c: Add bzero
+ and memset.
+ * sysdeps/powerpc/powerpc32/power4/memset.S: Moved to...
+ * sysdeps/powerpc/powerpc32/multiarch/memset-power4.S: ... here.
+ * sysdeps/powerpc/powerpc32/power6/memset.S: Moved to...
+ * sysdeps/powerpc/powerpc32/multiarch/memset-power6.S: ... here.
+ * sysdeps/powerpc/powerpc32/power7/memset.S: Moved to...
+ * sysdeps/powerpc/powerpc32/multiarch/memset-power7.S: ... here.
+ * sysdeps/powerpc/powerpc32/multiarch/bzero-power4.S: New file.
+ * sysdeps/powerpc/powerpc32/multiarch/bzero-power6.S: Likewise.
+ * sysdeps/powerpc/powerpc32/multiarch/bzero-power7.S: Likewise.
+
2013-03-07 Tulio Magno Quites Machado Filho <tuliom@linux.vnet.ibm.com>
* sysdeps/powerpc/powerpc32/multiarch/Makefile (sysdep_routines):
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
+/* Let other functions reuse the code of this file. */
+#ifdef BZERO
+# define __bzero BZERO
+#endif
+
#include <sysdep.h>
-ENTRY (__bzero)
+EALIGN (__bzero, 5, 0)
mr r5,r4
li r4,0
+#ifdef MEMSET_FCNT
+ b MEMSET_FCNT@local
+#else
b memset@local
+#endif
END (__bzero)
+
+#ifdef BZERO
+libc_hidden_builtin_def (__bzero)
+#else
+# ifndef MEMSET_FCNT
+/* When BZERO and MEMSET_FCTN aren't defined, it means that this is the
+ default definition of bzero. */
weak_alias (__bzero, bzero)
+# endif
+#endif
ifeq ($(subdir),string)
sysdep_routines += memcpy-power7 memcpy-a2 memcpy-power6 memcpy-cell \
- memcmp-power7
+ memcmp-power7 memset-power4 memset-power6 memset-power7 \
+ bzero-power4 bzero-power6 bzero-power7
endif
--- /dev/null
+/* Optimized bzero implementation for Power4 on 32 bits.
+ 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/>. */
+
+#define BZERO __bzero_power4
+#define MEMSET_FCNT __memset_power4
+
+#include "../bzero.S"
--- /dev/null
+/* Optimized bzero implementation for Power6 on 32 bits.
+ 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/>. */
+
+#define BZERO __bzero_power6
+#define MEMSET_FCNT __memset_power6
+
+#include "../bzero.S"
--- /dev/null
+/* Optimized bzero implementation for Power7 on 32 bits.
+ 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/>. */
+
+#define BZERO __bzero_power7
+#define MEMSET_FCNT __memset_power7
+
+#include "../bzero.S"
--- /dev/null
+/* Optimized bzero 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/>. */
+
+
+#define MEMSET bzero
+#define INTERNAL_MEMSET __bzero
+
+#include "memset.S"
+
+weak_alias (__bzero, bzero)
+
+#define MEMSET_FCNT __memset_ppc32
+#include "../bzero.S"
/* Maximum number of IFUNC implementations. */
#define MAX_IFUNC 5
+/* Some of the . */
+#define PPC_POWER4 (PPC_FEATURE_POWER4|PPC_FEATURE_ARCH_2_05| \
+ PPC_FEATURE_ARCH_2_06)
+#define PPC_POWER6 (PPC_FEATURE_ARCH_2_05|PPC_FEATURE_ARCH_2_06)
+
size_t
__libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
size_t max)
hwcap = GLRO(dl_hwcap);
+ IFUNC_IMPL (i, name, bzero,
+ IFUNC_IMPL_ADD (array, i, bzero, hwcap & PPC_FEATURE_HAS_VSX,
+ __bzero_power7)
+ IFUNC_IMPL_ADD (array, i, bzero, hwcap & PPC_POWER6,
+ __bzero_power6)
+ IFUNC_IMPL_ADD (array, i, bzero, hwcap & PPC_POWER4,
+ __bzero_power4)
+ IFUNC_IMPL_ADD (array, i, bzero, 1, __bzero_ppc32))
+
+ IFUNC_IMPL (i, name, memset,
+ IFUNC_IMPL_ADD (array, i, memset, hwcap & PPC_FEATURE_HAS_VSX,
+ __memset_power7)
+ IFUNC_IMPL_ADD (array, i, memset, hwcap & PPC_POWER6,
+ __memset_power6)
+ IFUNC_IMPL_ADD (array, i, memset, hwcap & PPC_POWER4,
+ __memset_power4)
+ IFUNC_IMPL_ADD (array, i, memset, 1, __memset_ppc32))
+
#ifdef SHARED
IFUNC_IMPL (i, name, memcmp,
IFUNC_IMPL_ADD (array, i, memcmp, hwcap & PPC_FEATURE_HAS_VSX,
__memcpy_power7)
IFUNC_IMPL_ADD (array, i, memcpy, hwcap & PPC_FEATURE_ARCH_2_06,
__memcpy_a2)
- IFUNC_IMPL_ADD (array, i, memcpy, hwcap & PPC_FEATURE_ARCH_2_05,
+ IFUNC_IMPL_ADD (array, i, memcpy, hwcap & PPC_POWER6,
__memcpy_power6)
IFUNC_IMPL_ADD (array, i, memcpy,
hwcap & (PPC_FEATURE_CELL_BE >> 16),
to 0, to take advantage of the dcbz instruction. */
.machine power4
-EALIGN (memset, 5, 0)
+EALIGN (__memset_power4, 5, 0)
CALL_MCOUNT
#define rTMP r0
stw rCHR, -4(rMEMP)
stw rCHR, -8(rMEMP)
blr
-END (memset)
-libc_hidden_builtin_def (memset)
+END (__memset_power4)
to 0, to take advantage of the dcbz instruction. */
.machine power6
-EALIGN (memset, 7, 0)
+EALIGN (__memset_power6, 7, 0)
CALL_MCOUNT
#define rTMP r0
stw rCHR, -4(rMEMP)
stw rCHR, -8(rMEMP)
blr
-END (memset)
-libc_hidden_builtin_def (memset)
+END (__memset_power6)
Returns 's'. */
.machine power7
-EALIGN (memset, 5, 0)
+EALIGN (__memset_power7, 5, 0)
CALL_MCOUNT
.align 4
stw 4,4(10)
blr
-END (memset)
-libc_hidden_builtin_def (memset)
+END (__memset_power7)
--- /dev/null
+/* Optimized memset 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/>. */
+
+/* Let other functions reuse the code of this file. */
+#ifdef MEMSET
+# define memset MEMSET
+#endif
+
+#ifndef INTERNAL_MEMSET
+# define INTERNAL_MEMSET memset
+#endif
+
+#define CONCAT(x, y) __ ## x ## _ ## y
+#define EVALUATE(x, y) CONCAT(x, y)
+#define OPTIM(NAME) EVALUATE(memset, NAME)
+
+#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(INTERNAL_MEMSET)
+ .type memset, @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)
+ andi. r7,r6,PPC_FEATURE_ARCH_2_05
+ bne- L(power6)
+ andis. r7,r6,(PPC_FEATURE_POWER4>>16)
+ bne- L(power4)
+# ifdef PIC
+ lwz r3,OPTIM(ppc32)@got(r5)
+# else
+ lis r3,OPTIM(ppc32)@ha
+ lwz r3,OPTIM(ppc32)@l(r3)
+# endif
+ blr
+L(power7):
+# ifdef PIC
+ lwz r3,OPTIM(power7)@got(r5)
+# else
+ lis r3,OPTIM(power7)@ha
+ lwz r3,OPTIM(power7)@l(r3)
+# endif
+ blr
+L(power6):
+# ifdef PIC
+ lwz r3,OPTIM(power6)@got(r5)
+# else
+ lis r3,OPTIM(power6)@ha
+ lwz r3,OPTIM(power6)@l(r3)
+# endif
+ blr
+L(power4):
+# ifdef PIC
+ lwz r3,OPTIM(power4)@got(r5)
+# else
+ lis r3,OPTIM(power4)@ha
+ lwz r3,OPTIM(power4)@l(r3)
+# endif
+ blr
+END(INTERNAL_MEMSET)
+
+# undef EALIGN
+# define EALIGN(name, alignt, words) \
+ .globl C_SYMBOL_NAME(OPTIM(ppc32)); \
+ .type C_SYMBOL_NAME(OPTIM(ppc32)),@function ; \
+ .align ALIGNARG(alignt); \
+ EALIGN_W_##words; \
+ C_LABEL(OPTIM(ppc32)) \
+ cfi_startproc;
+
+# undef END
+# define END(name) \
+ cfi_endproc; \
+ ASM_SIZE_DIRECTIVE(OPTIM(ppc32))
+
+# undef libc_hidden_builtin_def
+# define libc_hidden_builtin_def(name) \
+ .globl EVALUATE(GI, memset); EVALUATE(GI, memset) = OPTIM(ppc32)
+
+#endif
+
+#ifndef MEMSET
+# include "../memset.S"
+#endif