This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Factor out division by squares and remove division around comparisons (0/2)
- From: Jeff Law <law at redhat dot com>
- To: Jackson Woodruff <jackson dot woodruff at foss dot arm dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>
- Cc: Wilco Dijkstra <Wilco dot Dijkstra at arm dot com>, Richard Biener <richard dot guenther at gmail dot com>, "kyrylo dot tkachov at foss dot arm dot com" <kyrylo dot tkachov at foss dot arm dot com>, "Joseph S. Myers" <joseph at codesourcery dot com>
- Date: Wed, 13 Sep 2017 09:45:37 -0600
- Subject: Re: [PATCH] Factor out division by squares and remove division around comparisons (0/2)
- Authentication-results: sourceware.org; auth=none
- Authentication-results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com
- Authentication-results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=law at redhat dot com
- Dmarc-filter: OpenDMARC Filter v1.3.2 mx1.redhat.com E4F98C04B930
- References: <a97a80c5-c2a9-86de-5152-cd1207036592@foss.arm.com>
On 09/06/2017 03:54 AM, Jackson Woodruff wrote:
> Hi all,
>
> This patch is split from part (1/2). It includes the patterns that have
> been moved out of fold-const.c
>
>
> It also removes an (almost entirely) redundant pattern:
>
> (A / C1) +- (A / C2) -> A * (1 / C1 +- 1 / C2)
>
> which was only used in special cases, either with combinations
> of flags like -fno-reciprocal-math -funsafe-math-optimizations
> and cases where C was sNaN, or small enough to result in infinity.
>
> This pattern is covered by:
>
> (A / C1) +- (A / C2) -> (with O1 and reciprocal math)
> A * (1 / C1) +- A * (1 / C2) ->
> A * (1 / C1 +- 1 / C2)
>
> The previous pattern required funsafe-math-optimizations.
>
> To adjust for this case, the testcase has been updated to require O1 so
> that the optimization is still performed.
>
>
> This pattern is moved verbatim into match.pd:
>
> (A / C) +- (B / C) -> (A +- B) / C.
>
> OK for trunk?
>
> Jackson
>
> gcc/
>
> 2017-08-30 Jackson Woodruff <jackson.woodruff@arm.com>
>
> PR 71026/tree-optimization
> * 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.
>
> gcc/testsuite/
>
> 2017-08-30 Jackson Woodruff <jackson.woodruff@arm.com>
>
> PR 71026/tree-optimization
> * gcc/testsuire/gcc.dg/fold-div-1.c: Use O1.
Sorry. Just one more question here. Does the new match.pd pattern need
to be conditional on flag_unsafe_math_optimizations? ISTM as written
it's going to do those transformations independent of that flag.
If this has already been discussed, don't hesitate to just point me at
the discussion :-)
Jeff