diff options
Diffstat (limited to 'sysdeps/s390')
-rw-r--r-- | sysdeps/s390/Makefile | 3 | ||||
-rw-r--r-- | sysdeps/s390/ifunc-strchrnul.h | 52 | ||||
-rw-r--r-- | sysdeps/s390/multiarch/Makefile | 3 | ||||
-rw-r--r-- | sysdeps/s390/multiarch/ifunc-impl-list.c | 14 | ||||
-rw-r--r-- | sysdeps/s390/strchrnul-c.c (renamed from sysdeps/s390/multiarch/strchrnul-c.c) | 14 | ||||
-rw-r--r-- | sysdeps/s390/strchrnul-vx.S (renamed from sysdeps/s390/multiarch/strchrnul-vx.S) | 16 | ||||
-rw-r--r-- | sysdeps/s390/strchrnul.c (renamed from sysdeps/s390/multiarch/strchrnul.c) | 23 |
7 files changed, 106 insertions, 19 deletions
diff --git a/sysdeps/s390/Makefile b/sysdeps/s390/Makefile index 59d6e845db..07ec5e969f 100644 --- a/sysdeps/s390/Makefile +++ b/sysdeps/s390/Makefile @@ -70,5 +70,6 @@ sysdep_routines += bzero memset memset-z900 \ strncat strncat-vx strncat-c \ strcmp strcmp-vx strcmp-z900 \ strncmp strncmp-vx strncmp-c \ - strchr strchr-vx strchr-c + strchr strchr-vx strchr-c \ + strchrnul strchrnul-vx strchrnul-c endif diff --git a/sysdeps/s390/ifunc-strchrnul.h b/sysdeps/s390/ifunc-strchrnul.h new file mode 100644 index 0000000000..cac817e6f0 --- /dev/null +++ b/sysdeps/s390/ifunc-strchrnul.h @@ -0,0 +1,52 @@ +/* strchrnul variant information on S/390 version. + Copyright (C) 2018 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#if defined USE_MULTIARCH && IS_IN (libc) \ + && ! defined HAVE_S390_MIN_Z13_ZARCH_ASM_SUPPORT +# define HAVE_STRCHRNUL_IFUNC 1 +#else +# define HAVE_STRCHRNUL_IFUNC 0 +#endif + +#ifdef HAVE_S390_VX_ASM_SUPPORT +# define HAVE_STRCHRNUL_IFUNC_AND_VX_SUPPORT HAVE_STRCHRNUL_IFUNC +#else +# define HAVE_STRCHRNUL_IFUNC_AND_VX_SUPPORT 0 +#endif + +#if defined HAVE_S390_MIN_Z13_ZARCH_ASM_SUPPORT +# define STRCHRNUL_DEFAULT STRCHRNUL_Z13 +# define HAVE_STRCHRNUL_C 0 +# define HAVE_STRCHRNUL_Z13 1 +#else +# define STRCHRNUL_DEFAULT STRCHRNUL_C +# define HAVE_STRCHRNUL_C 1 +# define HAVE_STRCHRNUL_Z13 HAVE_STRCHRNUL_IFUNC_AND_VX_SUPPORT +#endif + +#if HAVE_STRCHRNUL_C +# define STRCHRNUL_C __strchrnul_c +#else +# define STRCHRNUL_C NULL +#endif + +#if HAVE_STRCHRNUL_Z13 +# define STRCHRNUL_Z13 __strchrnul_vx +#else +# define STRCHRNUL_Z13 NULL +#endif diff --git a/sysdeps/s390/multiarch/Makefile b/sysdeps/s390/multiarch/Makefile index a8e9d0acd9..999a979fee 100644 --- a/sysdeps/s390/multiarch/Makefile +++ b/sysdeps/s390/multiarch/Makefile @@ -1,6 +1,5 @@ ifeq ($(subdir),string) -sysdep_routines += strchrnul strchrnul-vx strchrnul-c \ - strrchr strrchr-vx strrchr-c \ +sysdep_routines += strrchr strrchr-vx strrchr-c \ strspn strspn-vx strspn-c \ strpbrk strpbrk-vx strpbrk-c \ strcspn strcspn-vx strcspn-c \ diff --git a/sysdeps/s390/multiarch/ifunc-impl-list.c b/sysdeps/s390/multiarch/ifunc-impl-list.c index e809ca3bac..0a47ffeac3 100644 --- a/sysdeps/s390/multiarch/ifunc-impl-list.c +++ b/sysdeps/s390/multiarch/ifunc-impl-list.c @@ -37,6 +37,7 @@ #include <ifunc-strcmp.h> #include <ifunc-strncmp.h> #include <ifunc-strchr.h> +#include <ifunc-strchrnul.h> /* Maximum number of IFUNC implementations. */ #define MAX_IFUNC 3 @@ -307,6 +308,18 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array, ) #endif /* HAVE_STRCHR_IFUNC */ +#if HAVE_STRCHRNUL_IFUNC + IFUNC_IMPL (i, name, strchrnul, +# if HAVE_STRCHRNUL_Z13 + IFUNC_IMPL_ADD (array, i, strchrnul, + dl_hwcap & HWCAP_S390_VX, STRCHRNUL_Z13) +# endif +# if HAVE_STRCHRNUL_C + IFUNC_IMPL_ADD (array, i, strchrnul, 1, STRCHRNUL_C) +# endif + ) +#endif /* HAVE_STRCHRNUL_IFUNC */ + #ifdef HAVE_S390_VX_ASM_SUPPORT # define IFUNC_VX_IMPL(FUNC) \ @@ -337,7 +350,6 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array, IFUNC_VX_IMPL (wcschr); - IFUNC_VX_IMPL (strchrnul); IFUNC_VX_IMPL (wcschrnul); IFUNC_VX_IMPL (strrchr); diff --git a/sysdeps/s390/multiarch/strchrnul-c.c b/sysdeps/s390/strchrnul-c.c index 020cebcf3e..585273f5de 100644 --- a/sysdeps/s390/multiarch/strchrnul-c.c +++ b/sysdeps/s390/strchrnul-c.c @@ -16,11 +16,15 @@ License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ -#if defined HAVE_S390_VX_ASM_SUPPORT && IS_IN (libc) -# define STRCHRNUL __strchrnul_c -# define __strchrnul STRCHRNUL -# undef weak_alias -# define weak_alias(name, alias) +#include <ifunc-strchrnul.h> + +#if HAVE_STRCHRNUL_C +# if HAVE_STRCHRNUL_IFUNC +# define STRCHRNUL STRCHRNUL_C +# define __strchrnul STRCHRNUL +# undef weak_alias +# define weak_alias(name, alias) +# endif # include <string/strchrnul.c> #endif diff --git a/sysdeps/s390/multiarch/strchrnul-vx.S b/sysdeps/s390/strchrnul-vx.S index d561825e04..0cd587bc32 100644 --- a/sysdeps/s390/multiarch/strchrnul-vx.S +++ b/sysdeps/s390/strchrnul-vx.S @@ -16,7 +16,9 @@ License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ -#if defined HAVE_S390_VX_ASM_SUPPORT && IS_IN (libc) +#include <ifunc-strchrnul.h> + +#if HAVE_STRCHRNUL_Z13 # include "sysdep.h" # include "asm-syntax.h" @@ -35,7 +37,7 @@ -v16=part of s -v18=vector with c replicated in every byte */ -ENTRY(__strchrnul_vx) +ENTRY(STRCHRNUL_Z13) .machine "z13" .machinemode "zarch_nohighgprs" @@ -89,5 +91,11 @@ ENTRY(__strchrnul_vx) .Lend: br %r14 -END(__strchrnul_vx) -#endif /* HAVE_S390_VX_ASM_SUPPORT && IS_IN (libc) */ +END(STRCHRNUL_Z13) + +# if ! HAVE_STRCHRNUL_IFUNC +strong_alias (STRCHRNUL_Z13, __strchrnul) +weak_alias (__strchrnul, strchrnul) +# endif + +#endif /* HAVE_STRCHRNUL_Z13 */ diff --git a/sysdeps/s390/multiarch/strchrnul.c b/sysdeps/s390/strchrnul.c index 62dfc6bd90..e9fefe1bdc 100644 --- a/sysdeps/s390/multiarch/strchrnul.c +++ b/sysdeps/s390/strchrnul.c @@ -16,13 +16,24 @@ License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ -#if defined HAVE_S390_VX_ASM_SUPPORT && IS_IN (libc) +#include <ifunc-strchrnul.h> + +#if HAVE_STRCHRNUL_IFUNC # include <string.h> # include <ifunc-resolve.h> -s390_vx_libc_ifunc (__strchrnul) -weak_alias (__strchrnul, strchrnul) +# if HAVE_STRCHRNUL_C +extern __typeof (__strchrnul) STRCHRNUL_C attribute_hidden; +# endif -#else -# include <string/strchrnul.c> -#endif /* !(defined HAVE_S390_VX_ASM_SUPPORT && IS_IN (libc)) */ +# if HAVE_STRCHRNUL_Z13 +extern __typeof (__strchrnul) STRCHRNUL_Z13 attribute_hidden; +# endif + +s390_libc_ifunc_expr (__strchrnul, __strchrnul, + (HAVE_STRCHRNUL_Z13 && (hwcap & HWCAP_S390_VX)) + ? STRCHRNUL_Z13 + : STRCHRNUL_DEFAULT + ) +weak_alias (__strchrnul, strchrnul) +#endif /* HAVE_STRCHRNUL_IFUNC */ |