Re: [EXTERNAL] Re: [PATCH] tree-optimization: Optimize division followed by multiply [PR95176]

2021-08-22 Thread Victor Tong via Gcc-patches
Y_INTEGRAL_TYPE_P (type) > > || TYPE_OVERFLOW_WRAPS (type)) > >    (negate (view_convert @1)) > >    (view_convert (negate @1 > > > > pattern.  Once we'd "inline" nop_convert genmatch would complain > > about this. > > > >>  

Re: [EXTERNAL] Re: [PATCH] tree-optimization: Optimize division followed by multiply [PR95176]

2021-08-09 Thread Richard Biener via Gcc-patches
k. Otherwise whether it works or not (as expected) depends on placing positions of the patterns ... So no, it's not inherently "bad" but it's not designed to work. > > Is someone working on inlining nop_convert? I'd like to avoid breaking > > someone else's work if that's

Re: [EXTERNAL] Re: [PATCH] tree-optimization: Optimize division followed by multiply [PR95176]

2021-08-06 Thread Marc Glisse
this new pattern. I've attached a patch with my latest changes. From: Richard Biener Sent: Wednesday, July 28, 2021 2:59 AM To: Victor Tong Cc: Marc Glisse ; gcc-patches@gcc.gnu.org Subject: Re: [EXTERNAL] Re: [PATCH] tree-optimization: Optimize division followed by multiply [PR95176]

Re: [EXTERNAL] Re: [PATCH] tree-optimization: Optimize division followed by multiply [PR95176]

2021-08-06 Thread Victor Tong via Gcc-patches
ra tests to cover this new pattern. I've attached a patch with my latest changes. From: Richard Biener Sent: Wednesday, July 28, 2021 2:59 AM To: Victor Tong Cc: Marc Glisse ; gcc-patches@gcc.gnu.org Subject: Re: [EXTERNAL] Re: [PATCH] tree-optimization: Optimize division followed by mul

Re: [EXTERNAL] Re: [PATCH] tree-optimization: Optimize division followed by multiply [PR95176]

2021-07-28 Thread Richard Biener via Gcc-patches
gt; is being applied in the right scenarios and not being applied in others, but > I think there are too many possibilities to manually write them all. Is there > anything in GCC that can be used to verify that match.pd transformations are > correct? I'm thinking of something like Ali

Re: [EXTERNAL] Re: [PATCH] tree-optimization: Optimize division followed by multiply [PR95176]

2021-07-19 Thread Victor Tong via Gcc-patches
Gentle ping. From: Gcc-patches on behalf of Victor Tong via Gcc-patches Sent: Monday, June 28, 2021 4:10 PM To: Richard Biener ; Marc Glisse Cc: gcc-patches@gcc.gnu.org Subject: Re: [EXTERNAL] Re: [PATCH] tree-optimization: Optimize division followed

Re: [EXTERNAL] Re: [PATCH] tree-optimization: Optimize division followed by multiply [PR95176]

2021-06-28 Thread Victor Tong via Gcc-patches
hem all. Is there anything in GCC that can be used to verify that match.pd transformations are correct? I'm thinking of something like Alive https://github.com/AliveToolkit/alive2. Thanks, Victor From: Richard Biener Sent: Monday, June 21, 2021 12:08 AM To: Marc Glisse Cc: Victor Tong ;

Re: [EXTERNAL] Re: [PATCH] tree-optimization: Optimize division followed by multiply [PR95176]

2021-06-21 Thread Richard Biener via Gcc-patches
On Sat, Jun 19, 2021 at 7:05 PM Marc Glisse wrote: > > On Fri, 18 Jun 2021, Richard Biener wrote: > > >> Option 2: Add a new pattern to support scenarios that the existing > >> nop_convert pattern bails out on. > >> > >> Existing pattern: > >> > >> (simplify > >>(minus (nop_convert1? @0)

Re: [EXTERNAL] Re: [PATCH] tree-optimization: Optimize division followed by multiply [PR95176]

2021-06-19 Thread Marc Glisse
On Fri, 18 Jun 2021, Richard Biener wrote: Option 2: Add a new pattern to support scenarios that the existing nop_convert pattern bails out on. Existing pattern: (simplify (minus (nop_convert1? @0) (nop_convert2? (minus (nop_convert3? @@0) @1))) (view_convert @1)) I tried to check

Re: [EXTERNAL] Re: [PATCH] tree-optimization: Optimize division followed by multiply [PR95176]

2021-06-18 Thread Richard Biener via Gcc-patches
gt; Y */ > +(simplify > + (minus (convert1? @0) (convert2? (minus @@0 @1))) > + (if ((INTEGRAL_TYPE_P (type) || VECTOR_INTEGER_TYPE_P (type)) && > TYPE_OVERFLOW_UNDEFINED(type)) > + (convert @1))) > > would match (int)x - (int)(x - y) where you assert the outer subtra

Re: [EXTERNAL] Re: [PATCH] tree-optimization: Optimize division followed by multiply [PR95176]

2021-06-16 Thread Victor Tong via Gcc-patches
, or if you can think of a better option to fix the regression. Thanks, Victor From: Richard Biener Sent: Monday, June 7, 2021 1:25 AM To: Victor Tong Cc: gcc-patches@gcc.gnu.org Subject: Re: [EXTERNAL] Re: [PATCH] tree-optimization: Optimize division followed by multiply [PR95176]   On

Re: [EXTERNAL] Re: [PATCH] tree-optimization: Optimize division followed by multiply [PR95176]

2021-06-07 Thread Richard Biener via Gcc-patches
> Sent: Tuesday, April 27, 2021 1:29 AM > To: Victor Tong > Cc: gcc-patches@gcc.gnu.org > Subject: [EXTERNAL] Re: [PATCH] tree-optimization: Optimize division followed > by multiply [PR95176] > > On Thu, Apr 1, 2021 at 1:03 AM Victor Tong via Gcc-patches > wrote: > > >

Re: [EXTERNAL] Re: [PATCH] tree-optimization: Optimize division followed by multiply [PR95176]

2021-06-02 Thread Victor Tong via Gcc-patches
s true, the second pattern that I added (X - (X - Y) --> Y) gets triggered. Thanks, Victor From: Richard Biener Sent: Tuesday, April 27, 2021 1:29 AM To: Victor Tong Cc: gcc-patches@gcc.gnu.org Subject: [EXTERNAL] Re: [PATCH] tree-optimization: Optimize division followed by multiply