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 tree-optimization/106245] Failure to optimize (u8)(a << 7) >> 7 pattern to a & 1 Date: Fri, 20 Oct 2023 23:08:20 +0000 [thread overview] Message-ID: <bug-106245-4-GEqDXTnkJw@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-106245-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106245 --- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Roger Sayle <sayle@gcc.gnu.org>: https://gcc.gnu.org/g:e28869670c9879fe7c67caf6cc11af202509ef78 commit r14-4810-ge28869670c9879fe7c67caf6cc11af202509ef78 Author: Roger Sayle <roger@nextmovesoftware.com> Date: Sat Oct 21 00:06:02 2023 +0100 PR 106245: Split (x<<31)>>31 as -(x&1) in i386.md This patch is the backend piece of a solution to PRs 101955 and 106245, that adds a define_insn_and_split to the i386 backend, to perform sign extension of a single (least significant) bit using and $1 then neg. Previously, (x<<31)>>31 would be generated as sall $31, %eax // 3 bytes sarl $31, %eax // 3 bytes with this patch the backend now generates: andl $1, %eax // 3 bytes negl %eax // 2 bytes Not only is this smaller in size, but microbenchmarking confirms that it's a performance win on both Intel and AMD; Intel sees only a 2% improvement (perhaps just a size effect), but AMD sees a 7% win. 2023-10-21 Roger Sayle <roger@nextmovesoftware.com> Uros Bizjak <ubizjak@gmail.com> gcc/ChangeLog PR middle-end/101955 PR tree-optimization/106245 * config/i386/i386.md (*extv<mode>_1_0): New define_insn_and_split. gcc/testsuite/ChangeLog PR middle-end/101955 PR tree-optimization/106245 * gcc.target/i386/pr106245-2.c: New test case. * gcc.target/i386/pr106245-3.c: New 32-bit test case. * gcc.target/i386/pr106245-4.c: New 64-bit test case. * gcc.target/i386/pr106245-5.c: Likewise.
prev parent reply other threads:[~2023-10-20 23:08 UTC|newest] Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-07-10 9:30 [Bug tree-optimization/106245] New: " gabravier at gmail dot com 2022-07-10 19:46 ` [Bug tree-optimization/106245] " pinskia at gcc dot gnu.org 2023-10-11 7:09 ` cvs-commit at gcc dot gnu.org 2023-10-20 23:08 ` cvs-commit 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-106245-4-GEqDXTnkJw@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).