]> www.infradead.org Git - users/jedix/linux-maple.git/commit
x86/crc32: optimize tail handling for crc32c short inputs
authorEric Biggers <ebiggers@google.com>
Tue, 4 Mar 2025 21:32:16 +0000 (13:32 -0800)
committerEric Biggers <ebiggers@google.com>
Mon, 10 Mar 2025 16:29:29 +0000 (09:29 -0700)
commit5aebe00b2f7215d996926517cc9710a1d2d8b7f9
treef870143ade76edc79af3573ba248d5f85d19fbbc
parent511484fa881e8ce32fda63c5c3d3492394dbddda
x86/crc32: optimize tail handling for crc32c short inputs

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@zytor.com>
Acked-by: Uros Bizjak <ubizjak@gmail.com>
Link: https://lore.kernel.org/r/20250304213216.108925-1-ebiggers@kernel.org
Signed-off-by: Eric Biggers <ebiggers@google.com>
arch/x86/lib/crc32-glue.c