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/114853] Inefficient code with a bunch of bitwise checks Date: Thu, 25 Apr 2024 17:47:38 +0000 [thread overview] Message-ID: <bug-114853-4-KqaLLr1PpW@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-114853-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114853 Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Component|tree-optimization |middle-end --- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> --- So what is happening is there is a missed Canonicalization happening here at the gimple level and only at the RTL level we decide to expand `(num & 7LL) == 7LL` as `((~num) & 7) == 0` (for x86_64). For aarch64 we expand still as `(num &7) == 7`. So we should pick one for the gimple level and then expand it and also actually do better CSE of `~num` for the RTL level. The other thing GCC should do better at is handle: ``` bool checko(long long num) { if((num & 7LL) == 7LL) return true; if((num & 22LL) == 22LL) return true; return false; } ``` Into: ``` and x1, x0, 7 mov x2, 22 cmp x1, 7 and x0, x0, x2 ccmp x0, x2, 4, ne cset w0, eq ``` For aarch64. I have an idea there ...
prev parent reply other threads:[~2024-04-25 17:47 UTC|newest] Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top 2024-04-25 13:05 [Bug c++/114853] New: " gh228df at gmail dot com 2024-04-25 13:40 ` [Bug tree-optimization/114853] " rguenth at gcc dot gnu.org 2024-04-25 15:42 ` pinskia at gcc dot gnu.org 2024-04-25 15:48 ` pinskia at gcc dot gnu.org 2024-04-25 17:47 ` pinskia at gcc dot gnu.org [this message]
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-114853-4-KqaLLr1PpW@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: linkBe 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).