This is the mail archive of the glibc-cvs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

GNU C Library master sources branch tuliom/multilib created. glibc-2.17-367-ga2f7665


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, tuliom/multilib has been created
        at  a2f7665683ca5913883db08ee78dc9dd7bd6dda5 (commit)

- Log -----------------------------------------------------------------
http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=a2f7665683ca5913883db08ee78dc9dd7bd6dda5

commit a2f7665683ca5913883db08ee78dc9dd7bd6dda5
Author: Adhemerval Zanella <azanella@linux.vnet.ibm.com>
Date:   Mon Mar 11 17:29:43 2013 -0300

    PowerPC Add 64-bit multilib implementation of memcpy
    
    Move and rename specialized memcpy implementation to multilib folder and
    add IFUNC memcpy source.

diff --git a/ChangeLog b/ChangeLog
index d4cb678..098973b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,24 @@
+2013-03-07  Adhemerval Zanella  <azanella@linux.vnet.ibm.com>
+	    Tulio Magno Quites Machado Filho  <tuliom@linux.vnet.ibm.com>
+
+     * sysdeps/powerpc/powerpc64/a2/memcpy.S: Moved to multiarch folder.
+     * sysdeps/powerpc/powerpc64/cell/memcpy.S: Moved to multiarch folder.
+     * sysdeps/powerpc/powerpc64/power4/memcpy.S: Moved to multiarch folder.
+     * sysdeps/powerpc/powerpc64/power6/memcpy.S: Moved to multiarch folder.
+     * sysdeps/powerpc/powerpc64/power7/memcpy.S: Moved to multiarch folder.
+     * sysdeps/powerpc/powerpc64/multiarch/Makefile: Multiarch makefile.
+     * sysdeps/powerpc/powerpc64/multiarch/memcpy-a2.S: Moved from a2 folder.
+     * sysdeps/powerpc/powerpc64/multiarch/memcpy-cell.S: Moved from cell
+     folder.
+     * sysdeps/powerpc/powerpc64/multiarch/memcpy-power4.S: Moved from power4
+     folder.
+     * sysdeps/powerpc/powerpc64/multiarch/memcpy-power6.S: Moved from power6
+     folder.
+     * sysdeps/powerpc/powerpc64/multiarch/memcpy-power7.S: Moved from power7
+     folder.
+     * sysdeps/powerpc/powerpc64/multiarch/memcpy.S: Multiarch implementation
+     using IFUNC extension.
+
 2013-03-07  Tulio Magno Quites Machado Filho  <tuliom@linux.vnet.ibm.com>
 
 	* sysdeps/powerpc/powerpc32/multiarch/Makefile (sysdep_routines):
diff --git a/sysdeps/powerpc/powerpc64/multiarch/Makefile b/sysdeps/powerpc/powerpc64/multiarch/Makefile
new file mode 100644
index 0000000..5ba03ca
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/multiarch/Makefile
@@ -0,0 +1,4 @@
+ifeq ($(subdir),string)
+sysdep_routines += memcpy-a2 memcpy-cell memcpy-power4 memcpy-power6 \
+		   memcpy-power7
+endif
diff --git a/sysdeps/powerpc/powerpc64/multiarch/ifunc-impl-list.c b/sysdeps/powerpc/powerpc64/multiarch/ifunc-impl-list.c
new file mode 100644
index 0000000..760f46c
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/multiarch/ifunc-impl-list.c
@@ -0,0 +1,62 @@
+/* Enumerate available IFUNC implementations of a function.  PowerPC32 version.
+   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 <assert.h>
+#include <string.h>
+#include <wchar.h>
+#include <ldsodefs.h>
+#include <ifunc-impl-list.h>
+
+/* 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)
+{
+  assert (max >= MAX_IFUNC);
+
+  size_t i = 0;
+
+  uint32_t hwcap;
+
+  hwcap = GLRO(dl_hwcap);
+
+#ifdef SHARED
+  IFUNC_IMPL (i, name, memcpy,
+	      IFUNC_IMPL_ADD (array, i, memcpy, hwcap & PPC_FEATURE_HAS_VSX,
+			      __memcpy_power7)
+	      IFUNC_IMPL_ADD (array, i, memcpy, hwcap & PPC_FEATURE_ARCH_2_06,
+			      __memcpy_power_a2)
+	      IFUNC_IMPL_ADD (array, i, memcpy, hwcap & PPC_POWER6,
+			      __memcpy_power6)
+	      IFUNC_IMPL_ADD (array, i, memcpy,
+			      hwcap & (PPC_FEATURE_CELL_BE >> 16),
+			      __memcpy_cell)
+	      IFUNC_IMPL_ADD (array, i, memcpy, hwcap & PPC_POWER4,
+			      __memcpy_power4)
+	      IFUNC_IMPL_ADD (array, i, memcpy, 1, __memcpy_ppc64))
+#endif
+
+  return i;
+}
diff --git a/sysdeps/powerpc/powerpc64/a2/memcpy.S b/sysdeps/powerpc/powerpc64/multiarch/memcpy-a2.S
similarity index 99%
rename from sysdeps/powerpc/powerpc64/a2/memcpy.S
rename to sysdeps/powerpc/powerpc64/multiarch/memcpy-a2.S
index 84c82bb..a2834f3 100644
--- a/sysdeps/powerpc/powerpc64/a2/memcpy.S
+++ b/sysdeps/powerpc/powerpc64/multiarch/memcpy-a2.S
@@ -30,7 +30,7 @@
 
 
 	.machine  a2
-EALIGN (memcpy, 5, 0)
+EALIGN (__memcpy_power_a2, 5, 0)
 	CALL_MCOUNT 3
 
 	dcbt    0,r4            /* Prefetch ONE SRC cacheline  */
