Luke Lau: Cracking a popcount benchmark

· Blogs Igalia · Oct. 17, 2026, 7:20 a.m.
Summary
In this post, Luke Lau discusses a performance regression related to RISC-V's automotive-bitcount benchmark. He identifies weaknesses in the vectorized implementation, explores how it deviates from expected performance, and ultimately reveals that the popcount function could be optimized using a specific instruction (`cpop`). Lau describes the steps taken to enhance LLVM's ability to recognize and optimize certain patterns in code, resulting in significant performance improvements for popcount implementations.
AUTHOR