3 ms·
> It was a Clang compiler, ARM-based platform > I do think it is a bug in this case, native popcnt could maybe be defended, but should not be used if compiling
by upon_drumhead 2y ago
> It was a Clang compiler, ARM-based platform
> I do think it is a bug in this case, native popcnt could maybe be defended, but should not be used if compiling for architecture that does not support it.
- mrcode007 2y ago> If you would like to experiment yourself, Compiler Explorer snippet can be found here https://gcc.godbolt.org/z/qGzWo39b6 https://gcc.godbolt.org/z/qGzWo39b6 Which is an x86-64 sample
- upon_drumhead 2y agoIt's a little impossible to show the difference between using popcnt and the expanded emulation code on a platform that doesn't support popcnt. It doesn't change the fact that the actual program itself was being complied on a platform that doesn't support popcnt, so no amount of compiler arguments would fix that.
- mrcode007 2y agoNEON extension on ARM comes with CNT instruction that counts set bits.