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