Sandy Bridge only has AVX support. You're out of luck there unless you buy a Haswell CPU.
Bochs has support for AVX2 emulation since v2.5, but it will be much slower, you only can test the correctness of your code.
문제
I've been using Intel's SSE instructions with good performance gains and, recently, I tried to use AVX instructions.
The problem is: I can compile my avx instructions, but I cannot run them. The instructions are:
__m256i* avx1 = (__m256i*)vct1;
__m256i* avx2 = (__m256i*)vct2;
__m256i* avx3 = (__m256i*)vct3;
__m256i va0, va1, va2;
va2 = _mm256_and_si256(va0, va1);
The only way I can compile these instructions is by having -mavx2 flag. Without this flag I can't compile the code and I received this error:
"sseAND.cpp:124:33: error: ‘_mm256_and_si256’ was not declared in this scope
va2 = _mm256_and_si256(va0, va1);
"
Ok, after compilling with -mavx2 and running the code, I received this error messagem:
"Illegal Instruction
".
Running /proc/cpuinfo
, I saw my Sandy Bridge CPU has support only for AVX instructions, not AVX2.
The question Is: is there anything wrong with my code or with my gcc flags?
Can I run the avx instructions I put below in my Sandybridge?
Thanks for your help.