@@ -520,5 +520,4 @@ L(endloop2_128):
 	b       L(lessthancacheline)
 
 
-END_GEN_TB (memcpy,TB_TOCLESS)
-libc_hidden_builtin_def (memcpy)
+END_GEN_TB (__memcpy_power_a2,TB_TOCLESS)
diff --git a/sysdeps/powerpc/powerpc64/cell/memcpy.S b/sysdeps/powerpc/powerpc64/multiarch/memcpy-cell.S
similarity index 98%
rename from sysdeps/powerpc/powerpc64/cell/memcpy.S
rename to sysdeps/powerpc/powerpc64/multiarch/memcpy-cell.S
index a271965..c8dd87f 100644
--- a/sysdeps/powerpc/powerpc64/cell/memcpy.S
+++ b/sysdeps/powerpc/powerpc64/multiarch/memcpy-cell.S
@@ -39,7 +39,7 @@
 
 .align  7
 
-EALIGN (memcpy, 5, 0)
+EALIGN (__memcpy_cell, 5, 0)
 	CALL_MCOUNT 3
 
 	dcbt	0,r4		/* Prefetch ONE SRC cacheline  */
@@ -238,5 +238,4 @@ EALIGN (memcpy, 5, 0)
 	stb	r0,0(r6)
 1:	blr
 
-END_GEN_TB (memcpy,TB_TOCLESS)
-libc_hidden_builtin_def (memcpy)
+END_GEN_TB (__memcpy_cell,TB_TOCLESS)
diff --git a/sysdeps/powerpc/powerpc64/power4/memcpy.S b/sysdeps/powerpc/powerpc64/multiarch/memcpy-power4.S
similarity index 98%
rename from sysdeps/powerpc/powerpc64/power4/memcpy.S
rename to sysdeps/powerpc/powerpc64/multiarch/memcpy-power4.S
index c43d1d2..cd167e2 100644
--- a/sysdeps/powerpc/powerpc64/power4/memcpy.S
+++ b/sysdeps/powerpc/powerpc64/multiarch/memcpy-power4.S
@@ -34,7 +34,7 @@
    Each case has a optimized unrolled loop.   */
 
 	.machine power4
-EALIGN (memcpy, 5, 0)
+EALIGN (__memcpy_power4, 5, 0)
 	CALL_MCOUNT 3
 
     cmpldi cr1,5,31
@@ -93,7 +93,7 @@ EALIGN (memcpy, 5, 0)
 
   /* Move doublewords where destination and source are DW aligned.
      Use a unrolled loop to copy 4 doubleword (32-bytes) per iteration.
-     If the copy is not an exact multiple of 32 bytes, 1-3
+     If the copy is not an exact multiple of 32 bytes, 1-3 
      doublewords are copied as needed to set up the main loop.  After
      the main loop exits there may be a tail of 1-7 bytes. These byte are 
      copied a word/halfword/byte at a time as needed to preserve alignment.  */
@@ -411,5 +411,4 @@ EALIGN (memcpy, 5, 0)
     ld 31,-8(1)
     ld 3,-16(1)
     blr
-END_GEN_TB (memcpy,TB_TOCLESS)
-libc_hidden_builtin_def (memcpy)
+END_GEN_TB (__memcpy_power4,TB_TOCLESS)
diff --git a/sysdeps/powerpc/powerpc64/power6/memcpy.S b/sysdeps/powerpc/powerpc64/multiarch/memcpy-power6.S
similarity index 99%
rename from sysdeps/powerpc/powerpc64/power6/memcpy.S
rename to sysdeps/powerpc/powerpc64/multiarch/memcpy-power6.S
index 55c0d71..e0eba0a 100644
--- a/sysdeps/powerpc/powerpc64/power6/memcpy.S
+++ b/sysdeps/powerpc/powerpc64/multiarch/memcpy-power6.S
@@ -41,7 +41,7 @@
    for the destination.  */
 
 	.machine	"power6"
-EALIGN (memcpy, 7, 0)
+EALIGN (__memcpy_power6, 7, 0)
 	CALL_MCOUNT 3
 
     cmpldi cr1,5,31
