2 ms·
> The clang code loads the 8-bit words into 16-bit vector instructions and parallelizes using a tree-algorithm to minimize dependencies. You specified the "in
by dragontamer 8y ago
> The clang code loads the 8-bit words into 16-bit vector instructions and parallelizes using a tree-algorithm to minimize dependencies.
You specified the "int sum", so that means "sum" needs to follow 32-bit overflow semantics. I don't think it is possible to do 8-bit
> But neither of these compilers are able to optimize for code size while using AVX
You can totally do that. You're specifying -O3, which is "speed over size". If you want size, you want -Os, and then use -ftree-vectorize to enable the auto-vectorization.