|
|
bdc76f |
commit 804f2e5c73b1363836ce5db29a0abb3d36e1286a
|
|
|
bdc76f |
Author: Stefan Liebler <stli@linux.ibm.com>
|
|
|
bdc76f |
Date: Tue Dec 18 13:57:18 2018 +0100
|
|
|
bdc76f |
|
|
|
bdc76f |
S390: Refactor wcscpy ifunc handling.
|
|
|
bdc76f |
|
|
|
bdc76f |
The ifunc handling for wcscpy is adjusted in order to omit ifunc
|
|
|
bdc76f |
if the minimum architecture level already supports newer CPUs by default.
|
|
|
bdc76f |
Unfortunately the c ifunc variant can't be omitted at all as it is used
|
|
|
bdc76f |
by the z13 ifunc variant as fallback if the pointers are not 4-byte aligned.
|
|
|
bdc76f |
|
|
|
bdc76f |
ChangeLog:
|
|
|
bdc76f |
|
|
|
bdc76f |
* sysdeps/s390/multiarch/Makefile
|
|
|
bdc76f |
(sysdep_routines): Remove wcscpy variants.
|
|
|
bdc76f |
* sysdeps/s390/Makefile (sysdep_routines): Add wcscpy variants.
|
|
|
bdc76f |
* sysdeps/s390/multiarch/ifunc-impl-list.c
|
|
|
bdc76f |
(__libc_ifunc_impl_list): Refactor ifunc handling for wcscpy.
|
|
|
bdc76f |
* sysdeps/s390/multiarch/wcscpy-c.c: Move to ...
|
|
|
bdc76f |
* sysdeps/s390/wcscpy-c.c: ... here and adjust ifunc handling.
|
|
|
bdc76f |
* sysdeps/s390/multiarch/wcscpy-vx.S: Move to ...
|
|
|
bdc76f |
* sysdeps/s390/wcscpy-vx.S: ... here and adjust ifunc handling.
|
|
|
bdc76f |
* sysdeps/s390/multiarch/wcscpy.c: Move to ...
|
|
|
bdc76f |
* sysdeps/s390/wcscpy.c: ... here and adjust ifunc handling.
|
|
|
bdc76f |
* sysdeps/s390/ifunc-wcscpy.h: New file.
|
|
|
bdc76f |
|
|
|
bdc76f |
diff --git a/sysdeps/s390/Makefile b/sysdeps/s390/Makefile
|
|
|
bdc76f |
index f5983815479a76da..8bdbd1b5d8e9df01 100644
|
|
|
bdc76f |
--- a/sysdeps/s390/Makefile
|
|
|
bdc76f |
+++ b/sysdeps/s390/Makefile
|
|
|
bdc76f |
@@ -61,5 +61,6 @@ endif
|
|
|
bdc76f |
|
|
|
bdc76f |
ifeq ($(subdir),wcsmbs)
|
|
|
bdc76f |
sysdep_routines += wcslen wcslen-vx wcslen-c \
|
|
|
bdc76f |
- wcsnlen wcsnlen-vx wcsnlen-c
|
|
|
bdc76f |
+ wcsnlen wcsnlen-vx wcsnlen-c \
|
|
|
bdc76f |
+ wcscpy wcscpy-vx wcscpy-c
|
|
|
bdc76f |
endif
|
|
|
bdc76f |
diff --git a/sysdeps/s390/ifunc-wcscpy.h b/sysdeps/s390/ifunc-wcscpy.h
|
|
|
bdc76f |
new file mode 100644
|
|
|
bdc76f |
index 0000000000000000..fba7c9c7a7c354d1
|
|
|
bdc76f |
--- /dev/null
|
|
|
bdc76f |
+++ b/sysdeps/s390/ifunc-wcscpy.h
|
|
|
bdc76f |
@@ -0,0 +1,53 @@
|
|
|
bdc76f |
+/* wcscpy 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_WCSCPY_IFUNC 1
|
|
|
bdc76f |
+#else
|
|
|
bdc76f |
+# define HAVE_WCSCPY_IFUNC 0
|
|
|
bdc76f |
+#endif
|
|
|
bdc76f |
+
|
|
|
bdc76f |
+#ifdef HAVE_S390_VX_ASM_SUPPORT
|
|
|
bdc76f |
+# define HAVE_WCSCPY_IFUNC_AND_VX_SUPPORT HAVE_WCSCPY_IFUNC
|
|
|
bdc76f |
+#else
|
|
|
bdc76f |
+# define HAVE_WCSCPY_IFUNC_AND_VX_SUPPORT 0
|
|
|
bdc76f |
+#endif
|
|
|
bdc76f |
+
|
|
|
bdc76f |
+#if defined HAVE_S390_MIN_Z13_ZARCH_ASM_SUPPORT
|
|
|
bdc76f |
+# define WCSCPY_DEFAULT WCSCPY_Z13
|
|
|
bdc76f |
+/* The z13 ifunc variant is using the common code variant as fallback! */
|
|
|
bdc76f |
+# define HAVE_WCSCPY_C 1
|
|
|
bdc76f |
+# define HAVE_WCSCPY_Z13 1
|
|
|
bdc76f |
+#else
|
|
|
bdc76f |
+# define WCSCPY_DEFAULT WCSCPY_C
|
|
|
bdc76f |
+# define HAVE_WCSCPY_C 1
|
|
|
bdc76f |
+# define HAVE_WCSCPY_Z13 HAVE_WCSCPY_IFUNC_AND_VX_SUPPORT
|
|
|
bdc76f |
+#endif
|
|
|
bdc76f |
+
|
|
|
bdc76f |
+#if HAVE_WCSCPY_C
|
|
|
bdc76f |
+# define WCSCPY_C __wcscpy_c
|
|
|
bdc76f |
+#else
|
|
|
bdc76f |
+# define WCSCPY_C NULL
|
|
|
bdc76f |
+#endif
|
|
|
bdc76f |
+
|
|
|
bdc76f |
+#if HAVE_WCSCPY_Z13
|
|
|
bdc76f |
+# define WCSCPY_Z13 __wcscpy_vx
|
|
|
bdc76f |
+#else
|
|
|
bdc76f |
+# define WCSCPY_Z13 NULL
|
|
|
bdc76f |
+#endif
|
|
|
bdc76f |
diff --git a/sysdeps/s390/multiarch/Makefile b/sysdeps/s390/multiarch/Makefile
|
|
|
bdc76f |
index ce2e7ce5f4eef0fa..8828897a59ae580c 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 += wcscpy wcscpy-vx wcscpy-c \
|
|
|
bdc76f |
- wcpcpy wcpcpy-vx wcpcpy-c \
|
|
|
bdc76f |
+sysdep_routines += wcpcpy wcpcpy-vx wcpcpy-c \
|
|
|
bdc76f |
wcsncpy wcsncpy-vx wcsncpy-c \
|
|
|
bdc76f |
wcpncpy wcpncpy-vx wcpncpy-c \
|
|
|
bdc76f |
wcscat wcscat-vx wcscat-c \
|
|
|
bdc76f |
diff --git a/sysdeps/s390/multiarch/ifunc-impl-list.c b/sysdeps/s390/multiarch/ifunc-impl-list.c
|
|
|
bdc76f |
index c199fd0e0b43e4b4..aac8f4ea4671d0cf 100644
|
|
|
bdc76f |
--- a/sysdeps/s390/multiarch/ifunc-impl-list.c
|
|
|
bdc76f |
+++ b/sysdeps/s390/multiarch/ifunc-impl-list.c
|
|
|
bdc76f |
@@ -48,6 +48,7 @@
|
|
|
bdc76f |
#include <ifunc-memrchr.h>
|
|
|
bdc76f |
#include <ifunc-wcslen.h>
|
|
|
bdc76f |
#include <ifunc-wcsnlen.h>
|
|
|
bdc76f |
+#include <ifunc-wcscpy.h>
|
|
|
bdc76f |
|
|
|
bdc76f |
/* Maximum number of IFUNC implementations. */
|
|
|
bdc76f |
#define MAX_IFUNC 3
|
|
|
bdc76f |
@@ -450,6 +451,18 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
|
|
|
bdc76f |
)
|
|
|
bdc76f |
#endif /* HAVE_WCSNLEN_IFUNC */
|
|
|
bdc76f |
|
|
|
bdc76f |
+#if HAVE_WCSCPY_IFUNC
|
|
|
bdc76f |
+ IFUNC_IMPL (i, name, wcscpy,
|
|
|
bdc76f |
+# if HAVE_WCSCPY_Z13
|
|
|
bdc76f |
+ IFUNC_IMPL_ADD (array, i, wcscpy,
|
|
|
bdc76f |
+ dl_hwcap & HWCAP_S390_VX, WCSCPY_Z13)
|
|
|
bdc76f |
+# endif
|
|
|
bdc76f |
+# if HAVE_WCSCPY_C
|
|
|
bdc76f |
+ IFUNC_IMPL_ADD (array, i, wcscpy, 1, WCSCPY_C)
|
|
|
bdc76f |
+# endif
|
|
|
bdc76f |
+ )
|
|
|
bdc76f |
+#endif /* HAVE_WCSCPY_IFUNC */
|
|
|
bdc76f |
+
|
|
|
bdc76f |
#ifdef HAVE_S390_VX_ASM_SUPPORT
|
|
|
bdc76f |
|
|
|
bdc76f |
# define IFUNC_VX_IMPL(FUNC) \
|
|
|
bdc76f |
@@ -458,8 +471,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 (wcscpy);
|
|
|
bdc76f |
-
|
|
|
bdc76f |
IFUNC_VX_IMPL (wcpcpy);
|
|
|
bdc76f |
|
|
|
bdc76f |
IFUNC_VX_IMPL (wcsncpy);
|
|
|
bdc76f |
diff --git a/sysdeps/s390/multiarch/wcscpy-c.c b/sysdeps/s390/wcscpy-c.c
|
|
|
bdc76f |
similarity index 86%
|
|
|
bdc76f |
rename from sysdeps/s390/multiarch/wcscpy-c.c
|
|
|
bdc76f |
rename to sysdeps/s390/wcscpy-c.c
|
|
|
bdc76f |
index 4a510f466be80679..db2967f47d7bc3cc 100644
|
|
|
bdc76f |
--- a/sysdeps/s390/multiarch/wcscpy-c.c
|
|
|
bdc76f |
+++ b/sysdeps/s390/wcscpy-c.c
|
|
|
bdc76f |
@@ -16,10 +16,12 @@
|
|
|
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 WCSCPY __wcscpy_c
|
|
|
bdc76f |
+#include <ifunc-wcscpy.h>
|
|
|
bdc76f |
+
|
|
|
bdc76f |
+#if HAVE_WCSCPY_C
|
|
|
bdc76f |
+# if HAVE_WCSCPY_IFUNC || HAVE_WCSCPY_Z13
|
|
|
bdc76f |
+# define WCSCPY WCSCPY_C
|
|
|
bdc76f |
+# endif
|
|
|
bdc76f |
|
|
|
bdc76f |
-# include <wchar.h>
|
|
|
bdc76f |
-extern __typeof (wcscpy) __wcscpy_c;
|
|
|
bdc76f |
# include <wcsmbs/wcscpy.c>
|
|
|
bdc76f |
#endif
|
|
|
bdc76f |
diff --git a/sysdeps/s390/multiarch/wcscpy-vx.S b/sysdeps/s390/wcscpy-vx.S
|
|
|
bdc76f |
similarity index 95%
|
|
|
bdc76f |
rename from sysdeps/s390/multiarch/wcscpy-vx.S
|
|
|
bdc76f |
rename to sysdeps/s390/wcscpy-vx.S
|
|
|
bdc76f |
index c2e81055be958907..8fe12f4d8b3e66a8 100644
|
|
|
bdc76f |
--- a/sysdeps/s390/multiarch/wcscpy-vx.S
|
|
|
bdc76f |
+++ b/sysdeps/s390/wcscpy-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-wcscpy.h>
|
|
|
bdc76f |
+#if HAVE_WCSCPY_Z13
|
|
|
bdc76f |
|
|
|
bdc76f |
# include "sysdep.h"
|
|
|
bdc76f |
# include "asm-syntax.h"
|
|
|
bdc76f |
@@ -37,7 +38,7 @@
|
|
|
bdc76f |
-v17=index of zero
|
|
|
bdc76f |
-v18=part of src
|
|
|
bdc76f |
*/
|
|
|
bdc76f |
-ENTRY(__wcscpy_vx)
|
|
|
bdc76f |
+ENTRY(WCSCPY_Z13)
|
|
|
bdc76f |
.machine "z13"
|
|
|
bdc76f |
.machinemode "zarch_nohighgprs"
|
|
|
bdc76f |
|
|
|
bdc76f |
@@ -106,6 +107,10 @@ ENTRY(__wcscpy_vx)
|
|
|
bdc76f |
br %r14
|
|
|
bdc76f |
|
|
|
bdc76f |
.Lfallback:
|
|
|
bdc76f |
- jg __wcscpy_c
|
|
|
bdc76f |
-END(__wcscpy_vx)
|
|
|
bdc76f |
-#endif /* HAVE_S390_VX_ASM_SUPPORT && IS_IN (libc) */
|
|
|
bdc76f |
+ jg WCSCPY_C
|
|
|
bdc76f |
+END(WCSCPY_Z13)
|
|
|
bdc76f |
+
|
|
|
bdc76f |
+# if ! HAVE_WCSCPY_IFUNC
|
|
|
bdc76f |
+strong_alias (WCSCPY_Z13, wcscpy)
|
|
|
bdc76f |
+# endif
|
|
|
bdc76f |
+#endif
|
|
|
bdc76f |
diff --git a/sysdeps/s390/multiarch/wcscpy.c b/sysdeps/s390/wcscpy.c
|
|
|
bdc76f |
similarity index 70%
|
|
|
bdc76f |
rename from sysdeps/s390/multiarch/wcscpy.c
|
|
|
bdc76f |
rename to sysdeps/s390/wcscpy.c
|
|
|
bdc76f |
index e69baa6c59906df3..51f07327da1bec74 100644
|
|
|
bdc76f |
--- a/sysdeps/s390/multiarch/wcscpy.c
|
|
|
bdc76f |
+++ b/sysdeps/s390/wcscpy.c
|
|
|
bdc76f |
@@ -16,12 +16,23 @@
|
|
|
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-wcscpy.h>
|
|
|
bdc76f |
+
|
|
|
bdc76f |
+#if HAVE_WCSCPY_IFUNC
|
|
|
bdc76f |
# include <wchar.h>
|
|
|
bdc76f |
# include <ifunc-resolve.h>
|
|
|
bdc76f |
|
|
|
bdc76f |
-s390_vx_libc_ifunc2 (__wcscpy, wcscpy)
|
|
|
bdc76f |
+# if HAVE_WCSCPY_C
|
|
|
bdc76f |
+extern __typeof (wcscpy) WCSCPY_C attribute_hidden;
|
|
|
bdc76f |
+# endif
|
|
|
bdc76f |
+
|
|
|
bdc76f |
+# if HAVE_WCSCPY_Z13
|
|
|
bdc76f |
+extern __typeof (wcscpy) WCSCPY_Z13 attribute_hidden;
|
|
|
bdc76f |
+# endif
|
|
|
bdc76f |
|
|
|
bdc76f |
-#else
|
|
|
bdc76f |
-# include <wcsmbs/wcscpy.c>
|
|
|
bdc76f |
-#endif /* !(defined HAVE_S390_VX_ASM_SUPPORT && IS_IN (libc)) */
|
|
|
bdc76f |
+s390_libc_ifunc_expr (wcscpy, wcscpy,
|
|
|
bdc76f |
+ (HAVE_WCSCPY_Z13 && (hwcap & HWCAP_S390_VX))
|
|
|
bdc76f |
+ ? WCSCPY_Z13
|
|
|
bdc76f |
+ : WCSCPY_DEFAULT
|
|
|
bdc76f |
+ )
|
|
|
bdc76f |
+#endif
|