bdc76f
commit b7e024a838452a85870256d8f1ab946dc8f931cd
bdc76f
Author: Stefan Liebler <stli@linux.ibm.com>
bdc76f
Date:   Tue Dec 18 13:57:05 2018 +0100
bdc76f
bdc76f
    S390: Refactor memcmp ifunc handling.
bdc76f
    
bdc76f
    This patch moves all ifunc variants for memcmp
bdc76f
    to sysdeps/s390/memcmp-z900.S. The configure-check/preprocessor logic
bdc76f
    in sysdeps/s390/ifunc-memcmp.h decides if ifunc is needed at all
bdc76f
    and which ifunc variants should be available.
bdc76f
    E.g. if the compiler/assembler already supports z196 by default,
bdc76f
    the older ifunc variants are not included.
bdc76f
    If we only need the newest ifunc variant,
bdc76f
    then we can skip ifunc at all.
bdc76f
    
bdc76f
    Therefore the ifunc-resolvers and __libc_ifunc_impl_list are adjusted
bdc76f
    in order to handle only the available ifunc variants.
bdc76f
    
bdc76f
    ChangeLog:
bdc76f
    
bdc76f
            * sysdeps/s390/ifunc-memcmp.h: New File.
bdc76f
            * sysdeps/s390/memcmp.S: Move to ...
bdc76f
            * sysdeps/s390/memcmp-z900.S ... here.
bdc76f
            Move implementations from memcmp-s390x.s to here.
bdc76f
            * sysdeps/s390/multiarch/memcmp-s390x.S: Delete File.
bdc76f
            * sysdeps/s390/multiarch/Makefile (sysdep_routines):
bdc76f
            Remove memcmp variants.
bdc76f
            * sysdeps/s390/Makefile (sysdep_routines):
bdc76f
            Add memcmp variants.
bdc76f
            * sysdeps/s390/multiarch/ifunc-impl-list.c
bdc76f
            (__libc_ifunc_impl_list): Adjust ifunc variants for
bdc76f
            memcmp.
bdc76f
            * sysdeps/s390/multiarch/memcmp.c: Move ifunc resolver
bdc76f
            to ...
bdc76f
            * sysdeps/s390/memcmp.c: ... here.
bdc76f
            Adjust ifunc variants for memcmp.
bdc76f
bdc76f
diff --git a/sysdeps/s390/Makefile b/sysdeps/s390/Makefile
bdc76f
index e40e5bd982e54d89..c59cbdc25aad408a 100644
bdc76f
--- a/sysdeps/s390/Makefile
bdc76f
+++ b/sysdeps/s390/Makefile
bdc76f
@@ -31,5 +31,6 @@ sysdeps-gconv-modules = ../sysdeps/s390/gconv-modules
bdc76f
 endif
bdc76f
 
bdc76f
 ifeq ($(subdir),string)
bdc76f
-sysdep_routines += bzero memset memset-z900
bdc76f
+sysdep_routines += bzero memset memset-z900 \
bdc76f
+		   memcmp memcmp-z900
bdc76f
 endif