@@ -1163,5 +1163,4 @@ L(du_done):
     ld 31,-8(1)
     ld 3,-16(1)
     blr
-END_GEN_TB (memcpy,TB_TOCLESS)
-libc_hidden_builtin_def (memcpy)
+END_GEN_TB (__memcpy_power6,TB_TOCLESS)
diff --git a/sysdeps/powerpc/powerpc64/power7/memcpy.S b/sysdeps/powerpc/powerpc64/multiarch/memcpy-power7.S
similarity index 99%
rename from sysdeps/powerpc/powerpc64/power7/memcpy.S
rename to sysdeps/powerpc/powerpc64/multiarch/memcpy-power7.S
index 800a9f1..e6ee4e2 100644
--- a/sysdeps/powerpc/powerpc64/power7/memcpy.S
+++ b/sysdeps/powerpc/powerpc64/multiarch/memcpy-power7.S
@@ -24,7 +24,7 @@
    Returns 'dst'.  */
 
 	.machine power7
-EALIGN (memcpy, 5, 0)
+EALIGN (__memcpy_power7, 5, 0)
 	CALL_MCOUNT 3
 
 	cmpldi  cr1,5,31
@@ -500,5 +500,4 @@ L(end_unaligned_loop):
 	ld	3,-16(1)
 	blr
 
-END_GEN_TB (memcpy,TB_TOCLESS)
-libc_hidden_builtin_def (memcpy)
+END_GEN_TB (__memcpy_power7,TB_TOCLESS)
diff --git a/sysdeps/powerpc/powerpc64/multiarch/memcpy.S b/sysdeps/powerpc/powerpc64/multiarch/memcpy.S
new file mode 100644
index 0000000..92c2e2a
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/multiarch/memcpy.S
@@ -0,0 +1,92 @@
+/* Multiple versions of memcpy PowerPC64.
+   Copyright (C) 2012-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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <sysdep.h>
+#include <rtld-global-offsets.h>
+
+/* Define multiple versions only for the definition in lib and for
+   DSO.  In static binaries we need memcpy before the initialization
+   happened.  */
+#if defined SHARED && !defined NOT_IN_libc
+	.section	".toc","aw"
+.LC__dl_hwcap:
+# ifdef SHARED
+	.tc _rtld_global_ro[TC],_rtld_global_ro
+# else
+	.tc _dl_hwcap[TC],_dl_hwcap
+# endif
+	.section ".text"
+
+ENTRY(memcpy)
+	.type   memcpy, @gnu_indirect_function
+	ld	r5,.LC__dl_hwcap@toc(r2)
+# ifdef SHARED
+	/* Load _rtld-global._dl_hwcap. */
+	ld	r5,RTLD_GLOBAL_RO_DL_HWCAP_OFFSET(r5)
+# else
+	ld	r5,0(r5) /* Load extern _dl_hwcap. */
+# endif
+	rldicl.	r0,r5,57,63
+	bne- L(power7)
+	rldicl. r0,r5,56,63
+	bne- L(powerA2)
+	rldicl.	r0,r5,52,63
+	bne- L(power6)
+	rldicl.	r0,r5,48,63
+	bne- L(powercell)
+	rldicl. r0,r5,45,63
+	bne- L(power4)
+	ld	r3,__memcpy_ppc64@got(r2)
+	blr
+L(power7):
+	ld	r3,__memcpy_power7@got(r2)
+	blr
+L(powerA2):
+	ld	r3,__memcpy_power_a2@got(r2)
+	blr
+L(power6):
+	ld	r3,__memcpy_power6@got(r2)
+	blr
+L(powercell):
+	ld	r3,__memcpy_cell@got(r2)
+	blr
+L(power4):
+	ld	r3,__memcpy_power4@got(r2)
+	blr
+END(memcpy)
+
+# undef EALIGN
+# define EALIGN(name, alignt, words)                  \
+  ENTRY_2(__memcpy_ppc64)                             \
+BODY_LABEL(__memcpy_ppc64):                           \
+  cfi_startproc;
+
+# undef END_GEN_TB
+# define END_GEN_TB(name, mask)                       \
+  cfi_endproc;                                        \
+  TRACEBACK_MASK(__memcpy_ppc64,mask)                 \
+  END_2(__memcpy_ppc64)
+
+# undef libc_hidden_builtin_def
+# define libc_hidden_builtin_def(name)                \
+  .globl __GI_memcpy; __GI_memcpy = __memcpy_ppc64
+
+#endif
+
+#include "../memcpy.S"

http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=ca7a6adf22bfc375452aba1f0606b97e89659edc

commit ca7a6adf22bfc375452aba1f0606b97e89659edc
Author: Tulio Magno Quites Machado Filho <tuliom@linux.vnet.ibm.com>
Date:   Thu Mar 7 16:18:29 2013 -0300

    PowerPC: Add 32-bit multilib implementation of strlen
    
    Move and rename specialized strlen implementation to multilib folder and
    add IFUNC strlen source.

