#vectorization
2 posts tagged #vectorization.
Keeping the early exit and getting vector code on a 64-byte compare
Cut a 64-byte early-exit compare into chunks that exit between chunks, and GCC and Clang compile each chunk to a vector test: 12 instructions with 32-byte chunks and AVX2 flags on GCC, 13 on Clang. Instruction counts for six forms on four compilers, one way to read them, and std::simd on GCC.
Five ways to compare 64 bytes, and what GCC, Clang and MSVC make of them
In every build I made, array equality, memcmp and std::equal compile to the same instructions as each other for a 64-byte block. Written as a loop with an early exit, the compare stays scalar on Clang and MSVC, and GCC vectorizes it only with AVX2 flags and behind alignment checks. Ten builds on x86-64, the compiler messages that explain them, three public bug reports, and a control that vectorizes.