Nonvectorization on loops containing pointers and indirect addressing
Indirect addressing is not vectorizable with the NEON unit.
Indirect addressing occurs when an array is accessed by a vector of values. If the array is being fetched from memory, the operation is called a gather. If the array is being stored into memory, the operation is called a scatter.
In the following example,
being scattered and
b is being gathered.
float a, b; int ia, ib, i, n, j; ... for (i = 0; i < n; i++) a[ia[i]] = b[j + ib[i]];
Indirect addressing is not vectorizable with the NEON unit because it can only deal with vectors that are stored consecutively in memory. If there is indirect addressing and significant calculations in a loop, it might be more efficient for you to move the indirect addressing into a separate non vector loop. This enables the calculations to vectorize efficiently.