I'm trying to apply the log2 onto a __m128 variable. Like this:
#include <immintrin.h>
int main (void) {
__m128 two_v = {2.0, 2.0, 2.0, 2.0};
__m128 log2_v = _mm_log2_ps(two_v); // log_2 := log(2)
return 0;
}
Trying to compile this returns this error:
error: initializing '__m128' with an expression of
incompatible type 'int'
__m128 log2_v = _mm_log2_ps(two_v); // log_2 := log(2)
^ ~~~~~~~~~~~~~~~~~~
How can I fix it?
The immintrin.h you look into and immintrin.h used for compilation are different.
Likely, you're looking into Intel-specific header (somewhere like /opt/intel/include/immintrin.h), while your compiler uses default immintrin.h
As it was correctly said, extern __m128 _mm_log2_ps(__m128 v1)
is SVML routine, so
the very first solution I see is to use Intel Compiler. For non-commercial development its free for Linux.
Although you can specify the include path to your custom immintrin.h file as a very first argument during compilation using different compiler, but I think you'll get just way too many errors - just because this header is Intel-specific.