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/19832] don't remove an if when we know the value is the same as with the if (subtraction) Date: Fri, 01 Sep 2023 06:58:10 +0000 [thread overview] Message-ID: <bug-19832-4-Hc70CorR0r@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-19832-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=19832 --- Comment #11 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:3d86e7f4a8aef1b864a51660825597eafe9059b1 commit r14-3606-g3d86e7f4a8aef1b864a51660825597eafe9059b1 Author: Andrew Pinski <apinski@marvell.com> Date: Wed Aug 30 21:21:01 2023 -0700 MATCH [PR19832]: Optimize some `(a != b) ? a OP b : c` This patch adds the following match patterns to optimize these: /* (a != b) ? (a - b) : 0 -> (a - b) */ /* (a != b) ? (a ^ b) : 0 -> (a ^ b) */ /* (a != b) ? (a & b) : a -> (a & b) */ /* (a != b) ? (a | b) : a -> (a | b) */ /* (a != b) ? min(a,b) : a -> min(a,b) */ /* (a != b) ? max(a,b) : a -> max(a,b) */ /* (a != b) ? (a * b) : (a * a) -> (a * b) */ /* (a != b) ? (a + b) : (a + a) -> (a + b) */ /* (a != b) ? (a + b) : (2 * a) -> (a + b) */ Note currently only integer types (include vector types) are handled. Floating point types can be added later on. OK? Bootstrapped and tested on x86_64-linux-gnu. The first pattern had still shows up in GCC in cse.c's preferable function which was the original motivation for this patch. PR tree-optimization/19832 gcc/ChangeLog: * match.pd: Add pattern to optimize `(a != b) ? a OP b : c`. gcc/testsuite/ChangeLog: * g++.dg/opt/vectcond-1.C: New test. * gcc.dg/tree-ssa/phi-opt-same-1.c: New test.
next prev parent reply other threads:[~2023-09-01 6:58 UTC|newest] Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top [not found] <bug-19832-4@http.gcc.gnu.org/bugzilla/> 2011-08-13 1:39 ` jimis at gmx dot net 2011-08-13 2:21 ` jimis at gmx dot net 2012-08-06 11:41 ` rguenth at gcc dot gnu.org 2023-05-06 21:15 ` pinskia at gcc dot gnu.org 2023-05-06 23:12 ` pinskia at gcc dot gnu.org 2023-05-06 23:13 ` pinskia at gcc dot gnu.org 2023-08-31 1:03 ` pinskia at gcc dot gnu.org 2023-08-31 4:48 ` pinskia at gcc dot gnu.org 2023-08-31 18:03 ` pinskia at gcc dot gnu.org 2023-09-01 6:58 ` cvs-commit at gcc dot gnu.org [this message] 2023-09-01 6:58 ` pinskia at gcc dot gnu.org 2023-09-01 12:23 ` cvs-commit at gcc dot gnu.org 2023-12-25 4:02 ` cvs-commit at gcc dot gnu.org 2005-02-09 7:41 [Bug c/19832] New: Missed optimisation christophe dot jaillet at wanadoo dot fr 2005-02-09 7:46 ` [Bug tree-optimization/19832] don't remove an if when we know the value is the same as with the if (subtraction) pinskia at gcc dot gnu dot 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-19832-4-Hc70CorR0r@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).