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