[llvm] [Support][APint] Add fast case for 128 bit-width in APInt::reverseBits (PR #189291)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 30 06:41:28 PDT 2026


https://github.com/nikic commented:

I'm not sure the 128-bit specific code is worthwhile -- can we optimize the fallback instead? The current implementation looks really, really inefficient --- it seems to have found a way to reverse a bit string in O(n^2)? We should be able to do much better than that!

If we still want to be faster for i128, I think the way to do it would be something generic for all multiples of 8. We can reverse the bytes and then reverse the bits.

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


More information about the llvm-commits mailing list