diff options
author | Aurelien Jarno <aurelien@aurel32.net> | 2022-10-03 23:46:11 +0200 |
---|---|---|
committer | Aurelien Jarno <aurelien@aurel32.net> | 2022-10-03 23:47:49 +0200 |
commit | 29c577e0f54fe6e70ceacb3659179781c5569903 (patch) | |
tree | f3af2d0debf6f5d50fe1374f9a6c9d6f45c6d5cf /sysdeps/x86_64/multiarch/strncmp.c | |
parent | 7afbd1e56acb721031bffd876f275dcb1af7e530 (diff) | |
download | glibc-29c577e0f54fe6e70ceacb3659179781c5569903.tar.gz glibc-29c577e0f54fe6e70ceacb3659179781c5569903.tar.xz glibc-29c577e0f54fe6e70ceacb3659179781c5569903.zip |
x86-64: Require BMI2 for AVX2 strncmp implementation
The AVX2 strncmp implementations uses the 'bzhi' instruction, which belongs to the BMI2 CPU feature. NB: It also uses the 'tzcnt' BMI1 instruction, but it is executed as BSF as BSF if the CPU doesn't support TZCNT, and produces the same result for non-zero input. Partially fixes: b77b06e0e296 ("x86: Optimize strcmp-avx2.S") Partially resolves: BZ #29611 Reviewed-by: Noah Goldstein <goldstein.w.n@gmail.com> (cherry picked from commit fc7de1d9b99ae1676bc626ddca422d7abee0eb48)
Diffstat (limited to 'sysdeps/x86_64/multiarch/strncmp.c')
-rw-r--r-- | sysdeps/x86_64/multiarch/strncmp.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sysdeps/x86_64/multiarch/strncmp.c b/sysdeps/x86_64/multiarch/strncmp.c index 4ebe4bde30..c4f8b6bbb5 100644 --- a/sysdeps/x86_64/multiarch/strncmp.c +++ b/sysdeps/x86_64/multiarch/strncmp.c @@ -41,12 +41,12 @@ IFUNC_SELECTOR (void) const struct cpu_features *cpu_features = __get_cpu_features (); if (X86_ISA_CPU_FEATURE_USABLE_P (cpu_features, AVX2) + && X86_ISA_CPU_FEATURE_USABLE_P (cpu_features, BMI2) && X86_ISA_CPU_FEATURES_ARCH_P (cpu_features, AVX_Fast_Unaligned_Load, )) { if (X86_ISA_CPU_FEATURE_USABLE_P (cpu_features, AVX512VL) - && X86_ISA_CPU_FEATURE_USABLE_P (cpu_features, AVX512BW) - && X86_ISA_CPU_FEATURE_USABLE_P (cpu_features, BMI2)) + && X86_ISA_CPU_FEATURE_USABLE_P (cpu_features, AVX512BW)) return OPTIMIZE (evex); if (CPU_FEATURE_USABLE_P (cpu_features, RTM)) |