diff --git a/ChangeLog b/ChangeLog
index d441895..d4cb678 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 42c39b2..4d935fe 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 e5c6354..aae8d99 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
similarity index 98%
rename from sysdeps/powerpc/powerpc32/power7/strlen.S
rename to sysdeps/powerpc/powerpc32/multiarch/strlen-power7.S
index b71a10f..0a5ed8d 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 0000000..13cf8cd
--- /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 9a6eafc..58b875f 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 */

http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=f57a67e2c6d445d4ab0df34a523e8951192ea536

commit f57a67e2c6d445d4ab0df34a523e8951192ea536
Author: Tulio Magno Quites Machado Filho <tuliom@linux.vnet.ibm.com>
Date:   Thu Mar 7 16:14:19 2013 -0300

    PowerPC: Add 32-bit multilib implementation of strncmp
    
    Move and rename specialized strncmp implementation to multilib folder and
    add IFUNC strncmp source.

diff --git a/ChangeLog b/ChangeLog
index 7969bc2..d441895 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 28d74f1..42c39b2 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 42b372a..e5c6354 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
similarity index 98%
rename from sysdeps/powerpc/powerpc32/power4/strncmp.S
rename to sysdeps/powerpc/powerpc32/multiarch/strncmp-power4.S
index 724d908..ffbd11e 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
similarity index 98%
rename from sysdeps/powerpc/powerpc32/power7/strncmp.S
rename to sysdeps/powerpc/powerpc32/multiarch/strncmp-power7.S
index fdae44d..c2cb8cd 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 0000000..5e7e5b7
--- /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"

http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=380bf3efccb6c4bad2d75546b68e950b2381ae33

commit 380bf3efccb6c4bad2d75546b68e950b2381ae33
Author: Tulio Magno Quites Machado Filho <tuliom@linux.vnet.ibm.com>
Date:   Thu Mar 7 17:30:58 2013 -0300

    PowerPC: Add 32-bit multilib implementation of memset and bzero
    
    Move and rename specialized memset implementation to multilib folder and
    add IFUNC memset and bzero sources.

diff --git a/ChangeLog b/ChangeLog
index e09de03..7969bc2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,23 @@
 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):
 	Add memcmp-power7. 
 	* sysdeps/powerpc/powerpc32/multiarch/memcmp.S: Newfile.
diff --git a/sysdeps/powerpc/powerpc32/bzero.S b/sysdeps/powerpc/powerpc32/bzero.S
index b569924..642d046 100644
--- a/sysdeps/powerpc/powerpc32/bzero.S
+++ b/sysdeps/powerpc/powerpc32/bzero.S
@@ -16,12 +16,30 @@
    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
diff --git a/sysdeps/powerpc/powerpc32/multiarch/Makefile b/sysdeps/powerpc/powerpc32/multiarch/Makefile
index fb0e53a..28d74f1 100644
--- a/sysdeps/powerpc/powerpc32/multiarch/Makefile
+++ b/sysdeps/powerpc/powerpc32/multiarch/Makefile
@@ -1,4 +1,5 @@
 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
