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;
};
Non-ConfidentialPDF file icon PDF versionARM DUI0472M
Copyright © 2010-2016 ARM Limited or its affiliates. All rights reserved.