Open vient opened 1 year ago
Trying other functions, Clang replaces std::floor
with vroundpd
while std::sin
is not vectorized.
You need to specify what vector library you are using, e.g. -fveclib=libmvec for glibc vectormath
Ok, it works with -fveclib=libmvec
. Guess it would be nice to mention it in auto vectorization docs.
Thank you!
reopening - as we should mention this in the clang docs
Hi, Clang documentation on Loop Vectorizer mentions vectorizing of mathematical functions. I created a small test case, using latest Clang and GCC with
-std=c++20 -march=skylake -Ofast
: https://godbolt.org/z/dq1EGqszsGCC successfully inserted call to
_ZGVdN4v_exp
while Clang just callsexp
4 times. Array size or using float do not affect this. Documentation does not mention anything explicitly needed for vectorization besides-fno-math-errno
— I use-Ofast
.In this case Clang should be able to vectorize
exp
calls, right?