RE: [PATCH 1/2]middle-end: Fix wrong overmatching of div-bitmask by using new optabs [PR108583]

2023-03-01 Thread Tamar Christina via Gcc-patches
H 1/2]middle-end: Fix wrong overmatching of div-bitmask > by using new optabs [PR108583] > > On Thu, Feb 23, 2023 at 11:39:51AM -0500, Andrew MacLeod via Gcc- > patches wrote: > > > > > > Inheriting from operator_mult is also going to be hazardous because it > > also

Re: [PATCH 1/2]middle-end: Fix wrong overmatching of div-bitmask by using new optabs [PR108583]

2023-03-01 Thread Andrew Carlotti via Gcc-patches
On Thu, Feb 23, 2023 at 11:39:51AM -0500, Andrew MacLeod via Gcc-patches wrote: > > > Inheriting from operator_mult is also going to be hazardous because it also > has an op1_range and op2_range...� you should at least define those and > return VARYING to avoid other issues.� Same thing appli

Re: [PATCH 1/2]middle-end: Fix wrong overmatching of div-bitmask by using new optabs [PR108583]

2023-03-01 Thread Richard Biener via Gcc-patches
via Gcc-patches ; nd > >> ; rguent...@suse.de; j...@ventanamicro.com > >> Subject: Re: [PATCH 1/2]middle-end: Fix wrong overmatching of div-bitmask > >> by using new optabs [PR108583] > >> > >> Tamar Christina writes: > >> >> -Original Message-

Re: [PATCH 1/2]middle-end: Fix wrong overmatching of div-bitmask by using new optabs [PR108583]

2023-02-28 Thread Richard Sandiford via Gcc-patches
t; >> To: Tamar Christina via Gcc-patches >> >> Cc: Tamar Christina ; nd ; >> >> rguent...@suse.de; j...@ventanamicro.com >> >> Subject: Re: [PATCH 1/2]middle-end: Fix wrong overmatching of >> >> div-bitmask by using new optabs [PR108583] >>

RE: [PATCH 1/2]middle-end: Fix wrong overmatching of div-bitmask by using new optabs [PR108583]

2023-02-28 Thread Tamar Christina via Gcc-patches
Original Message- > >> >> From: Richard Sandiford > >> >> Sent: Monday, February 27, 2023 12:12 PM > >> >> To: Tamar Christina > >> >> Cc: Tamar Christina via Gcc-patches ; nd > >> >> ; rguent...@suse.de; j...@ventanamicro.co

Re: [PATCH 1/2]middle-end: Fix wrong overmatching of div-bitmask by using new optabs [PR108583]

2023-02-28 Thread Richard Sandiford via Gcc-patches
2:12 PM >> >> To: Tamar Christina >> >> Cc: Tamar Christina via Gcc-patches ; nd >> >> ; rguent...@suse.de; j...@ventanamicro.com >> >> Subject: Re: [PATCH 1/2]middle-end: Fix wrong overmatching of >> >> div-bitmask by using new optabs

RE: [PATCH 1/2]middle-end: Fix wrong overmatching of div-bitmask by using new optabs [PR108583]

2023-02-27 Thread Tamar Christina via Gcc-patches
istina via Gcc-patches ; nd > >> ; rguent...@suse.de; j...@ventanamicro.com > >> Subject: Re: [PATCH 1/2]middle-end: Fix wrong overmatching of > >> div-bitmask by using new optabs [PR108583] > >> > >> Tamar Christina writes: > >> > Hi, > >&g

Re: [PATCH 1/2]middle-end: Fix wrong overmatching of div-bitmask by using new optabs [PR108583]

2023-02-27 Thread Richard Sandiford via Gcc-patches
gt;> Subject: Re: [PATCH 1/2]middle-end: Fix wrong overmatching of div-bitmask >> by using new optabs [PR108583] >> >> Tamar Christina writes: >> > Hi, >> > >> >> > I avoided open coding it with add and shift because it creates a 4 >> >

RE: [PATCH 1/2]middle-end: Fix wrong overmatching of div-bitmask by using new optabs [PR108583]

