https://gcc.gnu.org/bugzilla/show_bug.cgi?id=128631
--- Comment #4 from Zhiyang Chen <jeffchen006 at gmail dot com> ---
(In reply to Zhiyang Chen from comment #3)
> Created attachment 66246 [details]
> A possible patch
Yes, that pattern, and x / -1 -> -x below it. For complex types real_onep
also matches the COMPLEX_CST 1 + 0i, and x / (1 + 0i) is not x when signed
zeros matter: the real part is (a*1 + b*0) / 1, so -0 + 0i gives +0. The
x * 1 and x * -1 patterns already have a guard for exactly this case:
&& (!HONOR_SIGNED_ZEROS (type)
|| !COMPLEX_FLOAT_TYPE_P (type))
The attached patch (suggested by AI) adds the same guard to
both rdiv patterns. On trunk r17-6489 the C and C++ tests from the
description and the x / -1 form give the -O0 result at -O0 to -O3. Not
bootstrapped; no full make check.