diff --git a/sysdeps/powerpc/powerpc32/bzero.S b/sysdeps/powerpc/powerpc32/multiarch/bzero-power4.S
similarity index 76%
copy from sysdeps/powerpc/powerpc32/bzero.S
copy to sysdeps/powerpc/powerpc32/multiarch/bzero-power4.S
index b569924..7b25c77 100644
--- a/sysdeps/powerpc/powerpc32/bzero.S
+++ b/sysdeps/powerpc/powerpc32/multiarch/bzero-power4.S
@@ -1,5 +1,5 @@
-/* Optimized bzero `implementation' for PowerPC.
-   Copyright (C) 1997-2013 Free Software Foundation, Inc.
+/* 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
@@ -16,12 +16,7 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-#include <sysdep.h>
+#define BZERO __bzero_power4
+#define MEMSET_FCNT __memset_power4
 
-ENTRY (__bzero)
-
-	mr	r5,r4
-	li	r4,0
-	b	memset@local
-END (__bzero)
-weak_alias (__bzero, bzero)
+#include "../bzero.S"
diff --git a/sysdeps/powerpc/powerpc32/bzero.S b/sysdeps/powerpc/powerpc32/multiarch/bzero-power6.S
similarity index 76%
copy from sysdeps/powerpc/powerpc32/bzero.S
copy to sysdeps/powerpc/powerpc32/multiarch/bzero-power6.S
index b569924..b9ac6ae 100644
--- a/sysdeps/powerpc/powerpc32/bzero.S
+++ b/sysdeps/powerpc/powerpc32/multiarch/bzero-power6.S
@@ -1,5 +1,5 @@
-/* Optimized bzero `implementation' for PowerPC.
-   Copyright (C) 1997-2013 Free Software Foundation, Inc.
+/* 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
@@ -16,12 +16,7 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-#include <sysdep.h>
+#define BZERO __bzero_power6
+#define MEMSET_FCNT __memset_power6
 
-ENTRY (__bzero)
-
-	mr	r5,r4
-	li	r4,0
-	b	memset@local
-END (__bzero)
-weak_alias (__bzero, bzero)
+#include "../bzero.S"
diff --git a/sysdeps/powerpc/powerpc32/bzero.S b/sysdeps/powerpc/powerpc32/multiarch/bzero-power7.S
similarity index 76%
copy from sysdeps/powerpc/powerpc32/bzero.S
copy to sysdeps/powerpc/powerpc32/multiarch/bzero-power7.S
index b569924..b41d60c 100644
--- a/sysdeps/powerpc/powerpc32/bzero.S
+++ b/sysdeps/powerpc/powerpc32/multiarch/bzero-power7.S
@@ -1,5 +1,5 @@
-/* Optimized bzero `implementation' for PowerPC.
-   Copyright (C) 1997-2013 Free Software Foundation, Inc.
+/* 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
@@ -16,12 +16,7 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-#include <sysdep.h>
+#define BZERO __bzero_power7
+#define MEMSET_FCNT __memset_power7
 
-ENTRY (__bzero)
-
-	mr	r5,r4
-	li	r4,0
-	b	memset@local
-END (__bzero)
-weak_alias (__bzero, bzero)
+#include "../bzero.S"
diff --git a/sysdeps/powerpc/powerpc32/bzero.S b/sysdeps/powerpc/powerpc32/multiarch/bzero.S
similarity index 76%
copy from sysdeps/powerpc/powerpc32/bzero.S
copy to sysdeps/powerpc/powerpc32/multiarch/bzero.S
index b569924..51dbec3 100644
--- a/sysdeps/powerpc/powerpc32/bzero.S
+++ b/sysdeps/powerpc/powerpc32/multiarch/bzero.S
@@ -1,5 +1,5 @@
-/* Optimized bzero `implementation' for PowerPC.
-   Copyright (C) 1997-2013 Free Software Foundation, Inc.
+/* 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
@@ -16,12 +16,13 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-#include <sysdep.h>
 
-ENTRY (__bzero)
+#define MEMSET bzero
+#define INTERNAL_MEMSET __bzero
+
+#include "memset.S"
 
-	mr	r5,r4
-	li	r4,0
-	b	memset@local
-END (__bzero)
 weak_alias (__bzero, bzero)
+
+#define MEMSET_FCNT __memset_ppc32
+#include "../bzero.S"
diff --git a/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c b/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c
index ca371be..42b372a 100644
--- a/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c
+++ b/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c
@@ -25,6 +25,11 @@
 /* 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)
@@ -37,6 +42,24 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
 
   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,
@@ -48,7 +71,7 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
 			      __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),
diff --git a/sysdeps/powerpc/powerpc32/power4/memset.S b/sysdeps/powerpc/powerpc32/multiarch/memset-power4.S
similarity index 98%
rename from sysdeps/powerpc/powerpc32/power4/memset.S
rename to sysdeps/powerpc/powerpc32/multiarch/memset-power4.S
index 1e8785c..6a46e9d 100644
--- a/sysdeps/powerpc/powerpc32/power4/memset.S
+++ b/sysdeps/powerpc/powerpc32/multiarch/memset-power4.S
@@ -26,7 +26,7 @@
    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
@@ -222,5 +222,4 @@ L(medium_28t):
         stw     rCHR, -4(rMEMP)
 	stw	rCHR, -8(rMEMP)
 	blr
-END (memset)
-libc_hidden_builtin_def (memset)
+END (__memset_power4)
diff --git a/sysdeps/powerpc/powerpc32/power6/memset.S b/sysdeps/powerpc/powerpc32/multiarch/memset-power6.S
similarity index 99%
rename from sysdeps/powerpc/powerpc32/power6/memset.S
rename to sysdeps/powerpc/powerpc32/multiarch/memset-power6.S
index ce06630..493c1ef 100644
--- a/sysdeps/powerpc/powerpc32/power6/memset.S
+++ b/sysdeps/powerpc/powerpc32/multiarch/memset-power6.S
@@ -26,7 +26,7 @@
    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
@@ -535,5 +535,4 @@ L(medium_28t):
         stw     rCHR, -4(rMEMP)
 	stw	rCHR, -8(rMEMP)
 	blr
-END (memset)
-libc_hidden_builtin_def (memset)
+END (__memset_power6)
diff --git a/sysdeps/powerpc/powerpc32/power7/memset.S b/sysdeps/powerpc/powerpc32/multiarch/memset-power7.S
similarity index 99%
rename from sysdeps/powerpc/powerpc32/power7/memset.S
rename to sysdeps/powerpc/powerpc32/multiarch/memset-power7.S
index 360ea71..baa741c 100644
--- a/sysdeps/powerpc/powerpc32/power7/memset.S
+++ b/sysdeps/powerpc/powerpc32/multiarch/memset-power7.S
@@ -23,7 +23,7 @@
    Returns 's'.  */
 
 	.machine  power7
