3.16 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, a is being scattered and b is being gathered.

float a[99], b[99];
int ia[99], ib[99], 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.

Related concepts
3.17 Nonvectorization on conditional loop exits
3.15 Vectorization on loops containing pointers
3.14 Reduction of a vector to a scalar
3.13 Carry-around scalar variables and vectorization
3.12 Data dependency conflicts when vectorizing code
3.9 Factors affecting NEON vectorization performance
3.6 Automatic vectorization
Related reference
3.11 Recommended loop structure for vectorization
8.189 --vectorize, --no_vectorize
3.10 NEON vectorization performance goals
Non-ConfidentialPDF file icon PDF versionARM DUI0472J
Copyright © 2010-2013 ARM. All rights reserved.