Re: [PATCH RFC v2 0/6] lib/crc: x86: convert the CRC assembly to C intrinsics
From: David Laight
Date: Fri Nov 20 2026 - 09:12:37 EST
On Fri, 20 Nov 2026 09:41:58 +0100
Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:
> On Thu, Nov 19, 2026 at 07:42:20PM -0800, Eric Biggers wrote:
>
> > So if we're going to proceed, I'd at least like to see a version that
> > compares a bit more favorably to the original. But also I think before
> > diving into this approach I'd like wider agreement in the Linux
> > community (x86 maintainers, crypto, etc.) that the x86 intrinsics are
> > the way to go, and for there to be a path forward for DOITM as well, and
> > hopefully some interest in improving the compilers too.
>
> My 2cents go towards keeping the asm. There is no point in fighting
> compilers over this. The very same is true for atomics.
>
Indeed.
IIRC the code loop had to go asm block because the compiler pretty much
refused to generate the loop that matched the source, instead it
generated one that added extra clock(s) to the loop making it slower.
I've also use some of the 'intrinsics' to write a short C function.
I basically worked out the asm instructions I wanted then tried to find
the correct intrinsic.
The whole thing would have been just as readable in asm
(possibly with some #defines to give the registers names).
David