5 ms·
> Autovectorization is rarely performed as a percentage of all the cases where it’s theoretically possible, This is not my experience. Do you have some justifi
by kolbe 3y ago
> Autovectorization is rarely performed as a percentage of all the cases where it’s theoretically possible,
This is not my experience. Do you have some justification for this statement? I've found myself far more impressed by autovectorization than disappointed by it. I've found that code most people think is autovectorizable actually violates scalar contracts. But if you write clear code whose scalar implementation won't introduce UB if autovectorized, the compiler is really good.
Here's my go-to example. Agner Fog's VCL is a well-respected library. It has vectorized versions of all sorts of useful mathematitical functions. For fun, I rewrote his `exp(x)` function using his exact algorithm, but in scalar code, and it autovectorized, and benchmarks the same.
https://godbolt.org/z/TK637PTh7 https://godbolt.org/z/TK637PTh7