-EALIGN (memset, 5, 0)
+EALIGN (__memset_power7, 5, 0)
 	CALL_MCOUNT
 
 	.align	4
@@ -427,5 +427,4 @@ L(small):
 	stw	4,4(10)
 	blr
 
-END (memset)
-libc_hidden_builtin_def (memset)
+END (__memset_power7)
diff --git a/sysdeps/powerpc/powerpc32/multiarch/memset.S b/sysdeps/powerpc/powerpc32/multiarch/memset.S
new file mode 100644
index 0000000..bc95595
--- /dev/null
+++ b/sysdeps/powerpc/powerpc32/multiarch/memset.S
@@ -0,0 +1,117 @@
+/* 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

http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=acacbda4c368576149800425fdd53905040762a5

commit acacbda4c368576149800425fdd53905040762a5
Author: Tulio Magno Quites Machado Filho <tuliom@linux.vnet.ibm.com>
Date:   Thu Mar 7 14:46:08 2013 -0300

    PowerPC: Add 32-bit multilib implementation of memcmp
    
    Move and rename specialized memcmp implementation to multilib folder and
    add IFUNC memcmp source.

diff --git a/ChangeLog b/ChangeLog
index 7483f90..e09de03 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2013-03-07  Tulio Magno Quites Machado Filho  <tuliom@linux.vnet.ibm.com>
+
+	* sysdeps/powerpc/powerpc32/multiarch/Makefile (sysdep_routines):
+	Add memcmp-power7. 
+	* sysdeps/powerpc/powerpc32/multiarch/memcmp.S: Newfile.
+	* sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c: Add memcmp.
+	* sysdeps/powerpc/powerpc32/power4/memcmp.S: Moved to...
+	* sysdeps/powerpc/powerpc32/memcmp.S: ... here.
+	* sysdeps/powerpc/powerpc32/power7/memcmp.S: Moved to...
+	* sysdeps/powerpc/powerpc32/multiarch/memcmp-power7.S: ... here.
+
 2013-03-07  Adhemerval Zanella  <azanella@linux.vnet.ibm.com>
 	    Tulio Magno Quites Machado Filho  <tuliom@linux.vnet.ibm.com>
 
diff --git a/sysdeps/powerpc/powerpc32/power4/memcmp.S b/sysdeps/powerpc/powerpc32/memcmp.S
similarity index 99%
rename from sysdeps/powerpc/powerpc32/power4/memcmp.S
rename to sysdeps/powerpc/powerpc32/memcmp.S
index edec7ab..f2850b0 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 9c27890..fb0e53a 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 2a23669..ca371be 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
similarity index 99%
rename from sysdeps/powerpc/powerpc32/power7/memcmp.S
rename to sysdeps/powerpc/powerpc32/multiarch/memcmp-power7.S
index f764b7c..6f2c7f1 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 0000000..09f8eb7
--- /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"

http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=d929af5d898233d5115a35b1cb6048895645c8d0

commit d929af5d898233d5115a35b1cb6048895645c8d0
Author: Adhemerval Zanella <azanella@linux.vnet.ibm.com>
Date:   Thu Mar 7 14:37:13 2013 -0300

    PowerPC: Add 32-bit multilib implementation of memcpy
    
    Move and rename specialized memcpy implementation to multilib folder and
    add IFUNC memcpy source.

diff --git a/ChangeLog b/ChangeLog
index 4f08ec6..7483f90 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2013-03-07  Adhemerval Zanella  <azanella@linux.vnet.ibm.com>
+	    Tulio Magno Quites Machado Filho  <tuliom@linux.vnet.ibm.com>
+
+	* sysdeps/powerpc/powerpc32/multiarch/Makefile: New file.
+	* sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c: Likewise.
+	* sysdeps/powerpc/powerpc32/multiarch/memcpy.S: Likewise.
+	* sysdeps/powerpc/powerpc32/a2/memcpy.S: Moved to...
+	* sysdeps/powerpc/powerpc32/multiarch/memcpy-a2.S: ... here.
+	* sysdeps/powerpc/powerpc32/cell/memcpy.S: Moved to...
+	* sysdeps/powerpc/powerpc32/multiarch/memcpy-cell.S: ... here.
+	* sysdeps/powerpc/powerpc32/power4/memcpy.S: Moved to...
+	* sysdeps/powerpc/powerpc32/memcpy.S: ... here.
+	* sysdeps/powerpc/powerpc32/power6/memcpy.S: Moved to...
+	* sysdeps/powerpc/powerpc32/multiarch/memcpy-power6.S: ... here.
+	* sysdeps/powerpc/powerpc32/power7/memcpy.S: Moved to...
+	* sysdeps/powerpc/powerpc32/multiarch/memcpy-power7.S: ... here.
+
 2013-03-07  Andreas Jaeger  <aj@suse.de>
 
 	* sysdeps/unix/sysv/linux/Makefile (sysdep_headers): Add
diff --git a/sysdeps/powerpc/powerpc32/power4/memcpy.S b/sysdeps/powerpc/powerpc32/memcpy.S
similarity index 100%
rename from sysdeps/powerpc/powerpc32/power4/memcpy.S
rename to sysdeps/powerpc/powerpc32/memcpy.S
diff --git a/sysdeps/powerpc/powerpc32/multiarch/Makefile b/sysdeps/powerpc/powerpc32/multiarch/Makefile
new file mode 100644
index 0000000..9c27890
--- /dev/null
+++ b/sysdeps/powerpc/powerpc32/multiarch/Makefile
@@ -0,0 +1,3 @@
+ifeq ($(subdir),string)
+sysdep_routines += memcpy-power7 memcpy-a2 memcpy-power6 memcpy-cell
+endif
diff --git a/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c b/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c
new file mode 100644
index 0000000..2a23669
--- /dev/null
+++ b/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c
@@ -0,0 +1,55 @@
+/* Enumerate available IFUNC implementations of a function.  PowerPC32 version.
+   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 <assert.h>
+#include <string.h>
+#include <wchar.h>
+#include <ldsodefs.h>
+#include <ifunc-impl-list.h>
+
+/* Maximum number of IFUNC implementations.  */
+#define MAX_IFUNC	5
+
+size_t
+__libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
+			size_t max)
+{
+  assert (max >= MAX_IFUNC);
+
+  size_t i = 0;
+
+  uint32_t hwcap;
+
+  hwcap = GLRO(dl_hwcap);
+
+#ifdef SHARED
+  IFUNC_IMPL (i, name, memcpy,
+	      IFUNC_IMPL_ADD (array, i, memcpy, 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,
+			      __memcpy_power6)
+	      IFUNC_IMPL_ADD (array, i, memcpy,
+			      hwcap & (PPC_FEATURE_CELL_BE >> 16),
+			      __memcpy_cell)
+	      IFUNC_IMPL_ADD (array, i, memcpy, 1, __memcpy_ppc32))
+#endif
+
+  return i;
+}
diff --git a/sysdeps/powerpc/powerpc32/a2/memcpy.S b/sysdeps/powerpc/powerpc32/multiarch/memcpy-a2.S
similarity index 99%
rename from sysdeps/powerpc/powerpc32/a2/memcpy.S
rename to sysdeps/powerpc/powerpc32/multiarch/memcpy-a2.S
index f2f63b1..67e0f1b 100644
--- a/sysdeps/powerpc/powerpc32/a2/memcpy.S
+++ b/sysdeps/powerpc/powerpc32/multiarch/memcpy-a2.S
@@ -23,7 +23,7 @@
 #define ZERO_AHEAD 2            /* no cache lines DST zeroing ahead  */
 
 	.machine  a2
