mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-30 13:13:43 +08:00
6f47401bd5
This patch introduces the new arch13 ifunc variant for strstr. For needles longer than 9 charachters it is relying on the common-code implementation. For shorter needles it is using the new vstrs instruction which is able to search a substring within a vector register. ChangeLog: * sysdeps/s390/Makefile (sysdep_routines): Add strstr-arch13. * sysdeps/s390/ifunc-strstr.h (HAVE_STRSTR_ARCH13, STRSTR_ARCH13, STRSTR_Z13_ONLY_USED_AS_FALLBACK, HAVE_STRSTR_IFUNC_AND_ARCH13_SUPPORT): New defines. * sysdeps/s390/multiarch/ifunc-impl-list.c (__libc_ifunc_impl_list): Add ifunc variant for arch13 strstr. * sysdeps/s390/strstr-arch13.S: New file. * sysdeps/s390/strstr-vx.c: Omit GI symbol for z13 strstr ifunc variant if it is only used as fallback. * sysdeps/s390/strstr.c (strstr): Add arch13 variant in ifunc selector.
47 lines
1.5 KiB
C
47 lines
1.5 KiB
C
/* Multiple versions of strstr.
|
|
Copyright (C) 2018-2019 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/>. */
|
|
|
|
#include <ifunc-strstr.h>
|
|
|
|
#if HAVE_STRSTR_IFUNC
|
|
# define strstr __redirect_strstr
|
|
# include <string.h>
|
|
# include <ifunc-resolve.h>
|
|
# undef strstr
|
|
|
|
# if HAVE_STRSTR_C
|
|
extern __typeof (__redirect_strstr) STRSTR_C attribute_hidden;
|
|
# endif
|
|
|
|
# if HAVE_STRSTR_Z13
|
|
extern __typeof (__redirect_strstr) STRSTR_Z13 attribute_hidden;
|
|
# endif
|
|
|
|
# if HAVE_STRSTR_ARCH13
|
|
extern __typeof (__redirect_strstr) STRSTR_ARCH13 attribute_hidden;
|
|
# endif
|
|
|
|
s390_libc_ifunc_expr (__redirect_strstr, strstr,
|
|
(HAVE_STRSTR_ARCH13 && (hwcap & HWCAP_S390_VXRS_EXT2))
|
|
? STRSTR_ARCH13
|
|
: (HAVE_STRSTR_Z13 && (hwcap & HWCAP_S390_VX))
|
|
? STRSTR_Z13
|
|
: STRSTR_DEFAULT
|
|
)
|
|
#endif
|