From: litenglong Date: Fri, 17 Oct 2025 01:45:41 +0000 (+0800) Subject: x86: Disable AVX Fast Unaligned Load on Hygon 1/2/3 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=00d406e77bb0e49d79dc1b13d7077436ee5cdf14;p=thirdparty%2Fglibc.git x86: Disable AVX Fast Unaligned Load on Hygon 1/2/3 - Performance testing revealed significant memcpy performance degradation when bit_arch_AVX_Fast_Unaligned_Load is enabled on Hygon 3. - Hygon confirmed AVX performance issues in certain memory functions. - Glibc benchmarks show SSE outperforms AVX for memcpy/memmove/memset/strcmp/strcpy/strlen and so on. - Hardware differences primarily in floating-point operations don't justify AVX usage for memory operations. Reviewed-by: gaoxiang Signed-off-by: litenglong Reviewed-by: H.J. Lu --- diff --git a/sysdeps/x86/cpu-features.c b/sysdeps/x86/cpu-features.c index b67ef541dd..c696a4d1f7 100644 --- a/sysdeps/x86/cpu-features.c +++ b/sysdeps/x86/cpu-features.c @@ -1123,6 +1123,12 @@ disable_tsx: hardware. */ cpu_features->preferred[index_arch_Avoid_Non_Temporal_Memset] &= ~bit_arch_Avoid_Non_Temporal_Memset; + if (model < 0x4) + { + /* Unaligned AVX loads are slower. */ + cpu_features->preferred[index_arch_AVX_Fast_Unaligned_Load] + &= ~bit_arch_AVX_Fast_Unaligned_Load; + } } else {