-EALIGN (memcpy, 5, 0)
+EALIGN (__memcpy_a2, 5, 0)
 	CALL_MCOUNT
 
 	dcbt    0,r4            /* Prefetch ONE SRC cacheline  */
@@ -523,5 +523,4 @@ L(endloop2_128):
 	b       L(lessthancacheline)
 
 
-END (memcpy)
-libc_hidden_builtin_def (memcpy)
+END (__memcpy_a2)
diff --git a/sysdeps/powerpc/powerpc32/cell/memcpy.S b/sysdeps/powerpc/powerpc32/multiarch/memcpy-cell.S
similarity index 98%
rename from sysdeps/powerpc/powerpc32/cell/memcpy.S
rename to sysdeps/powerpc/powerpc32/multiarch/memcpy-cell.S
index f3605d7..8b0bf40 100644
--- a/sysdeps/powerpc/powerpc32/cell/memcpy.S
+++ b/sysdeps/powerpc/powerpc32/multiarch/memcpy-cell.S
@@ -39,7 +39,7 @@
 
 .align  7
 
-EALIGN (memcpy, 5, 0)
+EALIGN (__memcpy_cell, 5, 0)
 	CALL_MCOUNT
 
 	dcbt	0,r4		/* Prefetch ONE SRC cacheline  */
@@ -238,5 +238,4 @@ EALIGN (memcpy, 5, 0)
 	stb	r0,0(r6)
 1:	blr
 
-END (memcpy)
-libc_hidden_builtin_def (memcpy)
+END (__memcpy_cell)
diff --git a/sysdeps/powerpc/powerpc32/power6/memcpy.S b/sysdeps/powerpc/powerpc32/multiarch/memcpy-power6.S
similarity index 99%
rename from sysdeps/powerpc/powerpc32/power6/memcpy.S
rename to sysdeps/powerpc/powerpc32/multiarch/memcpy-power6.S
index d900028..4e39046 100644
--- a/sysdeps/powerpc/powerpc32/power6/memcpy.S
+++ b/sysdeps/powerpc/powerpc32/multiarch/memcpy-power6.S
@@ -21,7 +21,7 @@
 /* __ptr_t [r3] memcpy (__ptr_t dst [r3], __ptr_t src [r4], size_t len [r5]);
    Returns 'dst'.
 
-   Memcpy handles short copies (< 32-bytes) using a binary move blocks 
+   Memcpy handles short copies (< 32-bytes) using a binary move blocks
    (no loops) of lwz/stw.  The tail (remaining 1-3) bytes is handled
    with the appropriate combination of byte and halfword load/stores.
    There is minimal effort to optimize the alignment of short moves.
@@ -32,7 +32,7 @@
    Each case has an optimized unrolled loop.   */
 
 	.machine power6
