Extends #pragma omp simd, allowing vectorization of multiple exit loops.
#pragma omp simd early_exit |
Extends #pragma omp simd allowing vectorization of multiple exit loops. When this clause is specified:
The following example demonstrates how to use this pragma.
In the following example, the pragma specifies that the vector execution of the for loop is safe even though the loop may exit before the loop upper bound condition j < ub becomes false. Suppose j1 is the smallest j, between lb and ub, such that j satisfies b[j] <= 0 . If j1 and j1+1, j1+2, … are within the same (last) SIMD chunk, read of b[j1], b[j1+1], b[j1+2], … and the subsequent evaluation of <= 0 will happen unconditionally, unlike the scalar execution of the same loop. Safety of such vector evaluation is programmer's responsibility. If necessary, simdlen() clause can be used to control the SIMD chunk size.
Example |
---|
|