PR tree-optimization/126467: 0.0-x -> -x vs. signed zeros in match.pd.

This is my proposed solution to PR tree-optimization/126467, where we're
inappropriately converting 0.0 - x to -x when we honor IEEE signed zeros.
This transformation is valid with -Ofast, but by default +0.0 - +0.0
should return +0.0, but -(+0.0) is -0.0.  Likewise when x is NaN, 0.0 - x
may change the payload, but -x is guaranteed not to.  My fix is to
separate the logic for this transformation from that for FP addition.

Technically, we could do slightly better by introducing a
tree_expr_negative_p (complementing and mutually recursive with the
existing tree_expr_nonnegative_p), but that's a bigger change and
less suitable for backporting to release branches, i.e. a follow-up.

I agree with Alexander Monakov that an alternate fix might be to
correctly reuse the existing fold_real_zero_addition_p functionality
by constructing and garbage collecting a NEGATE_EXPR tree on each call,
but this seems a little less efficient.

2026-08-09  Roger Sayle  <roger@nextmovesofware.com>
	    Andrea Pinski  <andrew.pinski@oss.qualcomm.com>

gcc/ChangeLog
	PR tree-optimization/126467
	* match.pd (0.0 - x -> -x): Update the conditions under which
	the transformation is performed, disallowing x = +0.0 when we
	honor signed zeros.  This is still disallowed if x is a NaN.

gcc/testsuite/ChangeLog
	PR tree-optimization/126467
	* gcc.dg/pr126467-1.c: New test case.
	* gcc.dg/pr126467-2.c: Likewise.
	* gcc.dg/pr96392.c: Fix incorrect test case.
4 files changed