ce426f
From 46450f90b70326319f8dc7f0e447e14f0cbd95e6 Mon Sep 17 00:00:00 2001
ce426f
From: Rajalakshmi Srinivasaraghavan <raji@linux.vnet.ibm.com>
ce426f
Date: Wed, 30 Jul 2014 05:01:14 -0500
ce426f
Subject: [PATCH] PowerPC: multiarch memcpy for PowerPC64
ce426f
ce426f
commit b5beafbceec80b5a33d3383dde88196afc966e67 Author:
ce426f
 Adhemerval Zanella <azanella@linux.vnet.ibm.com> Date:   Fri Dec 13 14:31:41
ce426f
 2013 -0500
ce426f
ce426f
    PowerPC: multiarch memcpy for PowerPC64
ce426f
ce426f
Added sysdeps/powerpc/powerpc32/power4/multiarch/init-arch.h which was not part
ce426f
of original commit
ce426f
---
ce426f
 .../powerpc/powerpc32/power4/multiarch/init-arch.h | 52 +++++++++++++++++
ce426f
 sysdeps/powerpc/powerpc64/multiarch/Makefile       |  4 ++
ce426f
 .../powerpc/powerpc64/multiarch/ifunc-impl-list.c  | 66 ++++++++++++++++++++++
ce426f
 sysdeps/powerpc/powerpc64/multiarch/init-arch.h    | 18 ++++++
ce426f
 sysdeps/powerpc/powerpc64/multiarch/memcpy-a2.S    | 39 +++++++++++++
ce426f
 sysdeps/powerpc/powerpc64/multiarch/memcpy-cell.S  | 39 +++++++++++++
ce426f
 .../powerpc/powerpc64/multiarch/memcpy-power4.S    | 39 +++++++++++++
ce426f
 .../powerpc/powerpc64/multiarch/memcpy-power6.S    | 39 +++++++++++++
ce426f
 .../powerpc/powerpc64/multiarch/memcpy-power7.S    | 39 +++++++++++++
ce426f
 sysdeps/powerpc/powerpc64/multiarch/memcpy-ppc64.S | 41 ++++++++++++++
ce426f
 sysdeps/powerpc/powerpc64/multiarch/memcpy.c       | 55 ++++++++++++++++++
ce426f
 11 files changed, 431 insertions(+)
ce426f
 create mode 100644 sysdeps/powerpc/powerpc32/power4/multiarch/init-arch.h
ce426f
 create mode 100644 sysdeps/powerpc/powerpc64/multiarch/Makefile
ce426f
 create mode 100644 sysdeps/powerpc/powerpc64/multiarch/ifunc-impl-list.c
ce426f
 create mode 100644 sysdeps/powerpc/powerpc64/multiarch/init-arch.h
ce426f
 create mode 100644 sysdeps/powerpc/powerpc64/multiarch/memcpy-a2.S
ce426f
 create mode 100644 sysdeps/powerpc/powerpc64/multiarch/memcpy-cell.S
ce426f
 create mode 100644 sysdeps/powerpc/powerpc64/multiarch/memcpy-power4.S
ce426f
 create mode 100644 sysdeps/powerpc/powerpc64/multiarch/memcpy-power6.S
ce426f
 create mode 100644 sysdeps/powerpc/powerpc64/multiarch/memcpy-power7.S
ce426f
 create mode 100644 sysdeps/powerpc/powerpc64/multiarch/memcpy-ppc64.S
ce426f
 create mode 100644 sysdeps/powerpc/powerpc64/multiarch/memcpy.c
