]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
x86: Disable AVX Fast Unaligned Load on Hygon 1/2/3
authorlitenglong <litenglong@kylinos.cn>
Fri, 17 Oct 2025 01:45:41 +0000 (09:45 +0800)
committerH.J. Lu <hjl.tools@gmail.com>
Sun, 26 Oct 2025 21:16:30 +0000 (05:16 +0800)
- 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 <gaoxiang@kylinos.cn>
Signed-off-by: litenglong <litenglong@kylinos.cn>
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
sysdeps/x86/cpu-features.c

index b67ef541dd6dbafab84a389e2a11aa1185f2097a..c696a4d1f79ede8aa94850697ea6035807272a7e 100644 (file)
@@ -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
     {