Files
linux-stable-mirror/lib/crc/arm64/crc64.h
T
Ard BiesheuvelandEric Biggers 061cef5fce lib/crc: Turn NEON intrinsics crc64 implementation into common code
Move and rename the CRC64 NEON intrinsics implementation source file and
rename the function name to reflect that it is NEON code that can be
shared. This will be wired up for 32-bit ARM in a subsequent patch.

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Link: https://patch.msgid.link/20260422171655.3437334-14-ardb+git@google.com
Signed-off-by: Eric Biggers <ebiggers@kernel.org>
2026-05-28 13:14:22 -07:00

29 lines
606 B
C

/* SPDX-License-Identifier: GPL-2.0-only */
/*
* CRC64 using ARM64 PMULL instructions
*/
#include <linux/cpufeature.h>
#include <asm/simd.h>
#include <linux/minmax.h>
#include <linux/sizes.h>
u64 crc64_nvme_neon(u64 crc, const u8 *p, size_t len);
#define crc64_be_arch crc64_be_generic
static inline u64 crc64_nvme_arch(u64 crc, const u8 *p, size_t len)
{
if (len >= 128 && cpu_have_named_feature(PMULL) &&
likely(may_use_simd())) {
size_t chunk = len & ~15;
scoped_ksimd()
crc = crc64_nvme_neon(crc, p, chunk);
p += chunk;
len &= 15;
}
return crc64_nvme_generic(crc, p, len);
}