public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "pinskia at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/68894] Recognition min/max pattern with multiple arguments. Date: Mon, 24 Apr 2023 19:06:53 +0000 [thread overview] Message-ID: <bug-68894-4-qlNX02HgzL@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-68894-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68894 --- Comment #12 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Just a quick note on this part of the bug report: (In reply to Richard Biener from comment #3) > Doing this in a classical way in phi-opt might end up being slightly > convoluted. > So I'd propose to try to utilize match-and-simplify by adding > > > (cond (ge @0 @1) (max:s @0 @2) (max:s @1 @2)) > -> (max (max @0 @1) @2) I am going to submit patches for the above later today or tomorrow. > > kind patterns and from phiopt doing exploded queries of this simplification > by seeding the cond expr from the dominating condition plus the PHI operands. > > res = gimple_simplify (COND_EXPR, build2 /* Ick */ (cond-code, > boolean_type, cond-op0, cond-op1), true-phi-arg, false-phi-arg, &seq, > follow_single_use_edges); > > of course you need more than a single pattern or consider swapped ops 2 and 3 > (not yet supported). In the end explicit pattern explosion might make a > manual > implementation in phiopt easier (who knows). This part is fully implemented in r14-204-gf1f5cbaa3f716fcb472dee5 (there was a few pieces of the match-and-simplify phiopt implemented in GCC 12). Note phiopt already does "a ? b : c" -> "!a ? c : b" (where !a folds) (implemented in r12-2040-ga50cecb20a10) specifically because of the explosion issue.
next prev parent reply other threads:[~2023-04-24 19:06 UTC|newest] Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top [not found] <bug-68894-4@http.gcc.gnu.org/bugzilla/> 2023-04-09 23:33 ` pinskia at gcc dot gnu.org 2023-04-09 23:50 ` pinskia at gcc dot gnu.org 2023-04-10 22:11 ` pinskia at gcc dot gnu.org 2023-04-24 15:50 ` cvs-commit at gcc dot gnu.org 2023-04-24 15:57 ` pinskia at gcc dot gnu.org 2023-04-24 19:06 ` pinskia at gcc dot gnu.org [this message] 2023-04-28 14:55 ` 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-68894-4-qlNX02HgzL@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).