Loops can be formed with the usual for and while constructs. However, the loops must have a single entry and a single exit to be vectorized.
while(i<n) { // If branch is inside body of loop
a[i]=b[i]*c[i]; if(a[i]<0.0) { a[i]=0.0; } i++; } |
while(i<n) { if (condition) break; // 2nd exit. ++i; } |