2023-02-27 Thread Tamar Christina via Gcc-patches
> -Original Message- > From: Richard Sandiford > Sent: Monday, February 27, 2023 12:12 PM > To: Tamar Christina > Cc: Tamar Christina via Gcc-patches ; nd > ; rguent...@suse.de; j...@ventanamicro.com > Subject: Re: [PATCH 1/2]middle-end: Fix wrong overmatching of d

Re: [PATCH 1/2]middle-end: Fix wrong overmatching of div-bitmask by using new optabs [PR108583]

2023-02-27 Thread Richard Sandiford via Gcc-patches
Tamar Christina writes: > Hi, > >> > I avoided open coding it with add and shift because it creates a 4 >> > instructions (and shifts which are typically slow) dependency chain >> > instead of a load and multiply. This change, unless the target is >> > known to optimize it further is unlikely to

RE: [PATCH 1/2]middle-end: Fix wrong overmatching of div-bitmask by using new optabs [PR108583]

2023-02-27 Thread Tamar Christina via Gcc-patches
Hi, > > I avoided open coding it with add and shift because it creates a 4 > > instructions (and shifts which are typically slow) dependency chain > > instead of a load and multiply. This change, unless the target is > > known to optimize it further is unlikely to be beneficial. And by the > > t

RE: [PATCH 1/2]middle-end: Fix wrong overmatching of div-bitmask by using new optabs [PR108583]

2023-02-23 Thread Tamar Christina via Gcc-patches
> -Original Message- > From: Andrew MacLeod > Sent: Thursday, February 23, 2023 4:40 PM > To: Tamar Christina ; Richard Biener > ; Richard Sandiford > Cc: Tamar Christina via Gcc-patches ; nd > ; j...@ventanamicro.com > Subject: Re: [PATCH 1/2]middle-end: Fix w

Re: [PATCH 1/2]middle-end: Fix wrong overmatching of div-bitmask by using new optabs [PR108583]

2023-02-23 Thread Andrew MacLeod via Gcc-patches
On 2/23/23 03:36, Tamar Christina wrote: Hi Andrew, Oh yeah, and in case you haven't figured it out on your own, you'll have to remove WIDEN_MULT_EXPR from the range-ops init table.   This non-standard mechanism only gets checked if there is no standard range-op table entry for the tree code :

RE: [PATCH 1/2]middle-end: Fix wrong overmatching of div-bitmask by using new optabs [PR108583]

2023-02-23 Thread Tamar Christina via Gcc-patches
Hi Andrew, > >> Oh yeah, and in case you haven't figured it out on your own, you'll > >> have to remove WIDEN_MULT_EXPR from the range-ops init table.   This > >> non-standard mechanism only gets checked if there is no standard > >> range-op table entry for the tree code :-P > >> > > Hmm it looks

Re: [PATCH 1/2]middle-end: Fix wrong overmatching of div-bitmask by using new optabs [PR108583]

