5de29b
From 8d960764b1afa3b64c3c388665499935a38b194e Mon Sep 17 00:00:00 2001
5de29b
From: Rajalakshmi Srinivasaraghavan <raji@linux.vnet.ibm.com>
5de29b
Date: Wed, 30 Jul 2014 08:12:17 -0500
5de29b
Subject: [PATCH] PowerPC: multiarch wordcopy for PowerPC64
5de29b
5de29b
commit e28bcd427b21b6c74021ca65736dd66474b09013
5de29b
Author: Adhemerval Zanella <azanella@linux.vnet.ibm.com>
5de29b
Date:   Fri Dec 13 14:54:08 2013 -0500
5de29b
5de29b
Added the following files apart from original commit.
5de29b
sysdeps/powerpc/powerpc32/power4/multiarch/wordcopy-power6.c
5de29b
sysdeps/powerpc/powerpc32/power4/multiarch/wordcopy-power7.c
5de29b
sysdeps/powerpc/powerpc32/power4/multiarch/wordcopy-ppc32.c
5de29b
sysdeps/powerpc/power4/wordcopy.c
5de29b
sysdeps/powerpc/power6/wordcopy.c
5de29b
Removed the following files apart from original commit.
5de29b
sysdeps/powerpc/power4/wordcopy.c
5de29b
sysdeps/powerpc/powerpc64/power6/wordcopy.c
5de29b
---
5de29b
 string/wordcopy.c                                  |  38 ++--
5de29b
 sysdeps/powerpc/power4/wordcopy.c                  | 212 ++++++++++++++++++++
5de29b
 sysdeps/powerpc/power6/wordcopy.c                  | 221 +++++++++++++++++++++
5de29b
 .../powerpc32/power4/multiarch/wordcopy-power6.c   |  23 +++
5de29b
 .../powerpc32/power4/multiarch/wordcopy-power7.c   |  23 +++
5de29b
 .../powerpc32/power4/multiarch/wordcopy-ppc32.c    |  23 +++
5de29b
 sysdeps/powerpc/powerpc64/multiarch/Makefile       |   5 +-
5de29b
 .../powerpc/powerpc64/multiarch/wordcopy-power6.c  |  19 ++
5de29b
 .../powerpc/powerpc64/multiarch/wordcopy-power7.c  |  19 ++
5de29b
 .../powerpc/powerpc64/multiarch/wordcopy-ppc64.c   |  18 ++
5de29b
 sysdeps/powerpc/powerpc64/multiarch/wordcopy.c     |  86 ++++++++
5de29b
 sysdeps/powerpc/powerpc64/power4/wordcopy.c        |   1 -
5de29b
 sysdeps/powerpc/powerpc64/power6/wordcopy.c        | 217 --------------------
5de29b
 13 files changed, 669 insertions(+), 236 deletions(-)
5de29b
 create mode 100644 sysdeps/powerpc/power4/wordcopy.c
5de29b
 create mode 100644 sysdeps/powerpc/power6/wordcopy.c
5de29b
 create mode 100644 sysdeps/powerpc/powerpc32/power4/multiarch/wordcopy-power6.c
5de29b
 create mode 100644 sysdeps/powerpc/powerpc32/power4/multiarch/wordcopy-power7.c
5de29b
 create mode 100644 sysdeps/powerpc/powerpc32/power4/multiarch/wordcopy-ppc32.c
5de29b
 create mode 100644 sysdeps/powerpc/powerpc64/multiarch/wordcopy-power6.c
5de29b
 create mode 100644 sysdeps/powerpc/powerpc64/multiarch/wordcopy-power7.c
5de29b
 create mode 100644 sysdeps/powerpc/powerpc64/multiarch/wordcopy-ppc64.c
5de29b
 create mode 100644 sysdeps/powerpc/powerpc64/multiarch/wordcopy.c
5de29b
 delete mode 100644 sysdeps/powerpc/powerpc64/power4/wordcopy.c
5de29b
 delete mode 100644 sysdeps/powerpc/powerpc64/power6/wordcopy.c
5de29b
12745e
diff --git glibc-2.17-c758a686/string/wordcopy.c glibc-2.17-c758a686/string/wordcopy.c
5de29b
index b171f27..ff4cce4 100644
12745e
--- glibc-2.17-c758a686/string/wordcopy.c
12745e
+++ glibc-2.17-c758a686/string/wordcopy.c
5de29b
@@ -1,5 +1,5 @@
5de29b
 /* _memcopy.c -- subroutines for memory copy functions.
5de29b
-   Copyright (C) 1991, 1996 Free Software Foundation, Inc.
5de29b
+   Copyright (C) 1991-2014 Free Software Foundation, Inc.
5de29b
    This file is part of the GNU C Library.
5de29b
    Contributed by Torbjorn Granlund (tege@sics.se).
5de29b
 
5de29b
@@ -26,11 +26,12 @@
5de29b
    block beginning at DSTP with LEN `op_t' words (not LEN bytes!).
5de29b
    Both SRCP and DSTP should be aligned for memory operations on `op_t's.  */
5de29b
 
5de29b
+#ifndef WORDCOPY_FWD_ALIGNED
5de29b
+# define WORDCOPY_FWD_ALIGNED _wordcopy_fwd_aligned
5de29b
+#endif
5de29b
+
5de29b
 void
