Quantcast
Channel: Intel Developer Zone Articles
Viewing all articles
Browse latest Browse all 3384

15330: loop was not vectorized: unsupported reduction

$
0
0

Cause:

This diagnostic message is emitted when a loop of below kind is written.

Example:
 

int foo(float *A, int n){
  int inx = 0;
  float max = A[0];
  int i;
  for (i=0;i<n;i++){
    if (max>A[i]){
      max = A[i];
      inx = i*i;
    }
  }
  return inx;
}


$ icpc -vec-report6 example24.cc -c
example24.cc(8): (col. 7) remark: loop was not vectorized: unsupported reduction

Resolution:

Change the code as shown below for the loop to get vectorized:

int foo(float *A, int n){
int inx = 0;
float max = A[0];
int i;
for (i=0;i<n;i++){
if (max>A[i]){
max = A[i];
inx = i;
}
}
return inx*inx;
}

Viewing all articles
Browse latest Browse all 3384

Trending Articles