https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127824
--- Comment #2 from Tamar Christina <tnfchris at gcc dot gnu.org> --- (In reply to Richard Biener from comment #1) > -fno-trapping-math is required, v3 cannot mask the IEEE trapping compare and > with v4 we lack .COND_<tcc_comparison> (there's a PR about that). > > So confirmed, but the comparison with clang is unfair - try -ftrapping-math > there. > > > ./cc1 -quiet t.c -O3 -march=x86-64-v3 -fopt-info-vec -fno-trapping-math > t.c:13:14: optimized: loop vectorized using 32 byte vectors and unroll > factor 4 > t.c:13:14: optimized: loop versioned for vectorization to enhance alignment > t.c:10:12: optimized: loop vectorized using 32 byte vectors and unroll > factor 8 > t.c:10:12: optimized: loop versioned for vectorization to enhance alignment > t.c:24:28: optimized: loop vectorized using 32 byte vectors and unroll > factor 8 > t.c:32:28: optimized: loop vectorized using 32 byte vectors and unroll > factor 4 > t.c:32:28: optimized: loop versioned for vectorization to enhance alignment > > I'll note we seem to unroll the inner loop, vectorizing an early break one, > which explains that we need the masking (but only in the epilog?)? Tamar? > We don't actually require masking, just that the operations don't trap. Even with masking the speculative nature of early breaks means a trap can be raised in an iteration you'd never gotten to in the scalar loop. So the loops above won't ever vectorize with -ftrapping-math, and all 3 are correctly rejected.
