public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: Richard Biener <richard.guenther@gmail.com>
Cc: Drew Ross <drross@redhat.com>, gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] match.pd: Implement missed optimization (~X | Y) ^ X -> ~(X & Y) [PR109986]
Date: Thu, 6 Jul 2023 21:51:46 +0200	[thread overview]
Message-ID: <ZKcbUgUMoP0O91FF@tucnak> (raw)
In-Reply-To: <CAFiYyc0J95EveoqKahTKj+o-yzSQoVeXSAM2=QxkG7uhw8WU_g@mail.gmail.com>

On Thu, Jul 06, 2023 at 03:00:28PM +0200, Richard Biener via Gcc-patches wrote:
> > +  (if (types_match (type, @1))
> > +   (bit_not (bit_and @1 (convert @0)))
> > +   (if (types_match (type, @0))
> > +    (bit_not (bit_and (convert @1) @0))
> > +    (convert (bit_not (bit_and @0 (convert @1)))))))
> 
> You can elide the types_match checks and instead always emit
> 
>   (convert (bit_not (bit_and @0 (convert @1)))
> 
> the conversions are elided when the types match.

If all types match, sure, any of the variants will be good.
But if say @1 matches type and doesn't match @0, then
(convert (bit_not (bit_and @0 (convert @1)))
will result in 2 conversions instead of just 1.
Of course, it could be alternatively solved by some other simplify
that would reduce the number of conversions.

	Jakub


  reply	other threads:[~2023-07-06 19:51 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-05 13:41 Drew Ross
2023-07-06 13:00 ` Richard Biener
2023-07-06 19:51   ` Jakub Jelinek [this message]
2023-07-11 13:08   ` Jakub Jelinek
2023-07-11 13:58     ` Richard Biener
2023-07-19 13:17       ` Drew Ross
2023-07-25 19:42 David Edelsohn
2023-07-25 19:44 ` Jakub Jelinek
2023-07-25 20:54   ` Andrew Pinski
2023-07-25 21:58     ` Andrew Pinski
2023-07-26 13:37       ` Drew Ross

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZKcbUgUMoP0O91FF@tucnak \
    --to=jakub@redhat.com \
    --cc=drross@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=richard.guenther@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).