public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "pinskia at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/54571] Missed optimization converting between bit sets
Date: Tue, 06 Jul 2021 08:39:30 +0000 [thread overview]
Message-ID: <bug-54571-4-QIb6o84FHY@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-54571-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54571
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #1)
> Confirmed. The natural place to optimize this is the tree level phiopt pass.
>
> <bb 2>:
> _3 = x_2(D) & 2;
> if (_3 != 0)
> goto <bb 3>;
> else
> goto <bb 4>;
>
> <bb 3>:
> y_5 = y_4(D) | 1;
>
> <bb 4>:
> # y_1 = PHI <y_4(D)(2), y_5(3)>
>
> where we should handle
>
> int f1(int x, int y, int d) { int tem; if ((tem = x & d)) y |= tem; return
> y; }
>
> as well. Yes, that's just y |= x & d, but it falls out naturally if the
> transform is implemented in a generic enough way.
This one should be easy to add to match.pd:
(simplify
(cond @1 (ior @2 INTEGER_CST@3) @2)
(ior @2 (bit_and (negate (convert @1)) @3)))
(bit_and (negate (convert thurth_value@1)) integer_onep)
should be just converted to:
@1
Which is not done right now, I fill that as a bug.
next prev parent reply other threads:[~2021-07-06 8:39 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-13 21:25 [Bug middle-end/54571] New: " rth at gcc dot gnu.org
2012-09-13 21:25 ` [Bug middle-end/54571] " rth at gcc dot gnu.org
2012-09-14 8:40 ` rguenth at gcc dot gnu.org
2021-07-06 8:39 ` pinskia at gcc dot gnu.org [this message]
2021-07-20 3:16 ` pinskia at gcc dot gnu.org
2021-11-15 0:52 ` pinskia at gcc dot gnu.org
2023-06-07 15:20 ` pinskia at gcc dot gnu.org
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=bug-54571-4-QIb6o84FHY@http.gcc.gnu.org/bugzilla/ \
--to=gcc-bugzilla@gcc.gnu.org \
--cc=gcc-bugs@gcc.gnu.org \
/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).