Error message:
incompatible types when initializing type ‘__m256d {aka __vector(4) double}’ using type ‘__m256 {aka __vector(8) float}’ __m256d c0 = _mm256_setzero_ps();
I was running a c matrix multiplication with AVX intrinsic and i got the error when compiling. I included <x86intrin.h>
There are three relevant data types
__m256(holds 8floats),__m256d(holds 4doubles) and__m256i(holds 256 bits worth of integers). Each of these has an intrinsic for initialization to zero:_mm256_setzero_ps,_mm256_setzero_pdand_mm256_setzero_si256, respectively. You need to use the correct one according to the variable type.As a side note, the integer and float/double variant also emit as different instructions, so that a register does not have to cross between integer and FP domains in the CPU. There are minor performance penalties for that - at least there used to be (AFAIK Golden Cove does not have those anymore).