* [PATCH] Fix PR69556
@ 2016-02-01 15:34 Richard Biener
0 siblings, 0 replies; only message in thread
From: Richard Biener @ 2016-02-01 15:34 UTC (permalink / raw)
To: gcc-patches
Bootstrapped and tested on x86_64-unknown-linux-gnu, applied.
Richard.
2016-02-01 Richard Biener <rguenther@suse.de>
PR middle-end/69556
* match.pd: Guard (C1/X)*C2 -> (C1*C2)/X with single_use.
* gcc.dg/tree-ssa/recip-8.c: New testcase.
Index: gcc/match.pd
===================================================================
--- gcc/match.pd (revision 233033)
+++ gcc/match.pd (working copy)
@@ -445,8 +445,9 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
/* Fold (C1/X)*C2 into (C1*C2)/X. */
(simplify
- (mult (rdiv:s REAL_CST@0 @1) REAL_CST@2)
- (if (flag_associative_math)
+ (mult (rdiv@3 REAL_CST@0 @1) REAL_CST@2)
+ (if (flag_associative_math
+ && single_use (@3))
(with
{ tree tem = const_binop (MULT_EXPR, type, @0, @2); }
(if (tem)
Index: gcc/testsuite/gcc.dg/tree-ssa/recip-8.c
===================================================================
--- gcc/testsuite/gcc.dg/tree-ssa/recip-8.c (revision 0)
+++ gcc/testsuite/gcc.dg/tree-ssa/recip-8.c (working copy)
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -ffast-math -fdump-tree-optimized" } */
+
+double bar (double, double, double, double, double);
+
+double
+foo (double a)
+{
+ return bar (1.0/a, 2.0/a, 4.0/a, 8.0/a, 16.0/a);
+}
+
+/* { dg-final { scan-tree-dump-times "/" 1 "optimized" } } */
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2016-02-01 15:34 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-01 15:34 [PATCH] Fix PR69556 Richard Biener
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).