Diagnostic 15032: loop was not vectorized: unsupported reduction

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

Recommendation:

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;

	}

	

 

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