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