Re:Improving on std:count_if()'s auto-vectorization
by newgre on Sunday March 09, 2025 @05:28PM
(#43314066)
Why did the compiler even chose to fetch DWORDs only in the first place? It's unclear to me why the accumulator (apparently) determines the vectorization width?
[ Parent
| on HN ]
Re:Improving on std:count_if()'s auto-vectorization
by TinkersW on Sunday March 09, 2025 @05:47PM
(#43314241)
The accumulator is a vector type, with 64 bit sum you can only fit 4 into a 256 bit register.
After the loop it will do a horizontal add across the vector register to produce the final scalar result.