bdc76f
diff --git a/sysdeps/s390/ifunc-memcmp.h b/sysdeps/s390/ifunc-memcmp.h
bdc76f
new file mode 100644
bdc76f
index 0000000000000000..536ac455d177c027
bdc76f
--- /dev/null
bdc76f
+++ b/sysdeps/s390/ifunc-memcmp.h
bdc76f
@@ -0,0 +1,59 @@
bdc76f
+/* memcmp variant information on S/390 version.
bdc76f
+   Copyright (C) 2018 Free Software Foundation, Inc.
bdc76f
+   This file is part of the GNU C Library.
bdc76f
+
bdc76f
+   The GNU C Library is free software; you can redistribute it and/or
bdc76f
+   modify it under the terms of the GNU Lesser General Public
bdc76f
+   License as published by the Free Software Foundation; either
bdc76f
+   version 2.1 of the License, or (at your option) any later version.
bdc76f
+
bdc76f
+   The GNU C Library is distributed in the hope that it will be useful,
bdc76f
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
bdc76f
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
bdc76f
+   Lesser General Public License for more details.
bdc76f
+
bdc76f
+   You should have received a copy of the GNU Lesser General Public
bdc76f
+   License along with the GNU C Library; if not, see
bdc76f
+   <http://www.gnu.org/licenses/>.  */
bdc76f
+
bdc76f
+#if defined USE_MULTIARCH && IS_IN (libc)	\
bdc76f
+  && ! defined HAVE_S390_MIN_Z196_ZARCH_ASM_SUPPORT
bdc76f
+# define HAVE_MEMCMP_IFUNC	1
bdc76f
+#else
bdc76f
+# define HAVE_MEMCMP_IFUNC	0
bdc76f
+#endif
bdc76f
+
bdc76f
+#if defined HAVE_S390_MIN_Z196_ZARCH_ASM_SUPPORT
bdc76f
+# define MEMCMP_DEFAULT		MEMCMP_Z196
bdc76f
+# define HAVE_MEMCMP_Z900_G5	0
bdc76f
+# define HAVE_MEMCMP_Z10	0
bdc76f
+# define HAVE_MEMCMP_Z196	1
bdc76f
+#elif defined HAVE_S390_MIN_Z10_ZARCH_ASM_SUPPORT
bdc76f
+# define MEMCMP_DEFAULT		MEMCMP_Z10
bdc76f
+# define HAVE_MEMCMP_Z900_G5	0
bdc76f
+# define HAVE_MEMCMP_Z10	1
bdc76f
+# define HAVE_MEMCMP_Z196	HAVE_MEMCMP_IFUNC
bdc76f
+#else
bdc76f
+# define MEMCMP_DEFAULT		MEMCMP_Z900_G5
bdc76f
+# define HAVE_MEMCMP_Z900_G5	1
bdc76f
+# define HAVE_MEMCMP_Z10	HAVE_MEMCMP_IFUNC
bdc76f
+# define HAVE_MEMCMP_Z196	HAVE_MEMCMP_IFUNC
bdc76f
+#endif
bdc76f
+
bdc76f
+#if HAVE_MEMCMP_Z900_G5
bdc76f
+# define MEMCMP_Z900_G5		__memcmp_default
bdc76f
+#else
bdc76f
+# define MEMCMP_Z900_G5		NULL
bdc76f
+#endif
bdc76f
+
bdc76f
+#if HAVE_MEMCMP_Z10
bdc76f
+# define MEMCMP_Z10		__memcmp_z10
bdc76f
+#else
bdc76f
+# define MEMCMP_Z10		NULL
bdc76f
+#endif
bdc76f
+
bdc76f
+#if HAVE_MEMCMP_Z196
bdc76f
+# define MEMCMP_Z196		__memcmp_z196
bdc76f
+#else
bdc76f
+# define MEMCMP_Z196		NULL
bdc76f
+#endif
bdc76f
diff --git a/sysdeps/s390/multiarch/memcmp-s390x.S b/sysdeps/s390/memcmp-z900.S
bdc76f
similarity index 54%
bdc76f
rename from sysdeps/s390/multiarch/memcmp-s390x.S
bdc76f
rename to sysdeps/s390/memcmp-z900.S
bdc76f
index 6321737acec821ec..c3b3677ba78264ee 100644
bdc76f
--- a/sysdeps/s390/multiarch/memcmp-s390x.S
bdc76f
+++ b/sysdeps/s390/memcmp-z900.S
bdc76f
@@ -1,4 +1,4 @@
bdc76f
-/* CPU specific memcmp implementations.  31/64 bit S/390 version.
bdc76f
+/* memcmp - compare two memory blocks.  31/64 bit S/390 version.
bdc76f
    Copyright (C) 2012-2018 Free Software Foundation, Inc.
bdc76f
    This file is part of the GNU C Library.
bdc76f
 
bdc76f
@@ -17,8 +17,9 @@
bdc76f
    <http://www.gnu.org/licenses/>.  */
