0001-lib-x86-increase-AVX-VNNI-gcc-prerequisite-to-12.1.patch 1.4 KB

1234567891011121314151617181920212223242526272829303132
  1. From e522b1d09d3536ddc15459b4259150f4a53ee65a Mon Sep 17 00:00:00 2001
  2. From: Eric Biggers <[email protected]>
  3. Date: Thu, 4 Apr 2024 20:16:33 -0400
  4. Subject: [PATCH] lib/x86: increase AVX-VNNI gcc prerequisite to 12.1
  5. Although gcc 11.1 supports AVX-VNNI, a popular distro pairs it with a
  6. binutils version that does not. Require gcc 12 instead.
  7. Resolves https://github.com/ebiggers/libdeflate/issues/365
  8. ---
  9. lib/x86/adler32_impl.h | 9 ++++++++-
  10. 1 file changed, 8 insertions(+), 1 deletion(-)
  11. --- a/lib/x86/adler32_impl.h
  12. +++ b/lib/x86/adler32_impl.h
  13. @@ -52,8 +52,15 @@
  14. /*
  15. * AVX-VNNI implementation. This is used on CPUs that have AVX2 and AVX-VNNI
  16. * but don't have AVX-512, for example Intel Alder Lake.
  17. + *
  18. + * Unusually for a new CPU feature, gcc added support for the AVX-VNNI
  19. + * intrinsics (in gcc 11.1) slightly before binutils added support for
  20. + * assembling AVX-VNNI instructions (in binutils 2.36). Distros can reasonably
  21. + * have gcc 11 with binutils 2.35. Because of this issue, we check for gcc 12
  22. + * instead of gcc 11. (libdeflate supports direct compilation without a
  23. + * configure step, so checking the binutils version is not always an option.)
  24. */
  25. -#if GCC_PREREQ(11, 1) || CLANG_PREREQ(12, 0, 13000000) || MSVC_PREREQ(1930)
  26. +#if GCC_PREREQ(12, 1) || CLANG_PREREQ(12, 0, 13000000) || MSVC_PREREQ(1930)
  27. # define adler32_x86_avx2_vnni adler32_x86_avx2_vnni
  28. # define SUFFIX _avx2_vnni
  29. # define ATTRIBUTES _target_attribute("avx2,avxvnni")