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

Folkert de Vries via llvm-commits llvm-commits at lists.llvm.org
Sun Jun 14 03:14:56 PDT 2026


folkertdev wrote:

The comparison should be against the multiply with holes approach right? so really 

- multiply with holes https://godbolt.org/z/hnqT6fPnn (81 lines)
- _Bitint https://godbolt.org/z/5eMKjndvj (140 lines)

It should be possible to extend this approach, I just didn't yet because 

- this algorithm is complicated as it is
- I'm not actually that familiar with C++ (and the dialect used by LLVM)
- I'm not that familiar with this part of LLVM

But the stride (which is currently hardcoded to 4) can be lowered to generate good code for `i8` and `i16`, and for wider integers maybe a stride of 5 can work for `i128`, or maybe at that point a karatsuba approach is better (i.e. the 128-bit implementation is just defined in terms of 64-bit, and so on for 256-bit and up). 

So I think the naive fallback can eventually be removed, it just seemed a bit much to take on in a single PR.

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


More information about the llvm-commits mailing list