Re: [PATCH] x86/crc32: optimize tail handling for crc32c short inputs

From: Eric Biggers
Date: Thu Mar 06 2025 - 12:21:23 EST


On Tue, Mar 04, 2025 at 01:32:16PM -0800, Eric Biggers wrote:
> From: Eric Biggers <ebiggers@xxxxxxxxxx>
>
> For handling the 0 <= len < sizeof(unsigned long) bytes left at the end,
> do a 4-2-1 step-down instead of a byte-at-a-time loop. This allows
> taking advantage of wider CRC instructions. Note that crc32c-3way.S
> already uses this same optimization too.
>
> crc_kunit shows an improvement of about 25% for len=127.
>
> Suggested-by: H. Peter Anvin <hpa@xxxxxxxxx>
> Signed-off-by: Eric Biggers <ebiggers@xxxxxxxxxx>
> ---
>
> This applies to
> https://web.git.kernel.org/pub/scm/linux/kernel/git/ebiggers/linux.git/log/?h=crc-next

Applied to
https://web.git.kernel.org/pub/scm/linux/kernel/git/ebiggers/linux.git/log/?h=crc-next

- Eric