Intel® C++ Compiler 16.0 User and Reference Guide

GAP Message (Diagnostic ID 30506)

Message

If the following operations(s) can be safely performed unconditionally, the loop at line %d will be vectorized by adding a "%s ivdep" statement right before the loop: %s.

Advice

Add "#pragma ivdep" before the specified loop.

This pragma enables the vectorization of the loop at the specified line. Insure that any conditional divide, sqrt, and inverse sqrt operations will not alter the exception semantics expected by the program when they are performed unconditionally.

Example

Consider the following:

void foo(float *a, int n) {
  int i;
  for (i=0; i<n; i++) {
    if (a[i] > 0) {
      a[i] = 1 / a[i];
    }
  }
  return; 
}

In this case, the compiler is unable to vectorize the loop if compiled with floating-point exception semantics (such as /fp:except option) because the condition "a[i] > 0" may be guarding floating-point exceptions for the divide.

If you determine it is safe to do so, you can add the pragma as follows:

void foo(float *a, int n) {
  int i; 
#pragma ivdep
  for (i=0; i<n; i++) {
    if (a[i] > 0) {
      a[i] = 1 / a[i];
    }
  }
  return; 
}

Verify

Confirm that the program operands have safe values for all iterations.