How to build the ICC sample code for AVX?

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[i] = 0;
#pragma simd
#pragma vector aligned
      for (j = 0;j < size2; j++) {
      b[i] += a[i][j] * x[j];

2 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

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.

Leave a Comment

Please sign in to add a comment. Not a member? Join today