Diagnostic 13379: loop was not vectorized with "simd"

Cause:

This diagnostic message is emitted when a loop marked with #pragma simd cannot be vectorized. This message can be emitted because of multiple scenarios. One such scenario is described below with example. 

Example 1:
In this example, we see that the loop body has a array notation statements which acts as an inner loop. So the outer loop won't be vectorized.

#include<iostream>
using namespace std;
int main(){
int a[20];
a[:] = __sec_implicit_index(0);
#pragma simd 
for(int i = 0; i < 20; i++)
{
switch(a[i]){
                case 0: break;
                case 1: a[i]++;
                        break;
                case 2: a[i]+2;
                        break;
                case 3: a[i]+3;
                        break;
                case 4: a[i]+4;
                        break;
                case 5: a[i]+5;
                        break;
                case 6: a[i]+6;
                        break;
                case 7: a[i]+7;
                        break;
                case 8: a[i]+8;
                        break;
                case 9: a[i]+9;
                        break;
                case 10: a[i]+10;
                         break;
                case 11: a[i]+11;
                         break;
                case 12: a[i]+12;
                         break;
                case 13: a[i]+13;
                         break;
                case 14: a[i]+14;
                         break;
                case 15: a[i]+15;
                         break;
                case 16: a[i]+16;
                         break;
                case 17: a[i]+17;
                         break;
                default: a[i]+11;
}
}
int sum = __sec_reduce_add(a[:]);
return 0;
}


$ icpc testswitch1.cc -vec-report2
testswitch1.cc(9): error #18015: Switch statement inside #pragma simd loop has more than 16 case labels
testswitch1.cc(5): (col. 8) remark: LOOP WAS VECTORIZED
testswitch1.cc(11): (col. 11) remark: loop was not vectorized: conditional assignment to a scalar
testswitch1.cc(7): (col. 1) warning #13379: loop was not vectorized with "simd"
compilation aborted for testswitch1.cc (code 1)

Example 2:

An example below will generate the following remark in optimization report:

int main(){
int a[10] = {0,1,1,1,4,3,2,5,1,1};
#pragma simd
for(int i=0;i<10;i++){
if (a[i]>5){
return 0;
}
cout << i << "\n";
}
}

$ icc test1.cpp -qopt-report=5 -qopt-report-phase=vec 

...

LOOP BEGIN at test.cpp(7,1)
   remark #15520: simd loop was not vectorized: loop with multiple exits cannot be vectorized unless it meets search loop idiom criteria   [ test.cpp(10,8) ]
   remark #15552: loop was not vectorized with "simd"
LOOP END

 

For more complete information about compiler optimizations, see our Optimization Notice.