]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Do not allow "x + 0.0" to "x" optimization with -fsignaling-nans
authorToru Kisuki <tkisuki@tachyum.com>
Mon, 19 Jun 2023 17:51:09 +0000 (11:51 -0600)
committerJeff Law <jlaw@ventanamicro.com>
Mon, 19 Jun 2023 17:53:11 +0000 (11:53 -0600)
gcc/
PR rtl-optimization/110305
* simplify-rtx.cc (simplify_context::simplify_binary_operation_1):
Handle HONOR_SNANS for x + 0.0.

gcc/simplify-rtx.cc

index 9c68d36067236a8b14ddefae3455f12fe30e35d2..1b581447de68dfb3b05eb4d8ab4ad309a55556f5 100644 (file)
@@ -2831,7 +2831,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