From ed17cb57b8ddfa4d0c48e0428d0b1df4384a90c5 Mon Sep 17 00:00:00 2001 From: Jackson Woodruff Date: Fri, 15 Sep 2017 16:17:55 +0000 Subject: [PATCH] re PR tree-optimization/71026 (Missing division optimizations) 2017-09-15 Jackson Woodruff PR tree-optimization/71026 * match.pd: Move RDIV patterns from fold-const.c * fold-const.c (distribute_real_division): Removed. (fold_binary_loc): Remove calls to distribute_real_divison. PR tree-optimization/71026 * gcc/testsuire/gcc.dg/fold-div-1.c: Use -O1. From-SVN: r252827 --- gcc/ChangeLog | 7 +++++++ gcc/match.pd | 7 +++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/fold-div-1.c | 2 +- 4 files changed, 20 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 71191121ce3..7147d5d1671 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2017-09-15 Jackson Woodruff + + PR tree-optimization/71026 + * match.pd: Move RDIV patterns from fold-const.c + * fold-const.c (distribute_real_division): Removed. + (fold_binary_loc): Remove calls to distribute_real_divison. + 2017-09-15 Jakub Jelinek * doc/invoke.texi: Document -std=c++17 and -std=gnu++17 and document diff --git a/gcc/match.pd b/gcc/match.pd index dbfceaf10a5..e9017e41f20 100644 --- a/gcc/match.pd +++ b/gcc/match.pd @@ -3517,6 +3517,13 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) (if (!HONOR_SNANS (type)) @0)) + (for op (plus minus) + /* Simplify (A / C) +- (B / C) -> (A +- B) / C. */ + (simplify + (op (rdiv @0 @1) + (rdiv @2 @1)) + (rdiv (op @0 @2) @1))) + /* Simplify sqrt(x) * sqrt(y) -> sqrt(x*y). */ (for root (SQRT CBRT) (simplify diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e53e7be5d64..240544f036a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-09-15 Jackson Woodruff + + PR tree-optimization/71026 + * gcc/testsuire/gcc.dg/fold-div-1.c: Use -O1. + 2017-09-15 Jakub Jelinek * lib/g++-dg.exp (g++-dg-runtest): Use 17 instead of 1z. diff --git a/gcc/testsuite/gcc.dg/fold-div-1.c b/gcc/testsuite/gcc.dg/fold-div-1.c index c1c7250f882..73b75861166 100644 --- a/gcc/testsuite/gcc.dg/fold-div-1.c +++ b/gcc/testsuite/gcc.dg/fold-div-1.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-funsafe-math-optimizations -fdump-tree-gimple" } */ +/* { dg-options "-O1 -funsafe-math-optimizations -fdump-tree-gimple" } */ float f(float x) { -- 2.30.2