3 ms·
The bext, bdep instructions are the same as x86_64 BMI2 PDEP/PEXT. These are essentially scatter/gather instructions for bits and generally have a latency of th
by CalChris 7y ago
The bext, bdep instructions are the same as x86_64 BMI2 PDEP/PEXT. These are essentially scatter/gather instructions for bits and generally have a latency of three cycles on x86_64. I've never used them. I wonder whether Intel C uses them for anything but intrinsics.
But ARMv8 has the more prosaic Bitfield Operations which fit in 32b instructions and are single cycle on A75. I use these a lot.
- jandrewrogers 7y agoI've never seen code generated that uses PDEP/PEXT, probably because there are separate bitfield instructions. These intrinsics are definitely useful though (I use them) and they can radically simplify operations on some types of data models. I doubt the compiler will ever be good at finding those patterns in code, use cases aren't a simple substitution and the logic you'd be rewriting is large and diffuse.
- ncmncm 7y agoThis kind of instruction, in general, is not often emitted by compilers under normal circumstances, but can be essential to get good performance in e.g. encoding or decoding H.265 or AV1, or decompressing the best compression formats. What makes these formats hard to do fast with regular code is that they may have been designed to work through dedicated hardware; or they just really pack in the bits.