I do some explicitly vectorised computations using SSE types, such as __m128
(defined in xmmintrin.h
etc), but now I need to raise all elements of the vector to some (same) power, i.e. ideally I would want something like __m128 _mm_pow_ps(__m128, float)
, which unfortunately doesn't exist.
What is the best way around this? I could store the vector, call std::pow
on each element, and then reload it. Is this the best I can do? How do compilers implement a call to std::pow
when auto-vectorising code that otherwise is well vectorisable? Are there any libraries that provide something useful?
(note that this question is related by not a duplicate and certainly doesn't have a useful answer.)
exp/log
and writepow(x,k)
asexp(k*log(x)
when auto-vectorisation was not an option. Not sure how it compares with auto-vectorized code. – Espalierexp()
with SSE4 support? – Venereal