This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: ((X /[ex] A) +- B) * A --> X +- A * B
- From: Richard Biener <richard dot guenther at gmail dot com>
- To: Marc Glisse <marc dot glisse at inria dot fr>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 1 Oct 2018 10:32:29 +0200
- Subject: Re: ((X /[ex] A) +- B) * A --> X +- A * B
- References: <alpine.DEB.2.02.1809291327050.7519@stedding.saclay.inria.fr>
On Sat, Sep 29, 2018 at 1:35 PM Marc Glisse <marc.glisse@inria.fr> wrote:
>
> Hello,
>
> I noticed quite ugly code from both testcases. This transformation does
> not fix either, but it helps a bit.
I'm curious why you chose to restrict to INTEGER_CST A and B?
Is that because of the case when (X / [ex] A) +- B evaluates to zero
but A * B overflows? Can that ever happen? Isn't it enough to know
that A isn't -1? That is, can we use expr_not_equal_to or friends
to put constraints on possibly non-constant A/B?
Otherwise the patch is of course OK and the above would just improve
it.
Thanks,
Richard.
> bootstrap+regtest on powerpc64le-unknown-linux-gnu.
>
> 2018-09-30 Marc Glisse <marc.glisse@inria.fr>
>
> gcc/
> * match.pd (((X /[ex] A) +- B) * A): New transformation.
>
> gcc/testsuite/
> * gcc.dg/tree-ssa/muldiv-1.c: New file.
> * gcc.dg/tree-ssa/muldiv-2.c: Likewise.
>
> --
> Marc Glisse