|
|
bdc76f |
commit 3459e23dd4ae4aa8999df7111d833a0bb9add7cd
|
|
|
bdc76f |
Author: Stefan Liebler <stli@linux.ibm.com>
|
|
|
bdc76f |
Date: Tue Dec 18 13:57:21 2018 +0100
|
|
|
bdc76f |
|
|
|
bdc76f |
S390: Refactor wcscmp ifunc handling.
|
|
|
bdc76f |
|
|
|
bdc76f |
The ifunc handling for wcscmp is adjusted in order to omit ifunc
|
|
|
bdc76f |
variants if those will never be used as the minimum architecture level
|
|
|
bdc76f |
already supports newer CPUs by default.
|
|
|
bdc76f |
Glibc internal calls will then also use the "newer" ifunc variant.
|
|
|
bdc76f |
|
|
|
bdc76f |
ChangeLog:
|
|
|
bdc76f |
|
|
|
bdc76f |
* sysdeps/s390/multiarch/Makefile
|
|
|
bdc76f |
(sysdep_routines): Remove wcscmp variants.
|
|
|
bdc76f |
* sysdeps/s390/Makefile (sysdep_routines): Add wcscmp variants.
|
|
|
bdc76f |
* sysdeps/s390/multiarch/ifunc-impl-list.c
|
|
|
bdc76f |
(__libc_ifunc_impl_list): Refactor ifunc handling for wcscmp.
|
|
|
bdc76f |
* sysdeps/s390/multiarch/wcscmp-c.c: Move to ...
|
|
|
bdc76f |
* sysdeps/s390/wcscmp-c.c: ... here and adjust ifunc handling.
|
|
|
bdc76f |
* sysdeps/s390/multiarch/wcscmp-vx.S: Move to ...
|
|
|
bdc76f |
* sysdeps/s390/wcscmp-vx.S: ... here and adjust ifunc handling.
|
|
|
bdc76f |
* sysdeps/s390/multiarch/wcscmp.c: Move to ...
|
|
|
bdc76f |
* sysdeps/s390/wcscmp.c: ... here and adjust ifunc handling.
|
|
|
bdc76f |
* sysdeps/s390/ifunc-wcscmp.h: New file.
|
|
|
bdc76f |
|
|
|
bdc76f |
diff --git a/sysdeps/s390/Makefile b/sysdeps/s390/Makefile
|
|
|
bdc76f |
index cafabe62165f0213..fb104af231c48d3a 100644
|
|
|
bdc76f |
--- a/sysdeps/s390/Makefile
|
|
|
bdc76f |
+++ b/sysdeps/s390/Makefile
|
|
|
bdc76f |
@@ -67,5 +67,6 @@ sysdep_routines += wcslen wcslen-vx wcslen-c \
|
|
|
bdc76f |
wcsncpy wcsncpy-vx wcsncpy-c \
|
|
|
bdc76f |
wcpncpy wcpncpy-vx wcpncpy-c \
|
|
|
bdc76f |
wcscat wcscat-vx wcscat-c \
|
|
|
bdc76f |
- wcsncat wcsncat-vx wcsncat-c
|
|
|
bdc76f |
+ wcsncat wcsncat-vx wcsncat-c \
|
|
|
bdc76f |
+ wcscmp wcscmp-vx wcscmp-c
|
|
|
bdc76f |
endif
|
|
|
bdc76f |
diff --git a/sysdeps/s390/ifunc-wcscmp.h b/sysdeps/s390/ifunc-wcscmp.h
|
|
|
bdc76f |
new file mode 100644
|
|
|
bdc76f |
index 0000000000000000..99fe0213021458ae
|
|
|
bdc76f |
--- /dev/null
|
|
|
bdc76f |
+++ b/sysdeps/s390/ifunc-wcscmp.h
|
|
|
bdc76f |
@@ -0,0 +1,52 @@
|
|
|
bdc76f |
+/* wcscmp 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_Z13_ZARCH_ASM_SUPPORT
|
|
|
bdc76f |
+# define HAVE_WCSCMP_IFUNC 1
|
|
|
bdc76f |
+#else
|
|
|
bdc76f |
+# define HAVE_WCSCMP_IFUNC 0
|
|
|
bdc76f |
+#endif
|
|
|
bdc76f |
+
|
|
|
bdc76f |
+#ifdef HAVE_S390_VX_ASM_SUPPORT
|
|
|
bdc76f |
+# define HAVE_WCSCMP_IFUNC_AND_VX_SUPPORT HAVE_WCSCMP_IFUNC
|
|
|
bdc76f |
+#else
|
|
|
bdc76f |
+# define HAVE_WCSCMP_IFUNC_AND_VX_SUPPORT 0
|
|
|
bdc76f |
+#endif
|
|
|
bdc76f |
+
|
|
|
bdc76f |
+#if defined HAVE_S390_MIN_Z13_ZARCH_ASM_SUPPORT
|
|
|
bdc76f |
+# define WCSCMP_DEFAULT WCSCMP_Z13
|
|
|
bdc76f |
+# define HAVE_WCSCMP_C 0
|
|
|
bdc76f |
+# define HAVE_WCSCMP_Z13 1
|
|
|
bdc76f |
+#else
|
|
|
bdc76f |
+# define WCSCMP_DEFAULT WCSCMP_C
|
|
|
bdc76f |
+# define HAVE_WCSCMP_C 1
|
|
|
bdc76f |
+# define HAVE_WCSCMP_Z13 HAVE_WCSCMP_IFUNC_AND_VX_SUPPORT
|
|
|
bdc76f |
+#endif
|
|
|
bdc76f |
+
|
|
|
bdc76f |
+#if HAVE_WCSCMP_C
|
|
|
bdc76f |
+# define WCSCMP_C __wcscmp_c
|
|
|
bdc76f |
+#else
|
|
|
bdc76f |
+# define WCSCMP_C NULL
|
|
|
bdc76f |
+#endif
|
|
|
bdc76f |
+
|
|
|
bdc76f |
+#if HAVE_WCSCMP_Z13
|
|
|
bdc76f |
+# define WCSCMP_Z13 __wcscmp_vx
|
|
|
bdc76f |
+#else
|
|
|
bdc76f |
+# define WCSCMP_Z13 NULL
|
|
|
bdc76f |
+#endif
|
|
|
bdc76f |
diff --git a/sysdeps/s390/multiarch/Makefile b/sysdeps/s390/multiarch/Makefile
|
|
|
bdc76f |
index 6cb75950c2c453f6..70162d0eaa6a0dee 100644
|
|
|
bdc76f |
--- a/sysdeps/s390/multiarch/Makefile
|
|
|
bdc76f |
+++ b/sysdeps/s390/multiarch/Makefile
|
|
|
bdc76f |
@@ -1,6 +1,5 @@
|
|
|
bdc76f |
ifeq ($(subdir),wcsmbs)
|
|
|
bdc76f |
-sysdep_routines += wcscmp wcscmp-vx wcscmp-c \
|
|
|
bdc76f |
- wcsncmp wcsncmp-vx wcsncmp-c \
|
|
|
bdc76f |
+sysdep_routines += wcsncmp wcsncmp-vx wcsncmp-c \
|
|
|
bdc76f |
wcschr wcschr-vx wcschr-c \
|
|
|
bdc76f |
wcschrnul wcschrnul-vx wcschrnul-c \
|
|
|
bdc76f |
wcsrchr wcsrchr-vx wcsrchr-c \
|
|
|
bdc76f |
diff --git a/sysdeps/s390/multiarch/ifunc-impl-list.c b/sysdeps/s390/multiarch/ifunc-impl-list.c
|
|
|
bdc76f |
index 7b7b1e7497ec1a4f..f461063c80b364fb 100644
|
|
|
bdc76f |
--- a/sysdeps/s390/multiarch/ifunc-impl-list.c
|
|
|
bdc76f |
+++ b/sysdeps/s390/multiarch/ifunc-impl-list.c
|
|
|
bdc76f |
@@ -54,6 +54,7 @@
|
|
|
bdc76f |
#include <ifunc-wcpncpy.h>
|
|
|
bdc76f |
#include <ifunc-wcscat.h>
|
|
|
bdc76f |
#include <ifunc-wcsncat.h>
|
|
|
bdc76f |
+#include <ifunc-wcscmp.h>
|
|
|
bdc76f |
|
|
|
bdc76f |
/* Maximum number of IFUNC implementations. */
|
|
|
bdc76f |
#define MAX_IFUNC 3
|
|
|
bdc76f |
@@ -528,6 +529,18 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
|
|
|
bdc76f |
)
|
|
|
bdc76f |
#endif /* HAVE_WCSNCAT_IFUNC */
|
|
|
bdc76f |
|
|
|
bdc76f |
+#if HAVE_WCSCMP_IFUNC
|
|
|
bdc76f |
+ IFUNC_IMPL (i, name, wcscmp,
|
|
|
bdc76f |
+# if HAVE_WCSCMP_Z13
|
|
|
bdc76f |
+ IFUNC_IMPL_ADD (array, i, wcscmp,
|
|
|
bdc76f |
+ dl_hwcap & HWCAP_S390_VX, WCSCMP_Z13)
|
|
|
bdc76f |
+# endif
|
|
|
bdc76f |
+# if HAVE_WCSCMP_C
|
|
|
bdc76f |
+ IFUNC_IMPL_ADD (array, i, wcscmp, 1, WCSCMP_C)
|
|
|
bdc76f |
+# endif
|
|
|
bdc76f |
+ )
|
|
|
bdc76f |
+#endif /* HAVE_WCSCMP_IFUNC */
|
|
|
bdc76f |
+
|
|
|
bdc76f |
#ifdef HAVE_S390_VX_ASM_SUPPORT
|
|
|
bdc76f |
|
|
|
bdc76f |
# define IFUNC_VX_IMPL(FUNC) \
|
|
|
bdc76f |
@@ -536,8 +549,6 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
|
|
|
bdc76f |
__##FUNC##_vx) \
|
|
|
bdc76f |
IFUNC_IMPL_ADD (array, i, FUNC, 1, __##FUNC##_c))
|
|
|
bdc76f |
|
|
|
bdc76f |
- IFUNC_VX_IMPL (wcscmp);
|
|
|
bdc76f |
-
|
|
|
bdc76f |
IFUNC_VX_IMPL (wcsncmp);
|
|
|
bdc76f |
|
|
|
bdc76f |
IFUNC_VX_IMPL (wcschr);
|
|
|
bdc76f |
diff --git a/sysdeps/s390/multiarch/wcscmp-c.c b/sysdeps/s390/wcscmp-c.c
|
|
|
bdc76f |
similarity index 72%
|
|
|
bdc76f |
rename from sysdeps/s390/multiarch/wcscmp-c.c
|
|
|
bdc76f |
rename to sysdeps/s390/wcscmp-c.c
|
|
|
bdc76f |
index ce0817ae97deab77..643ba7a682469e73 100644
|
|
|
bdc76f |
--- a/sysdeps/s390/multiarch/wcscmp-c.c
|
|
|
bdc76f |
+++ b/sysdeps/s390/wcscmp-c.c
|
|
|
bdc76f |
@@ -16,17 +16,19 @@
|
|
|
bdc76f |
License along with the GNU C Library; if not, see
|
|
|
bdc76f |
<http://www.gnu.org/licenses/>. */
|
|
|
bdc76f |
|
|
|
bdc76f |
-#if defined HAVE_S390_VX_ASM_SUPPORT && IS_IN (libc)
|
|
|
bdc76f |
-# define WCSCMP __wcscmp_c
|
|
|
bdc76f |
+#include <ifunc-wcscmp.h>
|
|
|
bdc76f |
|
|
|
bdc76f |
-# include <wchar.h>
|
|
|
bdc76f |
-extern __typeof (wcscmp) __wcscmp_c;
|
|
|
bdc76f |
-# undef weak_alias
|
|
|
bdc76f |
-# define weak_alias(name, alias)
|
|
|
bdc76f |
-# ifdef SHARED
|
|
|
bdc76f |
-# undef libc_hidden_def
|
|
|
bdc76f |
-# define libc_hidden_def(name) \
|
|
|
bdc76f |
+#if HAVE_WCSCMP_C
|
|
|
bdc76f |
+# if HAVE_WCSCMP_IFUNC
|
|
|
bdc76f |
+# define WCSCMP WCSCMP_C
|
|
|
bdc76f |
+# undef weak_alias
|
|
|
bdc76f |
+# define weak_alias(name, alias)
|
|
|
bdc76f |
+# if defined SHARED && IS_IN (libc)
|
|
|
bdc76f |
+# undef libc_hidden_def
|
|
|
bdc76f |
+# define libc_hidden_def(name) \
|
|
|
bdc76f |
__hidden_ver1 (__wcscmp_c, __GI___wcscmp, __wcscmp_c);
|
|
|
bdc76f |
-# endif /* SHARED */
|
|
|
bdc76f |
+# endif
|
|
|
bdc76f |
+# endif
|
|
|
bdc76f |
+
|
|
|
bdc76f |
# include <wcsmbs/wcscmp.c>
|
|
|
bdc76f |
-#endif /* HAVE_S390_VX_ASM_SUPPORT && IS_IN (libc) */
|
|
|
bdc76f |
+#endif
|
|
|
bdc76f |
diff --git a/sysdeps/s390/multiarch/wcscmp-vx.S b/sysdeps/s390/wcscmp-vx.S
|
|
|
bdc76f |
similarity index 92%
|
|
|
bdc76f |
rename from sysdeps/s390/multiarch/wcscmp-vx.S
|
|
|
bdc76f |
rename to sysdeps/s390/wcscmp-vx.S
|
|
|
bdc76f |
index 14267dbfc7d9b936..a2789d8a693802cc 100644
|
|
|
bdc76f |
--- a/sysdeps/s390/multiarch/wcscmp-vx.S
|
|
|
bdc76f |
+++ b/sysdeps/s390/wcscmp-vx.S
|
|
|
bdc76f |
@@ -16,7 +16,8 @@
|
|
|
bdc76f |
License along with the GNU C Library; if not, see
|
|
|
bdc76f |
<http://www.gnu.org/licenses/>. */
|
|
|
bdc76f |
|
|
|
bdc76f |
-#if defined HAVE_S390_VX_ASM_SUPPORT && IS_IN (libc)
|
|
|
bdc76f |
+#include <ifunc-wcscmp.h>
|
|
|
bdc76f |
+#if HAVE_WCSCMP_Z13
|
|
|
bdc76f |
|
|
|
bdc76f |
# include "sysdep.h"
|
|
|
bdc76f |
# include "asm-syntax.h"
|
|
|
bdc76f |
@@ -36,7 +37,7 @@
|
|
|
bdc76f |
-v17=part of s2
|
|
|
bdc76f |
-v18=index of unequal
|
|
|
bdc76f |
*/
|
|
|
bdc76f |
-ENTRY(__wcscmp_vx)
|
|
|
bdc76f |
+ENTRY(WCSCMP_Z13)
|
|
|
bdc76f |
.machine "z13"
|
|
|
bdc76f |
.machinemode "zarch_nohighgprs"
|
|
|
bdc76f |
|
|
|
bdc76f |
@@ -127,5 +128,14 @@ ENTRY(__wcscmp_vx)
|
|
|
bdc76f |
.Lend_equal:
|
|
|
bdc76f |
lghi %r2,0
|
|
|
bdc76f |
br %r14
|
|
|
bdc76f |
-END(__wcscmp_vx)
|
|
|
bdc76f |
-#endif /* HAVE_S390_VX_ASM_SUPPORT && IS_IN (libc) */
|
|
|
bdc76f |
+END(WCSCMP_Z13)
|
|
|
bdc76f |
+
|
|
|
bdc76f |
+# if ! HAVE_WCSCMP_IFUNC
|
|
|
bdc76f |
+strong_alias (WCSCMP_Z13, __wcscmp)
|
|
|
bdc76f |
+weak_alias (__wcscmp, wcscmp)
|
|
|
bdc76f |
+# endif
|
|
|
bdc76f |
+
|
|
|
bdc76f |
+# if ! HAVE_WCSCMP_C && defined SHARED && IS_IN (libc)
|
|
|
bdc76f |
+strong_alias (WCSCMP_Z13, __GI___wcscmp)
|
|
|
bdc76f |
+# endif
|
|
|
bdc76f |
+#endif
|
|
|
bdc76f |
diff --git a/sysdeps/s390/multiarch/wcscmp.c b/sysdeps/s390/wcscmp.c
|
|
|
bdc76f |
similarity index 70%
|
|
|
bdc76f |
rename from sysdeps/s390/multiarch/wcscmp.c
|
|
|
bdc76f |
rename to sysdeps/s390/wcscmp.c
|
|
|
bdc76f |
index 5ee0fd4d881db9cb..769c73506e40c3a0 100644
|
|
|
bdc76f |
--- a/sysdeps/s390/multiarch/wcscmp.c
|
|
|
bdc76f |
+++ b/sysdeps/s390/wcscmp.c
|
|
|
bdc76f |
@@ -16,15 +16,26 @@
|
|
|
bdc76f |
License along with the GNU C Library; if not, see
|
|
|
bdc76f |
<http://www.gnu.org/licenses/>. */
|
|
|
bdc76f |
|
|
|
bdc76f |
-#if defined HAVE_S390_VX_ASM_SUPPORT && IS_IN (libc)
|
|
|
bdc76f |
+#include <ifunc-wcscmp.h>
|
|
|
bdc76f |
+
|
|
|
bdc76f |
+#if HAVE_WCSCMP_IFUNC
|
|
|
bdc76f |
# define __wcscmp __redirect___wcscmp
|
|
|
bdc76f |
# include <wchar.h>
|
|
|
bdc76f |
# undef __wcscmp
|
|
|
bdc76f |
# include <ifunc-resolve.h>
|
|
|
bdc76f |
|
|
|
bdc76f |
-s390_vx_libc_ifunc_redirected (__redirect___wcscmp, __wcscmp)
|
|
|
bdc76f |
-weak_alias (__wcscmp, wcscmp)
|
|
|
bdc76f |
+# if HAVE_WCSCMP_C
|
|
|
bdc76f |
+extern __typeof (__redirect___wcscmp) WCSCMP_C attribute_hidden;
|
|
|
bdc76f |
+# endif
|
|
|
bdc76f |
|
|
|
bdc76f |
-#else
|
|
|
bdc76f |
-# include <wcsmbs/wcscmp.c>
|
|
|
bdc76f |
-#endif /* !(defined HAVE_S390_VX_ASM_SUPPORT && IS_IN (libc)) */
|
|
|
bdc76f |
+# if HAVE_WCSCMP_Z13
|
|
|
bdc76f |
+extern __typeof (__redirect___wcscmp) WCSCMP_Z13 attribute_hidden;
|
|
|
bdc76f |
+# endif
|
|
|
bdc76f |
+
|
|
|
bdc76f |
+s390_libc_ifunc_expr (__redirect___wcscmp, __wcscmp,
|
|
|
bdc76f |
+ (HAVE_WCSCMP_Z13 && (hwcap & HWCAP_S390_VX))
|
|
|
bdc76f |
+ ? WCSCMP_Z13
|
|
|
bdc76f |
+ : WCSCMP_DEFAULT
|
|
|
bdc76f |
+ )
|
|
|
bdc76f |
+weak_alias (__wcscmp, wcscmp)
|
|
|
bdc76f |
+#endif
|