Re: [PATCH] middle-end: fix de-optimizations with bitclear patterns on signed values

2021-11-19 Thread Jakub Jelinek via Gcc-patches
On Fri, Nov 12, 2021 at 07:30:35AM +, Tamar Christina via Gcc-patches wrote: > @@ -2099,7 +2124,7 @@ spaceship_replacement (basic_block cond_bb, basic_block > middle_bb, >|| !tree_fits_shwi_p (rhs) >|| !IN_RANGE (tree_to_shwi (rhs), -1, 1)) > return false; > - if (orig_us

RE: [PATCH] middle-end: fix de-optimizations with bitclear patterns on signed values

2021-11-19 Thread Tamar Christina via Gcc-patches
Ping > -Original Message- > From: Tamar Christina > Sent: Friday, November 12, 2021 7:31 AM > To: Jakub Jelinek > Cc: Jonathan Wakely ; Richard Biener > ; gcc-patches@gcc.gnu.org; nd > Subject: RE: [PATCH] middle-end: fix de-optimizations with bitclear patter

RE: [PATCH] middle-end: fix de-optimizations with bitclear patterns on signed values

2021-11-11 Thread Tamar Christina via Gcc-patches
> -Original Message- > From: Jakub Jelinek > Sent: Thursday, November 4, 2021 4:11 PM > To: Tamar Christina > Cc: Jonathan Wakely ; Richard Biener > ; gcc-patches@gcc.gnu.org; nd > Subject: Re: [PATCH] middle-end: fix de-optimizations with bitclear patterns >

Re: [PATCH] middle-end: fix de-optimizations with bitclear patterns on signed values

2021-11-04 Thread Jakub Jelinek via Gcc-patches
On Thu, Nov 04, 2021 at 12:19:34PM +, Tamar Christina wrote: > I'm not sure the precision matters since if the conversion resulted in not > enough > precision such that It influences the compare it would have been optimized > out. You can't really rely on other optimizations being performed.

RE: [PATCH] middle-end: fix de-optimizations with bitclear patterns on signed values

2021-11-04 Thread Tamar Christina via Gcc-patches
> > + if (!TYPE_UNSIGNED (TREE_TYPE (orig_use_lhs))) > > + return false; > > + if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (orig_use_lhs)) > > + return false; > > + if (EDGE_COUNT (phi_bb->preds) != 4) > > + return false; > > + if (!TYPE_UNSIGNED (TREE_TYPE (orig_use_lhs))) > > +

Re: [PATCH] middle-end: fix de-optimizations with bitclear patterns on signed values

2021-11-03 Thread Jakub Jelinek via Gcc-patches
On Wed, Nov 03, 2021 at 10:56:30AM +, Tamar Christina wrote: > The spaceship operator is looking for (res & 1) == res which was previously > folded to (res & ~1) == 0. > This is now being folded further to ((unsigned) res) <= 1. Is that match.pd change already in the tree (which commit) or no

RE: [PATCH] middle-end: fix de-optimizations with bitclear patterns on signed values

2021-11-03 Thread Tamar Christina via Gcc-patches
Hi, I think it was lost along the way that I did post an update to the detection code to fix the regression 😊 I think I have a better understanding of the code now and have updated the patch. Essentially when a signed comparison is encountered my match.pd pattern will trigger for EQ and NE.

Re: [PATCH] middle-end: fix de-optimizations with bitclear patterns on signed values

2021-10-26 Thread Jonathan Wakely via Gcc-patches
On Tue, 26 Oct 2021 at 20:40, Jakub Jelinek wrote: > On Tue, Oct 26, 2021 at 08:35:40PM +0100, Jonathan Wakely wrote: > > We can change __cmp_cat::type if that would result in better code. I > picked > > signed char because we only need two bits, and preferably have a signed > > type as it simplif

Re: [PATCH] middle-end: fix de-optimizations with bitclear patterns on signed values

2021-10-26 Thread Jakub Jelinek via Gcc-patches
On Tue, Oct 26, 2021 at 08:35:40PM +0100, Jonathan Wakely wrote: > We can change __cmp_cat::type if that would result in better code. I picked > signed char because we only need two bits, and preferably have a signed > type as it simplifies some things. Would int make more sense? Or int:2 ? I thin

Re: [PATCH] middle-end: fix de-optimizations with bitclear patterns on signed values

2021-10-26 Thread Jonathan Wakely via Gcc-patches
On Tue, 26 Oct 2021 at 14:36, Jakub Jelinek wrote: > On Tue, Oct 26, 2021 at 03:21:55PM +0200, Richard Biener wrote: > > On Tue, 26 Oct 2021, Jakub Jelinek wrote: > > > > > On Tue, Oct 26, 2021 at 03:13:29PM +0200, Richard Biener wrote: > > > > try > > > > auto c = ...; > > > > signed char c2

Re: [PATCH] middle-end: fix de-optimizations with bitclear patterns on signed values

2021-10-26 Thread Richard Biener via Gcc-patches
On Tue, 26 Oct 2021, Jakub Jelinek wrote: > On Tue, Oct 26, 2021 at 03:21:55PM +0200, Richard Biener wrote: > > On Tue, 26 Oct 2021, Jakub Jelinek wrote: > > > > > On Tue, Oct 26, 2021 at 03:13:29PM +0200, Richard Biener wrote: > > > > try > > > > auto c = ...; > > > > signed char c2 = c; > >

