public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug target/97503] Suboptimal use of cntlzw and cntlzd Date: Wed, 21 Oct 2020 08:54:54 +0000 [thread overview] Message-ID: <bug-97503-4-c22fCm37fv@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-97503-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97503 --- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>: https://gcc.gnu.org/g:5244b4af5e47bc98a2a9cf36f048981583a1b163 commit r11-4183-g5244b4af5e47bc98a2a9cf36f048981583a1b163 Author: Jakub Jelinek <jakub@redhat.com> Date: Wed Oct 21 10:51:33 2020 +0200 phiopt: Optimize x ? __builtin_clz (x) : 32 in GIMPLE [PR97503] While we have at the RTL level noce_try_ifelse_collapse combined with simplify_cond_clz_ctz, that optimization doesn't always trigger because e.g. on powerpc there is an define_insn to compare a reg against zero and copy that register to another one and so we end up with a different pseudo in the simplify_cond_clz_ctz test and punt. For targets that define C?Z_DEFINED_VALUE_AT_ZERO to 2 for certain modes, we can optimize it already in phiopt though, just need to ensure that we transform the __builtin_c?z* calls into .C?Z ifns because my recent VRP changes codified that the builtin calls are always undefined at zero, while ifns honor C?Z_DEFINED_VALUE_AT_ZERO equal to 2. And, in phiopt we already have popcount handling that does pretty much the same thing, except for always using a zero value rather than the one set by C?Z_DEFINED_VALUE_AT_ZERO. So, this patch extends that function to handle not just popcount, but also clz and ctz. 2020-10-21 Jakub Jelinek <jakub@redhat.com> PR tree-optimization/97503 * tree-ssa-phiopt.c: Include internal-fn.h. (cond_removal_in_popcount_pattern): Rename to ... (cond_removal_in_popcount_clz_ctz_pattern): ... this. Handle not just popcount, but also clz and ctz if it has C?Z_DEFINED_VALUE_AT_ZERO 2. * gcc.dg/tree-ssa/pr97503.c: New test.
next prev parent reply other threads:[~2020-10-21 8:54 UTC|newest] Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-10-20 14:44 [Bug c/97503] New: " christophe.leroy at csgroup dot eu 2020-10-20 16:25 ` [Bug c/97503] " jakub at gcc dot gnu.org 2020-10-20 16:49 ` jakub at gcc dot gnu.org 2020-10-21 8:54 ` cvs-commit at gcc dot gnu.org [this message] 2023-11-09 5:59 ` [Bug target/97503] " lh_mouse at 126 dot com 2023-11-09 6:05 ` lh_mouse at 126 dot com 2023-11-09 16:51 ` ubizjak at gmail dot com 2023-11-09 16:53 ` ubizjak at gmail dot com 2023-11-27 8:14 ` lh_mouse at 126 dot com
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-97503-4-c22fCm37fv@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).