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/99591] Improving __builtin_add_overflow performance on x86-64 Date: Thu, 02 Sep 2021 09:26:31 +0000 [thread overview] Message-ID: <bug-99591-4-QkziJog5eV@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-99591-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99591 --- Comment #7 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:2af6dd77ea742d4ee911f466878624972929508a commit r12-3312-g2af6dd77ea742d4ee911f466878624972929508a Author: Jakub Jelinek <jakub@redhat.com> Date: Thu Sep 2 11:25:07 2021 +0200 match.pd: Demote IFN_{ADD,SUB,MUL}_OVERFLOW operands [PR99591] The overflow builtins work on infinite precision integers and then convert to the result type's precision, so any argument promotions are useless. The expand_arith_overflow expansion is able to demote the arguments itself through get_range_pos_neg and get_min_precision calls and if needed promote to whatever mode it decides to perform the operations in, but if there are any promotions it demoted, those are already expanded. Normally combine would remove the useless sign or zero extensions when it sees the result of those is only used in a lowpart subreg, but typically those lowpart subregs appear multiple times in the pattern so that they describe properly the overflow behavior and combine gives up, so we end up with e.g. movswl %si, %esi movswl %di, %edi imulw %si, %di seto %al where both movswl insns are useless. The following patch fixes it by demoting operands of the ifns (only gets rid of integral to integral conversions that increase precision). While IFN_{ADD,MUL}_OVERFLOW are commutative and just one simplify would be enough, IFN_SUB_OVERFLOW is not, therefore two simplifications. 2021-09-02 Jakub Jelinek <jakub@redhat.com> PR tree-optimization/99591 * match.pd: Demote operands of IFN_{ADD,SUB,MUL}_OVERFLOW if they were promoted. * gcc.target/i386/pr99591.c: New test. * gcc.target/i386/pr97950.c: Match or reject setb or jn?b instructions together with seta or jn?a.
next prev parent reply other threads:[~2021-09-02 9:26 UTC|newest] Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-03-15 8:46 [Bug target/99591] New: " eggert at gnu dot org 2021-09-01 5:30 ` [Bug target/99591] " pinskia at gcc dot gnu.org 2021-09-01 5:32 ` pinskia at gcc dot gnu.org 2021-09-01 7:44 ` eggert at cs dot ucla.edu 2021-09-01 7:57 ` [Bug c/99591] " pinskia at gcc dot gnu.org 2021-09-01 8:16 ` jakub at gcc dot gnu.org 2021-09-01 8:53 ` [Bug tree-optimization/99591] " jakub at gcc dot gnu.org 2021-09-02 9:26 ` cvs-commit at gcc dot gnu.org [this message] 2021-09-02 9:29 ` jakub 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-99591-4-QkziJog5eV@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).