bdc76f
 
bdc76f
 
bdc76f
-#include "sysdep.h"
bdc76f
+#include <sysdep.h>
bdc76f
 #include "asm-syntax.h"
bdc76f
+#include <ifunc-memcmp.h>
bdc76f
 
bdc76f
 /* INPUT PARAMETERS
bdc76f
      %r2 = address of first memory area
bdc76f
@@ -27,46 +28,67 @@
bdc76f
 
bdc76f
        .text
bdc76f
 
bdc76f
-#if IS_IN (libc)
bdc76f
-
bdc76f
-ENTRY(__memcmp_z196)
bdc76f
-	.machine "z196"
bdc76f
-	.machinemode "zarch_nohighgprs"
bdc76f
-# if !defined __s390x__
bdc76f
-	llgfr	%r4,%r4
bdc76f
-# endif /* !defined __s390x__  */
bdc76f
-	ltgr    %r4,%r4
bdc76f
-	je      .L_Z196_4
bdc76f
-	aghi    %r4,-1
bdc76f
+#if HAVE_MEMCMP_Z900_G5
bdc76f
+# if defined __s390x__
bdc76f
+#  define LTGR	ltgr
bdc76f
+#  define AGHI	aghi
bdc76f
+#  define BRCTG	brctg
bdc76f
+# else
bdc76f
+#  define LTGR	ltr
bdc76f
+#  define AGHI	ahi
bdc76f
+#  define BRCTG	brct
bdc76f
+# endif /* ! defined __s390x__  */
bdc76f
+ENTRY(MEMCMP_Z900_G5)
bdc76f
+# if defined __s390x__
bdc76f
+	.machine "z900"
bdc76f
+# else
bdc76f
+	.machine "g5"
bdc76f
+	basr    %r5,0
bdc76f
+.L_Z900_G5_16:
bdc76f
+#  define Z900_G5_EX_D .L_Z900_G5_15-.L_Z900_G5_16
bdc76f
+# endif /* ! defined __s390x__  */
bdc76f
+	LTGR    %r4,%r4
bdc76f
+	je      .L_Z900_G5_4
bdc76f
+	AGHI    %r4,-1
bdc76f
+# if defined __s390x__
bdc76f
 	srlg    %r1,%r4,8
bdc76f
-	ltgr    %r1,%r1
bdc76f
-	jne     .L_Z196_2
bdc76f
-.L_Z196_3:
bdc76f
-	exrl    %r4,.L_Z196_14
bdc76f
-.L_Z196_4:
bdc76f
+	larl    %r5,.L_Z900_G5_15
bdc76f
+#  define Z900_G5_EX_D 0
bdc76f
+# else
bdc76f
+	lr	%r1,%r4
bdc76f
+	srl	%r1,8
bdc76f
+# endif /* ! defined __s390x__  */
bdc76f
+	LTGR    %r1,%r1
bdc76f
+	jne     .L_Z900_G5_12
bdc76f
+.L_Z900_G5_3:
bdc76f
+	ex      %r4,Z900_G5_EX_D(%r5)
bdc76f
+.L_Z900_G5_4:
bdc76f
 	ipm     %r2
bdc76f
+# if defined __s390x__
bdc76f
 	sllg    %r2,%r2,34
bdc76f
 	srag    %r2,%r2,62
bdc76f
+# else
bdc76f
+	sll     %r2,2
bdc76f
+	sra     %r2,30
bdc76f
+# endif /* ! defined __s390x__  */
bdc76f
 	br      %r14
bdc76f
-.L_Z196_17:
bdc76f
+.L_Z900_G5_12:
bdc76f
+	clc     0(256,%r3),0(%r2)
bdc76f
+	jne     .L_Z900_G5_4
bdc76f
 	la      %r3,256(%r3)
bdc76f
 	la      %r2,256(%r2)
