3 ms·
Seems to be a built-in, extremely specific use case: https://github.com/llvm-mirror/llvm/blob/ae889d36724efb174e8cc05d26e655c4c4ab8867/lib/Transforms/Scalar/Loo
by psuter 10y ago
Seems to be a built-in, extremely specific use case: https://github.com/llvm-mirror/llvm/blob/ae889d36724efb174e8cc05d26e655c4c4ab8867/lib/Transforms/Scalar/LoopIdiomRecognize.cpp#L1073-L1077 https://github.com/llvm-mirror/llvm/blob/ae889d36724efb174e8...
I suppose it makes sense, given: 1) popcount is very common in bit-manipulating programs, 2) there is no standard popcount in ISO C, 3) it potentially saves 100+ instructions.
(Edit: I see a comment on Lemire's blog already points to that.)
- pera 10y agoI was not aware of the popcnt[1] instruction. It's quite amazing how LLVM can recognize that code, thanks for the link! [1] - https://en.wikipedia.org/wiki/SSE4#POPCNT_and_LZCNT https://en.wikipedia.org/wiki/SSE4#POPCNT_and_LZCNT