On Fri, 6 Oct 2023, Robin Dapp wrote: > > We might need a similar assert > > > > gcc_assert (HONOR_SIGNED_ZEROS (vectype_out) > > && !HONOR_SIGN_DEPENDENT_ROUNDING (vectype_out));? > > erm, obviously not that exact assert but more something like > > if (HONOR_SIGNED_ZEROS && !HONOR_SIGN_DEPENDENT_ROUNDING...) > { > if (dump) > ... > return false; > } > > or so.
Yeah, of course the whole point of a fold-left reduction is to _not_ give up without -ffast-math which is why I added the above. I obviously didn't fully verify what happens for an original MINUS_EXPR. I think it's required to give up for -frounding-math, but I think I might have put the code to do that in a generic enough place. For x86 you need --param vect-partial-vector-usage=2 and an AVX512 enabled arch like -march=skylake-avx512 or -march=znver4. I think tranforming - x to + (-x) works for signed zeros. So if you think you got everything correct the patch is OK as-is, I just wasn't sure - maybe the neutral_element change deserves a comment as to how MINUS_EXPR is handled. Richard.