|
|
bdc76f |
commit 4c7b3cec113d9bb7dfc004e22c7a98e310ab9bcc
|
|
|
bdc76f |
Author: Stefan Liebler <stli@linux.ibm.com>
|
|
|
bdc76f |
Date: Tue Dec 18 13:57:16 2018 +0100
|
|
|
bdc76f |
|
|
|
bdc76f |
S390: Refactor rawmemchr ifunc handling.
|
|
|
bdc76f |
|
|
|
bdc76f |
The ifunc handling for rawmemchr 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 rawmemchr variants.
|
|
|
bdc76f |
* sysdeps/s390/Makefile (sysdep_routines): Add rawmemchr variants.
|
|
|
bdc76f |
* sysdeps/s390/multiarch/ifunc-impl-list.c
|
|
|
bdc76f |
(__libc_ifunc_impl_list): Refactor ifunc handling for rawmemchr.
|
|
|
bdc76f |
* sysdeps/s390/multiarch/rawmemchr-c.c: Move to ...
|
|
|
bdc76f |
* sysdeps/s390/rawmemchr-c.c: ... here and adjust ifunc handling.
|
|
|
bdc76f |
* sysdeps/s390/multiarch/rawmemchr-vx.S: Move to ...
|
|
|
bdc76f |
* sysdeps/s390/rawmemchr-vx.S: ... here and adjust ifunc handling.
|
|
|
bdc76f |
* sysdeps/s390/multiarch/rawmemchr.c: Move to ...
|
|
|
bdc76f |
* sysdeps/s390/rawmemchr.c: ... here and adjust ifunc handling.
|
|
|
bdc76f |
* sysdeps/s390/ifunc-rawmemchr.h: New file.
|
|
|
bdc76f |
|
|
|
bdc76f |
diff --git a/sysdeps/s390/Makefile b/sysdeps/s390/Makefile
|
|
|
bdc76f |
index 816b2fccdc75e4cf..9b38b461b34176b0 100644
|
|
|
bdc76f |
--- a/sysdeps/s390/Makefile
|
|
|
bdc76f |
+++ b/sysdeps/s390/Makefile
|
|
|
bdc76f |
@@ -53,5 +53,6 @@ sysdep_routines += bzero memset memset-z900 \
|
|
|
bdc76f |
strspn strspn-vx strspn-c \
|
|
|
bdc76f |
strpbrk strpbrk-vx strpbrk-c \
|
|
|
bdc76f |
strcspn strcspn-vx strcspn-c \
|
|
|
bdc76f |
- memchr memchr-vx memchr-z900
|
|
|
bdc76f |
+ memchr memchr-vx memchr-z900 \
|
|
|
bdc76f |
+ rawmemchr rawmemchr-vx rawmemchr-c
|
|
|
bdc76f |
endif
|
|
|
bdc76f |
diff --git a/sysdeps/s390/ifunc-rawmemchr.h b/sysdeps/s390/ifunc-rawmemchr.h
|
|
|
bdc76f |
new file mode 100644
|
|
|
bdc76f |
index 0000000000000000..bfcbeae802fb372e
|
|
|
bdc76f |
--- /dev/null
|
|
|
bdc76f |
+++ b/sysdeps/s390/ifunc-rawmemchr.h
|
|
|
bdc76f |
@@ -0,0 +1,52 @@
|
|
|
bdc76f |
+/* rawmemchr 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_RAWMEMCHR_IFUNC 1
|
|
|
bdc76f |
+#else
|
|
|
bdc76f |
+# define HAVE_RAWMEMCHR_IFUNC 0
|
|
|
bdc76f |
+#endif
|
|
|
bdc76f |
+
|
|
|
bdc76f |
+#ifdef HAVE_S390_VX_ASM_SUPPORT
|
|
|
bdc76f |
+# define HAVE_RAWMEMCHR_IFUNC_AND_VX_SUPPORT HAVE_RAWMEMCHR_IFUNC
|
|
|
bdc76f |
+#else
|
|
|
bdc76f |
+# define HAVE_RAWMEMCHR_IFUNC_AND_VX_SUPPORT 0
|
|
|
bdc76f |
+#endif
|
|
|
bdc76f |
+
|
|
|
bdc76f |
+#if defined HAVE_S390_MIN_Z13_ZARCH_ASM_SUPPORT
|
|
|
bdc76f |
+# define RAWMEMCHR_DEFAULT RAWMEMCHR_Z13
|
|
|
bdc76f |
+# define HAVE_RAWMEMCHR_C 0
|
|
|
bdc76f |
+# define HAVE_RAWMEMCHR_Z13 1
|
|
|
bdc76f |
+#else
|
|
|
bdc76f |
+# define RAWMEMCHR_DEFAULT RAWMEMCHR_C
|
|
|
bdc76f |
+# define HAVE_RAWMEMCHR_C 1
|
|
|
bdc76f |
+# define HAVE_RAWMEMCHR_Z13 HAVE_RAWMEMCHR_IFUNC_AND_VX_SUPPORT
|
|
|
bdc76f |
+#endif
|
|
|
bdc76f |
+
|
|
|
bdc76f |
+#if HAVE_RAWMEMCHR_C
|
|
|
bdc76f |
+# define RAWMEMCHR_C __rawmemchr_c
|
|
|
bdc76f |
+#else
|
|
|
bdc76f |
+# define RAWMEMCHR_C NULL
|
|
|
bdc76f |
+#endif
|
|
|
bdc76f |
+
|
|
|
bdc76f |
+#if HAVE_RAWMEMCHR_Z13
|
|
|
bdc76f |
+# define RAWMEMCHR_Z13 __rawmemchr_vx
|
|
|
bdc76f |
+#else
|
|
|
bdc76f |
+# define RAWMEMCHR_Z13 NULL
|
|
|
bdc76f |
+#endif
|
|
|
bdc76f |
diff --git a/sysdeps/s390/multiarch/Makefile b/sysdeps/s390/multiarch/Makefile
|
|
|
bdc76f |
index fa1f7b81db912be0..ac6cfcf9c7dbbc3a 100644
|
|
|
bdc76f |
--- a/sysdeps/s390/multiarch/Makefile
|
|
|
bdc76f |
+++ b/sysdeps/s390/multiarch/Makefile
|
|
|
bdc76f |
@@ -1,6 +1,5 @@
|
|
|
bdc76f |
ifeq ($(subdir),string)
|
|
|
bdc76f |
-sysdep_routines += rawmemchr rawmemchr-vx rawmemchr-c \
|
|
|
bdc76f |
- memccpy memccpy-vx memccpy-c \
|
|
|
bdc76f |
+sysdep_routines += memccpy memccpy-vx memccpy-c \
|
|
|
bdc76f |
memrchr memrchr-vx memrchr-c
|
|
|
bdc76f |
endif
|
|
|
bdc76f |
|
|
|
bdc76f |
diff --git a/sysdeps/s390/multiarch/ifunc-impl-list.c b/sysdeps/s390/multiarch/ifunc-impl-list.c
|
|
|
bdc76f |
index b4be0140424aed69..bf3b40e111a6bd31 100644
|
|
|
bdc76f |
--- a/sysdeps/s390/multiarch/ifunc-impl-list.c
|
|
|
bdc76f |
+++ b/sysdeps/s390/multiarch/ifunc-impl-list.c
|
|
|
bdc76f |
@@ -43,6 +43,7 @@
|
|
|
bdc76f |
#include <ifunc-strpbrk.h>
|
|
|
bdc76f |
#include <ifunc-strcspn.h>
|
|
|
bdc76f |
#include <ifunc-memchr.h>
|
|
|
bdc76f |
+#include <ifunc-rawmemchr.h>
|
|
|
bdc76f |
|
|
|
bdc76f |
/* Maximum number of IFUNC implementations. */
|
|
|
bdc76f |
#define MAX_IFUNC 3
|
|
|
bdc76f |
@@ -385,6 +386,18 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
|
|
|
bdc76f |
)
|
|
|
bdc76f |
#endif /* HAVE_MEMCHR_IFUNC */
|
|
|
bdc76f |
|
|
|
bdc76f |
+#if HAVE_RAWMEMCHR_IFUNC
|
|
|
bdc76f |
+ IFUNC_IMPL (i, name, rawmemchr,
|
|
|
bdc76f |
+# if HAVE_RAWMEMCHR_Z13
|
|
|
bdc76f |
+ IFUNC_IMPL_ADD (array, i, rawmemchr,
|
|
|
bdc76f |
+ dl_hwcap & HWCAP_S390_VX, RAWMEMCHR_Z13)
|
|
|
bdc76f |
+# endif
|
|
|
bdc76f |
+# if HAVE_RAWMEMCHR_C
|
|
|
bdc76f |
+ IFUNC_IMPL_ADD (array, i, rawmemchr, 1, RAWMEMCHR_C)
|
|
|
bdc76f |
+# endif
|
|
|
bdc76f |
+ )
|
|
|
bdc76f |
+#endif /* HAVE_RAWMEMCHR_IFUNC */
|
|
|
bdc76f |
+
|
|
|
bdc76f |
#ifdef HAVE_S390_VX_ASM_SUPPORT
|
|
|
bdc76f |
|
|
|
bdc76f |
# define IFUNC_VX_IMPL(FUNC) \
|
|
|
bdc76f |
@@ -426,7 +439,6 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
|
|
|
bdc76f |
IFUNC_VX_IMPL (wcscspn);
|
|
|
bdc76f |
|
|
|
bdc76f |
IFUNC_VX_IMPL (wmemchr);
|
|
|
bdc76f |
- IFUNC_VX_IMPL (rawmemchr);
|
|
|
bdc76f |
|
|
|
bdc76f |
IFUNC_VX_IMPL (memccpy);
|
|
|
bdc76f |
|
|
|
bdc76f |
diff --git a/sysdeps/s390/multiarch/rawmemchr.c b/sysdeps/s390/rawmemchr-c.c
|
|
|
bdc76f |
similarity index 67%
|
|
|
bdc76f |
rename from sysdeps/s390/multiarch/rawmemchr.c
|
|
|
bdc76f |
rename to sysdeps/s390/rawmemchr-c.c
|
|
|
bdc76f |
index 5fdb2252df7f8fa1..8b8208e542092383 100644
|
|
|
bdc76f |
--- a/sysdeps/s390/multiarch/rawmemchr.c
|
|
|
bdc76f |
+++ b/sysdeps/s390/rawmemchr-c.c
|
|
|
bdc76f |
@@ -1,4 +1,4 @@
|
|
|
bdc76f |
-/* Multiple versions of rawmemchr.
|
|
|
bdc76f |
+/* Default rawmemchr implementation for S/390.
|
|
|
bdc76f |
Copyright (C) 2015-2018 Free Software Foundation, Inc.
|
|
|
bdc76f |
This file is part of the GNU C Library.
|
|
|
bdc76f |
|
|
|
bdc76f |
@@ -16,16 +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 __rawmemchr __redirect___rawmemchr
|
|
|
bdc76f |
-# include <string.h>
|
|
|
bdc76f |
-# undef __rawmemchr
|
|
|
bdc76f |
-# include <ifunc-resolve.h>
|
|
|
bdc76f |
+#include <ifunc-rawmemchr.h>
|
|
|
bdc76f |
|
|
|
bdc76f |
-s390_vx_libc_ifunc2_redirected (__redirect___rawmemchr, __rawmemchr
|
|
|
bdc76f |
- , __rawmemchr)
|
|
|
bdc76f |
-weak_alias (__rawmemchr, rawmemchr)
|
|
|
bdc76f |
+#if HAVE_RAWMEMCHR_C
|
|
|
bdc76f |
+# if HAVE_RAWMEMCHR_IFUNC
|
|
|
bdc76f |
+# define RAWMEMCHR RAWMEMCHR_C
|
|
|
bdc76f |
+# undef weak_alias
|
|
|
bdc76f |
+# define weak_alias(a, b)
|
|
|
bdc76f |
+# if defined SHARED && IS_IN (libc)
|
|
|
bdc76f |
+# undef libc_hidden_def
|
|
|
bdc76f |
+# define libc_hidden_def(name) \
|
|
|
bdc76f |
+ __hidden_ver1 (__rawmemchr_c, __GI___rawmemchr, __rawmemchr_c);
|
|
|
bdc76f |
+# endif
|
|
|
bdc76f |
+# endif
|
|
|
bdc76f |
|
|
|
bdc76f |
-#else
|
|
|
bdc76f |
# include <string/rawmemchr.c>
|
|
|
bdc76f |
-#endif /* !(defined HAVE_S390_VX_ASM_SUPPORT && IS_IN (libc)) */
|
|
|
bdc76f |
+#endif
|
|
|
bdc76f |
diff --git a/sysdeps/s390/multiarch/rawmemchr-vx.S b/sysdeps/s390/rawmemchr-vx.S
|
|
|
bdc76f |
similarity index 87%
|
|
|
bdc76f |
rename from sysdeps/s390/multiarch/rawmemchr-vx.S
|
|
|
bdc76f |
rename to sysdeps/s390/rawmemchr-vx.S
|
|
|
bdc76f |
index d5778be068394394..f04c0e8b616a76ea 100644
|
|
|
bdc76f |
--- a/sysdeps/s390/multiarch/rawmemchr-vx.S
|
|
|
bdc76f |
+++ b/sysdeps/s390/rawmemchr-vx.S
|
|
|
bdc76f |
@@ -16,7 +16,9 @@
|
|
|
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-rawmemchr.h>
|
|
|
bdc76f |
+
|
|
|
bdc76f |
+#if HAVE_RAWMEMCHR_Z13
|
|
|
bdc76f |
|
|
|
bdc76f |
# include "sysdep.h"
|
|
|
bdc76f |
# include "asm-syntax.h"
|
|
|
bdc76f |
@@ -37,7 +39,7 @@
|
|
|
bdc76f |
-v17=index of unequal
|
|
|
bdc76f |
-v18=c replicated
|
|
|
bdc76f |
*/
|
|
|
bdc76f |
-ENTRY(__rawmemchr_vx)
|
|
|
bdc76f |
+ENTRY(RAWMEMCHR_Z13)
|
|
|
bdc76f |
.machine "z13"
|
|
|
bdc76f |
.machinemode "zarch_nohighgprs"
|
|
|
bdc76f |
|
|
|
bdc76f |
@@ -88,5 +90,15 @@ ENTRY(__rawmemchr_vx)
|
|
|
bdc76f |
.Lend_found:
|
|
|
bdc76f |
la %r2,0(%r5,%r2) /* Return pointer to character. */
|
|
|
bdc76f |
br %r14
|
|
|
bdc76f |
-END(__rawmemchr_vx)
|
|
|
bdc76f |
-#endif /* HAVE_S390_VX_ASM_SUPPORT && IS_IN (libc) */
|
|
|
bdc76f |
+END(RAWMEMCHR_Z13)
|
|
|
bdc76f |
+
|
|
|
bdc76f |
+# if ! HAVE_RAWMEMCHR_IFUNC
|
|
|
bdc76f |
+strong_alias (RAWMEMCHR_Z13, __rawmemchr)
|
|
|
bdc76f |
+weak_alias (__rawmemchr, rawmemchr)
|
|
|
bdc76f |
+# endif
|
|
|
bdc76f |
+
|
|
|
bdc76f |
+# if ! HAVE_RAWMEMCHR_C && defined SHARED && IS_IN (libc)
|
|
|
bdc76f |
+strong_alias (RAWMEMCHR_Z13, __GI___rawmemchr)
|
|
|
bdc76f |
+# endif
|
|
|
bdc76f |
+
|
|
|
bdc76f |
+#endif /* HAVE_RAWMEMCHR_Z13 */
|
|
|
bdc76f |
diff --git a/sysdeps/s390/multiarch/rawmemchr-c.c b/sysdeps/s390/rawmemchr.c
|
|
|
bdc76f |
similarity index 56%
|
|
|
bdc76f |
rename from sysdeps/s390/multiarch/rawmemchr-c.c
|
|
|
bdc76f |
rename to sysdeps/s390/rawmemchr.c
|
|
|
bdc76f |
index f43c883a76e52480..d9263ce208ea6361 100644
|
|
|
bdc76f |
--- a/sysdeps/s390/multiarch/rawmemchr-c.c
|
|
|
bdc76f |
+++ b/sysdeps/s390/rawmemchr.c
|
|
|
bdc76f |
@@ -1,4 +1,4 @@
|
|
|
bdc76f |
-/* Default rawmemchr implementation for S/390.
|
|
|
bdc76f |
+/* Multiple versions of rawmemchr.
|
|
|
bdc76f |
Copyright (C) 2015-2018 Free Software Foundation, Inc.
|
|
|
bdc76f |
This file is part of the GNU C Library.
|
|
|
bdc76f |
|
|
|
bdc76f |
@@ -16,19 +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-rawmemchr.h>
|
|
|
bdc76f |
+
|
|
|
bdc76f |
+#if HAVE_RAWMEMCHR_IFUNC
|
|
|
bdc76f |
+# define __rawmemchr __redirect___rawmemchr
|
|
|
bdc76f |
# include <string.h>
|
|
|
bdc76f |
+# undef __rawmemchr
|
|
|
bdc76f |
+# include <ifunc-resolve.h>
|
|
|
bdc76f |
|
|
|
bdc76f |
-# define RAWMEMCHR __rawmemchr_c
|
|
|
bdc76f |
-# undef weak_alias
|
|
|
bdc76f |
-# define weak_alias(a, b)
|
|
|
bdc76f |
-# ifdef SHARED
|
|
|
bdc76f |
-# undef libc_hidden_def
|
|
|
bdc76f |
-# define libc_hidden_def(name) \
|
|
|
bdc76f |
- __hidden_ver1 (__rawmemchr_c, __GI___rawmemchr, __rawmemchr_c);
|
|
|
bdc76f |
-# endif /* SHARED */
|
|
|
bdc76f |
+# if HAVE_RAWMEMCHR_C
|
|
|
bdc76f |
+extern __typeof (__redirect___rawmemchr) RAWMEMCHR_C attribute_hidden;
|
|
|
bdc76f |
+# endif
|
|
|
bdc76f |
|
|
|
bdc76f |
-extern __typeof (rawmemchr) __rawmemchr_c attribute_hidden;
|
|
|
bdc76f |
+# if HAVE_RAWMEMCHR_Z13
|
|
|
bdc76f |
+extern __typeof (__redirect___rawmemchr) RAWMEMCHR_Z13 attribute_hidden;
|
|
|
bdc76f |
+# endif
|
|
|
bdc76f |
|
|
|
bdc76f |
-# include <string/rawmemchr.c>
|
|
|
bdc76f |
-#endif /* !(defined HAVE_S390_VX_ASM_SUPPORT && IS_IN (libc)) */
|
|
|
bdc76f |
+s390_libc_ifunc_expr (__redirect___rawmemchr, __rawmemchr,
|
|
|
bdc76f |
+ (HAVE_RAWMEMCHR_Z13 && (hwcap & HWCAP_S390_VX))
|
|
|
bdc76f |
+ ? RAWMEMCHR_Z13
|
|
|
bdc76f |
+ : RAWMEMCHR_DEFAULT
|
|
|
bdc76f |
+ )
|
|
|
bdc76f |
+weak_alias (__rawmemchr, rawmemchr)
|
|
|
bdc76f |
+#endif /* HAVE_RAWMEMCHR_IFUNC */
|