bca718
From 6db8663b21a826cbf689a297a898675078256166 Mon Sep 17 00:00:00 2001
bca718
From: Stefan Liebler <stli@linux.vnet.ibm.com>
bca718
Date: Thu, 8 Oct 2015 10:44:39 +0200
bca718
Subject: [PATCH 05/30] S390: Refactor ifunc implementations and enable
bca718
 ifunc-test-framework.
bca718
bca718
upstream-commit-id: 31556246c3ac168a2dfec8f9036d913765bbb73d
bca718
https://www.sourceware.org/ml/libc-alpha/2015-07/msg00088.html
bca718
bca718
On s390 all ifunc resolvers were implemented in multiarch/ifunc-resolve.c.
bca718
The resulting single object files has undefined references to all ifunc-functions.
bca718
This patch introduces one multiarch/<func>.c file for each of memcpy, memcmp
bca718
and memset with the function specific ifunc resolver. The different function
bca718
implementations are now implemented in multiarch/<func>-s390x.S
bca718
(moved from multiarch/<func>.S).
bca718
bca718
The new multiarch/ifunc-resolve.h file contains the ifunc-resolver macro
bca718
and other helper-macros. They are merged and are now used in common for
bca718
32/64bit. Therefore the __<func>_g5/__<func>_z900 functions were renamed to
bca718
__<func>_default.
bca718
bca718
This patch also enables testing the ifunc implementations by implementing
bca718
the function __libc_ifunc_impl_list. It uses the helper-macros of ifunc-resolve.h.
bca718
bca718
ChangeLog:
bca718
bca718
	* sysdeps/s390/s390-32/multiarch/Makefile (sysdep_routines):
bca718
	Remove ifunc-resolve, add memset-s390, memcpy-s390, memcmp-s390.
bca718
	* sysdeps/s390/s390-32/multiarch/ifunc-resolve.c: Delete File.
bca718
	* sysdeps/s390/s390-32/multiarch/memcmp.S: Move to ...
bca718
	* sysdeps/s390/s390-32/multiarch/memcmp-s390.S: ... here.
bca718
	(memcmp, bcmp): Use __memcmp_default as alias source.
bca718
	* sysdeps/s390/s390-32/multiarch/memcmp.c: New File.
bca718
	* sysdeps/s390/s390-32/memcmp.S (__memcmp_g5):
bca718
	Rename to __memcmp_default.
bca718
	* sysdeps/s390/s390-32/multiarch/memcpy.S: Move to ...
bca718
	* sysdeps/s390/s390-32/multiarch/memcpy-s390.S: ... here.
bca718
	(memcpy): Use __memcpy_default as alias source.
bca718
	* sysdeps/s390/s390-32/multiarch/memcpy.c: New File.
bca718
	* sysdeps/s390/s390-32/memcpy.S (__memcpy_g5):
bca718
	Rename to __memcpy_default.
bca718
	* sysdeps/s390/s390-32/multiarch/memset.S: Move to ...
bca718
	* sysdeps/s390/s390-32/multiarch/memset-s390.S: ... here.
bca718
	(memset): Use __memset_default as alias source.
bca718
	* sysdeps/s390/s390-32/multiarch/memset.c: New File.
bca718
	* sysdeps/s390/s390-32/memset.S (__memset_g5):
bca718
	Rename to __memset_default.
bca718
	* sysdeps/s390/s390-64/multiarch/Makefile (sysdep_routines):
bca718
	Remove ifunc-resolve, add memset-s390x, memcpy-s390x, memcmp-s390x.
bca718
	* sysdeps/s390/s390-64/multiarch/ifunc-resolve.c: Delete File.
bca718
	* sysdeps/s390/s390-64/multiarch/memcmp.S: Move to ...
bca718
	* sysdeps/s390/s390-64/multiarch/memcmp-s390x.S: ... here.
bca718
	(memcmp, bcmp): Use __memcmp_default as alias source.
bca718
	* sysdeps/s390/s390-64/multiarch/memcmp.c: New File.
bca718
	* sysdeps/s390/s390-64/memcmp.S (__memcmp_z900):
bca718
	Rename to __memcmp_default.
bca718
	* sysdeps/s390/s390-64/multiarch/memcpy.S: Move to ...
bca718
	* sysdeps/s390/s390-64/multiarch/memcpy-s390x.S: ... here.
bca718
	(memcpy): Use __memcpy_default as alias source.
bca718
	* sysdeps/s390/s390-64/multiarch/memcpy.c: New File.
bca718
	* sysdeps/s390/s390-64/memcpy.S (__memcpy_z900):
bca718
	Rename to __memcpy_default.
bca718
	* sysdeps/s390/s390-64/multiarch/memset.S: Move to ...
bca718
	* sysdeps/s390/s390-64/multiarch/memset-s390x.S: ... here.
bca718
	(memset): Use __memset_default as alias source.
bca718
	* sysdeps/s390/s390-64/multiarch/memset.c: New File.
bca718
	* sysdeps/s390/s390-64/memset.S (__memset_z900):
bca718
	Rename to __memset_default.
bca718
	* sysdeps/s390/multiarch/ifunc-resolve.h: New File.
bca718
	* sysdeps/s390/multiarch/ifunc-impl-list.c: New File.
bca718
---
bca718
 sysdeps/s390/multiarch/ifunc-impl-list.c       |  74 ++++++++++++++++
bca718
 sysdeps/s390/multiarch/ifunc-resolve.h         |  75 ++++++++++++++++
bca718
 sysdeps/s390/s390-32/memcmp.S                  |  46 +++++-----
bca718
 sysdeps/s390/s390-32/memcpy.S                  |  50 +++++------
bca718
 sysdeps/s390/s390-32/memset.S                  |  44 +++++-----
bca718
 sysdeps/s390/s390-32/multiarch/Makefile        |   3 +-
bca718
 sysdeps/s390/s390-32/multiarch/ifunc-resolve.c |  72 ----------------
bca718
 sysdeps/s390/s390-32/multiarch/memcmp-s390.S   | 104 +++++++++++++++++++++++
bca718
 sysdeps/s390/s390-32/multiarch/memcmp.S        | 104 -----------------------
bca718
 sysdeps/s390/s390-32/multiarch/memcmp.c        |  24 ++++++
bca718
 sysdeps/s390/s390-32/multiarch/memcpy-s390.S   |  98 +++++++++++++++++++++
bca718
 sysdeps/s390/s390-32/multiarch/memcpy.S        |  98 ---------------------
bca718
 sysdeps/s390/s390-32/multiarch/memcpy.c        |  24 ++++++
bca718
 sysdeps/s390/s390-32/multiarch/memset-s390.S   | 113 +++++++++++++++++++++++++
bca718
 sysdeps/s390/s390-32/multiarch/memset.S        | 113 -------------------------
bca718
 sysdeps/s390/s390-32/multiarch/memset.c        |  23 +++++
bca718
 sysdeps/s390/s390-64/memcmp.S                  |  42 ++++-----
bca718
 sysdeps/s390/s390-64/memcpy.S                  |  40 ++++-----
bca718
 sysdeps/s390/s390-64/memset.S                  |  40 ++++-----
bca718
 sysdeps/s390/s390-64/multiarch/Makefile        |   3 +-
bca718
 sysdeps/s390/s390-64/multiarch/ifunc-resolve.c |  76 -----------------
bca718
 sysdeps/s390/s390-64/multiarch/memcmp-s390x.S  | 101 ++++++++++++++++++++++
bca718
 sysdeps/s390/s390-64/multiarch/memcmp.S        | 101 ----------------------
bca718
 sysdeps/s390/s390-64/multiarch/memcmp.c        |  24 ++++++
bca718
 sysdeps/s390/s390-64/multiarch/memcpy-s390x.S  |  94 ++++++++++++++++++++
bca718
 sysdeps/s390/s390-64/multiarch/memcpy.S        |  94 --------------------
bca718
 sysdeps/s390/s390-64/multiarch/memcpy.c        |  24 ++++++
bca718
 sysdeps/s390/s390-64/multiarch/memset-s390x.S  | 109 ++++++++++++++++++++++++
bca718
 sysdeps/s390/s390-64/multiarch/memset.S        | 109 ------------------------
bca718
 sysdeps/s390/s390-64/multiarch/memset.c        |  23 +++++
bca718
 30 files changed, 1045 insertions(+), 900 deletions(-)
bca718
 create mode 100644 sysdeps/s390/multiarch/ifunc-impl-list.c
bca718
 create mode 100644 sysdeps/s390/multiarch/ifunc-resolve.h
bca718
 delete mode 100644 sysdeps/s390/s390-32/multiarch/ifunc-resolve.c
bca718
 create mode 100644 sysdeps/s390/s390-32/multiarch/memcmp-s390.S
bca718
 delete mode 100644 sysdeps/s390/s390-32/multiarch/memcmp.S
bca718
 create mode 100644 sysdeps/s390/s390-32/multiarch/memcmp.c
bca718
 create mode 100644 sysdeps/s390/s390-32/multiarch/memcpy-s390.S
bca718
 delete mode 100644 sysdeps/s390/s390-32/multiarch/memcpy.S
bca718
 create mode 100644 sysdeps/s390/s390-32/multiarch/memcpy.c
bca718
 create mode 100644 sysdeps/s390/s390-32/multiarch/memset-s390.S
bca718
 delete mode 100644 sysdeps/s390/s390-32/multiarch/memset.S
bca718
 create mode 100644 sysdeps/s390/s390-32/multiarch/memset.c
bca718
 delete mode 100644 sysdeps/s390/s390-64/multiarch/ifunc-resolve.c
bca718
 create mode 100644 sysdeps/s390/s390-64/multiarch/memcmp-s390x.S
bca718
 delete mode 100644 sysdeps/s390/s390-64/multiarch/memcmp.S
bca718
 create mode 100644 sysdeps/s390/s390-64/multiarch/memcmp.c
bca718
 create mode 100644 sysdeps/s390/s390-64/multiarch/memcpy-s390x.S
bca718
 delete mode 100644 sysdeps/s390/s390-64/multiarch/memcpy.S
bca718
 create mode 100644 sysdeps/s390/s390-64/multiarch/memcpy.c
bca718
 create mode 100644 sysdeps/s390/s390-64/multiarch/memset-s390x.S
bca718
 delete mode 100644 sysdeps/s390/s390-64/multiarch/memset.S
bca718
 create mode 100644 sysdeps/s390/s390-64/multiarch/memset.c
