Factor out division by squares
This patch implements the some of the division optimizations discussed in https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71026. The division reciprocal optimization now handles divisions by squares: x / (y * y) -> x * (1 / y) * (1 / y) This requires at least one more division by y before it triggers - the 3 divisions of (1/ y) are then CSEd into a single division. Overall this changes 1 division into 1 multiply, which is generally much faster. 2017-11-24 Jackson Woodruff <jackson.woodruff@arm.com> gcc/ PR tree-optimization/71026 * tree-ssa-math-opts (is_division_by_square, is_square_of): New. (insert_reciprocals): Change to insert reciprocals before a division by a square and to insert the square of a reciprocal. (execute_cse_reciprocals_1): Change to consider division by a square. (register_division_in): Add importance parameter. testsuite/ PR tree-optimization/71026 * gfortran.dg/extract_recip_1.f: New test. * gcc.dg/extract_recip_3.c: New test. * gcc.dg/extract_recip_4.c: New test. From-SVN: r255141
Showing
- gcc/ChangeLog 9 additions, 0 deletionsgcc/ChangeLog
- gcc/testsuite/ChangeLog 7 additions, 0 deletionsgcc/testsuite/ChangeLog
- gcc/testsuite/gcc.dg/extract_recip_3.c 29 additions, 0 deletionsgcc/testsuite/gcc.dg/extract_recip_3.c
- gcc/testsuite/gcc.dg/extract_recip_4.c 34 additions, 0 deletionsgcc/testsuite/gcc.dg/extract_recip_4.c
- gcc/testsuite/gfortran.dg/extract_recip_1.f 19 additions, 0 deletionsgcc/testsuite/gfortran.dg/extract_recip_1.f
- gcc/tree-ssa-math-opts.c 191 additions, 30 deletionsgcc/tree-ssa-math-opts.c
Loading
Please register or sign in to comment