Hi all, The patch implements the division opitmizations discussed in https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71026 .
The implemented change differs slightly from the proposed one in that we re-associate: C / x comparison 0.0 -> x comparison' 0.0 Where C is any constant and comparison' is changed as appropriate if C is negative. The implementations also removes the division from: x / C comparison 0.0 -> x comparison' 0.0 Where again, comparison' is changed as appropriate if C is negative. We also change the association of x / (y * C) -> (x / C) / y If C is a constant. All of the above require -funsafe-math-optimizations. We also change: x / (- y) -> (-x) / y Which requires -fno-trapping-math. Bootstrapped and regtested (with part 2 of this patch) on aarch64. OK for trunk? (Apologies if the recipients in the 'to' field received this twice, I accidentally sent this from an email gcc-patches doesn't accept) Jackson gcc/ 2017-08-03 Jackson Woodruff <jackson.woodr...@arm.com> PR 71026/tree-optimization * match.pd: New patterns. gcc/testsuite 2017-08-03 Jackson Woodruff <jackson.woodr...@arm.com> PR 71026/tree-optimization * gcc.dg/associate_comparison_1.c: New. * gcc.dg/associate_division_2.c: New.