On Tue, Nov 23, 2021 at 11:15 AM Jeff Law via Gcc-patches
<gcc-patches@gcc.gnu.org> wrote:
>
>
>
> On 11/23/2021 11:34 AM, Navid Rahimi via Gcc-patches wrote:
> > Hi GCC community,
> >
> > I wanted you take a quick look at this patch to solve this bug [1]. This is 
> > the code example for the optimization [2] which does include a link to 
> > proof of each different optimization.
> >
> > I think it should be possible to use simpler approach than what Andrew has 
> > used here [3].
> >
> > P.S. Tested and verified on Linux x86_64.
> >
> > 1) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101808
> > 2) https://compiler-explorer.com/z/Gc448eE3z
> > 3) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101808#c1
> Don't those match.pd patterns make things worse?  We're taking a single
> expression evaluation (the conditional) and turning it into two logicals
> AFAICT.
>
> For the !x expression, obviously if x is a  constant, then we can
> compute that at compile time and we're going from a single conditional
> to a single logical which is probably a win, but that's not the case
> with this patch AFAICT.

One thing is you could use ! to see if bit_not simplifies down to a
constant which is what I did in the bug report.  But it might be more
useful to use the ^ flag (which I added in a different patch) which
says the bit_xor is removed then accept it.

Note (bit_not @0) is wrong, it should be (bit_xor @0 { booleantrue; }
) as there are boolean types which are signed and/or > 1 precision
which is what I had in my patch.
Did you test Ada with this patch as that is where the "odd" boolean
types show up?

Thanks,
Andrew Pinski


>
> jeff

Reply via email to