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: Simplify 3*x == 3*y for wrapping types


On Sat, Jun 24, 2017 at 5:34 AM, Marc Glisse <marc.glisse@inria.fr> wrote:
> Hello,
>
> I remember wanting to add this when the undefined-overflow case was
> introduced a while ago.
>
> It turns out the tree where I wrote this wasn't clean. Since the rest is
> details, I am including it in this patch, hope it is ok.

You can do the x * C1 == y * C1 optimization for floating point (if
-ffast-math).  That is recorded as PR 31098.

Thanks,
Andrew

>
> Bootstrap + testsuite on powerpc64le-unknown-linux-gnu.
>
> 2017-06-26  Marc Glisse  <marc.glisse@inria.fr>
>
> gcc/
>         * match.pd ((X & ~Y) | (~X & Y)): Generalize to + and ^.
>         (x * C EQ/NE y * C): New transformation.
>
> gcc/testsuite/
>         * gcc.dg/tree-ssa/addadd.c: Remove test duplicated in addadd-2.c.
>         * gcc.dg/tree-ssa/mulcmp-1.c: New file.
>
> --
> Marc Glisse


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