Re: [PATCH] middle-end: fix de-optimizations with bitclear patterns on signed values

2021-10-26 Thread Jakub Jelinek via Gcc-patches
On Tue, Oct 26, 2021 at 03:21:55PM +0200, Richard Biener wrote: > On Tue, 26 Oct 2021, Jakub Jelinek wrote: > > > On Tue, Oct 26, 2021 at 03:13:29PM +0200, Richard Biener wrote: > > > try > > > auto c = ...; > > > signed char c2 = c; > > > return c2 >= ... > > > then > > > > That won't work

Re: [PATCH] middle-end: fix de-optimizations with bitclear patterns on signed values

2021-10-26 Thread Richard Biener via Gcc-patches
On Tue, 26 Oct 2021, Jakub Jelinek wrote: > On Tue, Oct 26, 2021 at 03:13:29PM +0200, Richard Biener wrote: > > try > > auto c = ...; > > signed char c2 = c; > > return c2 >= ... > > then > > That won't work, at least when using , which is what we with the > optimization want to deal with p

Re: [PATCH] middle-end: fix de-optimizations with bitclear patterns on signed values

2021-10-26 Thread Jakub Jelinek via Gcc-patches
On Tue, Oct 26, 2021 at 03:13:29PM +0200, Richard Biener wrote: > try > auto c = ...; > signed char c2 = c; > return c2 >= ... > then That won't work, at least when using , which is what we with the optimization want to deal with primarily. Because std::partial_ordering etc. aren't implicitl

RE: [PATCH] middle-end: fix de-optimizations with bitclear patterns on signed values

2021-10-26 Thread Richard Biener via Gcc-patches
ctober 26, 2021 9:26 AM > > > > To: Tamar Christina > > > > Cc: gcc-patches@gcc.gnu.org; Jakub Jelinek ; nd > > > > > > > > Subject: RE: [PATCH] middle-end: fix de-optimizations with bitclear > > > > patterns on signed values > > > >

RE: [PATCH] middle-end: fix de-optimizations with bitclear patterns on signed values

2021-10-26 Thread Tamar Christina via Gcc-patches
> -Original Message- > From: Richard Biener > Sent: Tuesday, October 26, 2021 9:46 AM > To: Tamar Christina > Cc: gcc-patches@gcc.gnu.org; Jakub Jelinek ; nd > > Subject: RE: [PATCH] middle-end: fix de-optimizations with bitclear patterns > on signed values

RE: [PATCH] middle-end: fix de-optimizations with bitclear patterns on signed values

2021-10-26 Thread Richard Biener via Gcc-patches
15, 2021 12:31 PM > > > > To: Tamar Christina > > > > Cc: gcc-patches@gcc.gnu.org; Jakub Jelinek ; nd > > > > > > > > Subject: Re: [PATCH] middle-end: fix de-optimizations with bitclear > > > > patterns on signed values > > > > > > &

RE: [PATCH] middle-end: fix de-optimizations with bitclear patterns on signed values

2021-10-26 Thread Tamar Christina via Gcc-patches
> -Original Message- > From: Richard Biener > Sent: Tuesday, October 26, 2021 9:26 AM > To: Tamar Christina > Cc: gcc-patches@gcc.gnu.org; Jakub Jelinek ; nd > > Subject: RE: [PATCH] middle-end: fix de-optimizations with bitclear patterns > on signed values

RE: [PATCH] middle-end: fix de-optimizations with bitclear patterns on signed values

2021-10-26 Thread Richard Biener via Gcc-patches
On Mon, 25 Oct 2021, Tamar Christina wrote: > > -Original Message- > > From: Richard Biener > > Sent: Friday, October 15, 2021 12:31 PM > > To: Tamar Christina > > Cc: gcc-patches@gcc.gnu.org; Jakub Jelinek ; nd > > > > Subject: Re: [PA

RE: [PATCH] middle-end: fix de-optimizations with bitclear patterns on signed values

2021-10-25 Thread Tamar Christina via Gcc-patches
> -Original Message- > From: Richard Biener > Sent: Friday, October 15, 2021 12:31 PM > To: Tamar Christina > Cc: gcc-patches@gcc.gnu.org; Jakub Jelinek ; nd > > Subject: Re: [PATCH] middle-end: fix de-optimizations with bitclear patterns > on signed values

Re: [PATCH] middle-end: fix de-optimizations with bitclear patterns on signed values

2021-10-15 Thread Richard Biener via Gcc-patches
On Fri, 15 Oct 2021, Tamar Christina wrote: > Hi All, > > During testing after rebasing to commit I noticed a failing testcase with the > bitmask compare patch. > > Consider the following C++ testcase: > > #include > > #define A __attribute__((noipa)) > A bool f5 (double i, double j) { auto c

[PATCH] middle-end: fix de-optimizations with bitclear patterns on signed values

2021-10-15 Thread Tamar Christina via Gcc-patches
Hi All, During testing after rebasing to commit I noticed a failing testcase with the bitmask compare patch. Consider the following C++ testcase: #include #define A __attribute__((noipa)) A bool f5 (double i, double j) { auto c = i <=> j; return c >= 0; } This turns into a comparison against