[llvm] use multiplication with holes for 32-bit/64-bit clmul fallback (PR #203727)

Jan Schultke via llvm-commits llvm-commits at lists.llvm.org
Sat Jun 13 22:19:40 PDT 2026


eisenwave wrote:

> Just based on the cost model though, maybe you have an intuition for whether that other implementation beats it?
> 
> > When the multiplication with holes approach is used, that emits 16 MULs, 8 + 4 ANDs, 12 XORs and 3 ORs.

I checked what a narrowing form of my approach looks like for 64-bit, and it generates 21 ANDs, 41 SHLs/SHRs, 24 XORs, and a large amount of memory access gunk because the 8-element lookup table is creating too much register pressure (?). It does not generate any multiplication.

Just when eyeballing it, https://godbolt.org/z/sM914e4fo from https://github.com/rust-lang/rust/pull/157831 looks much better than my https://godbolt.org/z/5eMKjndvj

https://github.com/llvm/llvm-project/pull/203727


More information about the llvm-commits mailing list