bdc76f
-	aghi    %r1,-1
bdc76f
-	je      .L_Z196_3
bdc76f
-.L_Z196_2:
bdc76f
-	pfd     1,512(%r3)
bdc76f
-	pfd     1,512(%r2)
bdc76f
-	clc     0(256,%r3),0(%r2)
bdc76f
-	je      .L_Z196_17
bdc76f
-	ipm     %r2
bdc76f
-	sllg    %r2,%r2,34
bdc76f
-	srag    %r2,%r2,62
bdc76f
-	br      %r14
bdc76f
-.L_Z196_14:
bdc76f
+	BRCTG   %r1,.L_Z900_G5_12
bdc76f
+	j       .L_Z900_G5_3
bdc76f
+.L_Z900_G5_15:
bdc76f
 	clc     0(1,%r3),0(%r2)
bdc76f
-END(__memcmp_z196)
bdc76f
+END(MEMCMP_Z900_G5)
bdc76f
+# undef LTGR
bdc76f
+# undef AGHI
bdc76f
+# undef BRCTG
bdc76f
+#endif /* HAVE_MEMCMP_Z900_G5  */
bdc76f
 
bdc76f
-ENTRY(__memcmp_z10)
bdc76f
+#if HAVE_MEMCMP_Z10
bdc76f
+ENTRY(MEMCMP_Z10)
bdc76f
 	.machine "z10"
bdc76f
 	.machinemode "zarch_nohighgprs"
bdc76f
 # if !defined __s390x__
bdc76f
@@ -95,18 +117,57 @@ ENTRY(__memcmp_z10)
bdc76f
 	j       .L_Z10_3
bdc76f
 .L_Z10_15:
bdc76f
 	clc     0(1,%r3),0(%r2)
bdc76f
-END(__memcmp_z10)
bdc76f
+END(MEMCMP_Z10)
bdc76f
+#endif /* HAVE_MEMCMP_Z10  */
bdc76f
 
bdc76f
-#endif /* IS_IN (libc) */
bdc76f
+#if HAVE_MEMCMP_Z196
bdc76f
+ENTRY(MEMCMP_Z196)
bdc76f
+	.machine "z196"
bdc76f
+	.machinemode "zarch_nohighgprs"
bdc76f
+# if !defined __s390x__
bdc76f
+	llgfr	%r4,%r4
bdc76f
+# endif /* !defined __s390x__  */
bdc76f
+	ltgr    %r4,%r4
bdc76f
+	je      .L_Z196_4
bdc76f
+	aghi    %r4,-1
bdc76f
+	srlg    %r1,%r4,8
bdc76f
+	ltgr    %r1,%r1
bdc76f
+	jne     .L_Z196_2
bdc76f
+.L_Z196_3:
bdc76f
+	exrl    %r4,.L_Z196_14
bdc76f
+.L_Z196_4:
bdc76f
+	ipm     %r2
bdc76f
+	sllg    %r2,%r2,34
bdc76f
+	srag    %r2,%r2,62
bdc76f
+	br      %r14
bdc76f
+.L_Z196_17:
bdc76f
+	la      %r3,256(%r3)
bdc76f
+	la      %r2,256(%r2)
bdc76f
+	aghi    %r1,-1
bdc76f
+	je      .L_Z196_3
bdc76f
+.L_Z196_2:
bdc76f
+	pfd     1,512(%r3)
bdc76f
+	pfd     1,512(%r2)
bdc76f
+	clc     0(256,%r3),0(%r2)
bdc76f
+	je      .L_Z196_17
bdc76f
+	ipm     %r2
bdc76f
+	sllg    %r2,%r2,34
bdc76f
+	srag    %r2,%r2,62
bdc76f
+	br      %r14
bdc76f
+.L_Z196_14:
bdc76f
+	clc     0(1,%r3),0(%r2)
bdc76f
+END(MEMCMP_Z196)
bdc76f
+#endif /* HAVE_MEMCMP_Z196  */
bdc76f
 
