|
|
d8307d |
commit 8c25dddd2e32bce47dfe01ca51c8aab535dbe23d
|
|
|
d8307d |
Author: Stefan Liebler <stli@linux.ibm.com>
|
|
|
d8307d |
Date: Tue Dec 18 13:57:09 2018 +0100
|
|
|
d8307d |
|
|
|
d8307d |
S390: Add z13 strstr ifunc variant.
|
|
|
d8307d |
|
|
|
d8307d |
The new vector variant of strstr is using the common code
|
|
|
d8307d |
implementation, but instead of calling the default
|
|
|
d8307d |
str* / mem* functions, the vector variants are called.
|
|
|
d8307d |
|
|
|
d8307d |
ChangeLog:
|
|
|
d8307d |
|
|
|
d8307d |
* sysdeps/s390/Makefile (sysdep_routines): Add strstr variants.
|
|
|
d8307d |
* sysdeps/s390/multiarch/ifunc-impl-list.c
|
|
|
d8307d |
(__libc_ifunc_impl_list): Add ifunc variants for strstr.
|
|
|
d8307d |
* sysdeps/s390/ifunc-strstr.h: New file.
|
|
|
d8307d |
* sysdeps/s390/strstr.c: Likewise.
|
|
|
d8307d |
* sysdeps/s390/strstr-c.c: Likewise.
|
|
|
d8307d |
* sysdeps/s390/strstr-vx.c: Likewise.
|
|
|
d8307d |
|
|
|
d8307d |
diff --git a/sysdeps/s390/Makefile b/sysdeps/s390/Makefile
|
|
|
d8307d |
index 3a7cccdf8f147398..4441e7a5cf6fa167 100644
|
|
|
d8307d |
--- a/sysdeps/s390/Makefile
|
|
|
d8307d |
+++ b/sysdeps/s390/Makefile
|
|
|
d8307d |
@@ -34,5 +34,6 @@ ifeq ($(subdir),string)
|
|
|
d8307d |
sysdep_routines += bzero memset memset-z900 \
|
|
|
d8307d |
memcmp memcmp-z900 \
|
|
|
d8307d |
mempcpy memcpy memcpy-z900 \
|
|
|
d8307d |
- memmove memmove-c
|
|
|
d8307d |
+ memmove memmove-c \
|
|
|
d8307d |
+ strstr strstr-vx strstr-c
|
|
|
d8307d |
endif
|
|
|
d8307d |
diff --git a/sysdeps/s390/ifunc-strstr.h b/sysdeps/s390/ifunc-strstr.h
|
|
|
d8307d |
new file mode 100644
|
|
|
d8307d |
index 0000000000000000..e6ccfd4e44a1a790
|
|
|
d8307d |
--- /dev/null
|
|
|
d8307d |
+++ b/sysdeps/s390/ifunc-strstr.h
|
|
|
d8307d |
@@ -0,0 +1,52 @@
|
|
|
d8307d |
+/* strstr 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_Z13_ZARCH_ASM_SUPPORT
|
|
|
d8307d |
+# define HAVE_STRSTR_IFUNC 1
|
|
|
d8307d |
+#else
|
|
|
d8307d |
+# define HAVE_STRSTR_IFUNC 0
|
|
|
d8307d |
+#endif
|
|
|
d8307d |
+
|
|
|
d8307d |
+#ifdef HAVE_S390_VX_ASM_SUPPORT
|
|
|
d8307d |
+# define HAVE_STRSTR_IFUNC_AND_VX_SUPPORT HAVE_STRSTR_IFUNC
|
|
|
d8307d |
+#else
|
|
|
d8307d |
+# define HAVE_STRSTR_IFUNC_AND_VX_SUPPORT 0
|
|
|
d8307d |
+#endif
|
|
|
d8307d |
+
|
|
|
d8307d |
+#if defined HAVE_S390_MIN_Z13_ZARCH_ASM_SUPPORT
|
|
|
d8307d |
+# define STRSTR_DEFAULT STRSTR_Z13
|
|
|
d8307d |
+# define HAVE_STRSTR_C 0
|
|
|
d8307d |
+# define HAVE_STRSTR_Z13 1
|
|
|
d8307d |
+#else
|
|
|
d8307d |
+# define STRSTR_DEFAULT STRSTR_C
|
|
|
d8307d |
+# define HAVE_STRSTR_C 1
|
|
|
d8307d |
+# define HAVE_STRSTR_Z13 HAVE_STRSTR_IFUNC_AND_VX_SUPPORT
|
|
|
d8307d |
+#endif
|
|
|
d8307d |
+
|
|
|
d8307d |
+#if HAVE_STRSTR_C
|
|
|
d8307d |
+# define STRSTR_C __strstr_c
|
|
|
d8307d |
+#else
|
|
|
d8307d |
+# define STRSTR_C NULL
|
|
|
d8307d |
+#endif
|
|
|
d8307d |
+
|
|
|
d8307d |
+#if HAVE_STRSTR_Z13
|
|
|
d8307d |
+# define STRSTR_Z13 __strstr_vx
|
|
|
d8307d |
+#else
|
|
|
d8307d |
+# define STRSTR_Z13 NULL
|
|
|
d8307d |
+#endif
|
|
|
d8307d |
diff --git a/sysdeps/s390/multiarch/ifunc-impl-list.c b/sysdeps/s390/multiarch/ifunc-impl-list.c
|
|
|
d8307d |
index c05c63e00608dcd7..14727f8fef5431dd 100644
|
|
|
d8307d |
--- a/sysdeps/s390/multiarch/ifunc-impl-list.c
|
|
|
d8307d |
+++ b/sysdeps/s390/multiarch/ifunc-impl-list.c
|
|
|
d8307d |
@@ -24,6 +24,7 @@
|
|
|
d8307d |
#include <ifunc-memset.h>
|
|
|
d8307d |
#include <ifunc-memcmp.h>
|
|
|
d8307d |
#include <ifunc-memcpy.h>
|
|
|
d8307d |
+#include <ifunc-strstr.h>
|
|
|
d8307d |
|
|
|
d8307d |
/* Maximum number of IFUNC implementations. */
|
|
|
d8307d |
#define MAX_IFUNC 3
|
|
|
d8307d |
@@ -138,6 +139,18 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
|
|
|
d8307d |
)
|
|
|
d8307d |
#endif /* HAVE_MEMMOVE_IFUNC */
|
|
|
d8307d |
|
|
|
d8307d |
+#if HAVE_STRSTR_IFUNC
|
|
|
d8307d |
+ IFUNC_IMPL (i, name, strstr,
|
|
|
d8307d |
+# if HAVE_STRSTR_Z13
|
|
|
d8307d |
+ IFUNC_IMPL_ADD (array, i, strstr,
|
|
|
d8307d |
+ dl_hwcap & HWCAP_S390_VX, STRSTR_Z13)
|
|
|
d8307d |
+# endif
|
|
|
d8307d |
+# if HAVE_STRSTR_C
|
|
|
d8307d |
+ IFUNC_IMPL_ADD (array, i, strstr, 1, STRSTR_C)
|
|
|
d8307d |
+# endif
|
|
|
d8307d |
+ )
|
|
|
d8307d |
+#endif /* HAVE_STRSTR_IFUNC */
|
|
|
d8307d |
+
|
|
|
d8307d |
#ifdef HAVE_S390_VX_ASM_SUPPORT
|
|
|
d8307d |
|
|
|
d8307d |
# define IFUNC_VX_IMPL(FUNC) \
|
|
|
d8307d |
diff --git a/sysdeps/s390/strstr-c.c b/sysdeps/s390/strstr-c.c
|
|
|
d8307d |
new file mode 100644
|
|
|
d8307d |
index 0000000000000000..53717bfb276fed3d
|
|
|
d8307d |
--- /dev/null
|
|
|
d8307d |
+++ b/sysdeps/s390/strstr-c.c
|
|
|
d8307d |
@@ -0,0 +1,32 @@
|
|
|
d8307d |
+/* Default strstr implementation for S/390.
|
|
|
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 |
+#include <ifunc-strstr.h>
|
|
|
d8307d |
+
|
|
|
d8307d |
+#if HAVE_STRSTR_C
|
|
|
d8307d |
+# if HAVE_STRSTR_IFUNC
|
|
|
d8307d |
+# define STRSTR STRSTR_C
|
|
|
d8307d |
+# if defined SHARED && IS_IN (libc)
|
|
|
d8307d |
+# undef libc_hidden_builtin_def
|
|
|
d8307d |
+# define libc_hidden_builtin_def(name) \
|
|
|
d8307d |
+ __hidden_ver1 (__strstr_c, __GI_strstr, __strstr_c);
|
|
|
d8307d |
+# endif
|
|
|
d8307d |
+# endif
|
|
|
d8307d |
+
|
|
|
d8307d |
+# include <string/strstr.c>
|
|
|
d8307d |
+#endif
|
|
|
d8307d |
diff --git a/sysdeps/s390/strstr-vx.c b/sysdeps/s390/strstr-vx.c
|
|
|
d8307d |
new file mode 100644
|
|
|
d8307d |
index 0000000000000000..effae9d5eb7d2fb1
|
|
|
d8307d |
--- /dev/null
|
|
|
d8307d |
+++ b/sysdeps/s390/strstr-vx.c
|
|
|
d8307d |
@@ -0,0 +1,52 @@
|
|
|
d8307d |
+/* Default strstr implementation with vector string functions for S/390.
|
|
|
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 |
+#include <ifunc-strstr.h>
|
|
|
d8307d |
+
|
|
|
d8307d |
+#if HAVE_STRSTR_Z13
|
|
|
d8307d |
+# if HAVE_STRSTR_IFUNC
|
|
|
d8307d |
+# define STRSTR STRSTR_Z13
|
|
|
d8307d |
+# if defined SHARED && IS_IN (libc)
|
|
|
d8307d |
+# undef libc_hidden_builtin_def
|
|
|
d8307d |
+# if HAVE_STRSTR_C
|
|
|
d8307d |
+# define libc_hidden_builtin_def(name)
|
|
|
d8307d |
+# else
|
|
|
d8307d |
+# define libc_hidden_builtin_def(name) \
|
|
|
d8307d |
+ __hidden_ver1 (__strstr_vx, __GI_strstr, __strstr_vx);
|
|
|
d8307d |
+# endif
|
|
|
d8307d |
+# endif
|
|
|
d8307d |
+# endif
|
|
|
d8307d |
+
|
|
|
d8307d |
+# include <string.h>
|
|
|
d8307d |
+
|
|
|
d8307d |
+# ifdef USE_MULTIARCH
|
|
|
d8307d |
+extern __typeof (strchr) __strchr_vx attribute_hidden;
|
|
|
d8307d |
+# define strchr __strchr_vx
|
|
|
d8307d |
+
|
|
|
d8307d |
+extern __typeof (strlen) __strlen_vx attribute_hidden;
|
|
|
d8307d |
+# define strlen __strlen_vx
|
|
|
d8307d |
+
|
|
|
d8307d |
+extern __typeof (__strnlen) __strnlen_vx attribute_hidden;
|
|
|
d8307d |
+# define __strnlen __strnlen_vx
|
|
|
d8307d |
+
|
|
|
d8307d |
+extern __typeof (memcmp) __memcmp_z196 attribute_hidden;
|
|
|
d8307d |
+# define memcmp __memcmp_z196
|
|
|
d8307d |
+# endif
|
|
|
d8307d |
+
|
|
|
d8307d |
+# include <string/strstr.c>
|
|
|
d8307d |
+#endif
|
|
|
d8307d |
diff --git a/sysdeps/s390/strstr.c b/sysdeps/s390/strstr.c
|
|
|
d8307d |
new file mode 100644
|
|
|
d8307d |
index 0000000000000000..f8432349a7254cc6
|
|
|
d8307d |
--- /dev/null
|
|
|
d8307d |
+++ b/sysdeps/s390/strstr.c
|
|
|
d8307d |
@@ -0,0 +1,40 @@
|
|
|
d8307d |
+/* Multiple versions of strstr.
|
|
|
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 |
+#include <ifunc-strstr.h>
|
|
|
d8307d |
+
|
|
|
d8307d |
+#if HAVE_STRSTR_IFUNC
|
|
|
d8307d |
+# define strstr __redirect_strstr
|
|
|
d8307d |
+# include <string.h>
|
|
|
d8307d |
+# include <ifunc-resolve.h>
|
|
|
d8307d |
+# undef strstr
|
|
|
d8307d |
+
|
|
|
d8307d |
+# if HAVE_STRSTR_C
|
|
|
d8307d |
+extern __typeof (__redirect_strstr) STRSTR_C attribute_hidden;
|
|
|
d8307d |
+# endif
|
|
|
d8307d |
+
|
|
|
d8307d |
+# if HAVE_STRSTR_Z13
|
|
|
d8307d |
+extern __typeof (__redirect_strstr) STRSTR_Z13 attribute_hidden;
|
|
|
d8307d |
+# endif
|
|
|
d8307d |
+
|
|
|
d8307d |
+s390_libc_ifunc_expr (__redirect_strstr, strstr,
|
|
|
d8307d |
+ (HAVE_STRSTR_Z13 && (hwcap & HWCAP_S390_VX))
|
|
|
d8307d |
+ ? STRSTR_Z13
|
|
|
d8307d |
+ : STRSTR_DEFAULT
|
|
|
d8307d |
+ )
|
|
|
d8307d |
+#endif
|