How to build the ICC sample code for AVX?

How to build the ICC sample code for AVX?

CPU:Intel Core i7-2600
memory:4G
OS:Windows XP sp3
Compiler:Intel(R) C++ Compiler XE 12.1.7.371 [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[i] = 0;
#pragma simd
#pragma vector aligned
      for (j = 0;j < size2; j++) {
      b[i] += a[i][j] * x[j];
      }
   }
}

2 帖子 / 0 全新
最新文章
如需更全面地了解编译器优化,请参阅优化注意事项

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.

发表评论

登录添加评论。还不是成员?立即加入