bdc76f
-#include "../memcmp.S"
bdc76f
+#if ! HAVE_MEMCMP_IFUNC
bdc76f
+/* If we don't use ifunc, define an alias for memcmp here.
bdc76f
+   Otherwise see sysdeps/s390/memcmp.c.  */
bdc76f
+strong_alias (MEMCMP_DEFAULT, memcmp)
bdc76f
+weak_alias (memcmp, bcmp)
bdc76f
+#endif
bdc76f
 
bdc76f
-#if !IS_IN (libc)
bdc76f
-.globl   memcmp
bdc76f
-.set     memcmp,__memcmp_default
bdc76f
-.weak    bcmp
bdc76f
-.set	 bcmp,__memcmp_default
bdc76f
-#elif defined SHARED && IS_IN (libc)
bdc76f
-.globl   __GI_memcmp
bdc76f
-.set     __GI_memcmp,__memcmp_default
bdc76f
+#if defined SHARED && IS_IN (libc)
bdc76f
+/* Defines the internal symbols.
bdc76f
+   Compare to libc_hidden_builtin_def (memcmp) in string/memcmp.c.  */
bdc76f
+strong_alias (MEMCMP_DEFAULT, __GI_memcmp)
bdc76f
 #endif
bdc76f
diff --git a/sysdeps/s390/memcmp.S b/sysdeps/s390/memcmp.S
bdc76f
deleted file mode 100644
bdc76f
index 751293a99e34f530..0000000000000000
bdc76f
--- a/sysdeps/s390/memcmp.S
bdc76f
+++ /dev/null
bdc76f
@@ -1,96 +0,0 @@
bdc76f
-/* memcmp - compare two memory blocks.  31/64 bit S/390 version.
bdc76f
-   Copyright (C) 2012-2018 Free Software Foundation, Inc.
bdc76f
-   This file is part of the GNU C Library.
bdc76f
-
bdc76f
-   The GNU C Library is free software; you can redistribute it and/or
bdc76f
-   modify it under the terms of the GNU Lesser General Public
bdc76f
-   License as published by the Free Software Foundation; either
bdc76f
-   version 2.1 of the License, or (at your option) any later version.
bdc76f
-
bdc76f
-   The GNU C Library is distributed in the hope that it will be useful,
bdc76f
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
bdc76f
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
bdc76f
-   Lesser General Public License for more details.
bdc76f
-
bdc76f
-   You should have received a copy of the GNU Lesser General Public
bdc76f
-   License along with the GNU C Library; if not, see
bdc76f
-   <http://www.gnu.org/licenses/>.  */
bdc76f
-
bdc76f
-
bdc76f
-#include <sysdep.h>
bdc76f
-#include "asm-syntax.h"
bdc76f
-
bdc76f
-/* INPUT PARAMETERS
bdc76f
-     %r2 = address of first memory area
bdc76f
-     %r3 = address of second memory area
bdc76f
-     %r4 = number of bytes to compare.  */
bdc76f
-
bdc76f
-       .text
bdc76f
-#if defined __s390x__
bdc76f
-# define LTGR	ltgr
bdc76f
-# define AGHI	aghi
bdc76f
-# define BRCTG	brctg
bdc76f
-#else
bdc76f
-# define LTGR	ltr
bdc76f
-# define AGHI	ahi
bdc76f
-# define BRCTG	brct
bdc76f
-#endif /* ! defined __s390x__  */
bdc76f
-
bdc76f
-#ifdef USE_MULTIARCH
bdc76f
-ENTRY(__memcmp_default)
bdc76f
-#else
bdc76f
-ENTRY(memcmp)
bdc76f
-#endif
bdc76f
-#if defined __s390x__
bdc76f
-	.machine "z900"
bdc76f
-#else
bdc76f
-	.machine "g5"
bdc76f
-	basr    %r5,0
bdc76f
-.L_Z900_G5_16:
bdc76f
-# define Z900_G5_EX_D .L_Z900_G5_15-.L_Z900_G5_16
bdc76f
-#endif /* ! defined __s390x__  */
bdc76f
-	LTGR    %r4,%r4
bdc76f
-	je      .L_Z900_G5_4
bdc76f
-	AGHI    %r4,-1
bdc76f
-#if defined __s390x__
bdc76f
-	srlg    %r1,%r4,8
bdc76f
-	larl    %r5,.L_Z900_G5_15
bdc76f
-# define Z900_G5_EX_D 0
bdc76f
-#else
bdc76f
-	lr	%r1,%r4
bdc76f
-	srl	%r1,8
bdc76f
-#endif /* ! defined __s390x__  */
bdc76f
-	LTGR    %r1,%r1
bdc76f
-	jne     .L_Z900_G5_12
bdc76f
-.L_Z900_G5_3:
bdc76f
-	ex      %r4,Z900_G5_EX_D(%r5)
bdc76f
-.L_Z900_G5_4:
bdc76f
-	ipm     %r2
bdc76f
-#if defined __s390x__
bdc76f
-	sllg    %r2,%r2,34
bdc76f
-	srag    %r2,%r2,62
bdc76f
-#else
bdc76f
-	sll     %r2,2
bdc76f
-	sra     %r2,30
bdc76f
-#endif /* ! defined __s390x__  */
bdc76f
-	br      %r14
bdc76f
-.L_Z900_G5_12:
bdc76f
-	clc     0(256,%r3),0(%r2)
bdc76f
-	jne     .L_Z900_G5_4
bdc76f
-	la      %r3,256(%r3)
bdc76f
-	la      %r2,256(%r2)
bdc76f
-	BRCTG   %r1,.L_Z900_G5_12
bdc76f
-	j       .L_Z900_G5_3
bdc76f
-.L_Z900_G5_15:
bdc76f
-	clc     0(1,%r3),0(%r2)
bdc76f
-#ifdef USE_MULTIARCH
bdc76f
-END(__memcmp_default)
bdc76f
-#else
bdc76f
-END(memcmp)
bdc76f
-libc_hidden_builtin_def (memcmp)
bdc76f
-weak_alias (memcmp, bcmp)
bdc76f
-#endif
bdc76f
-
bdc76f
-#undef LTGR
bdc76f
-#undef AGHI
bdc76f
-#undef BRCTG
bdc76f
diff --git a/sysdeps/s390/multiarch/memcmp.c b/sysdeps/s390/memcmp.c
bdc76f
similarity index 60%
bdc76f
rename from sysdeps/s390/multiarch/memcmp.c
bdc76f
rename to sysdeps/s390/memcmp.c
bdc76f
index 1e6f31806e172d7d..952ff6af7364fd92 100644
bdc76f
--- a/sysdeps/s390/multiarch/memcmp.c
bdc76f
+++ b/sysdeps/s390/memcmp.c
bdc76f
@@ -16,12 +16,34 @@
bdc76f
    License along with the GNU C Library; if not, see