-EALIGN (memcpy, 5, 0)
+EALIGN (__memcpy_power6, 5, 0)
 	CALL_MCOUNT
 
     stwu   1,-32(1)
@@ -835,6 +835,4 @@ L(wdus_0):
     lwz  31,24(1)
     addi 1,1,32
     blr
-END (memcpy)
-
-libc_hidden_builtin_def (memcpy)
+END (__memcpy_power6)
diff --git a/sysdeps/powerpc/powerpc32/power7/memcpy.S b/sysdeps/powerpc/powerpc32/multiarch/memcpy-power7.S
similarity index 99%
rename from sysdeps/powerpc/powerpc32/power7/memcpy.S
rename to sysdeps/powerpc/powerpc32/multiarch/memcpy-power7.S
index 7f00778..00e9fd7 100644
--- a/sysdeps/powerpc/powerpc32/power7/memcpy.S
+++ b/sysdeps/powerpc/powerpc32/multiarch/memcpy-power7.S
@@ -23,7 +23,7 @@
    Returns 'dst'.  */
 
 	.machine  power7
-EALIGN (memcpy, 5, 0)
+EALIGN (__memcpy_power7, 5, 0)
 	CALL_MCOUNT
 
 	stwu    1,-32(1)
@@ -520,5 +520,4 @@ L(end_unaligned_loop):
 	addi    1,1,32
 	blr
 
-END (memcpy)
-libc_hidden_builtin_def (memcpy)
+END (__memcpy_power7)
diff --git a/sysdeps/powerpc/powerpc32/multiarch/memcpy.S b/sysdeps/powerpc/powerpc32/multiarch/memcpy.S
new file mode 100644
index 0000000..7547520
--- /dev/null
+++ b/sysdeps/powerpc/powerpc32/multiarch/memcpy.S
@@ -0,0 +1,112 @@
+/* Optimized memcpy implementation for PowerPC32 on PowerPC64.
+   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(memcpy)
+	.type   memcpy, @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_06
+	bne-	L(powerA2)
+	andi.	r7,r6,PPC_FEATURE_ARCH_2_05
+	bne-	L(power6)
+	andis.	r7,r6,(PPC_FEATURE_CELL_BE >> 16)
+	bne-	L(powerCELL)
+# ifdef PIC
+	lwz	r3,__memcpy_ppc32@got(r5)
+# else
+	lis	r3,__memcpy_ppc32@ha
+	lwz	r3,__memcpy_ppc32@l(r3)
+# endif
+	blr
+L(power7):
+# ifdef PIC
+	lwz	r3,__memcpy_power7@got(r5)
+# else
+	lis	r3,__memcpy_power7@ha
+	lwz	r3,__memcpy_power7@l(r3)
+# endif
+	blr
+L(powerA2):
+# ifdef PIC
+	lwz	r3,__memcpy_a2@got(r5)
+# else
+	lis	r3,__memcpy_a2@ha
+	lwz	r3,__memcpy_a2@l(r3)
+# endif
+	blr
+L(power6):
+# ifdef PIC
+	lwz	r3,__memcpy_power6@got(r5)
+# else
+	lis	r3,__memcpy_power6@ha
+	lwz	r3,__memcpy_power6@l(r3)
+# endif
+	blr
+L(powerCELL):
+# ifdef PIC
+	lwz	r3,__memcpy_cell@got(r5)
+# else
+	lis	r3,__memcpy_cell@ha
+	lwz	r3,__memcpy_cell@l(r3)
+# endif
+	blr
+END(memcpy)
+
+# undef EALIGN
+# define EALIGN(name, alignt, words)                           \
+  .globl C_SYMBOL_NAME(__memcpy_ppc32);                        \
+  .type C_SYMBOL_NAME(__memcpy_ppc32),@function;               \
+  .align ALIGNARG(alignt);                                     \
+  EALIGN_W_##words;                                            \
+  C_LABEL(__memcpy_ppc32)                                      \
+  cfi_startproc;
+
+# undef END
+# define END(name)                                             \
+  cfi_endproc;                                                 \
+  ASM_SIZE_DIRECTIVE(__memcpy_ppc32)
+
+# undef libc_hidden_builtin_def
+# define libc_hidden_builtin_def(name)                         \
+  .globl __GI_memcpy; __GI_memcpy = __memcpy_ppc32
+
+#endif
+
+#include "../memcpy.S"

-----------------------------------------------------------------------


hooks/post-receive
-- 
GNU C Library master sources


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]