On Thu, Aug 10, 2017 at 4:10 PM, Jackson Woodruff <jackson.woodr...@foss.arm.com> wrote: > Hi all, > > The patch implements the some of the division optimizations discussed in > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71026 . > > We now reassociate (as discussed in the bug report): > > x / (y * y) -> x * (1 / y) * (1 / y) > > If it is reasonable to do so. This is done with > -funsafe-math-optimizations. > > Bootstrapped and regtested with part (1/2). OK for trunk?
I believe your enhancement shows the inherent weakness of CSE of reciprocals in that it works from the defs. It will handle x / (y * y) but not x / (y * y * y). I think a rewrite of this mini-pass is warranted. Richard. > Jackson > > gcc/ > > 2017-08-03 Jackson Woodruff <jackson.woodr...@arm.com> > > PR 71026/tree-optimization > * tree-ssa-math-opts (is_division_by_square, > is_square_of, insert_sqaure_reciprocals): New. > (insert_reciprocals): Change to insert reciprocals > before a division by a square. > (execute_cse_reciprocals_1): Change to consider > division by a square. > > > gcc/testsuite > > 2017-08-03 Jackson Woodruff <jackson.woodr...@arm.com> > > PR 71026/tree-optimization > * gcc.dg/associate_division_1.c: New. >