On Mon, Jun 19, 2023 at 12:33 PM Toru Kisuki via Gcc-patches
<gcc-patches@gcc.gnu.org> wrote:
>
> Hi,
>
>
> With -O3 -fsignaling-nans -fno-signed-zeros, compiler should not simplify 'x 
> + 0.0' to 'x'.
>

OK if you bootstrapped / tested this change.

Thanks,
Richard.

> GCC Bugzilla : Bug 110305
>
>
> gcc/ChangeLog:
>
> 2023-06-19  Toru Kisuki  <tkis...@tachyum.com>
>
> * simplify-rtx.cc (simplify_context::simplify_binary_operation_1):
>
> ---
>  gcc/simplify-rtx.cc | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/gcc/simplify-rtx.cc b/gcc/simplify-rtx.cc
> index e152918b0f1..cc96b36ad4e 100644
> --- a/gcc/simplify-rtx.cc
> +++ b/gcc/simplify-rtx.cc
> @@ -2698,7 +2698,8 @@ simplify_context::simplify_binary_operation_1 (rtx_code 
> code,
>          when x is NaN, infinite, or finite and nonzero.  They aren't
>          when x is -0 and the rounding mode is not towards -infinity,
>          since (-0) + 0 is then 0.  */
> -      if (!HONOR_SIGNED_ZEROS (mode) && trueop1 == CONST0_RTX (mode))
> +      if (!HONOR_SIGNED_ZEROS (mode) && !HONOR_SNANS (mode)
> +          && trueop1 == CONST0_RTX (mode))
>         return op0;
>
>        /* ((-a) + b) -> (b - a) and similarly for (a + (-b)).  These
> --
> 2.38.1
>

Reply via email to