C: x86 Using Intel Intrinsics _mm_log2_ps () & # 8594; error: incompatible type 'int'?

I am trying to apply log2 to the __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;
}

Attempting 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 this?

+4
source share
1 answer

The immintrin.h you look at and immintrin.h used for compilation are different. You are probably looking at a header specific to Intel (somewhere like /opt/intel/include/immintrin.h), while your compiler uses default immintrin.h

, extern __m128 _mm_log2_ps(__m128 v1) SVML, , , Intel Compiler. Linux.

include immintrin.h , , - , Intel.

+1

All Articles