3 ms·
It is broadly useful for bit vectors and integer algorithm performance engineering, showing up all over the place. One advantage the instruction has is fast con
by jandrewrogers 3y ago
It is broadly useful for bit vectors and integer algorithm performance engineering, showing up all over the place. One advantage the instruction has is fast constant-time performance, whereas algorithms composed from ALU primitives either have performance that is highly sensitive to the bit distribution or have consistent performance but relatively slow. It also uses less space in the instruction cache.
The non-classical bit-wise instructions that I find indispensable are popcount and PDEP/PEXT. For some codes, these can turn very messy integer work into a tight, elegant algorithm. Where performance matters, I would not want to live without them.