Please note, that this is a cross post from StackOverflow: http://stackoverflow.com/questions/21135281/how-to-make-the-intel-c-compiler-icc-vectorize-basic-blocks
I am currently using icc (version 22.214.171.124) to compile C programs running in native mode on the Intel Xeon Phi coprocessor.
Consider the following two code fragments:
// fragment 1
array[pos] += 1;
array[pos + 1] += 1;
array[pos + 2] += 1;
array[pos + 3] += 1;
// fragment 2
for (int i = 0; i < 4; ++i)
array[i] += 1;
Unfortunately, only the loop is vectorized automatically. However, if i compile for the x86 platform, icc also vectorizes the "unrolled" version.
Is there a way to tell icc to vectorize basic blocks when compiling for the Xeon Phi, too?
Any help is appreciated. Thanks in advance!