#pragma GCC ivdepFor example, the compiler can only unconditionally vectorize the following loop with the pragma:
void foo (int n, int *a, int *b, int *c)
{
int i, j;
#pragma GCC ivdep
for (i = 0; i < n; ++i)
a[i] = b[i] + c[i];
}
In this example, using the restrict qualifier had the same
effect. In the following example, that would not be possible. Assume
k < -m or k >= m. Only with the pragma, the compiler knows
that it can unconditionally vectorize the following loop:
void ignore_vec_dep (int *a, int k, int c, int m)
{
#pragma GCC ivdep
for (int i = 0; i < m; i++)
a[i] = a[i + k] * c;
}
#pragma GCC unroll nfor, while or do
loop or a #pragma GCC ivdep, and applies only to the loop that follows.
n is an integer constant expression specifying the unrolling factor.
The values of 0 and 1 block any unrolling of the loop.