Intel® ISA Extensions
Use hardware-based isolation and memory encryption to provide more code protection in your solutions.
1098 Discussions

How to build the ICC sample code for AVX?


CPU:Intel Core i7-2600
OS:Windows XP sp3
Compiler:Intel(R) C++ Compiler XE [IA-32]

I use the code in vec_samples in "Tutorial: Auto-vectorization".
(path: ..\Composer XE 2011 SP1\Samples\en_US\C++\vec_samples)

when command line switch is: /O2 /QaxSSE3 /Qstd=c99, the vectorized code is SSE2.

Then I change align(16) to align(32) and add some "#pragma" directives.
when command line switch is /QxAVX, the vectorized code is still SSE2!!

So my question is "how to generate the AVX codr by auto-vectorization"?

_declspec(align(32)) FTYPE a[ROW][COLWIDTH];
_declspec(align(32)) FTYPE b[ROW];
_declspec(align(32)) FTYPE x[COLWIDTH];

void matvec(int size1, int size2, FTYPE a[][size2], FTYPE b[], FTYPE x[])
    int i, j;

    for (i = 0; i < size1; i++) {
   b = 0;
#pragma simd
#pragma vector aligned
      for (j = 0;j < size2; j++) {
      b += a * x;

0 Kudos
1 Reply
Valued Contributor II
I see that the post duplicates subject of another thread in Intel C++ compiler forum. Why wouldn't we continue discussion in Intel C++ compiler forum since it is already started and there are responses. Thanks in advance.
0 Kudos