bdc76f
    <http://www.gnu.org/licenses/>.  */
bdc76f
 
bdc76f
-#if IS_IN (libc)
bdc76f
+#include <ifunc-memcmp.h>
bdc76f
+#if HAVE_MEMCMP_IFUNC
bdc76f
 # define memcmp __redirect_memcmp
bdc76f
 # include <string.h>
bdc76f
 # undef memcmp
bdc76f
 # include <ifunc-resolve.h>
bdc76f
 
bdc76f
-s390_libc_ifunc (__redirect_memcmp, __memcmp, memcmp)
bdc76f
+# if HAVE_MEMCMP_Z900_G5
bdc76f
+extern __typeof (__redirect_memcmp) MEMCMP_Z900_G5 attribute_hidden;
bdc76f
+# endif
bdc76f
+
bdc76f
+# if HAVE_MEMCMP_Z10
bdc76f
+extern __typeof (__redirect_memcmp) MEMCMP_Z10 attribute_hidden;
bdc76f
+# endif
bdc76f
+
bdc76f
+# if HAVE_MEMCMP_Z196
bdc76f
+extern __typeof (__redirect_memcmp) MEMCMP_Z196 attribute_hidden;
bdc76f
+# endif
bdc76f
+
bdc76f
+s390_libc_ifunc_expr (__redirect_memcmp, memcmp,
bdc76f
+		      ({
bdc76f
+			s390_libc_ifunc_init ();
bdc76f
+			(HAVE_MEMCMP_Z196 && S390_IS_Z196 (stfle_bits))
bdc76f
+			  ? MEMCMP_Z196
bdc76f
+			  : (HAVE_MEMCMP_Z10 && S390_IS_Z10 (stfle_bits))
bdc76f
+			  ? MEMCMP_Z10
bdc76f
+			  : MEMCMP_DEFAULT;
bdc76f
+		      })
bdc76f
+		      )
bdc76f
 weak_alias (memcmp, bcmp);
