Re: [PATCH 5/5] lib/crc: arm: Enable arm64's NEON intrinsics implementation of crc64

Eric Biggers
2026-03-31T22:41:58Z

On Mon, Mar 30, 2026 at 04:46:36PM +0200, Ard Biesheuvel wrote:
> Enable big-endian support only on GCC - the code generated by Clang is
> horribly broken.
[...]
> +#if defined(CONFIG_ARM) && defined(CONFIG_CC_IS_CLANG)
> +static inline uint64x2_t pmull64(uint64x2_t a, uint64x2_t b)
> +{
> + uint64_t l = vgetq_lane_u64(a, 0);
> + uint64_t m = vgetq_lane_u64(b, 0);
> + uint64x2_t result;
> +
> + asm("vmull.p64 %q0, %1, %2" : "=w"(result) : "w"(l), "w"(m));
> +
> + return result;
> +}

Perhaps omit big endian support, and use the inline asm implementation
of these functions with both gcc and clang? The more unique
combinations need to be tested to cover all the code, the higher the
chance of one being missed in testing.

Also, leaving shared code in lib/crc/arm64/ will be confusing. How
about lib/crc/arm-common/, and crc64_nvme_arm64_c => crc64_nvme_neon()?
Or even just put crc64-neon.c directly in lib/crc/.

- Eric