x86-64: Require BMI2 for strchr-avx2.S [BZ #29611]

Since strchr-avx2.S updated by

commit 1f745ecc21
Author: noah <goldstein.w.n@gmail.com>
Date:   Wed Feb 3 00:38:59 2021 -0500

    x86-64: Refactor and improve performance of strchr-avx2.S

uses sarx:

c4 e2 72 f7 c0       	sarx   %ecx,%eax,%eax

for strchr-avx2 family functions, require BMI2 in ifunc-impl-list.c and
ifunc-avx2.h.

This fixes BZ #29611.

(cherry picked from commit 83c5b36822)
This commit is contained in:
H.J. Lu 2021-04-19 10:45:07 -07:00 committed by Sunil K Pandey
parent 6da40102c7
commit 986e7b911f
2 changed files with 11 additions and 5 deletions

View File

@ -30,11 +30,11 @@ IFUNC_SELECTOR (void)
const struct cpu_features* cpu_features = __get_cpu_features ();
if (CPU_FEATURES_ARCH_P (cpu_features, AVX2_Usable)
&& CPU_FEATURES_CPU_P (cpu_features, BMI2)
&& CPU_FEATURES_ARCH_P (cpu_features, AVX_Fast_Unaligned_Load))
{
if (CPU_FEATURES_ARCH_P (cpu_features, AVX512VL_Usable)
&& CPU_FEATURES_ARCH_P (cpu_features, AVX512BW_Usable)
&& CPU_FEATURES_CPU_P (cpu_features, BMI2))
&& CPU_FEATURES_ARCH_P (cpu_features, AVX512BW_Usable))
return OPTIMIZE (evex);
if (CPU_FEATURES_CPU_P (cpu_features, RTM))

View File

@ -400,10 +400,12 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
/* Support sysdeps/x86_64/multiarch/strchr.c. */
IFUNC_IMPL (i, name, strchr,
IFUNC_IMPL_ADD (array, i, strchr,
HAS_ARCH_FEATURE (AVX2_Usable),
(HAS_ARCH_FEATURE (AVX2_Usable)
&& HAS_CPU_FEATURE (BMI2)),
__strchr_avx2)
IFUNC_IMPL_ADD (array, i, strchr,
(HAS_ARCH_FEATURE (AVX2_Usable)
&& HAS_CPU_FEATURE (BMI2)
&& HAS_CPU_FEATURE (RTM)),
__strchr_avx2_rtm)
IFUNC_IMPL_ADD (array, i, strchr,
@ -417,10 +419,12 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
/* Support sysdeps/x86_64/multiarch/strchrnul.c. */
IFUNC_IMPL (i, name, strchrnul,
IFUNC_IMPL_ADD (array, i, strchrnul,
HAS_ARCH_FEATURE (AVX2_Usable),
(HAS_ARCH_FEATURE (AVX2_Usable)
&& HAS_CPU_FEATURE (BMI2)),
__strchrnul_avx2)
IFUNC_IMPL_ADD (array, i, strchrnul,
(HAS_ARCH_FEATURE (AVX2_Usable)
&& HAS_CPU_FEATURE (BMI2)
&& HAS_CPU_FEATURE (RTM)),
__strchrnul_avx2_rtm)
IFUNC_IMPL_ADD (array, i, strchrnul,
@ -574,10 +578,12 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
/* Support sysdeps/x86_64/multiarch/wcschr.c. */
IFUNC_IMPL (i, name, wcschr,
IFUNC_IMPL_ADD (array, i, wcschr,
HAS_ARCH_FEATURE (AVX2_Usable),
(HAS_ARCH_FEATURE (AVX2_Usable)
&& HAS_CPU_FEATURE (BMI2)),
__wcschr_avx2)
IFUNC_IMPL_ADD (array, i, wcschr,
(HAS_ARCH_FEATURE (AVX2_Usable)
&& HAS_CPU_FEATURE (BMI2)
&& HAS_CPU_FEATURE (RTM)),
__wcschr_avx2_rtm)
IFUNC_IMPL_ADD (array, i, wcschr,