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