Im trying to run code similar to the following
#include <immintrin.h>
void foo() {
__m128i a = _mm_set_epi8 (0,0,6,5,4,3,2,1,8,7,6,5,4,3,2,1);
__m128i b = _mm_set_epi8 (0,0,0,0,0,0,0,1,8,7,6,5,4,3,2,1);
__mmask16 m = _mm_cmpeq_epi8_mask(a,b); // supposedly requires avx512vl and avx512bw
std::cout<<m<<std::endl;
}
void bar() {
int dataa[8] = {1,0,1,0,1,0,1,0};
__m256i points = _mm256_lddqu_si256((__m256i *)&dataa[0]); // requires just mavx
(void)points;
}
However, I keep running into the error Illegal instruction (core dumped)
I compile the code with
g++ -std=c++11 -march=broadwell -mavx -mavx512vl -mavx512bw tests.cpp
According to Intel's intrinsics documentation, these flags should be sufficient to run both foo
and bar
. However, when either foo
or bar
is run, I get the same error message.
If I remove foo
, however, and compile WITHOUT -mavx512vl
, I can run bar
smoothly.
I already checked that my cpu supports the mno-avx512vl
and mno-avx512bw
flags so it should support mavx512vl
and mavx512bw
right?
What flags must I include to run both functions? Or am I missing something else?