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