From 00d406e77bb0e49d79dc1b13d7077436ee5cdf14 Mon Sep 17 00:00:00 2001 From: litenglong Date: Fri, 17 Oct 2025 09:45:41 +0800 Subject: [PATCH] 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 --- sysdeps/x86/cpu-features.c | 6 ++++++ 1 file changed, 6 insertions(+) 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 {