3 ms·
That would involve changing code not touched since before AVX or even SSSE3 existed. Probably not even since before amd64 existed. But it's hard to switch on u
by ncmncm 7y ago
That would involve changing code not touched since before AVX or even SSSE3 existed. Probably not even since before amd64 existed.
But it's hard to switch on use of a single instruction. Checking at the use site consumes a branch predictor slot. Switching in a function pointer interferes with inlining. Self-modifying code would have been the old way. The modern way might be rewriting in the linker or loader, or JIT compiling.
I have discovered that compilers are extremely bad at recognizing hand-coded byte-order swapping and dropping in movbe or bswap instructions. That Gcc and Clang recognized ham-handed pop counting loops seems miraculous now.