This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: ((X /[ex] A) +- B) * A --> X +- A * B


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]