5de29b
-_wordcopy_fwd_aligned (dstp, srcp, len)
5de29b
-     long int dstp;
5de29b
-     long int srcp;
5de29b
-     size_t len;
5de29b
+WORDCOPY_FWD_ALIGNED (long int dstp, long int srcp, size_t len)
5de29b
 {
5de29b
   op_t a0, a1;
5de29b
 
5de29b
@@ -134,11 +135,12 @@ _wordcopy_fwd_aligned (dstp, srcp, len)
5de29b
    DSTP should be aligned for memory operations on `op_t's, but SRCP must
5de29b
    *not* be aligned.  */
5de29b
 
5de29b
+#ifndef WORDCOPY_FWD_DEST_ALIGNED
5de29b
+# define WORDCOPY_FWD_DEST_ALIGNED _wordcopy_fwd_dest_aligned
5de29b
+#endif
5de29b
+
5de29b
 void
5de29b
-_wordcopy_fwd_dest_aligned (dstp, srcp, len)
5de29b
-     long int dstp;
5de29b
-     long int srcp;
5de29b
-     size_t len;
5de29b
+WORDCOPY_FWD_DEST_ALIGNED (long int dstp, long int srcp, size_t len)
5de29b
 {
5de29b
   op_t a0, a1, a2, a3;
5de29b
   int sh_1, sh_2;
5de29b
@@ -221,11 +223,12 @@ _wordcopy_fwd_dest_aligned (dstp, srcp, len)
5de29b
    (not LEN bytes!).  Both SRCP and DSTP should be aligned for memory
5de29b
    operations on `op_t's.  */
5de29b
 
5de29b
+#ifndef WORDCOPY_BWD_ALIGNED
5de29b
+# define WORDCOPY_BWD_ALIGNED _wordcopy_bwd_aligned
5de29b
+#endif
5de29b
+
5de29b
 void
5de29b
-_wordcopy_bwd_aligned (dstp, srcp, len)
5de29b
-     long int dstp;
5de29b
-     long int srcp;
5de29b
-     size_t len;
5de29b
+WORDCOPY_BWD_ALIGNED (long int dstp, long int srcp, size_t len)
5de29b
 {
5de29b
   op_t a0, a1;
5de29b
 
5de29b
@@ -329,11 +332,12 @@ _wordcopy_bwd_aligned (dstp, srcp, len)
5de29b
    words (not LEN bytes!).  DSTP should be aligned for memory
5de29b
    operations on `op_t', but SRCP must *not* be aligned.  */
5de29b
 
5de29b
+#ifndef WORDCOPY_BWD_DEST_ALIGNED
5de29b
+# define WORDCOPY_BWD_DEST_ALIGNED _wordcopy_bwd_dest_aligned
5de29b
+#endif
5de29b
+
5de29b
 void
5de29b
-_wordcopy_bwd_dest_aligned (dstp, srcp, len)
5de29b
-     long int dstp;
5de29b
-     long int srcp;
5de29b
-     size_t len;
5de29b
+WORDCOPY_BWD_DEST_ALIGNED (long int dstp, long int srcp, size_t len)
5de29b
 {
5de29b
   op_t a0, a1, a2, a3;
5de29b
   int sh_1, sh_2;
12745e
diff --git glibc-2.17-c758a686/sysdeps/powerpc/power4/wordcopy.c glibc-2.17-c758a686/sysdeps/powerpc/power4/wordcopy.c
5de29b
new file mode 100644
5de29b
index 0000000..263b444
5de29b
--- /dev/null
12745e
+++ glibc-2.17-c758a686/sysdeps/powerpc/power4/wordcopy.c
5de29b
@@ -0,0 +1,212 @@
5de29b
+/* _memcopy.c -- subroutines for memory copy functions.
5de29b
+   Copyright (C) 1991-2014 Free Software Foundation, Inc.
5de29b
+   This file is part of the GNU C Library.
5de29b
+   Contributed by Torbjorn Granlund (tege@sics.se).
5de29b
+
5de29b
+   The GNU C Library is free software; you can redistribute it and/or
5de29b
+   modify it under the terms of the GNU Lesser General Public
5de29b
+   License as published by the Free Software Foundation; either
5de29b
+   version 2.1 of the License, or (at your option) any later version.
5de29b
+
5de29b
+   The GNU C Library is distributed in the hope that it will be useful,
5de29b
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
5de29b
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
5de29b
+   Lesser General Public License for more details.
5de29b
+
5de29b
+   You should have received a copy of the GNU Lesser General Public
5de29b
+   License along with the GNU C Library; if not, see
5de29b
+   <http://www.gnu.org/licenses/>.  */
5de29b
+
5de29b
+/* BE VERY CAREFUL IF YOU CHANGE THIS CODE...!  */
5de29b
+
5de29b
+#include <stddef.h>
5de29b
+#include <memcopy.h>
5de29b
+
5de29b
+/* _wordcopy_fwd_aligned -- Copy block beginning at SRCP to
5de29b
+   block beginning at DSTP with LEN `op_t' words (not LEN bytes!).
5de29b
+   Both SRCP and DSTP should be aligned for memory operations on `op_t's.  */
5de29b
+
5de29b
+#ifndef WORDCOPY_FWD_ALIGNED
5de29b
+# define WORDCOPY_FWD_ALIGNED _wordcopy_fwd_aligned
5de29b
+#endif
5de29b
+
5de29b
+void
5de29b
+WORDCOPY_FWD_ALIGNED (long int dstp, long int srcp, size_t len)
5de29b
+{
5de29b
+  op_t a0, a1;
5de29b
+
5de29b
+  if (len & 1)
5de29b
+  {
5de29b
+    ((op_t *) dstp)[0] = ((op_t *) srcp)[0];
5de29b
+
5de29b
+    if (len == 1)
5de29b
+      return;
5de29b
+    srcp += OPSIZ;
5de29b
+    dstp += OPSIZ;
5de29b
+    len -= 1;
5de29b
+  }
5de29b
+
5de29b
+  do
5de29b
+    {
5de29b
+      a0 = ((op_t *) srcp)[0];
5de29b
+      a1 = ((op_t *) srcp)[1];
5de29b
+      ((op_t *) dstp)[0] = a0;
5de29b
+      ((op_t *) dstp)[1] = a1;
5de29b
+
5de29b
+      srcp += 2 * OPSIZ;
5de29b
+      dstp += 2 * OPSIZ;
5de29b
+      len -= 2;
5de29b
+    }
5de29b
+  while (len != 0);
5de29b
+}
5de29b
+
5de29b
+/* _wordcopy_fwd_dest_aligned -- Copy block beginning at SRCP to
5de29b
+   block beginning at DSTP with LEN `op_t' words (not LEN bytes!).
5de29b
+   DSTP should be aligned for memory operations on `op_t's, but SRCP must
5de29b
+   *not* be aligned.  */
5de29b
+
5de29b
+#ifndef WORDCOPY_FWD_DEST_ALIGNED
5de29b
+# define WORDCOPY_FWD_DEST_ALIGNED _wordcopy_fwd_dest_aligned
5de29b
+#endif
5de29b
+
5de29b
+void
5de29b
+WORDCOPY_FWD_DEST_ALIGNED (long int dstp, long int srcp, size_t len)
5de29b
+{
5de29b
+  op_t a0, a1, a2;
5de29b
+  int sh_1, sh_2;
5de29b
+
5de29b
+  /* Calculate how to shift a word read at the memory operation
5de29b
+     aligned srcp to make it aligned for copy.  */
5de29b
+
5de29b
+  sh_1 = 8 * (srcp % OPSIZ);
5de29b
+  sh_2 = 8 * OPSIZ - sh_1;
5de29b
+
5de29b
+  /* Make SRCP aligned by rounding it down to the beginning of the `op_t'
5de29b
+     it points in the middle of.  */
5de29b
+  srcp &= -OPSIZ;
5de29b
+  a0 = ((op_t *) srcp)[0];
5de29b
+
5de29b
+  if (len & 1)
5de29b
+  {
5de29b
+    a1 = ((op_t *) srcp)[1];
5de29b
+    ((op_t *) dstp)[0] = MERGE (a0, sh_1, a1, sh_2);
5de29b
+
5de29b
+    if (len == 1)
5de29b
+      return;
5de29b
+
5de29b
+    a0 = a1;
5de29b
+    srcp += OPSIZ;
5de29b
+    dstp += OPSIZ;
5de29b
+    len -= 1;
5de29b
+  }
5de29b
+
5de29b
+  do
5de29b
+    {
5de29b
+      a1 = ((op_t *) srcp)[1];
5de29b
+      a2 = ((op_t *) srcp)[2];
5de29b
+      ((op_t *) dstp)[0] = MERGE (a0, sh_1, a1, sh_2);
5de29b
+      ((op_t *) dstp)[1] = MERGE (a1, sh_1, a2, sh_2);
5de29b
+      a0 = a2;
5de29b
+
5de29b
+      srcp += 2 * OPSIZ;
5de29b
+      dstp += 2 * OPSIZ;
5de29b
+      len -= 2;
5de29b
+    }
5de29b
+  while (len != 0);
5de29b
+}
5de29b
+
5de29b
+/* _wordcopy_bwd_aligned -- Copy block finishing right before
5de29b
+   SRCP to block finishing right before DSTP with LEN `op_t' words
5de29b
+   (not LEN bytes!).  Both SRCP and DSTP should be aligned for memory
5de29b
+   operations on `op_t's.  */
5de29b
+
5de29b
+#ifndef WORDCOPY_BWD_ALIGNED
5de29b
+# define WORDCOPY_BWD_ALIGNED _wordcopy_bwd_aligned
5de29b
+#endif
5de29b
+
5de29b
+void
5de29b
+WORDCOPY_BWD_ALIGNED (long int dstp, long int srcp, size_t len)
5de29b
+{
5de29b
+  op_t a0, a1;
5de29b
+
5de29b
+  if (len & 1)
5de29b
+  {
5de29b
+    srcp -= OPSIZ;
5de29b
+    dstp -= OPSIZ;
5de29b
+    ((op_t *) dstp)[0] = ((op_t *) srcp)[0];
5de29b
+
5de29b
+    if (len == 1)
5de29b
+      return;
5de29b
+    len -= 1;
5de29b
+  }
5de29b
+
5de29b
+  do
5de29b
+    {
5de29b
+      srcp -= 2 * OPSIZ;
5de29b
+      dstp -= 2 * OPSIZ;
5de29b
+
5de29b
+      a1 = ((op_t *) srcp)[1];
5de29b
+      a0 = ((op_t *) srcp)[0];
5de29b
+      ((op_t *) dstp)[1] = a1;
5de29b
+      ((op_t *) dstp)[0] = a0;
5de29b
+
5de29b
+      len -= 2;
5de29b
+    }
5de29b
+  while (len != 0);
5de29b
+}
5de29b
+
5de29b
+/* _wordcopy_bwd_dest_aligned -- Copy block finishing right
5de29b
+   before SRCP to block finishing right before DSTP with LEN `op_t'
5de29b
+   words (not LEN bytes!).  DSTP should be aligned for memory
5de29b
+   operations on `op_t', but SRCP must *not* be aligned.  */
5de29b
+
5de29b
+#ifndef WORDCOPY_BWD_DEST_ALIGNED
5de29b
+# define WORDCOPY_BWD_DEST_ALIGNED _wordcopy_bwd_dest_aligned
5de29b
+#endif
5de29b
+
5de29b
+void
5de29b
+WORDCOPY_BWD_DEST_ALIGNED (long int dstp, long int srcp, size_t len)
5de29b
+{
5de29b
+  op_t a0, a1, a2;
5de29b
+  int sh_1, sh_2;
5de29b
+
5de29b
+  /* Calculate how to shift a word read at the memory operation
5de29b
+     aligned srcp to make it aligned for copy.  */
5de29b
+
5de29b
+  sh_1 = 8 * (srcp % OPSIZ);
5de29b
+  sh_2 = 8 * OPSIZ - sh_1;
5de29b
+
5de29b
+  /* Make srcp aligned by rounding it down to the beginning of the op_t
5de29b
+     it points in the middle of.  */
5de29b
+  srcp &= -OPSIZ;
5de29b
+  a2 = ((op_t *) srcp)[0];
5de29b
+
5de29b
+  if (len & 1)
5de29b
+  {
5de29b
+    srcp -= OPSIZ;
5de29b
+    dstp -= OPSIZ;
5de29b
+    a1 = ((op_t *) srcp)[0];
5de29b
+    ((op_t *) dstp)[0] = MERGE (a1, sh_1, a2, sh_2);
5de29b
+
5de29b
+    if (len == 1)
5de29b
+      return;
5de29b
+
5de29b
+    a2 = a1;
5de29b
+    len -= 1;
5de29b
+  }
5de29b
+
5de29b
+  do
5de29b
+    {
5de29b
+      srcp -= 2 * OPSIZ;
5de29b
+      dstp -= 2 * OPSIZ;
5de29b
+
5de29b
+      a1 = ((op_t *) srcp)[1];
5de29b
+      a0 = ((op_t *) srcp)[0];
5de29b
+      ((op_t *) dstp)[1] = MERGE (a1, sh_1, a2, sh_2);
5de29b
+      ((op_t *) dstp)[0] = MERGE (a0, sh_1, a1, sh_2);
5de29b
+      a2 = a0;
5de29b
+
5de29b
+      len -= 2;
5de29b
+    }
5de29b
+  while (len != 0);
5de29b
+}
12745e
diff --git glibc-2.17-c758a686/sysdeps/powerpc/power6/wordcopy.c glibc-2.17-c758a686/sysdeps/powerpc/power6/wordcopy.c
5de29b
new file mode 100644
5de29b
index 0000000..c32e6dd
5de29b
--- /dev/null
12745e
+++ glibc-2.17-c758a686/sysdeps/powerpc/power6/wordcopy.c
5de29b
@@ -0,0 +1,221 @@
5de29b
+/* _memcopy.c -- subroutines for memory copy functions.
5de29b
+   Copyright (C) 1991-2014 Free Software Foundation, Inc.
5de29b
+   This file is part of the GNU C Library.
5de29b
+   Contributed by Torbjorn Granlund (tege@sics.se).
5de29b
+   Updated for POWER6 by Steven Munroe (sjmunroe@us.ibm.com).
5de29b
+
5de29b
+   The GNU C Library is free software; you can redistribute it and/or
5de29b
+   modify it under the terms of the GNU Lesser General Public
5de29b
+   License as published by the Free Software Foundation; either
5de29b
+   version 2.1 of the License, or (at your option) any later version.
5de29b
+
5de29b
+   The GNU C Library is distributed in the hope that it will be useful,
5de29b
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
5de29b
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
5de29b
+   Lesser General Public License for more details.
5de29b
+
5de29b
+   You should have received a copy of the GNU Lesser General Public
5de29b
+   License along with the GNU C Library; if not, see
5de29b
+   <http://www.gnu.org/licenses/>.  */
5de29b
+
5de29b
+/* BE VERY CAREFUL IF YOU CHANGE THIS CODE...!  */
5de29b
+
5de29b
+#include <stddef.h>
5de29b
+#include <memcopy.h>
5de29b
+
5de29b
+/* _wordcopy_fwd_aligned -- Copy block beginning at SRCP to
5de29b
+   block beginning at DSTP with LEN `op_t' words (not LEN bytes!).
5de29b
+   Both SRCP and DSTP should be aligned for memory operations on `op_t's.  */
5de29b
+
5de29b
+#ifndef WORDCOPY_FWD_ALIGNED
5de29b
+# define WORDCOPY_FWD_ALIGNED _wordcopy_fwd_aligned
5de29b
+#endif
5de29b
+
5de29b
+void
5de29b
+WORDCOPY_FWD_ALIGNED (long int dstp, long int srcp, size_t len)
5de29b
+{
5de29b
+  op_t a0, a1;
5de29b
+
5de29b
+  if (len & 1)
5de29b
+  {
5de29b
+    ((op_t *) dstp)[0] = ((op_t *) srcp)[0];
5de29b
+
5de29b
+    if (len == 1)
5de29b
+      return;
5de29b
+    srcp += OPSIZ;
5de29b
+    dstp += OPSIZ;
5de29b
+    len -= 1;
5de29b
+  }
5de29b
+
5de29b
+  do
5de29b
+    {
5de29b
+      a0 = ((op_t *) srcp)[0];
5de29b
+      a1 = ((op_t *) srcp)[1];
5de29b
+      ((op_t *) dstp)[0] = a0;
5de29b
+      ((op_t *) dstp)[1] = a1;
5de29b
+
5de29b
+      srcp += 2 * OPSIZ;
5de29b
+      dstp += 2 * OPSIZ;
5de29b
+      len -= 2;
5de29b
+    }
5de29b
+  while (len != 0);
5de29b
+}
5de29b
+
5de29b
+/* _wordcopy_fwd_dest_aligned -- Copy block beginning at SRCP to
5de29b
+   block beginning at DSTP with LEN `op_t' words (not LEN bytes!).
5de29b
+   DSTP should be aligned for memory operations on `op_t's, but SRCP must
5de29b
+   *not* be aligned.  */
5de29b
+
5de29b
+#define fwd_align_merge(align)                                         \
5de29b
+  do                                                                   \
5de29b
+    {                                                                  \
5de29b
+      a1 = ((op_t *) srcp)[1];                                         \
5de29b
+      a2 = ((op_t *) srcp)[2];                                         \
5de29b
+      ((op_t *) dstp)[0] = MERGE (a0, align*8, a1, (__WORDSIZE-align*8)); \
5de29b
+      ((op_t *) dstp)[1] = MERGE (a1, align*8, a2, (__WORDSIZE-align*8)); \
5de29b
+      a0 = a2;                                                         \
5de29b
+      srcp += 2 * OPSIZ;                                               \
5de29b
+      dstp += 2 * OPSIZ;                                               \
5de29b
+      len -= 2;                                                                \
5de29b
+    }                                                                  \
5de29b
+  while (len != 0)
5de29b
+
5de29b
+#ifndef WORDCOPY_FWD_DEST_ALIGNED
5de29b
+# define WORDCOPY_FWD_DEST_ALIGNED _wordcopy_fwd_dest_aligned
5de29b
+#endif
5de29b
+
5de29b
+void
5de29b
+WORDCOPY_FWD_DEST_ALIGNED (long int dstp, long int srcp, size_t len)
5de29b
+{
5de29b
+  op_t a0, a1, a2;
5de29b
+  int sh_1, sh_2;
5de29b
+  int align;
5de29b
+
5de29b
+  /* Calculate how to shift a word read at the memory operation
5de29b
+     aligned srcp to make it aligned for copy.  */
5de29b
+
5de29b
+  align = srcp % OPSIZ;
5de29b
+  sh_1 = 8 * (srcp % OPSIZ);
5de29b
+  sh_2 = 8 * OPSIZ - sh_1;
5de29b
+
5de29b
+  /* Make SRCP aligned by rounding it down to the beginning of the `op_t'
5de29b
+     it points in the middle of.  */
5de29b
+  srcp &= -OPSIZ;
5de29b
+  a0 = ((op_t *) srcp)[0];
5de29b
+
5de29b
+  if (len & 1)
5de29b
+  {
5de29b
+    a1 = ((op_t *) srcp)[1];
5de29b
+    ((op_t *) dstp)[0] = MERGE (a0, sh_1, a1, sh_2);
5de29b
+
5de29b
+    if (len == 1)
5de29b
+      return;
5de29b
+
5de29b
+    a0 = a1;
5de29b
+    srcp += OPSIZ;
5de29b
+    dstp += OPSIZ;
5de29b
+    len -= 1;
5de29b
+  }
5de29b
+
5de29b
+  fwd_align_merge (align);
5de29b
+
5de29b
+}
5de29b
+
5de29b
+/* _wordcopy_bwd_aligned -- Copy block finishing right before
5de29b
+   SRCP to block finishing right before DSTP with LEN `op_t' words
5de29b
+   (not LEN bytes!).  Both SRCP and DSTP should be aligned for memory
5de29b
+   operations on `op_t's.  */
5de29b
+
5de29b
+#ifndef WORDCOPY_BWD_ALIGNED
5de29b
+# define WORDCOPY_BWD_ALIGNED _wordcopy_bwd_aligned
5de29b
+#endif
5de29b
+
5de29b
+void
5de29b
+WORDCOPY_BWD_ALIGNED (long int dstp, long int srcp, size_t len)
5de29b
+{
5de29b
+  op_t a0, a1;
5de29b
+
5de29b
+  if (len & 1)
5de29b
+  {
5de29b
+    srcp -= OPSIZ;
5de29b
+    dstp -= OPSIZ;
5de29b
+    ((op_t *) dstp)[0] = ((op_t *) srcp)[0];
5de29b
+
5de29b
+    if (len == 1)
5de29b
+      return;
5de29b
+    len -= 1;
5de29b
+  }
5de29b
+
5de29b
+  do
5de29b
+    {
5de29b
+      srcp -= 2 * OPSIZ;
5de29b
+      dstp -= 2 * OPSIZ;
5de29b
+
5de29b
+      a1 = ((op_t *) srcp)[1];
5de29b
+      a0 = ((op_t *) srcp)[0];
5de29b
+      ((op_t *) dstp)[1] = a1;
5de29b
+      ((op_t *) dstp)[0] = a0;
5de29b
+
5de29b
+      len -= 2;
5de29b
+    }
5de29b
+  while (len != 0);
5de29b
+}
5de29b
+
5de29b
+#define bwd_align_merge(align)                                         \
5de29b
+  do                                                                   \
5de29b
+    {                                                                  \
5de29b
+      srcp -= 2 * OPSIZ;                                               \
5de29b
+      dstp -= 2 * OPSIZ;                                               \
5de29b
+      a1 = ((op_t *) srcp)[1];                                         \
5de29b
+      a0 = ((op_t *) srcp)[0];                                         \
5de29b
+      ((op_t *) dstp)[1] = MERGE (a1, align*8, a2, (__WORDSIZE-align*8)); \
5de29b
+      ((op_t *) dstp)[0] = MERGE (a0, align*8, a1, (__WORDSIZE-align*8)); \
5de29b
+      a2 = a0;                                                         \
5de29b
+      len -= 2;                                                                \
5de29b
+    }                                                                  \
5de29b
+  while (len != 0)
5de29b
+
5de29b
+/* _wordcopy_bwd_dest_aligned -- Copy block finishing right
5de29b
+   before SRCP to block finishing right before DSTP with LEN `op_t'
5de29b
+   words (not LEN bytes!).  DSTP should be aligned for memory
5de29b
+   operations on `op_t', but SRCP must *not* be aligned.  */
5de29b
+
5de29b
+#ifndef WORDCOPY_BWD_DEST_ALIGNED
5de29b
+# define WORDCOPY_BWD_DEST_ALIGNED _wordcopy_bwd_dest_aligned
5de29b
+#endif
5de29b
+
5de29b
+void
5de29b
+WORDCOPY_BWD_DEST_ALIGNED (long int dstp, long int srcp, size_t len)
5de29b
+{
5de29b
+  op_t a0, a1, a2;
5de29b
+  int sh_1, sh_2;
5de29b
+  int align;
5de29b
+
5de29b
+  /* Calculate how to shift a word read at the memory operation
5de29b
+     aligned srcp to make it aligned for copy.  */
5de29b
+
5de29b
+  align = srcp % OPSIZ;
5de29b
+  sh_1 = 8 * (srcp % OPSIZ);
5de29b
+  sh_2 = 8 * OPSIZ - sh_1;
5de29b
+
5de29b
+  /* Make srcp aligned by rounding it down to the beginning of the op_t
5de29b
+     it points in the middle of.  */
5de29b
+  srcp &= -OPSIZ;
5de29b
+  a2 = ((op_t *) srcp)[0];
5de29b
+
5de29b
+  if (len & 1)
5de29b
+  {
5de29b
+    srcp -= OPSIZ;
5de29b
+    dstp -= OPSIZ;
5de29b
+    a1 = ((op_t *) srcp)[0];
5de29b
+    ((op_t *) dstp)[0] = MERGE (a1, sh_1, a2, sh_2);
5de29b
+
5de29b
+    if (len == 1)
5de29b
+      return;
5de29b
+
5de29b
+    a2 = a1;
5de29b
+    len -= 1;
5de29b
+  }
5de29b
+
5de29b
+  bwd_align_merge (align);
5de29b
+}
12745e
diff --git glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power4/multiarch/wordcopy-power6.c glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power4/multiarch/wordcopy-power6.c
5de29b
new file mode 100644
5de29b
index 0000000..c5c6eb7
5de29b
--- /dev/null
12745e
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power4/multiarch/wordcopy-power6.c
5de29b
@@ -0,0 +1,23 @@
5de29b
+/* Copyright (C) 2013-2014 Free Software Foundation, Inc.
5de29b
+   This file is part of the GNU C Library.
5de29b
+
5de29b
+   The GNU C Library is free software; you can redistribute it and/or
5de29b
+   modify it under the terms of the GNU Lesser General Public
5de29b
+   License as published by the Free Software Foundation; either
5de29b
+   version 2.1 of the License, or (at your option) any later version.
5de29b
+
5de29b
+   The GNU C Library is distributed in the hope that it will be useful,
5de29b
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
5de29b
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
5de29b
+   Lesser General Public License for more details.
5de29b
+
5de29b
+   You should have received a copy of the GNU Lesser General Public
5de29b
+   License along with the GNU C Library; if not, see
5de29b
+   <http://www.gnu.org/licenses/>.  */
5de29b
+
5de29b
+#define WORDCOPY_FWD_ALIGNED      _wordcopy_fwd_aligned_power6
5de29b
+#define WORDCOPY_FWD_DEST_ALIGNED _wordcopy_fwd_dest_aligned_power6
5de29b
+#define WORDCOPY_BWD_ALIGNED      _wordcopy_bwd_aligned_power6
5de29b
+#define WORDCOPY_BWD_DEST_ALIGNED _wordcopy_bwd_dest_aligned_power6
5de29b
+
5de29b
+#include <sysdeps/powerpc/power6/wordcopy.c>
12745e
diff --git glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power4/multiarch/wordcopy-power7.c glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power4/multiarch/wordcopy-power7.c
5de29b
new file mode 100644
5de29b
index 0000000..841d1a2
5de29b
--- /dev/null
12745e
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power4/multiarch/wordcopy-power7.c
5de29b
@@ -0,0 +1,23 @@
5de29b
+/* Copyright (C) 2013-2014 Free Software Foundation, Inc.
5de29b
+   This file is part of the GNU C Library.
5de29b
+
5de29b
+   The GNU C Library is free software; you can redistribute it and/or
5de29b
+   modify it under the terms of the GNU Lesser General Public
5de29b
+   License as published by the Free Software Foundation; either
5de29b
+   version 2.1 of the License, or (at your option) any later version.
5de29b
+
5de29b
+   The GNU C Library is distributed in the hope that it will be useful,
5de29b
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
5de29b
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
5de29b
+   Lesser General Public License for more details.
5de29b
+
5de29b
+   You should have received a copy of the GNU Lesser General Public
5de29b
+   License along with the GNU C Library; if not, see
5de29b
+   <http://www.gnu.org/licenses/>.  */
5de29b
+
5de29b
+#define WORDCOPY_FWD_ALIGNED      _wordcopy_fwd_aligned_power7
5de29b
+#define WORDCOPY_FWD_DEST_ALIGNED _wordcopy_fwd_dest_aligned_power7
5de29b
+#define WORDCOPY_BWD_ALIGNED      _wordcopy_bwd_aligned_power7
5de29b
+#define WORDCOPY_BWD_DEST_ALIGNED _wordcopy_bwd_dest_aligned_power7
5de29b
+
5de29b
+#include <sysdeps/powerpc/power6/wordcopy.c>
12745e
diff --git glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power4/multiarch/wordcopy-ppc32.c glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power4/multiarch/wordcopy-ppc32.c
5de29b
new file mode 100644
5de29b
index 0000000..ccd24ad
5de29b
--- /dev/null
12745e
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power4/multiarch/wordcopy-ppc32.c
5de29b
@@ -0,0 +1,23 @@
5de29b
+/* Copyright (C) 2013-2014 Free Software Foundation, Inc.
5de29b
+   This file is part of the GNU C Library.
5de29b
+
5de29b
+   The GNU C Library is free software; you can redistribute it and/or
5de29b
+   modify it under the terms of the GNU Lesser General Public
5de29b
+   License as published by the Free Software Foundation; either
5de29b
+   version 2.1 of the License, or (at your option) any later version.
5de29b
+
5de29b
+   The GNU C Library is distributed in the hope that it will be useful,
5de29b
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
5de29b
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
5de29b
+   Lesser General Public License for more details.
5de29b
+
5de29b
+   You should have received a copy of the GNU Lesser General Public
5de29b
+   License along with the GNU C Library; if not, see
5de29b
+   <http://www.gnu.org/licenses/>.  */
5de29b
+
5de29b
+#define WORDCOPY_FWD_ALIGNED      _wordcopy_fwd_aligned_ppc
5de29b
+#define WORDCOPY_FWD_DEST_ALIGNED _wordcopy_fwd_dest_aligned_ppc
5de29b
+#define WORDCOPY_BWD_ALIGNED      _wordcopy_bwd_aligned_ppc
5de29b
+#define WORDCOPY_BWD_DEST_ALIGNED _wordcopy_bwd_dest_aligned_ppc
5de29b
+
5de29b
+#include <sysdeps/powerpc/power4/wordcopy.c>
12745e
diff --git glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/Makefile glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/Makefile
5de29b
index 7113212..8dceb09 100644
12745e
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/Makefile
12745e
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/Makefile
5de29b
@@ -11,7 +11,8 @@ sysdep_routines += memcpy-power7 memcpy-a2 memcpy-power6 memcpy-cell \
5de29b
                   strncmp-power4 strncmp-ppc64 strchr-power7 strchr-ppc64 \
5de29b
                   strchrnul-power7 strchrnul-ppc64 wcschr-power7 \
5de29b
                   wcschr-power6 wcschr-ppc64 wcsrchr-power7 wcsrchr-power6 \
5de29b
-                  wcsrchr-ppc64 wcscpy-power7 wcscpy-power6 wcscpy-ppc64
5de29b
+                  wcsrchr-ppc64 wcscpy-power7 wcscpy-power6 wcscpy-ppc64 \
5de29b
+                  wordcopy-power7 wordcopy-power6 wordcopy-ppc64
5de29b
 
5de29b
 CFLAGS-strncase-power7.c += -mcpu=power7 -funroll-loops
5de29b
 CFLAGS-strncase_l-power7.c += -mcpu=power7 -funroll-loops
5de29b
@@ -21,4 +22,6 @@ CFLAGS-wcsrchr-power7.c += -mcpu=power7
5de29b
 CFLAGS-wcsrchr-power6.c += -mcpu=power6
5de29b
 CFLAGS-wcscpy-power7.c += -mcpu=power7
5de29b
 CFLAGS-wcscpy-power6.c += -mcpu=power6
5de29b
+CFLAGS-wordcopy-power7.c += -mcpu=power7
5de29b
+CFLAGS-wordcopy-power6.c += -mcpu=power6
5de29b
 endif
12745e
diff --git glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/wordcopy-power6.c glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/wordcopy-power6.c
5de29b
new file mode 100644
5de29b
index 0000000..2a65b52
5de29b
--- /dev/null
12745e
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/wordcopy-power6.c
5de29b
@@ -0,0 +1,19 @@
5de29b
+/* wordcopy routines for powerpc64/power6.
5de29b
+   Copyright (C) 2013-2014 Free Software Foundation, Inc.
5de29b
+   This file is part of the GNU C Library.
5de29b
+
5de29b
+   The GNU C Library is free software; you can redistribute it and/or
5de29b
+   modify it under the terms of the GNU Lesser General Public
5de29b
+   License as published by the Free Software Foundation; either
5de29b
+   version 2.1 of the License, or (at your option) any later version.
5de29b
+
5de29b
+   The GNU C Library is distributed in the hope that it will be useful,
5de29b
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
5de29b
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
5de29b
+   Lesser General Public License for more details.
5de29b
+
5de29b
+   You should have received a copy of the GNU Lesser General Public
5de29b
+   License along with the GNU C Library; see the file COPYING.LIB.  If
5de29b
+   not, see <http://www.gnu.org/licenses/>.  */
5de29b
+
5de29b
+#include <sysdeps/powerpc/powerpc32/power4/multiarch/wordcopy-power6.c>
12745e
diff --git glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/wordcopy-power7.c glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/wordcopy-power7.c
5de29b
new file mode 100644
5de29b
index 0000000..e804f88
5de29b
--- /dev/null
12745e
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/wordcopy-power7.c
5de29b
@@ -0,0 +1,19 @@
5de29b
+/* wordcopy routines for powerpc64/power7.
5de29b
+   Copyright (C) 2013-2014 Free Software Foundation, Inc.
5de29b
+   This file is part of the GNU C Library.
5de29b
+
5de29b
+   The GNU C Library is free software; you can redistribute it and/or
5de29b
+   modify it under the terms of the GNU Lesser General Public
5de29b
+   License as published by the Free Software Foundation; either
5de29b
+   version 2.1 of the License, or (at your option) any later version.
5de29b
+
5de29b
+   The GNU C Library is distributed in the hope that it will be useful,
5de29b
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
5de29b
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
5de29b
+   Lesser General Public License for more details.
5de29b
+
5de29b
+   You should have received a copy of the GNU Lesser General Public
5de29b
+   License along with the GNU C Library; see the file COPYING.LIB.  If
5de29b
+   not, see <http://www.gnu.org/licenses/>.  */
5de29b
+
5de29b
+#include <sysdeps/powerpc/powerpc32/power4/multiarch/wordcopy-power7.c>
12745e
diff --git glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/wordcopy-ppc64.c glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/wordcopy-ppc64.c
5de29b
new file mode 100644
5de29b
index 0000000..0584277
5de29b
--- /dev/null
12745e
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/wordcopy-ppc64.c
5de29b
@@ -0,0 +1,18 @@
5de29b
+/* Copyright (C) 2013-2014 Free Software Foundation, Inc.
5de29b
+   This file is part of the GNU C Library.
5de29b
+
5de29b
+   The GNU C Library is free software; you can redistribute it and/or
5de29b
+   modify it under the terms of the GNU Lesser General Public
5de29b
+   License as published by the Free Software Foundation; either
5de29b
+   version 2.1 of the License, or (at your option) any later version.
5de29b
+
5de29b
+   The GNU C Library is distributed in the hope that it will be useful,
5de29b
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
5de29b
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
5de29b
+   Lesser General Public License for more details.
5de29b
+
5de29b
+   You should have received a copy of the GNU Lesser General Public
5de29b
+   License along with the GNU C Library; if not, see
5de29b
+   <http://www.gnu.org/licenses/>.  */
5de29b
+
5de29b
+#include <sysdeps/powerpc/powerpc32/power4/multiarch/wordcopy-ppc32.c>
12745e
diff --git glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/wordcopy.c glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/wordcopy.c
5de29b
new file mode 100644
5de29b
index 0000000..889be25
5de29b
--- /dev/null
12745e
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/wordcopy.c
5de29b
@@ -0,0 +1,86 @@
5de29b
+/* Multiple versions of wordcopy functions.
5de29b
+   Copyright (C) 2013-2014 Free Software Foundation, Inc.
5de29b
+   This file is part of the GNU C Library.
5de29b
+
5de29b
+   The GNU C Library is free software; you can redistribute it and/or
5de29b
+   modify it under the terms of the GNU Lesser General Public
5de29b
+   License as published by the Free Software Foundation; either
5de29b
+   version 2.1 of the License, or (at your option) any later version.
5de29b
+
5de29b
+   The GNU C Library is distributed in the hope that it will be useful,
5de29b
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
5de29b
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
5de29b
+   Lesser General Public License for more details.
5de29b
+
5de29b
+   You should have received a copy of the GNU Lesser General Public
5de29b
+   License along with the GNU C Library; if not, see
5de29b
+   <http://www.gnu.org/licenses/>.  */
5de29b
+
5de29b
+#ifndef NOT_IN_libc
5de29b
+# include <stddef.h>
5de29b
+# include <memcopy.h>
5de29b
+# include <shlib-compat.h>
5de29b
+# include "init-arch.h"
5de29b
+
5de29b
+extern __typeof (_wordcopy_fwd_aligned) _wordcopy_fwd_aligned_ppc
5de29b
+attribute_hidden;
5de29b
+extern __typeof (_wordcopy_fwd_aligned) _wordcopy_fwd_aligned_power6
5de29b
+attribute_hidden;
5de29b
+extern __typeof (_wordcopy_fwd_aligned) _wordcopy_fwd_aligned_power7
5de29b
+attribute_hidden;
5de29b
+
5de29b
+libc_ifunc (_wordcopy_fwd_aligned,
5de29b
+            (hwcap & PPC_FEATURE_HAS_VSX)
5de29b
+            ? _wordcopy_fwd_aligned_power7 :
5de29b
+	      (hwcap & PPC_FEATURE_ARCH_2_05)
5de29b
+              ? _wordcopy_fwd_aligned_power6
5de29b
+            : _wordcopy_fwd_aligned_ppc);
5de29b
+
5de29b
+
5de29b
+extern __typeof (_wordcopy_fwd_dest_aligned) _wordcopy_fwd_dest_aligned_ppc
5de29b
+attribute_hidden;
5de29b
+extern __typeof (_wordcopy_fwd_dest_aligned) _wordcopy_fwd_dest_aligned_power6
5de29b
+attribute_hidden;
5de29b
+extern __typeof (_wordcopy_fwd_dest_aligned) _wordcopy_fwd_dest_aligned_power7
5de29b
+attribute_hidden;
5de29b
+
5de29b
+libc_ifunc (_wordcopy_fwd_dest_aligned,
5de29b
+            (hwcap & PPC_FEATURE_HAS_VSX)
5de29b
+            ? _wordcopy_fwd_dest_aligned_power7 :
5de29b
+	      (hwcap & PPC_FEATURE_ARCH_2_05)
5de29b
+              ? _wordcopy_fwd_dest_aligned_power6
5de29b
+            : _wordcopy_fwd_dest_aligned_ppc);
5de29b
+
5de29b
+
5de29b
+extern __typeof (_wordcopy_bwd_aligned) _wordcopy_bwd_aligned_ppc
5de29b
+attribute_hidden;
5de29b
+extern __typeof (_wordcopy_bwd_aligned) _wordcopy_bwd_aligned_power6
5de29b
+attribute_hidden;
5de29b
+extern __typeof (_wordcopy_bwd_aligned) _wordcopy_bwd_aligned_power7
5de29b
+attribute_hidden;
5de29b
+
5de29b
+libc_ifunc (_wordcopy_bwd_aligned,
5de29b
+            (hwcap & PPC_FEATURE_HAS_VSX)
5de29b
+            ? _wordcopy_bwd_aligned_power7 :
5de29b
+	      (hwcap & PPC_FEATURE_ARCH_2_05)
5de29b
+              ? _wordcopy_bwd_aligned_power6
5de29b
+            : _wordcopy_bwd_aligned_ppc);
5de29b
+
5de29b
+
5de29b
+extern __typeof (_wordcopy_bwd_dest_aligned) _wordcopy_bwd_dest_aligned_ppc
5de29b
+attribute_hidden;
5de29b
+extern __typeof (_wordcopy_bwd_dest_aligned) _wordcopy_bwd_dest_aligned_power6
5de29b
+attribute_hidden;
5de29b
+extern __typeof (_wordcopy_bwd_dest_aligned) _wordcopy_bwd_dest_aligned_power7
5de29b
+attribute_hidden;
5de29b
+
5de29b
+libc_ifunc (_wordcopy_bwd_dest_aligned,
5de29b
+            (hwcap & PPC_FEATURE_HAS_VSX)
5de29b
+            ? _wordcopy_bwd_dest_aligned_power7 :
5de29b
+	      (hwcap & PPC_FEATURE_ARCH_2_05)
5de29b
+              ? _wordcopy_bwd_dest_aligned_power6
5de29b
+            : _wordcopy_bwd_dest_aligned_ppc);
5de29b
+
5de29b
+#else
5de29b
+#include <sysdeps/powerpc/power4/wordcopy.c>
5de29b
+#endif
12745e
diff --git glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/power4/wordcopy.c glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/power4/wordcopy.c
5de29b
deleted file mode 100644
5de29b
index f427b48..0000000
12745e
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/power4/wordcopy.c
5de29b
+++ /dev/null
5de29b
@@ -1 +0,0 @@
5de29b
-#include "../../powerpc32/power4/wordcopy.c"
12745e
diff --git glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/power6/wordcopy.c glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/power6/wordcopy.c
5de29b
deleted file mode 100644
5de29b
index 4c72404..0000000
12745e
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/power6/wordcopy.c
5de29b
+++ /dev/null
5de29b
@@ -1,217 +0,0 @@
5de29b
-/* _memcopy.c -- subroutines for memory copy functions.
5de29b
-   Copyright (C) 1991-2012 Free Software Foundation, Inc.
5de29b
-   This file is part of the GNU C Library.
5de29b
-   Contributed by Torbjorn Granlund (tege@sics.se).
5de29b
-
5de29b
-   The GNU C Library is free software; you can redistribute it and/or
5de29b
-   modify it under the terms of the GNU Lesser General Public
5de29b
-   License as published by the Free Software Foundation; either
5de29b
-   version 2.1 of the License, or (at your option) any later version.
5de29b
-
5de29b
-   The GNU C Library is distributed in the hope that it will be useful,
5de29b
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
5de29b
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
5de29b
-   Lesser General Public License for more details.
5de29b
-
5de29b
-   You should have received a copy of the GNU Lesser General Public
5de29b
-   License along with the GNU C Library; if not, see
5de29b
-   <http://www.gnu.org/licenses/>.  */
5de29b
-
5de29b
-/* BE VERY CAREFUL IF YOU CHANGE THIS CODE...!  */
5de29b
-
5de29b
-#include <stddef.h>
5de29b
-#include <memcopy.h>
5de29b
-
5de29b
-/* _wordcopy_fwd_aligned -- Copy block beginning at SRCP to
5de29b
-   block beginning at DSTP with LEN `op_t' words (not LEN bytes!).
5de29b
-   Both SRCP and DSTP should be aligned for memory operations on `op_t's.  */
5de29b
-
5de29b
-void
5de29b
-_wordcopy_fwd_aligned (dstp, srcp, len)
5de29b
-     long int dstp;
5de29b
-     long int srcp;
5de29b
-     size_t len;
5de29b
-{
5de29b
-  op_t a0, a1;
5de29b
-
5de29b
-  if (len & 1)
5de29b
-  {
5de29b
-    ((op_t *) dstp)[0] = ((op_t *) srcp)[0];
5de29b
-    
5de29b
-    if (len == 1)
5de29b
-      return;
5de29b
-    srcp += OPSIZ;
5de29b
-    dstp += OPSIZ;
5de29b
-    len -= 1;
5de29b
-  }
5de29b
-
5de29b
-  do
5de29b
-    {
5de29b
-      a0 = ((op_t *) srcp)[0];
5de29b
-      a1 = ((op_t *) srcp)[1];
5de29b
-      ((op_t *) dstp)[0] = a0;
5de29b
-      ((op_t *) dstp)[1] = a1;
5de29b
-
5de29b
-      srcp += 2 * OPSIZ;
5de29b
-      dstp += 2 * OPSIZ;
5de29b
-      len -= 2;
5de29b
-    }
5de29b
-  while (len != 0);
5de29b
-}
5de29b
-
5de29b
-#define fwd_align_merge(align)                                         \
5de29b
-  do                                                                   \
5de29b
-    {                                                                  \
5de29b
-      a1 = ((op_t *) srcp)[1];                                         \
5de29b
-      a2 = ((op_t *) srcp)[2];                                         \
5de29b
-      ((op_t *) dstp)[0] = MERGE (a0, align*8, a1, (64-align*8));      \
5de29b
-      ((op_t *) dstp)[1] = MERGE (a1, align*8, a2, (64-align*8));      \
5de29b
-      a0 = a2;                                                         \
5de29b
-      srcp += 2 * OPSIZ;                                               \
5de29b
-      dstp += 2 * OPSIZ;                                               \
5de29b
-      len -= 2;                                                                \
5de29b
-    }                                                                  \
5de29b
-  while (len != 0)
5de29b
-
5de29b
-
5de29b
-/* _wordcopy_fwd_dest_aligned -- Copy block beginning at SRCP to
5de29b
-   block beginning at DSTP with LEN `op_t' words (not LEN bytes!).
5de29b
-   DSTP should be aligned for memory operations on `op_t's, but SRCP must
5de29b
-   *not* be aligned.  */
5de29b
-
5de29b
-void
5de29b
-_wordcopy_fwd_dest_aligned (dstp, srcp, len)
5de29b
-     long int dstp;
5de29b
-     long int srcp;
5de29b
-     size_t len;
5de29b
-{
5de29b
-  op_t a0, a1, a2;
5de29b
-  int sh_1, sh_2;
5de29b
-  int align;
5de29b
-
5de29b
-  /* Calculate how to shift a word read at the memory operation
5de29b
-     aligned srcp to make it aligned for copy.  */
5de29b
-
5de29b
-  align = srcp % OPSIZ;
5de29b
-  sh_1 = 8 * (srcp % OPSIZ);
5de29b
-  sh_2 = 8 * OPSIZ - sh_1;
5de29b
-
5de29b
-  /* Make SRCP aligned by rounding it down to the beginning of the `op_t'
5de29b
-     it points in the middle of.  */
5de29b
-  srcp &= -OPSIZ;
5de29b
-  a0 = ((op_t *) srcp)[0];
5de29b
-
5de29b
-  if (len & 1)
5de29b
-  {
5de29b
-    a1 = ((op_t *) srcp)[1];
5de29b
-    ((op_t *) dstp)[0] = MERGE (a0, sh_1, a1, sh_2);
5de29b
-    
5de29b
-    if (len == 1)
5de29b
-      return;
5de29b
-    
5de29b
-    a0 = a1;
5de29b
-    srcp += OPSIZ;
5de29b
-    dstp += OPSIZ;
5de29b
-    len -= 1;
5de29b
-  }
5de29b
-
5de29b
-  fwd_align_merge (align);
5de29b
-
5de29b
-}
5de29b
-
5de29b
-/* _wordcopy_bwd_aligned -- Copy block finishing right before
5de29b
-   SRCP to block finishing right before DSTP with LEN `op_t' words
5de29b
-   (not LEN bytes!).  Both SRCP and DSTP should be aligned for memory
5de29b
-   operations on `op_t's.  */
5de29b
-
5de29b
-void
5de29b
-_wordcopy_bwd_aligned (dstp, srcp, len)
5de29b
-     long int dstp;
5de29b
-     long int srcp;
5de29b
-     size_t len;
5de29b
-{
5de29b
-  op_t a0, a1;
5de29b
-
5de29b
-  if (len & 1)
5de29b
-  {
5de29b
-    srcp -= OPSIZ;
5de29b
-    dstp -= OPSIZ;
5de29b
-    ((op_t *) dstp)[0] = ((op_t *) srcp)[0];
5de29b
-    
5de29b
-    if (len == 1)
5de29b
-      return;
5de29b
-    len -= 1;
5de29b
-  }
5de29b
-
5de29b
-  do
5de29b
-    {
5de29b
-      srcp -= 2 * OPSIZ;
5de29b
-      dstp -= 2 * OPSIZ;
5de29b
-
5de29b
-      a1 = ((op_t *) srcp)[1];
5de29b
-      a0 = ((op_t *) srcp)[0];
5de29b
-      ((op_t *) dstp)[1] = a1;
5de29b
-      ((op_t *) dstp)[0] = a0;
5de29b
-
5de29b
-      len -= 2;
5de29b
-    }
5de29b
-  while (len != 0);
5de29b
-}
5de29b
-
5de29b
-#define bwd_align_merge(align)                                         \
5de29b
-  do                                                                   \
5de29b
-    {                                                                  \
5de29b
-      srcp -= 2 * OPSIZ;                                               \
5de29b
-      dstp -= 2 * OPSIZ;                                               \
5de29b
-      a1 = ((op_t *) srcp)[1];                                         \
5de29b
-      a0 = ((op_t *) srcp)[0];                                         \
5de29b
-      ((op_t *) dstp)[1] = MERGE (a1, align*8, a2, (64-align*8));      \
5de29b
-      ((op_t *) dstp)[0] = MERGE (a0, align*8, a1, (64-align*8));      \
5de29b
-      a2 = a0;                                                         \
5de29b
-      len -= 2;                                                                \
5de29b
-    }                                                                  \
5de29b
-  while (len != 0)
5de29b
-
5de29b
-/* _wordcopy_bwd_dest_aligned -- Copy block finishing right
5de29b
-   before SRCP to block finishing right before DSTP with LEN `op_t'
5de29b
-   words (not LEN bytes!).  DSTP should be aligned for memory
5de29b
-   operations on `op_t', but SRCP must *not* be aligned.  */
5de29b
-
5de29b
-void
5de29b
-_wordcopy_bwd_dest_aligned (dstp, srcp, len)
5de29b
-     long int dstp;
5de29b
-     long int srcp;
5de29b
-     size_t len;
5de29b
-{
5de29b
-  op_t a0, a1, a2;
5de29b
-  int sh_1, sh_2;
5de29b
-  int align;
5de29b
-
5de29b
-  /* Calculate how to shift a word read at the memory operation
5de29b
-     aligned srcp to make it aligned for copy.  */
5de29b
-
5de29b
-  align = srcp % OPSIZ;
5de29b
-  sh_1 = 8 * (srcp % OPSIZ);
5de29b
-  sh_2 = 8 * OPSIZ - sh_1;
5de29b
-
5de29b
-  /* Make srcp aligned by rounding it down to the beginning of the op_t
5de29b
-     it points in the middle of.  */
5de29b
-  srcp &= -OPSIZ;
5de29b
-  a2 = ((op_t *) srcp)[0];
5de29b
-
5de29b
-  if (len & 1)
5de29b
-  {
5de29b
-    srcp -= OPSIZ;
5de29b
-    dstp -= OPSIZ;
5de29b
-    a1 = ((op_t *) srcp)[0];
5de29b
-    ((op_t *) dstp)[0] = MERGE (a1, sh_1, a2, sh_2);
5de29b
-
5de29b
-    if (len == 1)
5de29b
-      return;
5de29b
-
5de29b
-    a2 = a1;
5de29b
-    len -= 1;
5de29b
-  }
5de29b
-
5de29b
-  bwd_align_merge (align);
5de29b
-}
5de29b
-- 
5de29b
1.8.3.1
5de29b