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/106164] (a > b) & (a >= b) does not get optimized until reassoc1 Date: Thu, 14 Sep 2023 14:30:23 +0000 [thread overview] Message-ID: <bug-106164-4-B0APKEBEp1@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-106164-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106164 --- Comment #17 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The trunk branch has been updated by Andrew Pinski <pinskia@gcc.gnu.org>: https://gcc.gnu.org/g:5e4a248b03f01f422b0dbc9e1464eb6c2f2bafc6 commit r14-3995-g5e4a248b03f01f422b0dbc9e1464eb6c2f2bafc6 Author: Andrew Pinski <apinski@marvell.com> Date: Wed Sep 13 16:50:33 2023 -0700 MATCH: Support `(a != (CST+1)) & (a > CST)` optimizations Even though this is done via reassocation, match can support these with a simple change to detect that the difference is just one. This allows to optimize these earlier and even during phiopt for an example. This patch adds the following cases: (a != (CST+1)) & (a > CST) -> a > (CST+1) (a != (CST-1)) & (a < CST) -> a < (CST-1) (a == (CST-1)) | (a >= CST) -> a >= (CST-1) (a == (CST+1)) | (a <= CST) -> a <= (CST+1) Canonicalizations of comparisons causes this case to show up more. OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions. PR tree-optimization/106164 gcc/ChangeLog: * match.pd (`(X CMP1 CST1) AND/IOR (X CMP2 CST2)`): Expand to support constants that are off by one. gcc/testsuite/ChangeLog: * gcc.dg/pr21643.c: Update test now that match does the combing of the comparisons. * gcc.dg/tree-ssa/cmpbit-5.c: New test. * gcc.dg/tree-ssa/phi-opt-35.c: New test.
next prev parent reply other threads:[~2023-09-14 14:30 UTC|newest] Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-07-01 22:39 [Bug tree-optimization/106164] New: " pinskia at gcc dot gnu.org 2022-07-01 23:45 ` [Bug tree-optimization/106164] " pinskia at gcc dot gnu.org 2022-07-02 4:22 ` pinskia at gcc dot gnu.org 2022-07-02 4:23 ` pinskia at gcc dot gnu.org 2022-07-02 5:12 ` pinskia at gcc dot gnu.org 2022-07-04 6:38 ` rguenth at gcc dot gnu.org 2023-07-29 23:53 ` pinskia at gcc dot gnu.org 2023-07-30 3:00 ` pinskia at gcc dot gnu.org 2023-07-30 3:47 ` pinskia at gcc dot gnu.org 2023-07-30 5:09 ` pinskia at gcc dot gnu.org 2023-07-31 5:37 ` pinskia at gcc dot gnu.org 2023-07-31 7:08 ` rguenther at suse dot de 2023-07-31 17:12 ` cvs-commit at gcc dot gnu.org 2023-07-31 17:12 ` cvs-commit at gcc dot gnu.org 2023-09-14 0:09 ` pinskia at gcc dot gnu.org 2023-09-14 0:38 ` pinskia at gcc dot gnu.org 2023-09-14 5:34 ` pinskia at gcc dot gnu.org 2023-09-14 14:30 ` cvs-commit at gcc dot gnu.org [this message] 2023-09-14 14:36 ` pinskia at gcc dot gnu.org 2023-09-19 0:36 ` pinskia at gcc dot gnu.org 2023-09-19 2:46 ` pinskia at gcc dot gnu.org 2023-09-20 22:41 ` pinskia at gcc dot gnu.org 2023-09-26 15:01 ` cvs-commit at gcc dot gnu.org 2023-11-05 6:08 ` pinskia at gcc dot gnu.org 2023-11-05 6:10 ` 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-106164-4-B0APKEBEp1@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).