Linux cryptographic layer development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Qu Wenruo" <wqu@suse.com>, linux-crypto@vger.kernel.org
Cc: ebiggers@kernel.org, ardb@kernel.org, dsterba@suse.cz
Subject: Re: [PATCH RFC v2 3/6] lib/crc: x86: Convert crc32_lsb_*() from assembly to C
Date: Fri, 20 Nov 2026 01:30:11 +0000	[thread overview]
Message-ID: <sashiko-outbox-224307@kernel.org> (raw)
In-Reply-To: <f5577a87c45cd4b5ef4fa8ace3b0a05c3f9fddd3.1795137348.git.wqu@suse.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] lib/crc: x86: build failure in fold256() on GCC 8.1 and 8.2
--

commit 4e73f2c859c18b715ef71e051a7e40e392c143ab
Author: Qu Wenruo <wqu@suse.com>

lib/crc: x86: Convert crc32_lsb_*() from assembly to C

This commit rewrites the x86 PCLMULQDQ and VPCLMULQDQ crc32_lsb functions
from assembly to C using compiler intrinsics.

> diff --git a/lib/crc/x86/crc-pclmul-helpers.h b/lib/crc/x86/crc-pclmul-helpers.h
> new file mode 100644
> index 0000000000000..c4bac60220f32
> --- /dev/null
> +++ b/lib/crc/x86/crc-pclmul-helpers.h
> @@ -0,0 +1,72 @@
[ ... ]
> +/* The ISA extensions needed for each vector length */
> +#define CRC_TARGET_128	"sse4.1,pclmul"
> +#define CRC_TARGET_256	"sse4.1,pclmul,avx2,vpclmulqdq"
> +#define CRC_TARGET_512	"sse4.1,pclmul,avx2,vpclmulqdq,avx512f,avx512bw,avx512vl"
> +
> +/* The target attributes of the helpers, to keep their signatures short */
> +#define __crc128	__attribute__((target(CRC_TARGET_128)))
> +#define __crc256	__attribute__((target(CRC_TARGET_256)))
> +#define __crc512	__attribute__((target(CRC_TARGET_512)))
[ ... ]
> +static __always_inline __crc256 __m256i fold256(__m256i acc, __m256i data, __m256i k)
> +{
> +	__m256i lo = _mm256_clmulepi64_epi128(acc, k, 0x00);
> +	__m256i hi = _mm256_clmulepi64_epi128(acc, k, 0x11);
> +
> +	return _mm256_xor_si256(_mm256_xor_si256(hi, data), lo);
> +}

[Severity: Medium]
Does fold256() break x86 builds with CONFIG_CRC32_ARCH=y on GCC 8.1 and
8.2?

As noted in the commit message, GCC 8.1 and 8.2 declare
_mm256_clmulepi64_epi128() under #pragma GCC target("vpclmulqdq,avx512vl"),
which fails to inline into fold256() because CRC_TARGET_256 omits avx512vl.
Since scripts/min-tool-version.sh still declares 8.1.0 as the minimum
supported GCC version, fold256() needs a workaround for GCC < 8.3 (such as
calling __builtin_ia32_vpclmulqdq_v4di directly) unless the minimum GCC
version is raised first.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1795137348.git.wqu@suse.com?part=3

  reply	other threads:[~2026-11-20  1:30 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-20  1:18 [PATCH RFC v2 0/6] lib/crc: x86: convert the CRC assembly to C intrinsics Qu Wenruo
2026-11-20  1:18 ` [PATCH RFC v2 1/6] x86: Add a wrapper header for the compiler's SIMD intrinsics Qu Wenruo
2026-11-20  1:19 ` [PATCH RFC v2 2/6] lib/crc: x86: Convert crc32c_x86_3way() from assembly to C intrinsics Qu Wenruo
2026-11-20  1:19 ` [PATCH RFC v2 3/6] lib/crc: x86: Convert crc32_lsb_*() from assembly to C Qu Wenruo
2026-11-20  1:30   ` sashiko-bot [this message]
2026-11-20  1:19 ` [PATCH RFC v2 4/6] lib/crc: x86: Convert crc64_msb_*() " Qu Wenruo
2026-11-20  1:19 ` [PATCH RFC v2 5/6] lib/crc: x86: Convert crc64_lsb_*() " Qu Wenruo
2026-11-20  1:19 ` [PATCH RFC v2 6/6] lib/crc: x86: Convert crc16_msb_*() " Qu Wenruo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=sashiko-outbox-224307@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=ardb@kernel.org \
    --cc=dsterba@suse.cz \
    --cc=ebiggers@kernel.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=wqu@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox