Canonicalize constant multiplies in division
authorWilco Dijkstra <wdijkstr@arm.com>
Thu, 16 Nov 2017 11:54:49 +0000 (11:54 +0000)
committerWilco Dijkstra <wilco@gcc.gnu.org>
Thu, 16 Nov 2017 11:54:49 +0000 (11:54 +0000)
commit81825e283f6cec28db73af9769602b953d683e3e
tree8126f7147441bbeb11d41053c993f7ae1046aa37
parentefeee67f4c9fd021d2594e0271c84b7e90e63d3d
Canonicalize constant multiplies in division

This patch implements some of the optimizations discussed in
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71026.

Canonicalize x / (C1 * y) into (x * C2) / y.

This moves constant multiplies out of the RHS of a division in order
to allow further simplifications (such as (C1 * x) / (C2 * y) ->
(C3 * x) / y) and to enable more reciprocal CSEs.

2017-11-16  Wilco Dijkstra  <wdijkstr@arm.com>
    Jackson Woodruff  <jackson.woodruff@arm.com>

    gcc/
PR tree-optimization/71026
* match.pd: Canonicalize constant multiplies in division.

    gcc/testsuite/
PR tree-optimization/71026
* gcc.dg/cse_recip.c: New test.

Co-Authored-By: Jackson Woodruff <jackson.woodruff@arm.com>
From-SVN: r254816
gcc/ChangeLog
gcc/match.pd
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/cse_recip.c [new file with mode: 0644]