https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113134
--- Comment #9 from Tamar Christina <tnfchris at gcc dot gnu.org> --- (In reply to JuzheZhong from comment #8) > Suppose the loop mask is generated by whilelo instruction of ARM SVE. > > Suppose we have 8 elements in a single whole vector. > > mask = whilo (0, res) if res = 6, then mask = 11111000. > data = 12345678 > > Then if it is early break. You are reversing both data and mask as follows: > > new_mask = 00011111 > new_data = 87654321 > > Then use the EXTRACT_LAST, we will get value = 1 for early break. > > Am I right ? Yeah, the idea being the scalar loop will then run from 1 to 6 to do any side effects that we couldn't apply. We went with this approach first because it works for non-masked architectures too. In GCC-15 we'll try to implement staying entirely inside a vector loop by splitting the mask in elements until first active and element from first active so we can correctly mask the operations.