3.7 Data references within a vectorizable loop

To vectorize, the compiler has to identify variables with a vector access pattern. It also has to ensure that there are no data dependencies between different iterations of the loop.

Data references in your code can be classified as one of three types:

Scalar

A single value that does not change throughout all of the loop iterations.

Index

An integer quantity that increments by a constant amount each pass through the loop.

Vector

A range of memory locations with a constant stride between consecutive elements.

The following example shows the classification of variables in a loop:

i,j

index variables

a,b

vectors

n,x

scalar

float *a, *b;
int i, j, n, x;
...
for (i = 0; i < n; i++)
{
    *(a+j) = x + b[i];
    j += 2;
};
Related concepts
3.6 Automatic vectorization
3.8 Stride patterns and data accesses
Related reference
8.189 --vectorize, --no_vectorize
Non-ConfidentialPDF file icon PDF versionARM DUI0472J
Copyright © 2010-2013 ARM. All rights reserved.