ivdep

Instructs the compiler to ignore assumed vector dependencies.

Syntax

#pragma ivdep

Arguments

None

Description

The ivdep pragma instructs the compiler to ignore assumed vector dependencies. To ensure correct code, the compiler treats an assumed dependence as a proven dependence, which prevents vectorization. This pragma overrides that decision. Use this pragma only when you know that the assumed loop dependencies are safe to ignore.

Note iconNote

The proven dependencies that prevent vectorization are not ignored, only assumed dependencies are ignored.

Example

Example 1

The loop in this example will not vectorize without the ivdep pragma, since the value of k is not known; vectorization would be illegal if k<0.

void ignore_vec_dep(int *a, int k, int c, int m)
{
  #pragma ivdep
  for (int i = 0; i < m; i++)
    a[i] = a[i + k] * c;
}

The pragma binds only the for loop contained in current function. This includes a for loop contained in a sub-function called by the current function.

Example 2

The following loop requires the parallel option in addition to the ivdep pragma to indicate there is no loop-carried dependencies:

#pragma ivdep
for (i=1; i<n; i++)
{
  e[ix[2][i]] = e[ix[2][i]]+1.0;
  e[ix[3][i]] = e[ix[3][i]]+2.0;
}

Example 3

The following loop requires the parallel option in addition to the ivdep pragma to ensure there is no loop-carried dependency for the store into a().

#pragma ivdep
for (j=0; j<n; j++)
{
  a[b[j]] = a[b[j]] + 1;
}

See Also


Submit feedback on this help topic

Copyright © 1996-2011, Intel Corporation. All rights reserved.