https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94708
--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> --- fold guards it with !HONOR_SIGNED_ZEROS && !HONOR_NANS (fold_cond_expr_with_comparison). I think the flag_unsafe_math_optmizations check is bogus. Note we now have fmax/fmin named patterns that can be used unconditionally but I guess using expanders during RTL simplification can be tricky. Note also we as of today generally avoid doing "much" with FP math on the RTL side and IMHO we should continue to do so. IMHO the transform belongs on the GIMPLE side where we already do it.