3.17 Nonvectorization on conditional loop exits

For vectorization purposes, it is best to write loops that do not contain conditional exits from the loop.

The following example is nonvectorizable because it contains a conditional exit from the loop. In cases like this, you must rewrite the loop, if possible, for vectorization to succeed.

int a[99], b[99], c[99], i, n;
...
for (i = 0; i < n; i++)
{
     a[i] = b[i] + c[i];
     if (a[i] > 5) break;
};
Related concepts
3.16 Nonvectorization on loops containing pointers and indirect addressing
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
3.23 Conditional statements and efficient 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.