bdc76f
 #endif
bdc76f
diff --git a/sysdeps/s390/multiarch/Makefile b/sysdeps/s390/multiarch/Makefile
bdc76f
index 53dd8654d73677db..c893ebc5659fd4ae 100644
bdc76f
--- a/sysdeps/s390/multiarch/Makefile
bdc76f
+++ b/sysdeps/s390/multiarch/Makefile
bdc76f
@@ -19,8 +19,7 @@ sysdep_routines += strlen strlen-vx strlen-c \
bdc76f
 		   rawmemchr rawmemchr-vx rawmemchr-c \
bdc76f
 		   memccpy memccpy-vx memccpy-c \
bdc76f
 		   memrchr memrchr-vx memrchr-c \
bdc76f
-		   mempcpy \
bdc76f
-		   memcmp memcmp-s390x
bdc76f
+		   mempcpy
bdc76f
 endif
bdc76f
 
bdc76f
 ifeq ($(subdir),wcsmbs)
bdc76f
diff --git a/sysdeps/s390/multiarch/ifunc-impl-list.c b/sysdeps/s390/multiarch/ifunc-impl-list.c
bdc76f
index 253f36045b57cc3c..2e57d01abc21522e 100644
bdc76f
--- a/sysdeps/s390/multiarch/ifunc-impl-list.c
bdc76f
+++ b/sysdeps/s390/multiarch/ifunc-impl-list.c
bdc76f
@@ -22,6 +22,7 @@
bdc76f
 #include <ifunc-impl-list.h>
bdc76f
 #include <ifunc-resolve.h>
bdc76f
 #include <ifunc-memset.h>
bdc76f
+#include <ifunc-memcmp.h>
bdc76f
 
bdc76f
 /* Maximum number of IFUNC implementations.  */
bdc76f
 #define MAX_IFUNC	3
bdc76f
@@ -78,12 +79,21 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
bdc76f
 	      )
bdc76f
 #endif /* HAVE_MEMSET_IFUNC */
bdc76f
 
bdc76f
+#if HAVE_MEMCMP_IFUNC
bdc76f
   IFUNC_IMPL (i, name, memcmp,
bdc76f
+# if HAVE_MEMCMP_Z196
bdc76f
 	      IFUNC_IMPL_ADD (array, i, memcmp,
bdc76f
-			      S390_IS_Z196 (stfle_bits), __memcmp_z196)
bdc76f
+			      S390_IS_Z196 (stfle_bits), MEMCMP_Z196)
bdc76f
+# endif
bdc76f
+# if HAVE_MEMCMP_Z10
bdc76f
 	      IFUNC_IMPL_ADD (array, i, memcmp,
bdc76f
-			      S390_IS_Z10 (stfle_bits), __memcmp_z10)
bdc76f
-	      IFUNC_IMPL_ADD (array, i, memcmp, 1, __memcmp_default))
bdc76f
+			      S390_IS_Z10 (stfle_bits), MEMCMP_Z10)
bdc76f
+# endif
bdc76f
+# if HAVE_MEMCMP_Z900_G5
bdc76f
+	      IFUNC_IMPL_ADD (array, i, memcmp, 1, MEMCMP_Z900_G5)
bdc76f
+# endif
bdc76f
+	      )
bdc76f
+#endif /* HAVE_MEMCMP_IFUNC */
bdc76f
 
bdc76f
 #ifdef SHARED
bdc76f