2023-02-22 Thread Andrew MacLeod via Gcc-patches
: Fix wrong overmatching of div-bitmask by using new optabs [PR108583] On 2/15/23 13:42, Andrew MacLeod wrote: On 2/15/23 12:50, Andrew MacLeod wrote: On 2/15/23 12:13, Tamar Christina wrote: On 2/15/23 07:51, Tamar Christina wrote: void operator_plus::wi_fold (irange &r, tree

RE: [PATCH 1/2]middle-end: Fix wrong overmatching of div-bitmask by using new optabs [PR108583]

2023-02-22 Thread Tamar Christina via Gcc-patches
> -Original Message- > From: Andrew MacLeod > Sent: Wednesday, February 22, 2023 4:42 PM > To: Tamar Christina ; Richard Biener > ; Richard Sandiford > Cc: Tamar Christina via Gcc-patches ; nd > ; j...@ventanamicro.com > Subject: Re: [PATCH 1/2]middle-end: Fix w

Re: [PATCH 1/2]middle-end: Fix wrong overmatching of div-bitmask by using new optabs [PR108583]

2023-02-22 Thread Andrew MacLeod via Gcc-patches
On 2/15/23 13:42, Andrew MacLeod wrote: On 2/15/23 12:50, Andrew MacLeod wrote: On 2/15/23 12:13, Tamar Christina wrote: On 2/15/23 07:51, Tamar Christina wrote: void operator_plus::wi_fold (irange &r, tree type,     const wide_int &lh_lb, const wide_int &lh_ub,    

Re: [PATCH 1/2]middle-end: Fix wrong overmatching of div-bitmask by using new optabs [PR108583]

2023-02-22 Thread Andrew MacLeod via Gcc-patches
On 2/22/23 08:06, Tamar Christina wrote: Hi Andrew, all the range-op integer code is in gcc/range-op.cc.  As this is a basic binary operation, you should be able to get away with implementing a single routine,  wi_fold () which adds 2 wide int bounds  together and returns a result.  THis si th

RE: [PATCH 1/2]middle-end: Fix wrong overmatching of div-bitmask by using new optabs [PR108583]

2023-02-22 Thread Tamar Christina via Gcc-patches
Hi Andrew, > > all the range-op integer code is in gcc/range-op.cc.  As this is a basic > binary operation, you should be able to get away with implementing a > single routine,  wi_fold () which adds 2 wide int bounds  together and > returns a result.  THis si the implelemntaion for operator_plus

RE: [PATCH 1/2]middle-end: Fix wrong overmatching of div-bitmask by using new optabs [PR108583]

2023-02-22 Thread Tamar Christina via Gcc-patches
> -Original Message- > From: Andrew MacLeod > Sent: Wednesday, February 15, 2023 6:43 PM > To: Tamar Christina ; Richard Biener > ; Richard Sandiford > Cc: Tamar Christina via Gcc-patches ; nd > ; j...@ventanamicro.com > Subject: Re: [PATCH 1/2]middle-end: Fix w

Re: [PATCH 1/2]middle-end: Fix wrong overmatching of div-bitmask by using new optabs [PR108583]

2023-02-15 Thread Andrew MacLeod via Gcc-patches
On 2/15/23 12:50, Andrew MacLeod wrote: On 2/15/23 12:13, Tamar Christina wrote: On 2/15/23 07:51, Tamar Christina wrote: void operator_plus::wi_fold (irange &r, tree type,     const wide_int &lh_lb, const wide_int &lh_ub,     const wide_int &rh_lb, co

Re: [PATCH 1/2]middle-end: Fix wrong overmatching of div-bitmask by using new optabs [PR108583]

2023-02-15 Thread Andrew MacLeod via Gcc-patches
On 2/15/23 12:13, Tamar Christina wrote: On 2/15/23 07:51, Tamar Christina wrote: Thanks, lots of useful context there. This second pattern replaces the above into: _6 = _3 +w level_14(D); _7 = _6 / 255; _8 = (unsigned char) _7; Thus removing the need to promote before the additi

RE: [PATCH 1/2]middle-end: Fix wrong overmatching of div-bitmask by using new optabs [PR108583]

2023-02-15 Thread Tamar Christina via Gcc-patches
> On 2/15/23 07:51, Tamar Christina wrote: > >> In any case, if you disagree I don’t' really see a way forward > >> aside from making this its own pattern running it before the > >> overwidening > >>> pattern. > > I think we should look to see if ranger can be persuaded to > > p

Re: [PATCH 1/2]middle-end: Fix wrong overmatching of div-bitmask by using new optabs [PR108583]

2023-02-15 Thread Andrew MacLeod via Gcc-patches
On 2/15/23 07:51, Tamar Christina wrote: In any case, if you disagree I don’t' really see a way forward aside from making this its own pattern running it before the overwidening pattern. I think we should look to see if ranger can be persuaded to provide the range of the 16-bit addition, even

RE: [PATCH 1/2]middle-end: Fix wrong overmatching of div-bitmask by using new optabs [PR108583]

2023-02-15 Thread Tamar Christina via Gcc-patches
> > >>> In any case, if you disagree I don’t' really see a way forward > > >>> aside from making this its own pattern running it before the > > >>> overwidening > > pattern. > > >> I think we should look to see if ranger can be persuaded to provide > > >> the range of the 16-bit addition, even thou

RE: [PATCH 1/2]middle-end: Fix wrong overmatching of div-bitmask by using new optabs [PR108583]

2023-02-13 Thread Tamar Christina via Gcc-patches
> -Original Message- > From: Andrew MacLeod > Sent: Friday, February 10, 2023 8:59 PM > To: Richard Biener ; Richard Sandiford > > Cc: Tamar Christina ; Tamar Christina via Gcc- > patches ; nd ; > j...@ventanamicro.com > Subject: Re: [PATCH 1/2]middle-end: Fi

Re: [PATCH 1/2]middle-end: Fix wrong overmatching of div-bitmask by using new optabs [PR108583]

2023-02-10 Thread Andrew MacLeod via Gcc-patches
On 2/10/23 13:34, Richard Biener wrote: In any case, if you disagree I don’t' really see a way forward aside from making this its own pattern running it before the overwidening pattern. I think we should look to see if ranger can be persuaded to provide the range of the 16-bit addition, eve

Re: [PATCH 1/2]middle-end: Fix wrong overmatching of div-bitmask by using new optabs [PR108583]

2023-02-10 Thread Richard Biener via Gcc-patches
gt; Cc: Tamar Christina via Gcc-patches ; nd >>> ; rguent...@suse.de; j...@ventanamicro.com >>> Subject: Re: [PATCH 1/2]middle-end: Fix wrong overmatching of div-bitmask >>> by using new optabs [PR108583] >>> >>> Tamar Christina writes: >>>>

Re: [PATCH 1/2]middle-end: Fix wrong overmatching of div-bitmask by using new optabs [PR108583]

2023-02-10 Thread Richard Sandiford via Gcc-patches
t; >> To: Tamar Christina >> >> Cc: Tamar Christina via Gcc-patches ; nd >> >> ; rguent...@suse.de; j...@ventanamicro.com >> >> Subject: Re: [PATCH 1/2]middle-end: Fix wrong overmatching of >> >> div-bitmask by using new optabs [PR108583]

RE: [PATCH 1/2]middle-end: Fix wrong overmatching of div-bitmask by using new optabs [PR108583]

2023-02-10 Thread Tamar Christina via Gcc-patches
t; >> >> From: Richard Sandiford > >> >> Sent: Friday, February 10, 2023 3:57 PM > >> >> To: Tamar Christina > >> >> Cc: Tamar Christina via Gcc-patches ; nd > >> >> ; rguent...@suse.de; j...@ventanamicro.com > >

Re: [PATCH 1/2]middle-end: Fix wrong overmatching of div-bitmask by using new optabs [PR108583]

2023-02-10 Thread Richard Sandiford via Gcc-patches
Richard Sandiford writes: > Final pattern statements (those not in DEF_SEQ) always have the same > type and value as the original statements. We wouldn't see mismatched > precisions if we were only looking at final pattern statements. > > Like you say, the 16-bit addition didn't exist before vect

Re: [PATCH 1/2]middle-end: Fix wrong overmatching of div-bitmask by using new optabs [PR108583]

2023-02-10 Thread Richard Sandiford via Gcc-patches
t; >> To: Tamar Christina >> >> Cc: Tamar Christina via Gcc-patches ; nd >> >> ; rguent...@suse.de; j...@ventanamicro.com >> >> Subject: Re: [PATCH 1/2]middle-end: Fix wrong overmatching of >> >&

RE: [PATCH 1/2]middle-end: Fix wrong overmatching of div-bitmask by using new optabs [PR108583]

2023-02-10 Thread Tamar Christina via Gcc-patches
tches ; nd > >> ; rguent...@suse.de; j...@ventanamicro.com > >> Subject: Re: [PATCH 1/2]middle-end: Fix wrong overmatching of > >> div-bitmask by using new optabs [PR108583] > >> > >> Tamar Christina writes: > >> >> > a/gcc/tree-vect-p

Re: [PATCH 1/2]middle-end: Fix wrong overmatching of div-bitmask by using new optabs [PR108583]

2023-02-10 Thread Richard Sandiford via Gcc-patches
ject: Re: [PATCH 1/2]middle-end: Fix wrong overmatching of div-bitmask >> by using new optabs [PR108583] >> >> Tamar Christina writes: >> >> > a/gcc/tree-vect-patterns.cc b/gcc/tree-vect-patterns.cc index >> >> > >> >> >> 6934aebc69f231af2466

RE: [PATCH 1/2]middle-end: Fix wrong overmatching of div-bitmask by using new optabs [PR108583]

2023-02-10 Thread Tamar Christina via Gcc-patches
> -Original Message- > From: Richard Sandiford > Sent: Friday, February 10, 2023 3:57 PM > To: Tamar Christina > Cc: Tamar Christina via Gcc-patches ; nd > ; rguent...@suse.de; j...@ventanamicro.com > Subject: Re: [PATCH 1/2]middle-end: Fix wrong overmatching of d

Re: [PATCH 1/2]middle-end: Fix wrong overmatching of div-bitmask by using new optabs [PR108583]

2023-02-10 Thread Richard Sandiford via Gcc-patches
Tamar Christina writes: >> > a/gcc/tree-vect-patterns.cc b/gcc/tree-vect-patterns.cc index >> > >> 6934aebc69f231af24668f0a1c3d140e97f55487..e39d7e6b362ef44eb2fc467f33 >> 69 >> > de2afea139d6 100644 >> > --- a/gcc/tree-vect-patterns.cc >> > +++ b/gcc/tree-vect-patterns.cc >> > @@ -3914,12 +3914,82

RE: [PATCH 1/2]middle-end: Fix wrong overmatching of div-bitmask by using new optabs [PR108583]

2023-02-10 Thread Tamar Christina via Gcc-patches
stina ; nd ; > >> rguent...@suse.de; j...@ventanamicro.com > >> Subject: Re: [PATCH 1/2]middle-end: Fix wrong overmatching of > >> div-bitmask by using new optabs [PR108583] > >> > >> I think I'm misunderstanding, but: it seems like we're treating th

Re: [PATCH 1/2]middle-end: Fix wrong overmatching of div-bitmask by using new optabs [PR108583]

2023-02-10 Thread Richard Sandiford via Gcc-patches
ject: Re: [PATCH 1/2]middle-end: Fix wrong overmatching of div-bitmask >> by using new optabs [PR108583] >> >> I think I'm misunderstanding, but: it seems like we're treating the add >> highpart optabs as companions to the mul highpart optabs. But AIUI, the add >

RE: [PATCH 1/2]middle-end: Fix wrong overmatching of div-bitmask by using new optabs [PR108583]

2023-02-10 Thread Tamar Christina via Gcc-patches
> -Original Message- > From: Richard Sandiford > Sent: Friday, February 10, 2023 1:36 PM > To: Tamar Christina via Gcc-patches > Cc: Tamar Christina ; nd ; > rguent...@suse.de; j...@ventanamicro.com > Subject: Re: [PATCH 1/2]middle-end: Fix wrong overmatching of d

Re: [PATCH 1/2]middle-end: Fix wrong overmatching of div-bitmask by using new optabs [PR108583]

2023-02-10 Thread Richard Biener via Gcc-patches
On Fri, 10 Feb 2023, Richard Sandiford wrote: > I think I'm misunderstanding, but: it seems like we're treating the > add highpart optabs as companions to the mul highpart optabs. But AIUI, > the add highpart optab is used such that, for an N-bit mode, we do > an N-bit addition followed by a shif

Re: [PATCH 1/2]middle-end: Fix wrong overmatching of div-bitmask by using new optabs [PR108583]

2023-02-10 Thread Richard Sandiford via Gcc-patches
I think I'm misunderstanding, but: it seems like we're treating the add highpart optabs as companions to the mul highpart optabs. But AIUI, the add highpart optab is used such that, for an N-bit mode, we do an N-bit addition followed by a shift by N/2. Is that right? The mul highpart optabs inste

Re: [PATCH 1/2]middle-end: Fix wrong overmatching of div-bitmask by using new optabs [PR108583]

2023-02-10 Thread Richard Biener via Gcc-patches
On Thu, 9 Feb 2023, Tamar Christina wrote: > Hi All, > > As discussed in the ticket, this replaces the approach for optimizing the > div by bitmask operation from a hook into optabs implemented through > add_highpart. > > In order to be able to use this we need to check whether the current preci

RE: [PATCH 1/2]middle-end: Fix wrong overmatching of div-bitmask by using new optabs [PR108583]

2023-02-10 Thread Tamar Christina via Gcc-patches
Oops, realizes I forgot to fill in the test results, there were no issues 😊 > -Original Message- > From: Gcc-patches bounces+tamar.christina=arm@gcc.gnu.org> On Behalf Of Tamar > Christina via Gcc-patches > Sent: Thursday, February 9, 2023 5:17 PM > To: gcc-patches@gcc.gnu.org > Cc: n