bca718
bca718
diff --git a/sysdeps/s390/multiarch/ifunc-impl-list.c b/sysdeps/s390/multiarch/ifunc-impl-list.c
bca718
new file mode 100644
bca718
index 0000000..c330904
bca718
--- /dev/null
bca718
+++ b/sysdeps/s390/multiarch/ifunc-impl-list.c
bca718
@@ -0,0 +1,74 @@
bca718
+/* Enumerate available IFUNC implementations of a function. s390/s390x version.
bca718
+   Copyright (C) 2015 Free Software Foundation, Inc.
bca718
+   This file is part of the GNU C Library.
bca718
+
bca718
+   The GNU C Library is free software; you can redistribute it and/or
bca718
+   modify it under the terms of the GNU Lesser General Public
bca718
+   License as published by the Free Software Foundation; either
bca718
+   version 2.1 of the License, or (at your option) any later version.
bca718
+
bca718
+   The GNU C Library is distributed in the hope that it will be useful,
bca718
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
bca718
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
bca718
+   Lesser General Public License for more details.
bca718
+
bca718
+   You should have received a copy of the GNU Lesser General Public
bca718
+   License along with the GNU C Library; if not, see
bca718
+   <http://www.gnu.org/licenses/>.  */
bca718
+
bca718
+#include <assert.h>
bca718
+#include <string.h>
bca718
+#include <ifunc-impl-list.h>
bca718
+#include <ifunc-resolve.h>
bca718
+
bca718
+/* Maximum number of IFUNC implementations.  */
bca718
+#define MAX_IFUNC	3
bca718
+
bca718
+/* Fill ARRAY of MAX elements with IFUNC implementations for function
bca718
+   NAME supported on target machine and return the number of valid
bca718
+   entries.  */
bca718
+size_t
bca718
+__libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
bca718
+			size_t max)
bca718
+{
bca718
+  assert (max >= MAX_IFUNC);
bca718
+
bca718
+  size_t i = 0;
bca718
+
bca718
+  /* Get hardware information.  */
bca718
+  unsigned long int dl_hwcap = GLRO (dl_hwcap);
bca718
+  unsigned long long stfle_bits = 0ULL;
bca718
+  if ((dl_hwcap & HWCAP_S390_STFLE)
bca718
+	&& (dl_hwcap & HWCAP_S390_ZARCH)
bca718
+	&& (dl_hwcap & HWCAP_S390_HIGH_GPRS))
bca718
+    {
bca718
+      S390_STORE_STFLE (stfle_bits);
bca718
+    }
bca718
+
bca718
+  IFUNC_IMPL (i, name, memset,
bca718
+	      IFUNC_IMPL_ADD (array, i, memset,
bca718
+			      S390_IS_Z196 (stfle_bits), __memset_z196)
bca718
+	      IFUNC_IMPL_ADD (array, i, memset,
bca718
+			      S390_IS_Z10 (stfle_bits), __memset_z10)
bca718
+	      IFUNC_IMPL_ADD (array, i, memset, 1, __memset_default))
bca718
+
bca718
+  IFUNC_IMPL (i, name, memcmp,
bca718
+	      IFUNC_IMPL_ADD (array, i, memcmp,
bca718
+			      S390_IS_Z196 (stfle_bits), __memcmp_z196)
bca718
+	      IFUNC_IMPL_ADD (array, i, memcmp,
bca718
+			      S390_IS_Z10 (stfle_bits), __memcmp_z10)
bca718
+	      IFUNC_IMPL_ADD (array, i, memcmp, 1, __memcmp_default))
bca718
+
bca718
+#ifdef SHARED
bca718
+
bca718
+  IFUNC_IMPL (i, name, memcpy,
bca718
+	      IFUNC_IMPL_ADD (array, i, memcpy,
bca718
+			      S390_IS_Z196 (stfle_bits), __memcpy_z196)
bca718
+	      IFUNC_IMPL_ADD (array, i, memcpy,
bca718
+			      S390_IS_Z10 (stfle_bits), __memcpy_z10)
bca718
+	      IFUNC_IMPL_ADD (array, i, memcpy, 1, __memcpy_default))
bca718
+
bca718
+#endif /* SHARED */
bca718
+
bca718
+  return i;
bca718
+}
bca718
diff --git a/sysdeps/s390/multiarch/ifunc-resolve.h b/sysdeps/s390/multiarch/ifunc-resolve.h
bca718
new file mode 100644
bca718
index 0000000..491df68
bca718
--- /dev/null
bca718
+++ b/sysdeps/s390/multiarch/ifunc-resolve.h
bca718
@@ -0,0 +1,75 @@
bca718
+/* IFUNC resolver function for CPU specific functions.
bca718
+   32/64 bit S/390 version.
bca718
+   Copyright (C) 2015 Free Software Foundation, Inc.
bca718
+   This file is part of the GNU C Library.
bca718
+
bca718
+   The GNU C Library is free software; you can redistribute it and/or
bca718
+   modify it under the terms of the GNU Lesser General Public
bca718
+   License as published by the Free Software Foundation; either
bca718
+   version 2.1 of the License, or (at your option) any later version.
bca718
+
bca718
+   The GNU C Library is distributed in the hope that it will be useful,
bca718
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
bca718
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
bca718
+   Lesser General Public License for more details.
bca718
+
bca718
+   You should have received a copy of the GNU Lesser General Public
bca718
+   License along with the GNU C Library; if not, see
bca718
+   <http://www.gnu.org/licenses/>.  */
bca718
+
bca718
+#include <unistd.h>
bca718
+#include <dl-procinfo.h>
bca718
+
bca718
+#define S390_STFLE_BITS_Z10  34 /* General instructions extension */
bca718
+#define S390_STFLE_BITS_Z196 45 /* Distinct operands, pop ... */
bca718
+
bca718
+#define S390_IS_Z196(STFLE_BITS)			\
bca718
+  ((STFLE_BITS & (1ULL << (63 - S390_STFLE_BITS_Z196))) != 0)
bca718
+
bca718
+#define S390_IS_Z10(STFLE_BITS)				\
bca718
+  ((STFLE_BITS & (1ULL << (63 - S390_STFLE_BITS_Z10))) != 0)
bca718
+
bca718
+#define S390_STORE_STFLE(STFLE_BITS)					\
bca718
+  /* We want just 1 double word to be returned.  */			\
bca718
+  register unsigned long reg0 asm("0") = 0;				\
bca718
+									\
bca718
+  asm volatile(".machine push"        "\n\t"				\
bca718
+	       ".machine \"z9-109\""  "\n\t"				\
bca718
+	       ".machinemode \"zarch_nohighgprs\"\n\t"			\
bca718
+	       "stfle %0"             "\n\t"				\
bca718
+	       ".machine pop"         "\n"				\
bca718
+	       : "=QS" (STFLE_BITS), "+d" (reg0)			\
bca718
+	       : : "cc");
bca718
+
bca718
+#define s390_libc_ifunc(FUNC)						\
bca718
+  asm (".globl " #FUNC "\n\t"						\
bca718
+       ".type  " #FUNC ",@gnu_indirect_function\n\t"			\
bca718
+       ".set   " #FUNC ",__resolve_" #FUNC "\n\t"			\
bca718
+       ".globl __GI_" #FUNC "\n\t"					\
bca718
+       ".set   __GI_" #FUNC "," #FUNC "\n");				\
bca718
+									\
bca718
+  /* Make the declarations of the optimized functions hidden in order
bca718
+     to prevent GOT slots being generated for them. */			\
bca718
+  extern void *__##FUNC##_z196 attribute_hidden;			\
bca718
+  extern void *__##FUNC##_z10 attribute_hidden;				\
bca718
+  extern void *__##FUNC##_default attribute_hidden;			\
bca718
+									\
bca718
+  void *__resolve_##FUNC (unsigned long int dl_hwcap)			\
bca718
+  {									\
bca718
+    if ((dl_hwcap & HWCAP_S390_STFLE)					\
bca718
+	&& (dl_hwcap & HWCAP_S390_ZARCH)				\
bca718
+	&& (dl_hwcap & HWCAP_S390_HIGH_GPRS))				\
bca718
+      {									\
bca718
+	unsigned long long stfle_bits;					\
bca718
+	S390_STORE_STFLE (stfle_bits);					\
bca718
+									\
bca718
+	if (S390_IS_Z196 (stfle_bits))					\
bca718
+	  return &__##FUNC##_z196;					\
bca718
+	else if (S390_IS_Z10 (stfle_bits))				\
bca718
+	  return &__##FUNC##_z10;					\
bca718
+	else								\
bca718
+	  return &__##FUNC##_default;					\
bca718
+      }									\
bca718
+    else								\
bca718
+      return &__##FUNC##_default;					\
bca718
+  }
bca718
diff --git a/sysdeps/s390/s390-32/memcmp.S b/sysdeps/s390/s390-32/memcmp.S
bca718
index b6eabe5..104e280 100644
bca718
--- a/sysdeps/s390/s390-32/memcmp.S
bca718
+++ b/sysdeps/s390/s390-32/memcmp.S
bca718
@@ -27,38 +27,38 @@
bca718
 
bca718
        .text
bca718
 #ifdef USE_MULTIARCH
bca718
-ENTRY(__memcmp_g5)
bca718
+ENTRY(__memcmp_default)
bca718
 #else
bca718
 ENTRY(memcmp)
bca718
 #endif
bca718
 	.machine "g5"
bca718
-        basr    %r5,0
bca718
+	basr    %r5,0
bca718
 .L_G5_16:
bca718
-        ltr     %r4,%r4
bca718
-        je      .L_G5_4
bca718
-        ahi     %r4,-1
bca718
-        lr      %r1,%r4
bca718
-        srl     %r1,8
bca718
-        ltr     %r1,%r1
bca718
-        jne     .L_G5_12
bca718
-        ex      %r4,.L_G5_17-.L_G5_16(%r5)
bca718
+	ltr     %r4,%r4
bca718
+	je      .L_G5_4
bca718
+	ahi     %r4,-1
bca718
+	lr      %r1,%r4
bca718
+	srl     %r1,8
bca718
+	ltr     %r1,%r1
bca718
+	jne     .L_G5_12
bca718
+	ex      %r4,.L_G5_17-.L_G5_16(%r5)
bca718
 .L_G5_4:
bca718
-        ipm     %r2
bca718
-        sll     %r2,2
bca718
-        sra     %r2,30
bca718
-        br      %r14
bca718
+	ipm     %r2
bca718
+	sll     %r2,2
bca718
+	sra     %r2,30
bca718
+	br      %r14
bca718
 .L_G5_12:
bca718
-        clc     0(256,%r3),0(%r2)
bca718
-        jne     .L_G5_4
bca718
-        la      %r3,256(%r3)
bca718
-        la      %r2,256(%r2)
bca718
-        brct    %r1,.L_G5_12
bca718
-        ex      %r4,.L_G5_17-.L_G5_16(%r5)
bca718
-        j       .L_G5_4
bca718
+	clc     0(256,%r3),0(%r2)
bca718
+	jne     .L_G5_4
bca718
+	la      %r3,256(%r3)
bca718
+	la      %r2,256(%r2)
bca718
+	brct    %r1,.L_G5_12
bca718
+	ex      %r4,.L_G5_17-.L_G5_16(%r5)
bca718
+	j       .L_G5_4
bca718
 .L_G5_17:
bca718
-        clc     0(1,%r3),0(%r2)
bca718
+	clc     0(1,%r3),0(%r2)
bca718
 #ifdef USE_MULTIARCH
bca718
-END(__memcmp_g5)
bca718
+END(__memcmp_default)
bca718
 #else
bca718
 END(memcmp)
bca718
 libc_hidden_builtin_def (memcmp)
bca718
diff --git a/sysdeps/s390/s390-32/memcpy.S b/sysdeps/s390/s390-32/memcpy.S
bca718
index a3b1ace..6a2cf68 100644
bca718
--- a/sysdeps/s390/s390-32/memcpy.S
bca718
+++ b/sysdeps/s390/s390-32/memcpy.S
bca718
@@ -26,41 +26,41 @@
bca718
      %r4 = number of bytes to copy.  */
bca718
 
bca718
 #ifdef USE_MULTIARCH
bca718
-ENTRY(__memcpy_g5)
bca718
+ENTRY(__memcpy_default)
bca718
 #else
bca718
 ENTRY(memcpy)
bca718
 #endif
bca718
 	.machine "g5"
bca718
-        st      %r13,52(%r15)
bca718
-        .cfi_offset 13, -44
bca718
-        basr    %r13,0
bca718
+	st      %r13,52(%r15)
bca718
+	.cfi_offset 13, -44
bca718
+	basr    %r13,0
bca718
 .L_G5_16:
bca718
-        ltr     %r4,%r4
bca718
-        je      .L_G5_4
bca718
-        ahi     %r4,-1
bca718
-        lr      %r5,%r4
bca718
-        srl     %r5,8
bca718
-        ltr     %r5,%r5
bca718
-        lr      %r1,%r2
bca718
-        jne     .L_G5_12
bca718
-        ex      %r4,.L_G5_17-.L_G5_16(%r13)
bca718
+	ltr     %r4,%r4
bca718
+	je      .L_G5_4
bca718
+	ahi     %r4,-1
bca718
+	lr      %r5,%r4
bca718
+	srl     %r5,8
bca718
+	ltr     %r5,%r5
bca718
+	lr      %r1,%r2
bca718
+	jne     .L_G5_12
bca718
+	ex      %r4,.L_G5_17-.L_G5_16(%r13)
bca718
 .L_G5_4:
bca718
-        l       %r13,52(%r15)
bca718
-        br      %r14
bca718
+	l       %r13,52(%r15)
bca718
+	br      %r14
bca718
 .L_G5_13:
bca718
-        chi	%r5,4096             # Switch to mvcle for copies >1MB
bca718
-        jh	__memcpy_mvcle
bca718
+	chi	%r5,4096             # Switch to mvcle for copies >1MB
bca718
+	jh	__memcpy_mvcle
bca718
 .L_G5_12:
bca718
-        mvc     0(256,%r1),0(%r3)
bca718
-        la      %r1,256(%r1)
bca718
-        la      %r3,256(%r3)
bca718
-        brct    %r5,.L_G5_12
bca718
-        ex      %r4,.L_G5_17-.L_G5_16(%r13)
bca718
-        j       .L_G5_4
bca718
+	mvc     0(256,%r1),0(%r3)
bca718
+	la      %r1,256(%r1)
bca718
+	la      %r3,256(%r3)
bca718
+	brct    %r5,.L_G5_12
bca718
+	ex      %r4,.L_G5_17-.L_G5_16(%r13)
bca718
+	j       .L_G5_4
bca718
 .L_G5_17:
bca718
-        mvc     0(1,%r1),0(%r3)
bca718
+	mvc     0(1,%r1),0(%r3)
bca718
 #ifdef USE_MULTIARCH
bca718
-END(__memcpy_g5)
bca718
+END(__memcpy_default)
bca718
 #else
bca718
 END(memcpy)
bca718
 libc_hidden_builtin_def (memcpy)
bca718
diff --git a/sysdeps/s390/s390-32/memset.S b/sysdeps/s390/s390-32/memset.S
bca718
index a73dc6c..d363cf1 100644
bca718
--- a/sysdeps/s390/s390-32/memset.S
bca718
+++ b/sysdeps/s390/s390-32/memset.S
bca718
@@ -28,37 +28,37 @@
bca718
        .text
bca718
 
bca718
 #ifdef USE_MULTIARCH
bca718
-ENTRY(__memset_g5)
bca718
+ENTRY(__memset_default)
bca718
 #else
bca718
 ENTRY(memset)
bca718
 #endif
bca718
 	.machine "g5"
bca718
-        basr    %r5,0
bca718
+	basr    %r5,0
bca718
 .L_G5_19:
bca718
-        ltr     %r4,%r4
bca718
-        je      .L_G5_4
bca718
-        stc     %r3,0(%r2)
bca718
-        chi     %r4,1
bca718
-        lr      %r1,%r2
bca718
-        je      .L_G5_4
bca718
-        ahi     %r4,-2
bca718
-        lr      %r3,%r4
bca718
-        srl     %r3,8
bca718
-        ltr     %r3,%r3
bca718
-        jne     .L_G5_14
bca718
-        ex      %r4,.L_G5_20-.L_G5_19(%r5)
bca718
+	ltr     %r4,%r4
bca718
+	je      .L_G5_4
bca718
+	stc     %r3,0(%r2)
bca718
+	chi     %r4,1
bca718
+	lr      %r1,%r2
bca718
+	je      .L_G5_4
bca718
+	ahi     %r4,-2
bca718
+	lr      %r3,%r4
bca718
+	srl     %r3,8
bca718
+	ltr     %r3,%r3
bca718
+	jne     .L_G5_14
bca718
+	ex      %r4,.L_G5_20-.L_G5_19(%r5)
bca718
 .L_G5_4:
bca718
-        br      %r14
bca718
+	br      %r14
bca718
 .L_G5_14:
bca718
-        mvc     1(256,%r1),0(%r1)
bca718
-        la      %r1,256(%r1)
bca718
-        brct    %r3,.L_G5_14
bca718
-        ex      %r4,.L_G5_20-.L_G5_19(%r5)
bca718
-        j       .L_G5_4
bca718
+	mvc     1(256,%r1),0(%r1)
bca718
+	la      %r1,256(%r1)
bca718
+	brct    %r3,.L_G5_14
bca718
+	ex      %r4,.L_G5_20-.L_G5_19(%r5)
bca718
+	j       .L_G5_4
bca718
 .L_G5_20:
bca718
-        mvc     1(1,%r1),0(%r1)
bca718
+	mvc     1(1,%r1),0(%r1)
bca718
 #ifdef USE_MULTIARCH
bca718
-END(__memset_g5)
bca718
+END(__memset_default)
bca718
 #else
bca718
 END(memset)
bca718
 libc_hidden_builtin_def (memset)
bca718
diff --git a/sysdeps/s390/s390-32/multiarch/Makefile b/sysdeps/s390/s390-32/multiarch/Makefile
bca718
index 9baeecd..f8aee14 100644
bca718
--- a/sysdeps/s390/s390-32/multiarch/Makefile
bca718
+++ b/sysdeps/s390/s390-32/multiarch/Makefile
bca718
@@ -1,3 +1,4 @@
bca718
 ifeq ($(subdir),string)
bca718
-sysdep_routines += ifunc-resolve memset memcpy memcmp
bca718
+sysdep_routines += memset memset-s390 memcpy memcpy-s390 \
bca718
+		   memcmp memcmp-s390
bca718
 endif
bca718
diff --git a/sysdeps/s390/s390-32/multiarch/ifunc-resolve.c b/sysdeps/s390/s390-32/multiarch/ifunc-resolve.c
bca718
deleted file mode 100644
bca718
index 522c63c..0000000
bca718
--- a/sysdeps/s390/s390-32/multiarch/ifunc-resolve.c
bca718
+++ /dev/null
bca718
@@ -1,72 +0,0 @@
bca718
-/* IFUNC resolver function for CPU specific functions.
bca718
-   32 bit S/390 version.
bca718
-   Copyright (C) 2012 Free Software Foundation, Inc.
bca718
-   This file is part of the GNU C Library.
bca718
-
bca718
-   The GNU C Library is free software; you can redistribute it and/or
bca718
-   modify it under the terms of the GNU Lesser General Public
bca718
-   License as published by the Free Software Foundation; either
bca718
-   version 2.1 of the License, or (at your option) any later version.
bca718
-
bca718
-   The GNU C Library is distributed in the hope that it will be useful,
bca718
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
bca718
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
bca718
-   Lesser General Public License for more details.
bca718
-
bca718
-   You should have received a copy of the GNU Lesser General Public
bca718
-   License along with the GNU C Library; if not, see
bca718
-   <http://www.gnu.org/licenses/>.  */
bca718
-
bca718
-#include <unistd.h>
bca718
-#include <dl-procinfo.h>
bca718
-
bca718
-#define STFLE_BITS_Z10  34 /* General instructions extension */
bca718
-#define STFLE_BITS_Z196 45 /* Distinct operands, pop ... */
bca718
-
bca718
-#ifndef NOT_IN_libc
bca718
-
bca718
-#define IFUNC_RESOLVE(FUNC)						\
bca718
-  asm (".globl " #FUNC "\n\t"						\
bca718
-       ".type  " #FUNC ",@gnu_indirect_function\n\t"			\
bca718
-       ".set   " #FUNC ",__resolve_" #FUNC "\n\t"			\
bca718
-       ".globl __GI_" #FUNC "\n\t"					\
bca718
-       ".set   __GI_" #FUNC "," #FUNC "\n");				\
bca718
-									\
bca718
-  /* Make the declarations of the optimized functions hidden in order
bca718
-     to prevent GOT slots being generated for them. */			\
bca718
-  extern void *__##FUNC##_z196 attribute_hidden;			\
bca718
-  extern void *__##FUNC##_z10 attribute_hidden;				\
bca718
-  extern void *__##FUNC##_g5 attribute_hidden;				\
bca718
-									\
bca718
-  void *__resolve_##FUNC (unsigned long int dl_hwcap)			\
bca718
-  {									\
bca718
-    if ((dl_hwcap & HWCAP_S390_STFLE)					\
bca718
-	&& (dl_hwcap & HWCAP_S390_ZARCH)				\
bca718
-	&& (dl_hwcap & HWCAP_S390_HIGH_GPRS))				\
bca718
-      {									\
bca718
-	/* We want just 1 double word to be returned.  */		\
bca718
-	register unsigned long reg0 asm("0") = 0;			\
bca718
-	unsigned long long stfle_bits;					\
bca718
-									\
bca718
-	asm volatile(".insn s,0xb2b00000,%0" "\n\t"  /* stfle */	\
bca718
-		     : "=QS" (stfle_bits), "+d" (reg0)			\
bca718
-		     : : "cc");						\
bca718
-									\
bca718
-	if ((stfle_bits & (1ULL << (63 - STFLE_BITS_Z196))) != 0)	\
bca718
-	  return &__##FUNC##_z196;					\
bca718
-	else if ((stfle_bits & (1ULL << (63 - STFLE_BITS_Z10))) != 0)	\
bca718
-	  return &__##FUNC##_z10;					\
bca718
-      }									\
bca718
-    return &__##FUNC##_g5;						\
bca718
-  }
bca718
-
bca718
-IFUNC_RESOLVE(memset)
bca718
-IFUNC_RESOLVE(memcmp)
bca718
-asm(".weak bcmp ; bcmp = memcmp");
bca718
-
bca718
-/* In the static lib memcpy is needed before the reloc is resolved.  */
bca718
-#ifdef SHARED
bca718
-IFUNC_RESOLVE(memcpy)
bca718
-#endif
bca718
-
bca718
-#endif
bca718
diff --git a/sysdeps/s390/s390-32/multiarch/memcmp-s390.S b/sysdeps/s390/s390-32/multiarch/memcmp-s390.S
bca718
new file mode 100644
bca718
index 0000000..b339aac
bca718
--- /dev/null
bca718
+++ b/sysdeps/s390/s390-32/multiarch/memcmp-s390.S
bca718
@@ -0,0 +1,104 @@
bca718
+/* CPU specific memcmp implementations.  32 bit S/390 version.
bca718
+   Copyright (C) 2012-2015 Free Software Foundation, Inc.
bca718
+   This file is part of the GNU C Library.
bca718
+
bca718
+   The GNU C Library is free software; you can redistribute it and/or
bca718
+   modify it under the terms of the GNU Lesser General Public
bca718
+   License as published by the Free Software Foundation; either
bca718
+   version 2.1 of the License, or (at your option) any later version.
bca718
+
bca718
+   The GNU C Library is distributed in the hope that it will be useful,
bca718
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
bca718
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
bca718
+   Lesser General Public License for more details.
bca718
+
bca718
+   You should have received a copy of the GNU Lesser General Public
bca718
+   License along with the GNU C Library; if not, see
bca718
+   <http://www.gnu.org/licenses/>.  */
bca718
+
bca718
+
bca718
+#include "sysdep.h"
bca718
+#include "asm-syntax.h"
bca718
+
bca718
+/* INPUT PARAMETERS
bca718
+     %r2 = address of first memory area
bca718
+     %r3 = address of second memory area
bca718
+     %r4 = number of bytes to compare.  */
bca718
+
bca718
+       .text
bca718
+
bca718
+#ifndef NOT_IN_libc
bca718
+
bca718
+ENTRY(__memcmp_z196)
bca718
+	.machine "z196"
bca718
+	.machinemode "zarch_nohighgprs"
bca718
+	ltr     %r4,%r4
bca718
+	je      .L_Z196_4
bca718
+	ahi     %r4,-1
bca718
+	srlk    %r1,%r4,8
bca718
+	ltr     %r1,%r1
bca718
+	jne     .L_Z196_2
bca718
+.L_Z196_3:
bca718
+	exrl    %r4,.L_Z196_14
bca718
+.L_Z196_4:
bca718
+	ipm     %r2
bca718
+	sll     %r2,2
bca718
+	sra     %r2,30
bca718
+	br      %r14
bca718
+.L_Z196_17:
bca718
+	la      %r3,256(%r3)
bca718
+	la      %r2,256(%r2)
bca718
+	ahi     %r1,-1
bca718
+	je      .L_Z196_3
bca718
+.L_Z196_2:
bca718
+	pfd     1,512(%r3)
bca718
+	pfd     1,512(%r2)
bca718
+	clc     0(256,%r3),0(%r2)
bca718
+	je      .L_Z196_17
bca718
+	ipm     %r2
bca718
+	sll     %r2,2
bca718
+	sra     %r2,30
bca718
+	br      %r14
bca718
+.L_Z196_14:
bca718
+	clc     0(1,%r3),0(%r2)
bca718
+END(__memcmp_z196)
bca718
+
bca718
+ENTRY(__memcmp_z10)
bca718
+	.machine "z10"
bca718
+	.machinemode "zarch_nohighgprs"
bca718
+	ltr     %r4,%r4
bca718
+	je      .L_Z10_4
bca718
+	ahi     %r4,-1
bca718
+	lr      %r1,%r4
bca718
+	srl     %r1,8
bca718
+	cijlh   %r1,0,.L_Z10_12
bca718
+.L_Z10_3:
bca718
+	exrl    %r4,.L_Z10_15
bca718
+.L_Z10_4:
bca718
+	ipm     %r2
bca718
+	sll     %r2,2
bca718
+	sra     %r2,30
bca718
+	br      %r14
bca718
+.L_Z10_12:
bca718
+	pfd     1,512(%r3)
bca718
+	pfd     1,512(%r2)
bca718
+	clc     0(256,%r3),0(%r2)
bca718
+	jne     .L_Z10_4
bca718
+	la      %r3,256(%r3)
bca718
+	la      %r2,256(%r2)
bca718
+	brct    %r1,.L_Z10_12
bca718
+	j       .L_Z10_3
bca718
+.L_Z10_15:
bca718
+	clc     0(1,%r3),0(%r2)
bca718
+END(__memcmp_z10)
bca718
+
bca718
+#endif /* !NOT_IN_libc */
bca718
+
bca718
+#include "../memcmp.S"
bca718
+
bca718
+#ifdef NOT_IN_libc
bca718
+.globl   memcmp
bca718
+.set     memcmp,__memcmp_default
bca718
+.weak    bcmp
bca718
+.set	 bcmp,__memcmp_default
bca718
+#endif
bca718
diff --git a/sysdeps/s390/s390-32/multiarch/memcmp.S b/sysdeps/s390/s390-32/multiarch/memcmp.S
bca718
deleted file mode 100644
bca718
index c654d19..0000000
bca718
--- a/sysdeps/s390/s390-32/multiarch/memcmp.S
bca718
+++ /dev/null
bca718
@@ -1,104 +0,0 @@
bca718
-/* CPU specific memcmp implementations.  32 bit S/390 version.
bca718
-   Copyright (C) 2012 Free Software Foundation, Inc.
bca718
-   This file is part of the GNU C Library.
bca718
-
bca718
-   The GNU C Library is free software; you can redistribute it and/or
bca718
-   modify it under the terms of the GNU Lesser General Public
bca718
-   License as published by the Free Software Foundation; either
bca718
-   version 2.1 of the License, or (at your option) any later version.
bca718
-
bca718
-   The GNU C Library is distributed in the hope that it will be useful,
bca718
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
bca718
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
bca718
-   Lesser General Public License for more details.
bca718
-
bca718
-   You should have received a copy of the GNU Lesser General Public
bca718
-   License along with the GNU C Library; if not, see
bca718
-   <http://www.gnu.org/licenses/>.  */
bca718
-
bca718
-
bca718
-#include "sysdep.h"
bca718
-#include "asm-syntax.h"
bca718
-
bca718
-/* INPUT PARAMETERS
bca718
-     %r2 = address of first memory area
bca718
-     %r3 = address of second memory area
bca718
-     %r4 = number of bytes to compare.  */
bca718
-
bca718
-       .text
bca718
-
bca718
-#ifndef NOT_IN_libc
bca718
-
bca718
-ENTRY(__memcmp_z196)
bca718
-	.machine "z196"
bca718
-	.machinemode "zarch_nohighgprs"
bca718
-        ltr     %r4,%r4
bca718
-        je      .L_Z196_4
bca718
-        ahi     %r4,-1
bca718
-        srlk    %r1,%r4,8
bca718
-        ltr     %r1,%r1
bca718
-        jne     .L_Z196_2
bca718
-.L_Z196_3:
bca718
-        exrl    %r4,.L_Z196_14
bca718
-.L_Z196_4:
bca718
-        ipm     %r2
bca718
-        sll     %r2,2
bca718
-        sra     %r2,30
bca718
-        br      %r14
bca718
-.L_Z196_17:
bca718
-        la      %r3,256(%r3)
bca718
-        la      %r2,256(%r2)
bca718
-        ahi     %r1,-1
bca718
-        je      .L_Z196_3
bca718
-.L_Z196_2:
bca718
-        pfd     1,512(%r3)
bca718
-        pfd     1,512(%r2)
bca718
-        clc     0(256,%r3),0(%r2)
bca718
-        je      .L_Z196_17
bca718
-        ipm     %r2
bca718
-        sll     %r2,2
bca718
-        sra     %r2,30
bca718
-        br      %r14
bca718
-.L_Z196_14:
bca718
-        clc     0(1,%r3),0(%r2)
bca718
-END(__memcmp_z196)
bca718
-
bca718
-ENTRY(__memcmp_z10)
bca718
-	.machine "z10"
bca718
-	.machinemode "zarch_nohighgprs"
bca718
-        ltr     %r4,%r4
bca718
-        je      .L_Z10_4
bca718
-        ahi     %r4,-1
bca718
-        lr      %r1,%r4
bca718
-        srl     %r1,8
bca718
-        cijlh   %r1,0,.L_Z10_12
bca718
-.L_Z10_3:
bca718
-        exrl    %r4,.L_Z10_15
bca718
-.L_Z10_4:
bca718
-        ipm     %r2
bca718
-        sll     %r2,2
bca718
-        sra     %r2,30
bca718
-        br      %r14
bca718
-.L_Z10_12:
bca718
-        pfd     1,512(%r3)
bca718
-        pfd     1,512(%r2)
bca718
-        clc     0(256,%r3),0(%r2)
bca718
-        jne     .L_Z10_4
bca718
-        la      %r3,256(%r3)
bca718
-        la      %r2,256(%r2)
bca718
-        brct    %r1,.L_Z10_12
bca718
-        j       .L_Z10_3
bca718
-.L_Z10_15:
bca718
-        clc     0(1,%r3),0(%r2)
bca718
-END(__memcmp_z10)
bca718
-
bca718
-#endif
bca718
-
bca718
-#include "../memcmp.S"
bca718
-
bca718
-#ifdef NOT_IN_libc
bca718
-.globl   memcmp
bca718
-.set     memcmp,__memcmp_g5
bca718
-.weak    bcmp
bca718
-.set	 bcmp,__memcmp_g5
bca718
-#endif
bca718
diff --git a/sysdeps/s390/s390-32/multiarch/memcmp.c b/sysdeps/s390/s390-32/multiarch/memcmp.c
bca718
new file mode 100644
bca718
index 0000000..7089d56
bca718
--- /dev/null
bca718
+++ b/sysdeps/s390/s390-32/multiarch/memcmp.c
bca718
@@ -0,0 +1,24 @@
bca718
+/* Multiple versions of memcmp.
bca718
+   Copyright (C) 2015 Free Software Foundation, Inc.
bca718
+   This file is part of the GNU C Library.
bca718
+
bca718
+   The GNU C Library is free software; you can redistribute it and/or
bca718
+   modify it under the terms of the GNU Lesser General Public
bca718
+   License as published by the Free Software Foundation; either
bca718
+   version 2.1 of the License, or (at your option) any later version.
bca718
+
bca718
+   The GNU C Library is distributed in the hope that it will be useful,
bca718
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
bca718
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
bca718
+   Lesser General Public License for more details.
bca718
+
bca718
+   You should have received a copy of the GNU Lesser General Public
bca718
+   License along with the GNU C Library; if not, see
bca718
+   <http://www.gnu.org/licenses/>.  */
bca718
+
bca718
+#ifndef NOT_IN_libc
bca718
+# include <ifunc-resolve.h>
bca718
+
bca718
+s390_libc_ifunc (memcmp)
bca718
+asm(".weak bcmp ; bcmp = memcmp");
bca718
+#endif
bca718
diff --git a/sysdeps/s390/s390-32/multiarch/memcpy-s390.S b/sysdeps/s390/s390-32/multiarch/memcpy-s390.S
bca718
new file mode 100644
bca718
index 0000000..f6e0fea
bca718
--- /dev/null
bca718
+++ b/sysdeps/s390/s390-32/multiarch/memcpy-s390.S
bca718
@@ -0,0 +1,98 @@
bca718
+/* CPU specific memcpy implementations.  32 bit S/390 version.
bca718
+   Copyright (C) 2012-2015 Free Software Foundation, Inc.
bca718
+   This file is part of the GNU C Library.
bca718
+
bca718
+   The GNU C Library is free software; you can redistribute it and/or
bca718
+   modify it under the terms of the GNU Lesser General Public
bca718
+   License as published by the Free Software Foundation; either
bca718
+   version 2.1 of the License, or (at your option) any later version.
bca718
+
bca718
+   The GNU C Library is distributed in the hope that it will be useful,
bca718
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
bca718
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
bca718
+   Lesser General Public License for more details.
bca718
+
bca718
+   You should have received a copy of the GNU Lesser General Public
bca718
+   License along with the GNU C Library; if not, see
bca718
+   <http://www.gnu.org/licenses/>.  */
bca718
+
bca718
+
bca718
+#include "sysdep.h"
bca718
+#include "asm-syntax.h"
bca718
+
bca718
+/* INPUT PARAMETERS
bca718
+     %r2 = target operands address
bca718
+     %r3 = source operands address
bca718
+     %r4 = number of bytes to copy.  */
bca718
+
bca718
+       .text
bca718
+
bca718
+#if defined SHARED && !defined NOT_IN_libc
bca718
+
bca718
+ENTRY(__memcpy_z196)
bca718
+	.machine "z196"
bca718
+	.machinemode "zarch_nohighgprs"
bca718
+	llgfr   %r4,%r4
bca718
+	ltgr    %r4,%r4
bca718
+	je      .L_Z196_4
bca718
+	aghi    %r4,-1
bca718
+	lr      %r1,%r2
bca718
+	srlg    %r5,%r4,8
bca718
+	ltgr    %r5,%r5
bca718
+	jne     .L_Z196_5
bca718
+.L_Z196_3:
bca718
+	exrl    %r4,.L_Z196_14
bca718
+.L_Z196_4:
bca718
+	br      %r14
bca718
+.L_Z196_5:
bca718
+	cgfi    %r5,262144      # Switch to mvcle for copies >64MB
bca718
+	jh      __memcpy_mvcle
bca718
+.L_Z196_2:
bca718
+	pfd     1,768(%r3)
bca718
+	pfd     2,768(%r1)
bca718
+	mvc     0(256,%r1),0(%r3)
bca718
+	aghi    %r5,-1
bca718
+	la      %r1,256(%r1)
bca718
+	la      %r3,256(%r3)
bca718
+	jne     .L_Z196_2
bca718
+	j       .L_Z196_3
bca718
+.L_Z196_14:
bca718
+	mvc     0(1,%r1),0(%r3)
bca718
+END(__memcpy_z196)
bca718
+
bca718
+ENTRY(__memcpy_z10)
bca718
+	.machine "z10"
bca718
+	.machinemode "zarch_nohighgprs"
bca718
+	llgfr   %r4,%r4
bca718
+	cgije   %r4,0,.L_Z10_4
bca718
+	aghi    %r4,-1
bca718
+	lr      %r1,%r2
bca718
+	srlg    %r5,%r4,8
bca718
+	cgijlh  %r5,0,.L_Z10_13
bca718
+.L_Z10_3:
bca718
+	exrl    %r4,.L_Z10_15
bca718
+.L_Z10_4:
bca718
+	br      %r14
bca718
+.L_Z10_13:
bca718
+	cgfi    %r5,65535	# Switch to mvcle for copies >16MB
bca718
+	jh      __memcpy_mvcle
bca718
+.L_Z10_12:
bca718
+	pfd     1,768(%r3)
bca718
+	pfd     2,768(%r1)
bca718
+	mvc     0(256,%r1),0(%r3)
bca718
+	la      %r1,256(%r1)
bca718
+	la      %r3,256(%r3)
bca718
+	brctg   %r5,.L_Z10_12
bca718
+	j       .L_Z10_3
bca718
+.L_Z10_15:
bca718
+	mvc     0(1,%r1),0(%r3)
bca718
+END(__memcpy_z10)
bca718
+
bca718
+#endif /* SHARED && !defined NOT_IN_libc */
bca718
+
bca718
+#include "../memcpy.S"
bca718
+
bca718
+#if !defined SHARED || defined NOT_IN_libc
bca718
+.globl   memcpy
bca718
+.set     memcpy,__memcpy_default
bca718
+#endif
bca718
diff --git a/sysdeps/s390/s390-32/multiarch/memcpy.S b/sysdeps/s390/s390-32/multiarch/memcpy.S
bca718
deleted file mode 100644
bca718
index 5c2113f..0000000
bca718
--- a/sysdeps/s390/s390-32/multiarch/memcpy.S
bca718
+++ /dev/null
bca718
@@ -1,98 +0,0 @@
bca718
-/* CPU specific memcpy implementations.  32 bit S/390 version.
bca718
-   Copyright (C) 2012 Free Software Foundation, Inc.
bca718
-   This file is part of the GNU C Library.
bca718
-
bca718
-   The GNU C Library is free software; you can redistribute it and/or
bca718
-   modify it under the terms of the GNU Lesser General Public
bca718
-   License as published by the Free Software Foundation; either
bca718
-   version 2.1 of the License, or (at your option) any later version.
bca718
-
bca718
-   The GNU C Library is distributed in the hope that it will be useful,
bca718
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
bca718
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
bca718
-   Lesser General Public License for more details.
bca718
-
bca718
-   You should have received a copy of the GNU Lesser General Public
bca718
-   License along with the GNU C Library; if not, see
bca718
-   <http://www.gnu.org/licenses/>.  */
bca718
-
bca718
-
bca718
-#include "sysdep.h"
bca718
-#include "asm-syntax.h"
bca718
-
bca718
-/* INPUT PARAMETERS
bca718
-     %r2 = target operands address
bca718
-     %r3 = source operands address
bca718
-     %r4 = number of bytes to copy.  */
bca718
-
bca718
-       .text
bca718
-
bca718
-#if defined SHARED && !defined NOT_IN_libc
bca718
-
bca718
-ENTRY(__memcpy_z196)
bca718
-	.machine "z196"
bca718
-	.machinemode "zarch_nohighgprs"
bca718
-        llgfr   %r4,%r4
bca718
-        ltgr    %r4,%r4
bca718
-        je      .L_Z196_4
bca718
-        aghi    %r4,-1
bca718
-        lr      %r1,%r2
bca718
-        srlg    %r5,%r4,8
bca718
-        ltgr    %r5,%r5
bca718
-        jne     .L_Z196_5
bca718
-.L_Z196_3:
bca718
-        exrl    %r4,.L_Z196_14
bca718
-.L_Z196_4:
bca718
-        br      %r14
bca718
-.L_Z196_5:
bca718
-        cgfi    %r5,262144      # Switch to mvcle for copies >64MB
bca718
-        jh      __memcpy_mvcle
bca718
-.L_Z196_2:
bca718
-        pfd     1,768(%r3)
bca718
-        pfd     2,768(%r1)
bca718
-        mvc     0(256,%r1),0(%r3)
bca718
-        aghi    %r5,-1
bca718
-        la      %r1,256(%r1)
bca718
-        la      %r3,256(%r3)
bca718
-        jne     .L_Z196_2
bca718
-        j       .L_Z196_3
bca718
-.L_Z196_14:
bca718
-        mvc     0(1,%r1),0(%r3)
bca718
-END(__memcpy_z196)
bca718
-
bca718
-ENTRY(__memcpy_z10)
bca718
-	.machine "z10"
bca718
-	.machinemode "zarch_nohighgprs"
bca718
-        llgfr   %r4,%r4
bca718
-        cgije   %r4,0,.L_Z10_4
bca718
-        aghi    %r4,-1
bca718
-        lr      %r1,%r2
bca718
-        srlg    %r5,%r4,8
bca718
-        cgijlh  %r5,0,.L_Z10_13
bca718
-.L_Z10_3:
bca718
-        exrl    %r4,.L_Z10_15
bca718
-.L_Z10_4:
bca718
-        br      %r14
bca718
-.L_Z10_13:
bca718
-        cgfi    %r5,65535	# Switch to mvcle for copies >16MB
bca718
-        jh      __memcpy_mvcle
bca718
-.L_Z10_12:
bca718
-        pfd     1,768(%r3)
bca718
-        pfd     2,768(%r1)
bca718
-        mvc     0(256,%r1),0(%r3)
bca718
-        la      %r1,256(%r1)
bca718
-        la      %r3,256(%r3)
bca718
-        brctg   %r5,.L_Z10_12
bca718
-        j       .L_Z10_3
bca718
-.L_Z10_15:
bca718
-        mvc     0(1,%r1),0(%r3)
bca718
-END(__memcpy_z10)
bca718
-
bca718
-#endif
bca718
-
bca718
-#include "../memcpy.S"
bca718
-
bca718
-#if !defined SHARED || defined NOT_IN_libc
bca718
-.globl   memcpy
bca718
-.set     memcpy,__memcpy_g5
bca718
-#endif
bca718
diff --git a/sysdeps/s390/s390-32/multiarch/memcpy.c b/sysdeps/s390/s390-32/multiarch/memcpy.c
bca718
new file mode 100644
bca718
index 0000000..1ff31bb
bca718
--- /dev/null
bca718
+++ b/sysdeps/s390/s390-32/multiarch/memcpy.c
bca718
@@ -0,0 +1,24 @@
bca718
+/* Multiple versions of memcpy.
bca718
+   Copyright (C) 2015 Free Software Foundation, Inc.
bca718
+   This file is part of the GNU C Library.
bca718
+
bca718
+   The GNU C Library is free software; you can redistribute it and/or
bca718
+   modify it under the terms of the GNU Lesser General Public
bca718
+   License as published by the Free Software Foundation; either
bca718
+   version 2.1 of the License, or (at your option) any later version.
bca718
+
bca718
+   The GNU C Library is distributed in the hope that it will be useful,
bca718
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
bca718
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
bca718
+   Lesser General Public License for more details.
bca718
+
bca718
+   You should have received a copy of the GNU Lesser General Public
bca718
+   License along with the GNU C Library; if not, see
bca718
+   <http://www.gnu.org/licenses/>.  */
bca718
+
bca718
+/* In the static lib memcpy is needed before the reloc is resolved.  */
bca718
+#if defined SHARED && !defined NOT_IN_libc
bca718
+# include <ifunc-resolve.h>
bca718
+
bca718
+s390_libc_ifunc (memcpy)
bca718
+#endif
bca718
diff --git a/sysdeps/s390/s390-32/multiarch/memset-s390.S b/sysdeps/s390/s390-32/multiarch/memset-s390.S
bca718
new file mode 100644
bca718
index 0000000..f6df2fa
bca718
--- /dev/null
bca718
+++ b/sysdeps/s390/s390-32/multiarch/memset-s390.S
bca718
@@ -0,0 +1,113 @@
bca718
+/* Set a block of memory to some byte value.  32 bit S/390 version.
bca718
+   Copyright (C) 2012-2015 Free Software Foundation, Inc.
bca718
+   This file is part of the GNU C Library.
bca718
+
bca718
+   The GNU C Library is free software; you can redistribute it and/or
bca718
+   modify it under the terms of the GNU Lesser General Public
bca718
+   License as published by the Free Software Foundation; either
bca718
+   version 2.1 of the License, or (at your option) any later version.
bca718
+
bca718
+   The GNU C Library is distributed in the hope that it will be useful,
bca718
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
bca718
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
bca718
+   Lesser General Public License for more details.
bca718
+
bca718
+   You should have received a copy of the GNU Lesser General Public
bca718
+   License along with the GNU C Library; if not, see
bca718
+   <http://www.gnu.org/licenses/>.  */
bca718
+
bca718
+
bca718
+#include "sysdep.h"
bca718
+#include "asm-syntax.h"
bca718
+
bca718
+/* INPUT PARAMETERS
bca718
+     %r2 = address of memory area
bca718
+     %r3 = byte to fill memory with
bca718
+     %r4 = number of bytes to fill.  */
bca718
+
bca718
+       .text
bca718
+
bca718
+#ifndef NOT_IN_libc
bca718
+
bca718
+ENTRY(__memset_z196)
bca718
+	.machine "z196"
bca718
+	.machinemode "zarch_nohighgprs"
bca718
+	llgfr   %r4,%r4
bca718
+	ltgr    %r4,%r4
bca718
+	je      .L_Z196_4
bca718
+	stc     %r3,0(%r2)
bca718
+	lr      %r1,%r2
bca718
+	cghi    %r4,1
bca718
+	je      .L_Z196_4
bca718
+	aghi    %r4,-2
bca718
+	srlg    %r5,%r4,8
bca718
+	ltgr    %r5,%r5
bca718
+	jne     .L_Z196_1
bca718
+.L_Z196_3:
bca718
+	exrl    %r4,.L_Z196_17
bca718
+.L_Z196_4:
bca718
+	br      %r14
bca718
+.L_Z196_1:
bca718
+	cgfi	%r5,1048576
bca718
+	jh	__memset_mvcle	   # Switch to mvcle for >256MB
bca718
+.L_Z196_2:
bca718
+	pfd     2,1024(%r1)
bca718
+	mvc     1(256,%r1),0(%r1)
bca718
+	aghi    %r5,-1
bca718
+	la      %r1,256(%r1)
bca718
+	jne     .L_Z196_2
bca718
+	j       .L_Z196_3
bca718
+.L_Z196_17:
bca718
+	mvc     1(1,%r1),0(%r1)
bca718
+END(__memset_z196)
bca718
+
bca718
+ENTRY(__memset_z10)
bca718
+	.machine "z10"
bca718
+	.machinemode "zarch_nohighgprs"
bca718
+	llgfr   %r4,%r4
bca718
+	cgije   %r4,0,.L_Z10_4
bca718
+	stc     %r3,0(%r2)
bca718
+	lr      %r1,%r2
bca718
+	cgije   %r4,1,.L_Z10_4
bca718
+	aghi    %r4,-2
bca718
+	srlg    %r5,%r4,8
bca718
+	cgijlh  %r5,0,.L_Z10_15
bca718
+.L_Z10_3:
bca718
+	exrl    %r4,.L_Z10_18
bca718
+.L_Z10_4:
bca718
+	br      %r14
bca718
+.L_Z10_15:
bca718
+	cgfi	%r5,163840          # Switch to mvcle for >40MB
bca718
+	jh	__memset_mvcle
bca718
+.L_Z10_14:
bca718
+	pfd     2,1024(%r1)
bca718
+	mvc     1(256,%r1),0(%r1)
bca718
+	la      %r1,256(%r1)
bca718
+	brctg   %r5,.L_Z10_14
bca718
+	j       .L_Z10_3
bca718
+.L_Z10_18:
bca718
+	mvc     1(1,%r1),0(%r1)
bca718
+END(__memset_z10)
bca718
+
bca718
+ENTRY(__memset_mvcle)
bca718
+	ahi	%r4,2               # take back the change done by the caller
bca718
+	lr      %r0,%r2             # save source address
bca718
+	lr      %r1,%r3             # move pad byte to R1
bca718
+	lr      %r3,%r4
bca718
+	sr      %r4,%r4             # no source for MVCLE, only a pad byte
bca718
+	sr      %r5,%r5
bca718
+.L0:    mvcle   %r2,%r4,0(%r1)      # thats it, MVCLE is your friend
bca718
+	jo      .L0
bca718
+	lr      %r2,%r0             # return value is source address
bca718
+.L1:
bca718
+	br      %r14
bca718
+END(__memset_mvcle)
bca718
+
bca718
+#endif /* !NOT_IN_libc */
bca718
+
bca718
+#include "../memset.S"
bca718
+
bca718
+#ifdef NOT_IN_libc
bca718
+.globl   memset
bca718
+.set     memset,__memset_default
bca718
+#endif
bca718
diff --git a/sysdeps/s390/s390-32/multiarch/memset.S b/sysdeps/s390/s390-32/multiarch/memset.S
bca718
deleted file mode 100644
bca718
index 54aa028..0000000
bca718
--- a/sysdeps/s390/s390-32/multiarch/memset.S
bca718
+++ /dev/null
bca718
@@ -1,113 +0,0 @@
bca718
-/* Set a block of memory to some byte value.  32 bit S/390 version.
bca718
-   Copyright (C) 2012 Free Software Foundation, Inc.
bca718
-   This file is part of the GNU C Library.
bca718
-
bca718
-   The GNU C Library is free software; you can redistribute it and/or
bca718
-   modify it under the terms of the GNU Lesser General Public
bca718
-   License as published by the Free Software Foundation; either
bca718
-   version 2.1 of the License, or (at your option) any later version.
bca718
-
bca718
-   The GNU C Library is distributed in the hope that it will be useful,
bca718
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
bca718
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
bca718
-   Lesser General Public License for more details.
bca718
-
bca718
-   You should have received a copy of the GNU Lesser General Public
bca718
-   License along with the GNU C Library; if not, see
bca718
-   <http://www.gnu.org/licenses/>.  */
bca718
-
bca718
-
bca718
-#include "sysdep.h"
bca718
-#include "asm-syntax.h"
bca718
-
bca718
-/* INPUT PARAMETERS
bca718
-     %r2 = address of memory area
bca718
-     %r3 = byte to fill memory with
bca718
-     %r4 = number of bytes to fill.  */
bca718
-
bca718
-       .text
bca718
-
bca718
-#ifndef NOT_IN_libc
bca718
-
bca718
-ENTRY(__memset_z196)
bca718
-	.machine "z196"
bca718
-	.machinemode "zarch_nohighgprs"
bca718
-        llgfr   %r4,%r4
bca718
-        ltgr    %r4,%r4
bca718
-        je      .L_Z196_4
bca718
-        stc     %r3,0(%r2)
bca718
-        lr      %r1,%r2
bca718
-        cghi    %r4,1
bca718
-        je      .L_Z196_4
bca718
-        aghi    %r4,-2
bca718
-        srlg    %r5,%r4,8
bca718
-        ltgr    %r5,%r5
bca718
-        jne     .L_Z196_1
bca718
-.L_Z196_3:
bca718
-        exrl    %r4,.L_Z196_17
bca718
-.L_Z196_4:
bca718
-        br      %r14
bca718
-.L_Z196_1:
bca718
-	cgfi	%r5,1048576
bca718
-	jh	__memset_mvcle	   # Switch to mvcle for >256MB
bca718
-.L_Z196_2:
bca718
-        pfd     2,1024(%r1)
bca718
-        mvc     1(256,%r1),0(%r1)
bca718
-        aghi    %r5,-1
bca718
-        la      %r1,256(%r1)
bca718
-        jne     .L_Z196_2
bca718
-        j       .L_Z196_3
bca718
-.L_Z196_17:
bca718
-        mvc     1(1,%r1),0(%r1)
bca718
-END(__memset_z196)
bca718
-
bca718
-ENTRY(__memset_z10)
bca718
-	.machine "z10"
bca718
-	.machinemode "zarch_nohighgprs"
bca718
-        llgfr   %r4,%r4
bca718
-        cgije   %r4,0,.L_Z10_4
bca718
-        stc     %r3,0(%r2)
bca718
-        lr      %r1,%r2
bca718
-        cgije   %r4,1,.L_Z10_4
bca718
-        aghi    %r4,-2
bca718
-        srlg    %r5,%r4,8
bca718
-        cgijlh  %r5,0,.L_Z10_15
bca718
-.L_Z10_3:
bca718
-        exrl    %r4,.L_Z10_18
bca718
-.L_Z10_4:
bca718
-        br      %r14
bca718
-.L_Z10_15:
bca718
-	cgfi	%r5,163840          # Switch to mvcle for >40MB
bca718
-	jh	__memset_mvcle
bca718
-.L_Z10_14:
bca718
-        pfd     2,1024(%r1)
bca718
-        mvc     1(256,%r1),0(%r1)
bca718
-        la      %r1,256(%r1)
bca718
-        brctg   %r5,.L_Z10_14
bca718
-        j       .L_Z10_3
bca718
-.L_Z10_18:
bca718
-        mvc     1(1,%r1),0(%r1)
bca718
-END(__memset_z10)
bca718
-
bca718
-ENTRY(__memset_mvcle)
bca718
-	ahi	%r4,2               # take back the change done by the caller
bca718
-	lr      %r0,%r2             # save source address
bca718
-	lr      %r1,%r3             # move pad byte to R1
bca718
-	lr      %r3,%r4
bca718
-	sr      %r4,%r4             # no source for MVCLE, only a pad byte
bca718
-	sr      %r5,%r5
bca718
-.L0:    mvcle   %r2,%r4,0(%r1)      # thats it, MVCLE is your friend
bca718
-	jo      .L0
bca718
-	lr      %r2,%r0             # return value is source address
bca718
-.L1:
bca718
-	br      %r14
bca718
-END(__memset_mvcle)
bca718
-
bca718
-#endif
bca718
-
bca718
-#include "../memset.S"
bca718
-
bca718
-#ifdef NOT_IN_libc
bca718
-.globl   memset
bca718
-.set     memset,__memset_g5
bca718
-#endif
bca718
diff --git a/sysdeps/s390/s390-32/multiarch/memset.c b/sysdeps/s390/s390-32/multiarch/memset.c
bca718
new file mode 100644
bca718
index 0000000..3b15446
bca718
--- /dev/null
bca718
+++ b/sysdeps/s390/s390-32/multiarch/memset.c
bca718
@@ -0,0 +1,23 @@
bca718
+/* Multiple versions of memset.
bca718
+   Copyright (C) 2015 Free Software Foundation, Inc.
bca718
+   This file is part of the GNU C Library.
bca718
+
bca718
+   The GNU C Library is free software; you can redistribute it and/or
bca718
+   modify it under the terms of the GNU Lesser General Public
bca718
+   License as published by the Free Software Foundation; either
bca718
+   version 2.1 of the License, or (at your option) any later version.
bca718
+
bca718
+   The GNU C Library is distributed in the hope that it will be useful,
bca718
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
bca718
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
bca718
+   Lesser General Public License for more details.
bca718
+
bca718
+   You should have received a copy of the GNU Lesser General Public
bca718
+   License along with the GNU C Library; if not, see
bca718
+   <http://www.gnu.org/licenses/>.  */
bca718
+
bca718
+#ifndef NOT_IN_libc
bca718
+# include <ifunc-resolve.h>
bca718
+
bca718
+s390_libc_ifunc (memset)
bca718
+#endif
bca718
diff --git a/sysdeps/s390/s390-64/memcmp.S b/sysdeps/s390/s390-64/memcmp.S
bca718
index eb5370f..1d7e788 100644
bca718
--- a/sysdeps/s390/s390-64/memcmp.S
bca718
+++ b/sysdeps/s390/s390-64/memcmp.S
bca718
@@ -27,36 +27,36 @@
bca718
 
bca718
        .text
bca718
 #ifdef USE_MULTIARCH
bca718
-ENTRY(__memcmp_z900)
bca718
+ENTRY(__memcmp_default)
bca718
 #else
bca718
 ENTRY(memcmp)
bca718
 #endif
bca718
 	.machine "z900"
bca718
-        ltgr    %r4,%r4
bca718
-        je      .L_Z900_4
bca718
-        aghi    %r4,-1
bca718
-        srlg    %r1,%r4,8
bca718
-        ltgr    %r1,%r1
bca718
-        jne     .L_Z900_12
bca718
+	ltgr    %r4,%r4
bca718
+	je      .L_Z900_4
bca718
+	aghi    %r4,-1
bca718
+	srlg    %r1,%r4,8
bca718
+	ltgr    %r1,%r1
bca718
+	jne     .L_Z900_12
bca718
 .L_Z900_3:
bca718
-        larl    %r1,.L_Z900_15
bca718
-        ex      %r4,0(%r1)
bca718
+	larl    %r1,.L_Z900_15
bca718
+	ex      %r4,0(%r1)
bca718
 .L_Z900_4:
bca718
-        ipm     %r2
bca718
-        sllg    %r2,%r2,34
bca718
-        srag    %r2,%r2,62
bca718
-        br      %r14
bca718
+	ipm     %r2
bca718
+	sllg    %r2,%r2,34
bca718
+	srag    %r2,%r2,62
bca718
+	br      %r14
bca718
 .L_Z900_12:
bca718
-        clc     0(256,%r3),0(%r2)
bca718
-        jne     .L_Z900_4
bca718
-        la      %r3,256(%r3)
bca718
-        la      %r2,256(%r2)
bca718
-        brctg   %r1,.L_Z900_12
bca718
-        j       .L_Z900_3
bca718
+	clc     0(256,%r3),0(%r2)
bca718
+	jne     .L_Z900_4
bca718
+	la      %r3,256(%r3)
bca718
+	la      %r2,256(%r2)
bca718
+	brctg   %r1,.L_Z900_12
bca718
+	j       .L_Z900_3
bca718
 .L_Z900_15:
bca718
-        clc     0(1,%r3),0(%r2)
bca718
+	clc     0(1,%r3),0(%r2)
bca718
 #ifdef USE_MULTIARCH
bca718
-END(__memcmp_z900)
bca718
+END(__memcmp_default)
bca718
 #else
bca718
 END(memcmp)
bca718
 libc_hidden_builtin_def (memcmp)
bca718
diff --git a/sysdeps/s390/s390-64/memcpy.S b/sysdeps/s390/s390-64/memcpy.S
bca718
index 61fca0b..6827a0e 100644
bca718
--- a/sysdeps/s390/s390-64/memcpy.S
bca718
+++ b/sysdeps/s390/s390-64/memcpy.S
bca718
@@ -29,37 +29,37 @@
bca718
        .text
bca718
 
bca718
 #ifdef USE_MULTIARCH
bca718
-ENTRY(__memcpy_z900)
bca718
+ENTRY(__memcpy_default)
bca718
 #else
bca718
 ENTRY(memcpy)
bca718
 #endif
bca718
 	.machine "z900"
bca718
-        ltgr    %r4,%r4
bca718
-        je      .L_Z900_4
bca718
-        aghi    %r4,-1
bca718
-        srlg    %r5,%r4,8
bca718
-        ltgr    %r5,%r5
bca718
-        lgr     %r1,%r2
bca718
-        jne     .L_Z900_13
bca718
+	ltgr    %r4,%r4
bca718
+	je      .L_Z900_4
bca718
+	aghi    %r4,-1
bca718
+	srlg    %r5,%r4,8
bca718
+	ltgr    %r5,%r5
bca718
+	lgr     %r1,%r2
bca718
+	jne     .L_Z900_13
bca718
 .L_Z900_3:
bca718
-        larl    %r5,.L_Z900_15
bca718
-        ex      %r4,0(%r5)
bca718
+	larl    %r5,.L_Z900_15
bca718
+	ex      %r4,0(%r5)
bca718
 .L_Z900_4:
bca718
-        br      %r14
bca718
+	br      %r14
bca718
 .L_Z900_13:
bca718
-        chi	%r5,4096             # Switch to mvcle for copies >1MB
bca718
-        jh      __memcpy_mvcle
bca718
+	chi	%r5,4096             # Switch to mvcle for copies >1MB
bca718
+	jh      __memcpy_mvcle
bca718
 .L_Z900_12:
bca718
-        mvc     0(256,%r1),0(%r3)
bca718
-        la      %r1,256(%r1)
bca718
-        la      %r3,256(%r3)
bca718
-        brctg   %r5,.L_Z900_12
bca718
-        j       .L_Z900_3
bca718
+	mvc     0(256,%r1),0(%r3)
bca718
+	la      %r1,256(%r1)
bca718
+	la      %r3,256(%r3)
bca718
+	brctg   %r5,.L_Z900_12
bca718
+	j       .L_Z900_3
bca718
 .L_Z900_15:
bca718
-        mvc     0(1,%r1),0(%r3)
bca718
+	mvc     0(1,%r1),0(%r3)
bca718
 
bca718
 #ifdef USE_MULTIARCH
bca718
-END(__memcpy_z900)
bca718
+END(__memcpy_default)
bca718
 #else
bca718
 END(memcpy)
bca718
 libc_hidden_builtin_def (memcpy)
bca718
diff --git a/sysdeps/s390/s390-64/memset.S b/sysdeps/s390/s390-64/memset.S
bca718
index 8185e94..b1ba9e2 100644
bca718
--- a/sysdeps/s390/s390-64/memset.S
bca718
+++ b/sysdeps/s390/s390-64/memset.S
bca718
@@ -29,35 +29,35 @@
bca718
        .text
bca718
 
bca718
 #ifdef USE_MULTIARCH
bca718
-ENTRY(__memset_z900)
bca718
+ENTRY(__memset_default)
bca718
 #else
bca718
 ENTRY(memset)
bca718
 #endif
bca718
 	.machine "z900"
bca718
-        ltgr    %r4,%r4
bca718
-        je      .L_Z900_4
bca718
-        stc     %r3,0(%r2)
bca718
-        cghi    %r4,1
bca718
-        lgr     %r1,%r2
bca718
-        je      .L_Z900_4
bca718
-        aghi    %r4,-2
bca718
-        srlg    %r3,%r4,8
bca718
-        ltgr    %r3,%r3
bca718
-        jne     .L_Z900_14
bca718
+	ltgr    %r4,%r4
bca718
+	je      .L_Z900_4
bca718
+	stc     %r3,0(%r2)
bca718
+	cghi    %r4,1
bca718
+	lgr     %r1,%r2
bca718
+	je      .L_Z900_4
bca718
+	aghi    %r4,-2
bca718
+	srlg    %r3,%r4,8
bca718
+	ltgr    %r3,%r3
bca718
+	jne     .L_Z900_14
bca718
 .L_Z900_3:
bca718
-        larl    %r3,.L_Z900_18
bca718
-        ex      %r4,0(%r3)
bca718
+	larl    %r3,.L_Z900_18
bca718
+	ex      %r4,0(%r3)
bca718
 .L_Z900_4:
bca718
-        br      %r14
bca718
+	br      %r14
bca718
 .L_Z900_14:
bca718
-        mvc     1(256,%r1),0(%r1)
bca718
-        la      %r1,256(%r1)
bca718
-        brctg   %r3,.L_Z900_14
bca718
-        j       .L_Z900_3
bca718
+	mvc     1(256,%r1),0(%r1)
bca718
+	la      %r1,256(%r1)
bca718
+	brctg   %r3,.L_Z900_14
bca718
+	j       .L_Z900_3
bca718
 .L_Z900_18:
bca718
-        mvc     1(1,%r1),0(%r1)
bca718
+	mvc     1(1,%r1),0(%r1)
bca718
 #ifdef USE_MULTIARCH
bca718
-END(__memset_z900)
bca718
+END(__memset_default)
bca718
 #else
bca718
 END(memset)
bca718
 libc_hidden_builtin_def (memset)
bca718
diff --git a/sysdeps/s390/s390-64/multiarch/Makefile b/sysdeps/s390/s390-64/multiarch/Makefile
bca718
index 9baeecd..91053b5 100644
bca718
--- a/sysdeps/s390/s390-64/multiarch/Makefile
bca718
+++ b/sysdeps/s390/s390-64/multiarch/Makefile
bca718
@@ -1,3 +1,4 @@
bca718
 ifeq ($(subdir),string)
bca718
-sysdep_routines += ifunc-resolve memset memcpy memcmp
bca718
+sysdep_routines += memset memset-s390x memcpy memcpy-s390x \
bca718
+		   memcmp memcmp-s390x
bca718
 endif
bca718
diff --git a/sysdeps/s390/s390-64/multiarch/ifunc-resolve.c b/sysdeps/s390/s390-64/multiarch/ifunc-resolve.c
bca718
deleted file mode 100644
bca718
index b6be970..0000000
bca718
--- a/sysdeps/s390/s390-64/multiarch/ifunc-resolve.c
bca718
+++ /dev/null
bca718
@@ -1,76 +0,0 @@
bca718
-/* IFUNC resolver function for CPU specific functions.
bca718
-   64 bit S/390 version.
bca718
-   Copyright (C) 2012 Free Software Foundation, Inc.
bca718
-   This file is part of the GNU C Library.
bca718
-
bca718
-   The GNU C Library is free software; you can redistribute it and/or
bca718
-   modify it under the terms of the GNU Lesser General Public
bca718
-   License as published by the Free Software Foundation; either
bca718
-   version 2.1 of the License, or (at your option) any later version.
bca718
-
bca718
-   The GNU C Library is distributed in the hope that it will be useful,
bca718
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
bca718
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
bca718
-   Lesser General Public License for more details.
bca718
-
bca718
-   You should have received a copy of the GNU Lesser General Public
bca718
-   License along with the GNU C Library; if not, see
bca718
-   <http://www.gnu.org/licenses/>.  */
bca718
-
bca718
-#include <unistd.h>
bca718
-#include <dl-procinfo.h>
bca718
-
bca718
-#define STFLE_BITS_Z10  34 /* General instructions extension */
bca718
-#define STFLE_BITS_Z196 45 /* Distinct operands, pop ... */
bca718
-
bca718
-#ifndef NOT_IN_libc
bca718
-
bca718
-#define IFUNC_RESOLVE(FUNC)						\
bca718
-  asm (".globl " #FUNC "\n\t"						\
bca718
-       ".type  " #FUNC ",@gnu_indirect_function\n\t"			\
bca718
-       ".set   " #FUNC ",__resolve_" #FUNC "\n\t"			\
bca718
-       ".globl __GI_" #FUNC "\n\t"					\
bca718
-       ".set   __GI_" #FUNC "," #FUNC "\n");				\
bca718
-									\
bca718
-  /* Make the declarations of the optimized functions hidden in order
bca718
-     to prevent GOT slots being generated for them. */			\
bca718
-  extern void *__##FUNC##_z196 attribute_hidden;			\
bca718
-  extern void *__##FUNC##_z10 attribute_hidden;				\
bca718
-  extern void *__##FUNC##_z900 attribute_hidden;			\
bca718
-									\
bca718
-  void *__resolve_##FUNC (unsigned long int dl_hwcap)			\
bca718
-  {									\
bca718
-    if (dl_hwcap & HWCAP_S390_STFLE)					\
bca718
-      {									\
bca718
-	/* We want just 1 double word to be returned.  */		\
bca718
-	register unsigned long reg0 asm("0") = 0;			\
bca718
-	unsigned long stfle_bits;					\
bca718
-									\
bca718
-	asm volatile(".machine push"        "\n\t"			\
bca718
-		     ".machine \"z9-109\""  "\n\t"			\
bca718
-		     "stfle %0"             "\n\t"			\
bca718
-		     ".machine pop"         "\n"			\
bca718
-		     : "=QS" (stfle_bits), "+d" (reg0)			\
bca718
-		     : : "cc");						\
bca718
-									\
bca718
-	if ((stfle_bits & (1UL << (63 - STFLE_BITS_Z196))) != 0)	\
bca718
-	  return &__##FUNC##_z196;					\
bca718
-	else if ((stfle_bits & (1UL << (63 - STFLE_BITS_Z10))) != 0)	\
bca718
-	  return &__##FUNC##_z10;					\
bca718
-	else								\
bca718
-	  return &__##FUNC##_z900;					\
bca718
-      }									\
bca718
-    else								\
bca718
-      return &__##FUNC##_z900;						\
bca718
-  }
bca718
-
bca718
-IFUNC_RESOLVE(memset)
bca718
-IFUNC_RESOLVE(memcmp)
bca718
-asm(".weak bcmp ; bcmp = memcmp");
bca718
-
bca718
-/* In the static lib memcpy is needed before the reloc is resolved.  */
bca718
-#ifdef SHARED
bca718
-IFUNC_RESOLVE(memcpy)
bca718
-#endif
bca718
-
bca718
-#endif
bca718
diff --git a/sysdeps/s390/s390-64/multiarch/memcmp-s390x.S b/sysdeps/s390/s390-64/multiarch/memcmp-s390x.S
bca718
new file mode 100644
bca718
index 0000000..6d55b0b
bca718
--- /dev/null
bca718
+++ b/sysdeps/s390/s390-64/multiarch/memcmp-s390x.S
bca718
@@ -0,0 +1,101 @@
bca718
+/* CPU specific memcmp implementations.  64 bit S/390 version.
bca718
+   Copyright (C) 2012-2015 Free Software Foundation, Inc.
bca718
+   This file is part of the GNU C Library.
bca718
+
bca718
+   The GNU C Library is free software; you can redistribute it and/or
bca718
+   modify it under the terms of the GNU Lesser General Public
bca718
+   License as published by the Free Software Foundation; either
bca718
+   version 2.1 of the License, or (at your option) any later version.
bca718
+
bca718
+   The GNU C Library is distributed in the hope that it will be useful,
bca718
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
bca718
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
bca718
+   Lesser General Public License for more details.
bca718
+
bca718
+   You should have received a copy of the GNU Lesser General Public
bca718
+   License along with the GNU C Library; if not, see
bca718
+   <http://www.gnu.org/licenses/>.  */
bca718
+
bca718
+
bca718
+#include "sysdep.h"
bca718
+#include "asm-syntax.h"
bca718
+
bca718
+/* INPUT PARAMETERS
bca718
+     %r2 = address of first memory area
bca718
+     %r3 = address of second memory area
bca718
+     %r4 = number of bytes to compare.  */
bca718
+
bca718
+       .text
bca718
+
bca718
+#ifndef NOT_IN_libc
bca718
+
bca718
+ENTRY(__memcmp_z196)
bca718
+	.machine "z196"
bca718
+	ltgr    %r4,%r4
bca718
+	je      .L_Z196_4
bca718
+	aghi    %r4,-1
bca718
+	srlg    %r1,%r4,8
bca718
+	ltgr    %r1,%r1
bca718
+	jne     .L_Z196_2
bca718
+.L_Z196_3:
bca718
+	exrl    %r4,.L_Z196_14
bca718
+.L_Z196_4:
bca718
+	ipm     %r2
bca718
+	sllg    %r2,%r2,34
bca718
+	srag    %r2,%r2,62
bca718
+	br      %r14
bca718
+.L_Z196_17:
bca718
+	la      %r3,256(%r3)
bca718
+	la      %r2,256(%r2)
bca718
+	aghi    %r1,-1
bca718
+	je      .L_Z196_3
bca718
+.L_Z196_2:
bca718
+	pfd     1,512(%r3)
bca718
+	pfd     1,512(%r2)
bca718
+	clc     0(256,%r3),0(%r2)
bca718
+	je      .L_Z196_17
bca718
+	ipm     %r2
bca718
+	sllg    %r2,%r2,34
bca718
+	srag    %r2,%r2,62
bca718
+	br      %r14
bca718
+.L_Z196_14:
bca718
+	clc     0(1,%r3),0(%r2)
bca718
+END(__memcmp_z196)
bca718
+
bca718
+ENTRY(__memcmp_z10)
bca718
+	.machine "z10"
bca718
+	ltgr    %r4,%r4
bca718
+	je      .L_Z10_4
bca718
+	aghi    %r4,-1
bca718
+	srlg    %r1,%r4,8
bca718
+	cgijlh  %r1,0,.L_Z10_12
bca718
+.L_Z10_3:
bca718
+	exrl    %r4,.L_Z10_15
bca718
+.L_Z10_4:
bca718
+	ipm     %r2
bca718
+	sllg    %r2,%r2,34
bca718
+	srag    %r2,%r2,62
bca718
+	br      %r14
bca718
+.L_Z10_12:
bca718
+	pfd     1,512(%r3)
bca718
+	pfd     1,512(%r2)
bca718
+	clc     0(256,%r3),0(%r2)
bca718
+	jne     .L_Z10_4
bca718
+	la      %r3,256(%r3)
bca718
+	la      %r2,256(%r2)
bca718
+	brctg   %r1,.L_Z10_12
bca718
+	j       .L_Z10_3
bca718
+.L_Z10_15:
bca718
+	clc     0(1,%r3),0(%r2)
bca718
+END(__memcmp_z10)
bca718
+
bca718
+#endif /* !NOT_IN_libc */
bca718
+
bca718
+#include "../memcmp.S"
bca718
+
bca718
+#ifdef NOT_IN_libc
bca718
+.globl   memcmp
bca718
+.set     memcmp,__memcmp_default
bca718
+.weak    bcmp
bca718
+.set	 bcmp,__memcmp_default
bca718
+#endif
bca718
diff --git a/sysdeps/s390/s390-64/multiarch/memcmp.S b/sysdeps/s390/s390-64/multiarch/memcmp.S
bca718
deleted file mode 100644
bca718
index 9a8cba8..0000000
bca718
--- a/sysdeps/s390/s390-64/multiarch/memcmp.S
bca718
+++ /dev/null
bca718
@@ -1,101 +0,0 @@
bca718
-/* CPU specific memcmp implementations.  64 bit S/390 version.
bca718
-   Copyright (C) 2012 Free Software Foundation, Inc.
bca718
-   This file is part of the GNU C Library.
bca718
-
bca718
-   The GNU C Library is free software; you can redistribute it and/or
bca718
-   modify it under the terms of the GNU Lesser General Public
bca718
-   License as published by the Free Software Foundation; either
bca718
-   version 2.1 of the License, or (at your option) any later version.
bca718
-
bca718
-   The GNU C Library is distributed in the hope that it will be useful,
bca718
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
bca718
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
bca718
-   Lesser General Public License for more details.
bca718
-
bca718
-   You should have received a copy of the GNU Lesser General Public
bca718
-   License along with the GNU C Library; if not, see
bca718
-   <http://www.gnu.org/licenses/>.  */
bca718
-
bca718
-
bca718
-#include "sysdep.h"
bca718
-#include "asm-syntax.h"
bca718
-
bca718
-/* INPUT PARAMETERS
bca718
-     %r2 = address of first memory area
bca718
-     %r3 = address of second memory area
bca718
-     %r4 = number of bytes to compare.  */
bca718
-
bca718
-       .text
bca718
-
bca718
-#ifndef NOT_IN_libc
bca718
-
bca718
-ENTRY(__memcmp_z196)
bca718
-	.machine "z196"
bca718
-        ltgr    %r4,%r4
bca718
-        je      .L_Z196_4
bca718
-        aghi    %r4,-1
bca718
-        srlg    %r1,%r4,8
bca718
-        ltgr    %r1,%r1
bca718
-        jne     .L_Z196_2
bca718
-.L_Z196_3:
bca718
-        exrl    %r4,.L_Z196_14
bca718
-.L_Z196_4:
bca718
-        ipm     %r2
bca718
-        sllg    %r2,%r2,34
bca718
-        srag    %r2,%r2,62
bca718
-        br      %r14
bca718
-.L_Z196_17:
bca718
-        la      %r3,256(%r3)
bca718
-        la      %r2,256(%r2)
bca718
-        aghi    %r1,-1
bca718
-        je      .L_Z196_3
bca718
-.L_Z196_2:
bca718
-        pfd     1,512(%r3)
bca718
-        pfd     1,512(%r2)
bca718
-        clc     0(256,%r3),0(%r2)
bca718
-        je      .L_Z196_17
bca718
-        ipm     %r2
bca718
-        sllg    %r2,%r2,34
bca718
-        srag    %r2,%r2,62
bca718
-        br      %r14
bca718
-.L_Z196_14:
bca718
-        clc     0(1,%r3),0(%r2)
bca718
-END(__memcmp_z196)
bca718
-
bca718
-ENTRY(__memcmp_z10)
bca718
-	.machine "z10"
bca718
-        ltgr    %r4,%r4
bca718
-        je      .L_Z10_4
bca718
-        aghi    %r4,-1
bca718
-        srlg    %r1,%r4,8
bca718
-        cgijlh  %r1,0,.L_Z10_12
bca718
-.L_Z10_3:
bca718
-        exrl    %r4,.L_Z10_15
bca718
-.L_Z10_4:
bca718
-        ipm     %r2
bca718
-        sllg    %r2,%r2,34
bca718
-        srag    %r2,%r2,62
bca718
-        br      %r14
bca718
-.L_Z10_12:
bca718
-        pfd     1,512(%r3)
bca718
-        pfd     1,512(%r2)
bca718
-        clc     0(256,%r3),0(%r2)
bca718
-        jne     .L_Z10_4
bca718
-        la      %r3,256(%r3)
bca718
-        la      %r2,256(%r2)
bca718
-        brctg   %r1,.L_Z10_12
bca718
-        j       .L_Z10_3
bca718
-.L_Z10_15:
bca718
-        clc     0(1,%r3),0(%r2)
bca718
-END(__memcmp_z10)
bca718
-
bca718
-#endif
bca718
-
bca718
-#include "../memcmp.S"
bca718
-
bca718
-#ifdef NOT_IN_libc
bca718
-.globl   memcmp
bca718
-.set     memcmp,__memcmp_z900
bca718
-.weak    bcmp
bca718
-.set	 bcmp,__memcmp_z900
bca718
-#endif
bca718
diff --git a/sysdeps/s390/s390-64/multiarch/memcmp.c b/sysdeps/s390/s390-64/multiarch/memcmp.c
bca718
new file mode 100644
bca718
index 0000000..7089d56
bca718
--- /dev/null
bca718
+++ b/sysdeps/s390/s390-64/multiarch/memcmp.c
bca718
@@ -0,0 +1,24 @@
bca718
+/* Multiple versions of memcmp.
bca718
+   Copyright (C) 2015 Free Software Foundation, Inc.
bca718
+   This file is part of the GNU C Library.
bca718
+
bca718
+   The GNU C Library is free software; you can redistribute it and/or
bca718
+   modify it under the terms of the GNU Lesser General Public
bca718
+   License as published by the Free Software Foundation; either
bca718
+   version 2.1 of the License, or (at your option) any later version.
bca718
+
bca718
+   The GNU C Library is distributed in the hope that it will be useful,
bca718
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
bca718
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
bca718
+   Lesser General Public License for more details.
bca718
+
bca718
+   You should have received a copy of the GNU Lesser General Public
bca718
+   License along with the GNU C Library; if not, see
bca718
+   <http://www.gnu.org/licenses/>.  */
bca718
+
bca718
+#ifndef NOT_IN_libc
bca718
+# include <ifunc-resolve.h>
bca718
+
bca718
+s390_libc_ifunc (memcmp)
bca718
+asm(".weak bcmp ; bcmp = memcmp");
bca718
+#endif
bca718
diff --git a/sysdeps/s390/s390-64/multiarch/memcpy-s390x.S b/sysdeps/s390/s390-64/multiarch/memcpy-s390x.S
bca718
new file mode 100644
bca718
index 0000000..cdb34f1
bca718
--- /dev/null
bca718
+++ b/sysdeps/s390/s390-64/multiarch/memcpy-s390x.S
bca718
@@ -0,0 +1,94 @@
bca718
+/* CPU specific memcpy implementations.  64 bit S/390 version.
bca718
+   Copyright (C) 2012-2015 Free Software Foundation, Inc.
bca718
+   This file is part of the GNU C Library.
bca718
+
bca718
+   The GNU C Library is free software; you can redistribute it and/or
bca718
+   modify it under the terms of the GNU Lesser General Public
bca718
+   License as published by the Free Software Foundation; either
bca718
+   version 2.1 of the License, or (at your option) any later version.
bca718
+
bca718
+   The GNU C Library is distributed in the hope that it will be useful,
bca718
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
bca718
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
bca718
+   Lesser General Public License for more details.
bca718
+
bca718
+   You should have received a copy of the GNU Lesser General Public
bca718
+   License along with the GNU C Library; if not, see
bca718
+   <http://www.gnu.org/licenses/>.  */
bca718
+
bca718
+
bca718
+#include "sysdep.h"
bca718
+#include "asm-syntax.h"
bca718
+
bca718
+/* INPUT PARAMETERS
bca718
+     %r2 = target operands address
bca718
+     %r3 = source operands address
bca718
+     %r4 = number of bytes to copy.  */
bca718
+
bca718
+       .text
bca718
+
bca718
+#if defined SHARED && !defined NOT_IN_libc
bca718
+
bca718
+ENTRY(__memcpy_z196)
bca718
+	.machine "z196"
bca718
+	ltgr    %r4,%r4
bca718
+	je      .L_Z196_4
bca718
+	aghi    %r4,-1
bca718
+	lgr     %r1,%r2
bca718
+	srlg    %r5,%r4,8
bca718
+	ltgr    %r5,%r5
bca718
+	jne     .L_Z196_5
bca718
+.L_Z196_3:
bca718
+	exrl    %r4,.L_Z196_14
bca718
+.L_Z196_4:
bca718
+	br      %r14
bca718
+.L_Z196_5:
bca718
+	cgfi    %r5,262144      # Switch to mvcle for copies >64MB
bca718
+	jh      __memcpy_mvcle
bca718
+.L_Z196_2:
bca718
+	pfd     1,768(%r3)
bca718
+	pfd     2,768(%r1)
bca718
+	mvc     0(256,%r1),0(%r3)
bca718
+	aghi    %r5,-1
bca718
+	la      %r1,256(%r1)
bca718
+	la      %r3,256(%r3)
bca718
+	jne     .L_Z196_2
bca718
+	j       .L_Z196_3
bca718
+.L_Z196_14:
bca718
+	mvc     0(1,%r1),0(%r3)
bca718
+END(__memcpy_z196)
bca718
+
bca718
+ENTRY(__memcpy_z10)
bca718
+	.machine "z10"
bca718
+	cgije   %r4,0,.L_Z10_4
bca718
+	aghi    %r4,-1
bca718
+	lgr     %r1,%r2
bca718
+	srlg    %r5,%r4,8
bca718
+	cgijlh  %r5,0,.L_Z10_13
bca718
+.L_Z10_3:
bca718
+	exrl    %r4,.L_Z10_15
bca718
+.L_Z10_4:
bca718
+	br      %r14
bca718
+.L_Z10_13:
bca718
+	cgfi    %r5,65535	# Switch to mvcle for copies >16MB
bca718
+	jh      __memcpy_mvcle
bca718
+.L_Z10_12:
bca718
+	pfd     1,768(%r3)
bca718
+	pfd     2,768(%r1)
bca718
+	mvc     0(256,%r1),0(%r3)
bca718
+	la      %r1,256(%r1)
bca718
+	la      %r3,256(%r3)
bca718
+	brctg   %r5,.L_Z10_12
bca718
+	j       .L_Z10_3
bca718
+.L_Z10_15:
bca718
+	mvc     0(1,%r1),0(%r3)
bca718
+END(__memcpy_z10)
bca718
+
bca718
+#endif /* SHARED && !defined NOT_IN_libc  */
bca718
+
bca718
+#include "../memcpy.S"
bca718
+
bca718
+#if !defined SHARED || defined NOT_IN_libc
bca718
+.globl   memcpy
bca718
+.set     memcpy,__memcpy_default
bca718
+#endif
bca718
diff --git a/sysdeps/s390/s390-64/multiarch/memcpy.S b/sysdeps/s390/s390-64/multiarch/memcpy.S
bca718
deleted file mode 100644
bca718
index 525588f..0000000
bca718
--- a/sysdeps/s390/s390-64/multiarch/memcpy.S
bca718
+++ /dev/null
bca718
@@ -1,94 +0,0 @@
bca718
-/* CPU specific memcpy implementations.  64 bit S/390 version.
bca718
-   Copyright (C) 2012 Free Software Foundation, Inc.
bca718
-   This file is part of the GNU C Library.
bca718
-
bca718
-   The GNU C Library is free software; you can redistribute it and/or
bca718
-   modify it under the terms of the GNU Lesser General Public
bca718
-   License as published by the Free Software Foundation; either
bca718
-   version 2.1 of the License, or (at your option) any later version.
bca718
-
bca718
-   The GNU C Library is distributed in the hope that it will be useful,
bca718
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
bca718
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
bca718
-   Lesser General Public License for more details.
bca718
-
bca718
-   You should have received a copy of the GNU Lesser General Public
bca718
-   License along with the GNU C Library; if not, see
bca718
-   <http://www.gnu.org/licenses/>.  */
bca718
-
bca718
-
bca718
-#include "sysdep.h"
bca718
-#include "asm-syntax.h"
bca718
-
bca718
-/* INPUT PARAMETERS
bca718
-     %r2 = target operands address
bca718
-     %r3 = source operands address
bca718
-     %r4 = number of bytes to copy.  */
bca718
-
bca718
-       .text
bca718
-
bca718
-#if defined SHARED && !defined NOT_IN_libc
bca718
-
bca718
-ENTRY(__memcpy_z196)
bca718
-        .machine "z196"
bca718
-        ltgr    %r4,%r4
bca718
-        je      .L_Z196_4
bca718
-        aghi    %r4,-1
bca718
-        lgr     %r1,%r2
bca718
-        srlg    %r5,%r4,8
bca718
-        ltgr    %r5,%r5
bca718
-        jne     .L_Z196_5
bca718
-.L_Z196_3:
bca718
-        exrl    %r4,.L_Z196_14
bca718
-.L_Z196_4:
bca718
-        br      %r14
bca718
-.L_Z196_5:
bca718
-        cgfi    %r5,262144      # Switch to mvcle for copies >64MB
bca718
-        jh      __memcpy_mvcle
bca718
-.L_Z196_2:
bca718
-        pfd     1,768(%r3)
bca718
-        pfd     2,768(%r1)
bca718
-        mvc     0(256,%r1),0(%r3)
bca718
-        aghi    %r5,-1
bca718
-        la      %r1,256(%r1)
bca718
-        la      %r3,256(%r3)
bca718
-        jne     .L_Z196_2
bca718
-        j       .L_Z196_3
bca718
-.L_Z196_14:
bca718
-        mvc     0(1,%r1),0(%r3)
bca718
-END(__memcpy_z196)
bca718
-
bca718
-ENTRY(__memcpy_z10)
bca718
-	.machine "z10"
bca718
-        cgije   %r4,0,.L_Z10_4
bca718
-        aghi    %r4,-1
bca718
-        lgr     %r1,%r2
bca718
-        srlg    %r5,%r4,8
bca718
-        cgijlh  %r5,0,.L_Z10_13
bca718
-.L_Z10_3:
bca718
-        exrl    %r4,.L_Z10_15
bca718
-.L_Z10_4:
bca718
-        br      %r14
bca718
-.L_Z10_13:
bca718
-        cgfi    %r5,65535	# Switch to mvcle for copies >16MB
bca718
-        jh      __memcpy_mvcle
bca718
-.L_Z10_12:
bca718
-        pfd     1,768(%r3)
bca718
-        pfd     2,768(%r1)
bca718
-        mvc     0(256,%r1),0(%r3)
bca718
-        la      %r1,256(%r1)
bca718
-        la      %r3,256(%r3)
bca718
-        brctg   %r5,.L_Z10_12
bca718
-        j       .L_Z10_3
bca718
-.L_Z10_15:
bca718
-        mvc     0(1,%r1),0(%r3)
bca718
-END(__memcpy_z10)
bca718
-
bca718
-#endif
bca718
-
bca718
-#include "../memcpy.S"
bca718
-
bca718
-#if !defined SHARED || defined NOT_IN_libc
bca718
-.globl   memcpy
bca718
-.set     memcpy,__memcpy_z900
bca718
-#endif
bca718
diff --git a/sysdeps/s390/s390-64/multiarch/memcpy.c b/sysdeps/s390/s390-64/multiarch/memcpy.c
bca718
new file mode 100644
bca718
index 0000000..1ff31bb
bca718
--- /dev/null
bca718
+++ b/sysdeps/s390/s390-64/multiarch/memcpy.c
bca718
@@ -0,0 +1,24 @@
bca718
+/* Multiple versions of memcpy.
bca718
+   Copyright (C) 2015 Free Software Foundation, Inc.
bca718
+   This file is part of the GNU C Library.
bca718
+
bca718
+   The GNU C Library is free software; you can redistribute it and/or
bca718
+   modify it under the terms of the GNU Lesser General Public
bca718
+   License as published by the Free Software Foundation; either
bca718
+   version 2.1 of the License, or (at your option) any later version.
bca718
+
bca718
+   The GNU C Library is distributed in the hope that it will be useful,
bca718
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
bca718
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
bca718
+   Lesser General Public License for more details.
bca718
+
bca718
+   You should have received a copy of the GNU Lesser General Public
bca718
+   License along with the GNU C Library; if not, see
bca718
+   <http://www.gnu.org/licenses/>.  */
bca718
+
bca718
+/* In the static lib memcpy is needed before the reloc is resolved.  */
bca718
+#if defined SHARED && !defined NOT_IN_libc
bca718
+# include <ifunc-resolve.h>
bca718
+
bca718
+s390_libc_ifunc (memcpy)
bca718
+#endif
bca718
diff --git a/sysdeps/s390/s390-64/multiarch/memset-s390x.S b/sysdeps/s390/s390-64/multiarch/memset-s390x.S
bca718
new file mode 100644
bca718
index 0000000..0037bdf
bca718
--- /dev/null
bca718
+++ b/sysdeps/s390/s390-64/multiarch/memset-s390x.S
bca718
@@ -0,0 +1,109 @@
bca718
+/* Set a block of memory to some byte value.  64 bit S/390 version.
bca718
+   Copyright (C) 2012-2015 Free Software Foundation, Inc.
bca718
+   This file is part of the GNU C Library.
bca718
+
bca718
+   The GNU C Library is free software; you can redistribute it and/or
bca718
+   modify it under the terms of the GNU Lesser General Public
bca718
+   License as published by the Free Software Foundation; either
bca718
+   version 2.1 of the License, or (at your option) any later version.
bca718
+
bca718
+   The GNU C Library is distributed in the hope that it will be useful,
bca718
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
bca718
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
bca718
+   Lesser General Public License for more details.
bca718
+
bca718
+   You should have received a copy of the GNU Lesser General Public
bca718
+   License along with the GNU C Library; if not, see
bca718
+   <http://www.gnu.org/licenses/>.  */
bca718
+
bca718
+
bca718
+#include "sysdep.h"
bca718
+#include "asm-syntax.h"
bca718
+
bca718
+/* INPUT PARAMETERS
bca718
+     %r2 = address of memory area
bca718
+     %r3 = byte to fill memory with
bca718
+     %r4 = number of bytes to fill.  */
bca718
+
bca718
+       .text
bca718
+
bca718
+#ifndef NOT_IN_libc
bca718
+
bca718
+ENTRY(__memset_z196)
bca718
+	.machine "z196"
bca718
+	ltgr    %r4,%r4
bca718
+	je      .L_Z196_4
bca718
+	stc     %r3,0(%r2)
bca718
+	lgr     %r1,%r2
bca718
+	cghi    %r4,1
bca718
+	je      .L_Z196_4
bca718
+	aghi    %r4,-2
bca718
+	srlg    %r5,%r4,8
bca718
+	ltgr    %r5,%r5
bca718
+	jne     .L_Z196_1
bca718
+.L_Z196_3:
bca718
+	exrl    %r4,.L_Z196_17
bca718
+.L_Z196_4:
bca718
+	br      %r14
bca718
+.L_Z196_1:
bca718
+	cgfi	%r5,1048576
bca718
+	jh	__memset_mvcle	   # Switch to mvcle for >256MB
bca718
+.L_Z196_2:
bca718
+	pfd     2,1024(%r1)
bca718
+	mvc     1(256,%r1),0(%r1)
bca718
+	aghi    %r5,-1
bca718
+	la      %r1,256(%r1)
bca718
+	jne     .L_Z196_2
bca718
+	j       .L_Z196_3
bca718
+.L_Z196_17:
bca718
+	mvc     1(1,%r1),0(%r1)
bca718
+END(__memset_z196)
bca718
+
bca718
+ENTRY(__memset_z10)
bca718
+	.machine "z10"
bca718
+	cgije   %r4,0,.L_Z10_4
bca718
+	stc     %r3,0(%r2)
bca718
+	lgr     %r1,%r2
bca718
+	cgije   %r4,1,.L_Z10_4
bca718
+	aghi    %r4,-2
bca718
+	srlg    %r5,%r4,8
bca718
+	cgijlh  %r5,0,.L_Z10_15
bca718
+.L_Z10_3:
bca718
+	exrl    %r4,.L_Z10_18
bca718
+.L_Z10_4:
bca718
+	br      %r14
bca718
+.L_Z10_15:
bca718
+	cgfi	%r5,163840          # Switch to mvcle for >40MB
bca718
+	jh	__memset_mvcle
bca718
+.L_Z10_14:
bca718
+	pfd     2,1024(%r1)
bca718
+	mvc     1(256,%r1),0(%r1)
bca718
+	la      %r1,256(%r1)
bca718
+	brctg   %r5,.L_Z10_14
bca718
+	j       .L_Z10_3
bca718
+.L_Z10_18:
bca718
+	mvc     1(1,%r1),0(%r1)
bca718
+END(__memset_z10)
bca718
+
bca718
+ENTRY(__memset_mvcle)
bca718
+	aghi	%r4,2               # take back the change done by the caller
bca718
+	lgr	%r0,%r2		    # save source address
bca718
+	lgr	%r1,%r3		    # move pad byte to R1
bca718
+	lgr	%r3,%r4             # move length to r3
bca718
+	sgr	%r4,%r4		    # no source for MVCLE, only a pad byte
bca718
+	sgr	%r5,%r5
bca718
+.L0:	mvcle	%r2,%r4,0(%r1)	    # thats it, MVCLE is your friend
bca718
+	jo	.L0
bca718
+	lgr	%r2,%r0		    # return value is source address
bca718
+.L1:
bca718
+	br	%r14
bca718
+END(__memset_mvcle)
bca718
+
bca718
+#endif /* !NOT_IN_libc */
bca718
+
bca718
+#include "../memset.S"
bca718
+
bca718
+#ifdef NOT_IN_libc
bca718
+.globl   memset
bca718
+.set     memset,__memset_default
bca718
+#endif
bca718
diff --git a/sysdeps/s390/s390-64/multiarch/memset.S b/sysdeps/s390/s390-64/multiarch/memset.S
bca718
deleted file mode 100644
bca718
index 8dbb3cb..0000000
bca718
--- a/sysdeps/s390/s390-64/multiarch/memset.S
bca718
+++ /dev/null
bca718
@@ -1,109 +0,0 @@
bca718
-/* Set a block of memory to some byte value.  64 bit S/390 version.
bca718
-   Copyright (C) 2012 Free Software Foundation, Inc.
bca718
-   This file is part of the GNU C Library.
bca718
-
bca718
-   The GNU C Library is free software; you can redistribute it and/or
bca718
-   modify it under the terms of the GNU Lesser General Public
bca718
-   License as published by the Free Software Foundation; either
bca718
-   version 2.1 of the License, or (at your option) any later version.
bca718
-
bca718
-   The GNU C Library is distributed in the hope that it will be useful,
bca718
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
bca718
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
bca718
-   Lesser General Public License for more details.
bca718
-
bca718
-   You should have received a copy of the GNU Lesser General Public
bca718
-   License along with the GNU C Library; if not, see
bca718
-   <http://www.gnu.org/licenses/>.  */
bca718
-
bca718
-
bca718
-#include "sysdep.h"
bca718
-#include "asm-syntax.h"
bca718
-
bca718
-/* INPUT PARAMETERS
bca718
-     %r2 = address of memory area
bca718
-     %r3 = byte to fill memory with
bca718
-     %r4 = number of bytes to fill.  */
bca718
-
bca718
-       .text
bca718
-
bca718
-#ifndef NOT_IN_libc
bca718
-
bca718
-ENTRY(__memset_z196)
bca718
-	.machine "z196"
bca718
-        ltgr    %r4,%r4
bca718
-        je      .L_Z196_4
bca718
-        stc     %r3,0(%r2)
bca718
-        lgr     %r1,%r2
bca718
-        cghi    %r4,1
bca718
-        je      .L_Z196_4
bca718
-        aghi    %r4,-2
bca718
-        srlg    %r5,%r4,8
bca718
-        ltgr    %r5,%r5
bca718
-        jne     .L_Z196_1
bca718
-.L_Z196_3:
bca718
-        exrl    %r4,.L_Z196_17
bca718
-.L_Z196_4:
bca718
-        br      %r14
bca718
-.L_Z196_1:
bca718
-	cgfi	%r5,1048576
bca718
-	jh	__memset_mvcle	   # Switch to mvcle for >256MB
bca718
-.L_Z196_2:
bca718
-        pfd     2,1024(%r1)
bca718
-        mvc     1(256,%r1),0(%r1)
bca718
-        aghi    %r5,-1
bca718
-        la      %r1,256(%r1)
bca718
-        jne     .L_Z196_2
bca718
-        j       .L_Z196_3
bca718
-.L_Z196_17:
bca718
-        mvc     1(1,%r1),0(%r1)
bca718
-END(__memset_z196)
bca718
-
bca718
-ENTRY(__memset_z10)
bca718
-	.machine "z10"
bca718
-        cgije   %r4,0,.L_Z10_4
bca718
-        stc     %r3,0(%r2)
bca718
-        lgr     %r1,%r2
bca718
-        cgije   %r4,1,.L_Z10_4
bca718
-        aghi    %r4,-2
bca718
-        srlg    %r5,%r4,8
bca718
-        cgijlh  %r5,0,.L_Z10_15
bca718
-.L_Z10_3:
bca718
-        exrl    %r4,.L_Z10_18
bca718
-.L_Z10_4:
bca718
-        br      %r14
bca718
-.L_Z10_15:
bca718
-	cgfi	%r5,163840          # Switch to mvcle for >40MB
bca718
-	jh	__memset_mvcle
bca718
-.L_Z10_14:
bca718
-        pfd     2,1024(%r1)
bca718
-        mvc     1(256,%r1),0(%r1)
bca718
-        la      %r1,256(%r1)
bca718
-        brctg   %r5,.L_Z10_14
bca718
-        j       .L_Z10_3
bca718
-.L_Z10_18:
bca718
-        mvc     1(1,%r1),0(%r1)
bca718
-END(__memset_z10)
bca718
-
bca718
-ENTRY(__memset_mvcle)
bca718
-	aghi	%r4,2               # take back the change done by the caller
bca718
-	lgr	%r0,%r2		    # save source address
bca718
-	lgr	%r1,%r3		    # move pad byte to R1
bca718
-	lgr	%r3,%r4             # move length to r3
bca718
-	sgr	%r4,%r4		    # no source for MVCLE, only a pad byte
bca718
-	sgr	%r5,%r5
bca718
-.L0:	mvcle	%r2,%r4,0(%r1)	    # thats it, MVCLE is your friend
bca718
-	jo	.L0
bca718
-	lgr	%r2,%r0		    # return value is source address
bca718
-.L1:
bca718
-	br	%r14
bca718
-END(__memset_mvcle)
bca718
-
bca718
-#endif
bca718
-
bca718
-#include "../memset.S"
bca718
-
bca718
-#ifdef NOT_IN_libc
bca718
-.globl   memset
bca718
-.set     memset,__memset_z900
bca718
-#endif
bca718
diff --git a/sysdeps/s390/s390-64/multiarch/memset.c b/sysdeps/s390/s390-64/multiarch/memset.c
bca718
new file mode 100644
bca718
index 0000000..3b15446
bca718
--- /dev/null
bca718
+++ b/sysdeps/s390/s390-64/multiarch/memset.c
bca718
@@ -0,0 +1,23 @@
bca718
+/* Multiple versions of memset.
bca718
+   Copyright (C) 2015 Free Software Foundation, Inc.
bca718
+   This file is part of the GNU C Library.
bca718
+
bca718
+   The GNU C Library is free software; you can redistribute it and/or
bca718
+   modify it under the terms of the GNU Lesser General Public
bca718
+   License as published by the Free Software Foundation; either
bca718
+   version 2.1 of the License, or (at your option) any later version.
bca718
+
bca718
+   The GNU C Library is distributed in the hope that it will be useful,
bca718
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
bca718
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
bca718
+   Lesser General Public License for more details.
bca718
+
bca718
+   You should have received a copy of the GNU Lesser General Public
bca718
+   License along with the GNU C Library; if not, see
bca718
+   <http://www.gnu.org/licenses/>.  */
bca718
+
bca718
+#ifndef NOT_IN_libc
bca718
+# include <ifunc-resolve.h>
bca718
+
bca718
+s390_libc_ifunc (memset)
bca718
+#endif
bca718
-- 
bca718
2.3.0
bca718