]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
middle-end/116891 - fix (negate (IFN_FNMS@3 @0 @1 @2)) -> (IFN_FMA @0 @1 @2)
authorRichard Biener <rguenther@suse.de>
Mon, 14 Oct 2024 06:11:22 +0000 (08:11 +0200)
committerRichard Biener <rguenth@gcc.gnu.org>
Mon, 14 Oct 2024 07:50:20 +0000 (09:50 +0200)
Transforming -fma (-a, b, -c) to fma (a, b, c) is only valid when
not rounding towards -inf or +inf as the sign of the multiplication
changes.

PR middle-end/116891
* match.pd ((negate (IFN_FNMS@3 @0 @1 @2)) -> (IFN_FMA @0 @1 @2)):
Only enable for !HONOR_SIGN_DEPENDENT_ROUNDING.

gcc/match.pd

index 2814618124d795fc39c9061abbbc8cc5d3cc386d..ee53c25cef9797360f0d1a665e22b49128523a62 100644 (file)
@@ -9494,7 +9494,7 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
   (IFN_FMA @0 @1 @2))
  (simplify
   (negate (IFN_FNMS@3 @0 @1 @2))
-  (if (single_use (@3))
+  (if (!HONOR_SIGN_DEPENDENT_ROUNDING (type) && single_use (@3))
    (IFN_FMA @0 @1 @2))))
 
 /* CLZ simplifications.  */