It is a common occurrence to test a result array for conditions.
vector_mod = mod(vector_num, vector_i) !dir$ if(.true.) if(ANY(vector_mod .eq. 0) return !dir$ else do j=1,vector_length if(vector_mod(j) .eq. 0) return end do !dir$ endif
Where the ANY intrinsic or short loop is performing a relational operation on an array with scalar.
The expanded code IVF V16.0 update 1 on Windows generates scalar code for both !dir$ expansions.
On the MIC you have available __mmask16 _mm512_mask_cmpeq_epi32_mask and related instructions that could make quick work of making this determination using vectors.
As for usefulness, it is not unusual for code to contain:
a) Defensive code to detect for potential of divide by 0.0 ANY(array .eq. 0.0)
b) Convergence code to detect for convergence ANY(array .lt. bingo) or ANY(abs(array) .lt. bingo)
As an additional request:
c) ANY(isNaN(realArray))
Where it is vectorized and does not call for_is_nan_s_ (or d).
You might want to extend this to an intrinsic isNormal (in line and vectorized).
When I write simulation code that contains convergence routines and/or may produce 3D vector lengths of 0.0, that I must insert defensive code to test for unusual (exception) conditions, and that these tests typically do not vectorize (and are not in line). Are there others here on this forum that can express annoyance with the lack of vectorization in this area (and estimate what extent this impacts your performance).
Jim Dempsey