ce426f
ce426f
diff --git glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power4/multiarch/init-arch.h glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power4/multiarch/init-arch.h
ce426f
new file mode 100644
ce426f
index 0000000..51a34f2
ce426f
--- /dev/null
ce426f
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power4/multiarch/init-arch.h
ce426f
@@ -0,0 +1,52 @@
ce426f
+/* This file is part of the GNU C Library.
ce426f
+   Copyright (C) 2013-2014 Free Software Foundation, Inc.
ce426f
+
ce426f
+   The GNU C Library is free software; you can redistribute it and/or
ce426f
+   modify it under the terms of the GNU Lesser General Public
ce426f
+   License as published by the Free Software Foundation; either
ce426f
+   version 2.1 of the License, or (at your option) any later version.
ce426f
+
ce426f
+   The GNU C Library is distributed in the hope that it will be useful,
ce426f
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
ce426f
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
ce426f
+   Lesser General Public License for more details.
ce426f
+
ce426f
+   You should have received a copy of the GNU Lesser General Public
ce426f
+   License along with the GNU C Library; if not, see
ce426f
+   <http://www.gnu.org/licenses/>.  */
ce426f
+
ce426f
+#include <ldsodefs.h>
ce426f
+
ce426f
+/* The code checks if _rtld_global_ro was realocated before trying to access
ce426f
+   the dl_hwcap field. The assembly is to make the compiler not optimize the
ce426f
+   test (&_rtld_global_ro != NULL), which is always true in ISO C (but not
ce426f
+   in that case since _rtld_global_ro might not been realocated yet).  */
ce426f
+#if defined(SHARED) && !defined(IS_IN_rtld)
ce426f
+# define __GLRO(value) \
ce426f
+  ({ volatile void **__p = (volatile void**)(&_rtld_global_ro);	\
ce426f
+    unsigned long int __ret;					\
ce426f
+     asm ("# x in %0" : "+r" (__p));				\
ce426f
+     __ret = (__p) ? GLRO(value) : 0;				\
ce426f
+     __ret; })
ce426f
+#else
ce426f
+# define __GLRO(value)  GLRO(value)
ce426f
+#endif
ce426f
+
ce426f
+/* dl_hwcap contains only the latest supported ISA, the macro checks which is
ce426f
+   and fills the previous ones.  */
ce426f
+#define INIT_ARCH() \
ce426f
+  unsigned long int hwcap = __GLRO(dl_hwcap); 			\
ce426f
+  if (hwcap & PPC_FEATURE_ARCH_2_06)				\
ce426f
+    hwcap |= PPC_FEATURE_ARCH_2_05 |				\
ce426f
+	     PPC_FEATURE_POWER5_PLUS |				\
ce426f
+	     PPC_FEATURE_POWER5 |				\
ce426f
+	     PPC_FEATURE_POWER4;				\
ce426f
+  else if (hwcap & PPC_FEATURE_ARCH_2_05)			\
ce426f
+    hwcap |= PPC_FEATURE_POWER5_PLUS |				\
ce426f
+	     PPC_FEATURE_POWER5 |				\
ce426f
+	     PPC_FEATURE_POWER4;				\
ce426f
+  else if (hwcap & PPC_FEATURE_POWER5_PLUS)			\
ce426f
+    hwcap |= PPC_FEATURE_POWER5 |				\
ce426f
+	     PPC_FEATURE_POWER4;				\
ce426f
+  else if (hwcap & PPC_FEATURE_POWER5)				\
ce426f
+    hwcap |= PPC_FEATURE_POWER4;
ce426f
diff --git glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/Makefile glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/Makefile
ce426f
new file mode 100644
ce426f
index 0000000..638c102
ce426f
--- /dev/null
ce426f
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/Makefile
ce426f
@@ -0,0 +1,4 @@
ce426f
+ifeq ($(subdir),string)
ce426f
+sysdep_routines += memcpy-power7 memcpy-a2 memcpy-power6 memcpy-cell \
ce426f
+                  memcpy-power4 memcpy-ppc64
ce426f
+endif
ce426f
diff --git glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/ifunc-impl-list.c glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/ifunc-impl-list.c
ce426f
new file mode 100644
ce426f
index 0000000..5090af4
ce426f
--- /dev/null
ce426f
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/ifunc-impl-list.c
ce426f
@@ -0,0 +1,66 @@
ce426f
+/* Enumerate available IFUNC implementations of a function.  PowerPC64 version.
ce426f
+   Copyright (C) 2013 Free Software Foundation, Inc.
ce426f
+   This file is part of the GNU C Library.
ce426f
+
ce426f
+   The GNU C Library is free software; you can redistribute it and/or
ce426f
+   modify it under the terms of the GNU Lesser General Public
ce426f
+   License as published by the Free Software Foundation; either
ce426f
+   version 2.1 of the License, or (at your option) any later version.
ce426f
+
ce426f
+   The GNU C Library is distributed in the hope that it will be useful,
ce426f
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
ce426f
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
ce426f
+   Lesser General Public License for more details.
ce426f
+
ce426f
+   You should have received a copy of the GNU Lesser General Public
ce426f
+   License along with the GNU C Library; if not, see
ce426f
+   <http://www.gnu.org/licenses/>.  */
ce426f
+
ce426f
+#include <assert.h>
ce426f
+#include <string.h>
ce426f
+#include <wchar.h>
ce426f
+#include <ldsodefs.h>
ce426f
+#include <ifunc-impl-list.h>
ce426f
+
ce426f
+/* Maximum number of IFUNC implementations.  */
ce426f
+#define MAX_IFUNC      6
ce426f
+
ce426f
+size_t
ce426f
+__libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
ce426f
+                       size_t max)
ce426f
+{
ce426f
+  assert (max >= MAX_IFUNC);
ce426f
+
ce426f
+  size_t i = 0;
ce426f
+
ce426f
+  unsigned long int hwcap = GLRO(dl_hwcap);
ce426f
+  /* hwcap contains only the latest supported ISA, the code checks which is
ce426f
+     and fills the previous supported ones.  */
ce426f
+  if (hwcap & PPC_FEATURE_ARCH_2_06)
ce426f
+    hwcap |= PPC_FEATURE_ARCH_2_05 | PPC_FEATURE_POWER5_PLUS |
ce426f
+             PPC_FEATURE_POWER5 | PPC_FEATURE_POWER4;
ce426f
+  else if (hwcap & PPC_FEATURE_ARCH_2_05)
ce426f
+    hwcap |= PPC_FEATURE_POWER5_PLUS | PPC_FEATURE_POWER5 | PPC_FEATURE_POWER4;
ce426f
+  else if (hwcap & PPC_FEATURE_POWER5_PLUS)
ce426f
+    hwcap |= PPC_FEATURE_POWER5 | PPC_FEATURE_POWER4;
ce426f
+  else if (hwcap & PPC_FEATURE_POWER5)
ce426f
+    hwcap |= PPC_FEATURE_POWER4;
ce426f
+
ce426f
+#ifdef SHARED
ce426f
+  /* Support sysdeps/powerpc/powerpc64/multiarch/memcpy.c.  */
ce426f
+  IFUNC_IMPL (i, name, memcpy,
ce426f
+             IFUNC_IMPL_ADD (array, i, memcpy, hwcap & PPC_FEATURE_HAS_VSX,
ce426f
+                             __memcpy_power7)
ce426f
+             IFUNC_IMPL_ADD (array, i, memcpy, hwcap & PPC_FEATURE_ARCH_2_06,
ce426f
+                             __memcpy_a2)
ce426f
+             IFUNC_IMPL_ADD (array, i, memcpy, hwcap & PPC_FEATURE_ARCH_2_05,
ce426f
+                             __memcpy_power6)
ce426f
+             IFUNC_IMPL_ADD (array, i, memcpy, hwcap & PPC_FEATURE_CELL_BE,
ce426f
+                             __memcpy_cell)
ce426f
+             IFUNC_IMPL_ADD (array, i, memcpy, hwcap & PPC_FEATURE_POWER4,
ce426f
+                             __memcpy_power4)
ce426f
+             IFUNC_IMPL_ADD (array, i, memcpy, 1, __memcpy_ppc))
ce426f
+#endif
ce426f
+
ce426f
+  return i;
ce426f
+}
ce426f
diff --git glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/init-arch.h glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/init-arch.h
ce426f
new file mode 100644
ce426f
index 0000000..b7d238c
ce426f
--- /dev/null
ce426f
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/init-arch.h
ce426f
@@ -0,0 +1,18 @@
ce426f
+/* This file is part of the GNU C Library.
ce426f
+   Copyright (C) 2013 Free Software Foundation, Inc.
ce426f
+
ce426f
+   The GNU C Library is free software; you can redistribute it and/or
ce426f
+   modify it under the terms of the GNU Lesser General Public
ce426f
+   License as published by the Free Software Foundation; either
ce426f
+   version 2.1 of the License, or (at your option) any later version.
ce426f
+
ce426f
+   The GNU C Library is distributed in the hope that it will be useful,
ce426f
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
ce426f
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
ce426f
+   Lesser General Public License for more details.
ce426f
+
ce426f
+   You should have received a copy of the GNU Lesser General Public
ce426f
+   License along with the GNU C Library; if not, see
ce426f
+   <http://www.gnu.org/licenses/>.  */
ce426f
+
ce426f
+#include <sysdeps/powerpc/powerpc32/power4/multiarch/init-arch.h>
ce426f
diff --git glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/memcpy-a2.S glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/memcpy-a2.S
ce426f
new file mode 100644
ce426f
index 0000000..2d5bfa9
ce426f
--- /dev/null
ce426f
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/memcpy-a2.S
ce426f
@@ -0,0 +1,39 @@
ce426f
+/* Optimized memcpy implementation for PowerPC A2.
ce426f
+   Copyright (C) 2013-2014 Free Software Foundation, Inc.
ce426f
+   This file is part of the GNU C Library.
ce426f
+
ce426f
+   The GNU C Library is free software; you can redistribute it and/or
ce426f
+   modify it under the terms of the GNU Lesser General Public
ce426f
+   License as published by the Free Software Foundation; either
ce426f
+   version 2.1 of the License, or (at your option) any later version.
ce426f
+
ce426f
+   The GNU C Library is distributed in the hope that it will be useful,
ce426f
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
ce426f
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
ce426f
+   Lesser General Public License for more details.
ce426f
+
ce426f
+   You should have received a copy of the GNU Lesser General Public
ce426f
+   License along with the GNU C Library; if not, see
ce426f
+   <http://www.gnu.org/licenses/>.  */
ce426f
+
ce426f
+#include <sysdep.h>
ce426f
+
ce426f
+#undef EALIGN
ce426f
+#define EALIGN(name, alignt, words)				\
ce426f
+  .section ".text";						\
ce426f
+  ENTRY_2(__memcpy_a2)						\
ce426f
+  .align ALIGNARG(alignt);					\
ce426f
+  EALIGN_W_##words;						\
ce426f
+  BODY_LABEL(__memcpy_a2):					\
ce426f
+  cfi_startproc;
ce426f
+
ce426f
+#undef END_GEN_TB
ce426f
+#define END_GEN_TB(name, mask)					\
ce426f
+  cfi_endproc;							\
ce426f
+  TRACEBACK_MASK(__memcpy_a2,mask)				\
ce426f
+  END_2(__memcpy_a2)
ce426f
+
ce426f
+#undef libc_hidden_builtin_def
ce426f
+#define libc_hidden_builtin_def(name)
ce426f
+
ce426f
+#include <sysdeps/powerpc/powerpc64/a2/memcpy.S>
ce426f
diff --git glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/memcpy-cell.S glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/memcpy-cell.S
ce426f
new file mode 100644
ce426f
index 0000000..92c06be
ce426f
--- /dev/null
ce426f
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/memcpy-cell.S
ce426f
@@ -0,0 +1,39 @@
ce426f
+/* Optimized memcpy implementation for PowerPC/CELL.
ce426f
+   Copyright (C) 2013-2014 Free Software Foundation, Inc.
ce426f
+   This file is part of the GNU C Library.
ce426f
+
ce426f
+   The GNU C Library is free software; you can redistribute it and/or
ce426f
+   modify it under the terms of the GNU Lesser General Public
ce426f
+   License as published by the Free Software Foundation; either
ce426f
+   version 2.1 of the License, or (at your option) any later version.
ce426f
+
ce426f
+   The GNU C Library is distributed in the hope that it will be useful,
ce426f
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
ce426f
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
ce426f
+   Lesser General Public License for more details.
ce426f
+
ce426f
+   You should have received a copy of the GNU Lesser General Public
ce426f
+   License along with the GNU C Library; if not, see
ce426f
+   <http://www.gnu.org/licenses/>.  */
ce426f
+
ce426f
+#include <sysdep.h>
ce426f
+
ce426f
+#undef EALIGN
ce426f
+#define EALIGN(name, alignt, words)				\
ce426f
+  .section ".text";						\
ce426f
+  ENTRY_2(__memcpy_cell)					\
ce426f
+  .align ALIGNARG(alignt);					\
ce426f
+  EALIGN_W_##words;						\
ce426f
+  BODY_LABEL(__memcpy_cell):					\
ce426f
+  cfi_startproc;
ce426f
+
ce426f
+#undef END_GEN_TB
ce426f
+#define END_GEN_TB(name, mask)					\
ce426f
+  cfi_endproc;							\
ce426f
+  TRACEBACK_MASK(__memcpy_cell,mask)				\
ce426f
+  END_2(__memcpy_cell)
ce426f
+
ce426f
+#undef libc_hidden_builtin_def
ce426f
+#define libc_hidden_builtin_def(name)
ce426f
+
ce426f
+#include <sysdeps/powerpc/powerpc64/cell/memcpy.S>
ce426f
diff --git glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/memcpy-power4.S glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/memcpy-power4.S
ce426f
new file mode 100644
ce426f
index 0000000..eb01d67
ce426f
--- /dev/null
ce426f
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/memcpy-power4.S
ce426f
@@ -0,0 +1,39 @@
ce426f
+/* Optimized memcpy implementation for PowerPC64/POWER4.
ce426f
+   Copyright (C) 2013-2014 Free Software Foundation, Inc.
ce426f
+   This file is part of the GNU C Library.
ce426f
+
ce426f
+   The GNU C Library is free software; you can redistribute it and/or
ce426f
+   modify it under the terms of the GNU Lesser General Public
ce426f
+   License as published by the Free Software Foundation; either
ce426f
+   version 2.1 of the License, or (at your option) any later version.
ce426f
+
ce426f
+   The GNU C Library is distributed in the hope that it will be useful,
ce426f
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
ce426f
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
ce426f
+   Lesser General Public License for more details.
ce426f
+
ce426f
+   You should have received a copy of the GNU Lesser General Public
ce426f
+   License along with the GNU C Library; if not, see
ce426f
+   <http://www.gnu.org/licenses/>.  */
ce426f
+
ce426f
+#include <sysdep.h>
ce426f
+
ce426f
+#undef EALIGN
ce426f
+#define EALIGN(name, alignt, words)				\
ce426f
+  .section ".text";						\
ce426f
+  ENTRY_2(__memcpy_power4)					\
ce426f
+  .align ALIGNARG(alignt);					\
ce426f
+  EALIGN_W_##words;						\
ce426f
+  BODY_LABEL(__memcpy_power4):					\
ce426f
+  cfi_startproc;
ce426f
+
ce426f
+#undef END_GEN_TB
ce426f
+#define END_GEN_TB(name, mask)					\
ce426f
+  cfi_endproc;							\
ce426f
+  TRACEBACK_MASK(__memcpy_power4,mask)				\
ce426f
+  END_2(__memcpy_power4)
ce426f
+
ce426f
+#undef libc_hidden_builtin_def
ce426f
+#define libc_hidden_builtin_def(name)
ce426f
+
ce426f
+#include <sysdeps/powerpc/powerpc64/power4/memcpy.S>
ce426f
diff --git glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/memcpy-power6.S glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/memcpy-power6.S
ce426f
new file mode 100644
ce426f
index 0000000..13b514d
ce426f
--- /dev/null
ce426f
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/memcpy-power6.S
ce426f
@@ -0,0 +1,39 @@
ce426f
+/* Optimized memcpy implementation for PowerPC/POWER6.
ce426f
+   Copyright (C) 2013-2014 Free Software Foundation, Inc.
ce426f
+   This file is part of the GNU C Library.
ce426f
+
ce426f
+   The GNU C Library is free software; you can redistribute it and/or
ce426f
+   modify it under the terms of the GNU Lesser General Public
ce426f
+   License as published by the Free Software Foundation; either
ce426f
+   version 2.1 of the License, or (at your option) any later version.
ce426f
+
ce426f
+   The GNU C Library is distributed in the hope that it will be useful,
ce426f
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
ce426f
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
ce426f
+   Lesser General Public License for more details.
ce426f
+
ce426f
+   You should have received a copy of the GNU Lesser General Public
ce426f
+   License along with the GNU C Library; if not, see
ce426f
+   <http://www.gnu.org/licenses/>.  */
ce426f
+
ce426f
+#include <sysdep.h>
ce426f
+
ce426f
+#undef EALIGN
ce426f
+#define EALIGN(name, alignt, words)				\
ce426f
+  .section ".text";						\
ce426f
+  ENTRY_2(__memcpy_power6)					\
ce426f
+  .align ALIGNARG(alignt);					\
ce426f
+  EALIGN_W_##words;						\
ce426f
+  BODY_LABEL(__memcpy_power6):					\
ce426f
+  cfi_startproc;
ce426f
+
ce426f
+#undef END_GEN_TB
ce426f
+#define END_GEN_TB(name, mask)					\
ce426f
+  cfi_endproc;							\
ce426f
+  TRACEBACK_MASK(__memcpy_power6,mask)				\
ce426f
+  END_2(__memcpy_power6)
ce426f
+
ce426f
+#undef libc_hidden_builtin_def
ce426f
+#define libc_hidden_builtin_def(name)
ce426f
+
ce426f
+#include <sysdeps/powerpc/powerpc64/power6/memcpy.S>
ce426f
diff --git glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/memcpy-power7.S glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/memcpy-power7.S
ce426f
new file mode 100644
ce426f
index 0000000..2aea73d
ce426f
--- /dev/null
ce426f
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/memcpy-power7.S
ce426f
@@ -0,0 +1,39 @@
ce426f
+/* Optimized memcpy implementation for PowerPC/POWER7.
ce426f
+   Copyright (C) 2013-2014 Free Software Foundation, Inc.
ce426f
+   This file is part of the GNU C Library.
ce426f
+
ce426f
+   The GNU C Library is free software; you can redistribute it and/or
ce426f
+   modify it under the terms of the GNU Lesser General Public
ce426f
+   License as published by the Free Software Foundation; either
ce426f
+   version 2.1 of the License, or (at your option) any later version.
ce426f
+
ce426f
+   The GNU C Library is distributed in the hope that it will be useful,
ce426f
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
ce426f
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
ce426f
+   Lesser General Public License for more details.
ce426f
+
ce426f
+   You should have received a copy of the GNU Lesser General Public
ce426f
+   License along with the GNU C Library; if not, see
ce426f
+   <http://www.gnu.org/licenses/>.  */
ce426f
+
ce426f
+#include <sysdep.h>
ce426f
+
ce426f
+#undef EALIGN
ce426f
+#define EALIGN(name, alignt, words)				\
ce426f
+  .section ".text";						\
ce426f
+  ENTRY_2(__memcpy_power7)					\
ce426f
+  .align ALIGNARG(alignt);					\
ce426f
+  EALIGN_W_##words;						\
ce426f
+  BODY_LABEL(__memcpy_power7):					\
ce426f
+  cfi_startproc;
ce426f
+
ce426f
+#undef END_GEN_TB
ce426f
+#define END_GEN_TB(name, mask)					\
ce426f
+  cfi_endproc;							\
ce426f
+  TRACEBACK_MASK(__memcpy_power7,mask)				\
ce426f
+  END_2(__memcpy_power7)
ce426f
+
ce426f
+#undef libc_hidden_builtin_def
ce426f
+#define libc_hidden_builtin_def(name)
ce426f
+
ce426f
+#include <sysdeps/powerpc/powerpc64/power7/memcpy.S>
ce426f
diff --git glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/memcpy-ppc64.S glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/memcpy-ppc64.S
ce426f
new file mode 100644
ce426f
index 0000000..b828915
ce426f
--- /dev/null
ce426f
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/memcpy-ppc64.S
ce426f
@@ -0,0 +1,41 @@
ce426f
+/* Default memcpy implementation for PowerPC64.
ce426f
+   Copyright (C) 2013-2014 Free Software Foundation, Inc.
ce426f
+   This file is part of the GNU C Library.
ce426f
+
ce426f
+   The GNU C Library is free software; you can redistribute it and/or
ce426f
+   modify it under the terms of the GNU Lesser General Public
ce426f
+   License as published by the Free Software Foundation; either
ce426f
+   version 2.1 of the License, or (at your option) any later version.
ce426f
+
ce426f
+   The GNU C Library is distributed in the hope that it will be useful,
ce426f
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
ce426f
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
ce426f
+   Lesser General Public License for more details.
ce426f
+
ce426f
+   You should have received a copy of the GNU Lesser General Public
ce426f
+   License along with the GNU C Library; if not, see
ce426f
+   <http://www.gnu.org/licenses/>.  */
ce426f
+
ce426f
+#include <sysdep.h>
ce426f
+
ce426f
+#if defined SHARED && !defined NOT_IN_libc
ce426f
+# undef EALIGN
ce426f
+# define EALIGN(name, alignt, words)				\
ce426f
+  .section ".text";						\
ce426f
+  ENTRY_2(__memcpy_ppc)						\
ce426f
+  .align ALIGNARG(alignt);					\
ce426f
+  EALIGN_W_##words;						\
ce426f
+  BODY_LABEL(__memcpy_ppc):					\
ce426f
+  cfi_startproc;
ce426f
+
ce426f
+# undef END_GEN_TB
ce426f
+# define END_GEN_TB(name, mask)					\
ce426f
+   cfi_endproc;							\
ce426f
+   TRACEBACK_MASK(__memcpy_ppc,mask)				\
ce426f
+   END_2(__memcpy_ppc)
ce426f
+
ce426f
+# undef libc_hidden_builtin_def
ce426f
+# define libc_hidden_builtin_def(name)
ce426f
+#endif
ce426f
+
ce426f
+#include <sysdeps/powerpc/powerpc64/memcpy.S>
ce426f
diff --git glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/memcpy.c glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/memcpy.c
ce426f
new file mode 100644
ce426f
index 0000000..305e963
ce426f
--- /dev/null
ce426f
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/memcpy.c
ce426f
@@ -0,0 +1,55 @@
ce426f
+/* Multiple versions of memcpy. PowerPC64 version.
ce426f
+   Copyright (C) 2013-2014 Free Software Foundation, Inc.
ce426f
+   This file is part of the GNU C Library.
ce426f
+
ce426f
+   The GNU C Library is free software; you can redistribute it and/or
ce426f
+   modify it under the terms of the GNU Lesser General Public
ce426f
+   License as published by the Free Software Foundation; either
ce426f
+   version 2.1 of the License, or (at your option) any later version.
ce426f
+
ce426f
+   The GNU C Library is distributed in the hope that it will be useful,
ce426f
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
ce426f
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
ce426f
+   Lesser General Public License for more details.
ce426f
+
ce426f
+   You should have received a copy of the GNU Lesser General Public
ce426f
+   License along with the GNU C Library; if not, see
ce426f
+   <http://www.gnu.org/licenses/>.  */
ce426f
+
ce426f
+/* Define multiple versions only for the definition in lib and for
ce426f
+   DSO.  In static binaries we need memcpy before the initialization
ce426f
+   happened.  */
ce426f
+#if defined SHARED && !defined NOT_IN_libc
ce426f
+/* Redefine memcpy so that the compiler won't complain about the type
ce426f
+   mismatch with the IFUNC selector in strong_alias, below.  */
ce426f
+# undef memcpy
ce426f
+# define memcpy __redirect_memcpy
ce426f
+# include <string.h>
ce426f
+# include "init-arch.h"
ce426f
+
ce426f
+extern __typeof (__redirect_memcpy) __libc_memcpy;
ce426f
+
ce426f
+extern __typeof (__redirect_memcpy) __memcpy_ppc attribute_hidden;
ce426f
+extern __typeof (__redirect_memcpy) __memcpy_power4 attribute_hidden;
ce426f
+extern __typeof (__redirect_memcpy) __memcpy_cell attribute_hidden;
ce426f
+extern __typeof (__redirect_memcpy) __memcpy_power6 attribute_hidden;
ce426f
+extern __typeof (__redirect_memcpy) __memcpy_a2 attribute_hidden;
ce426f
+extern __typeof (__redirect_memcpy) __memcpy_power7 attribute_hidden;
ce426f
+
ce426f
+libc_ifunc (__libc_memcpy,
ce426f
+            (hwcap & PPC_FEATURE_HAS_VSX)
ce426f
+            ? __memcpy_power7 :
ce426f
+	      (hwcap & PPC_FEATURE_ARCH_2_06)
ce426f
+	      ? __memcpy_a2 :
ce426f
+		(hwcap & PPC_FEATURE_ARCH_2_05)
ce426f
+		? __memcpy_power6 :
ce426f
+		  (hwcap & PPC_FEATURE_CELL_BE)
ce426f
+		  ? __memcpy_cell :
ce426f
+		    (hwcap & PPC_FEATURE_POWER4)
ce426f
+		    ? __memcpy_power4
ce426f
+            : __memcpy_ppc);
ce426f
+
ce426f
+#undef memcpy
ce426f
+strong_alias (__libc_memcpy, memcpy);
ce426f
+libc_hidden_ver (__libc_memcpy, memcpy);
ce426f
+#endif
ce426f
-- 
ce426f
1.8.3.1
ce426f