From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 665A23858D28; Sun, 9 Apr 2023 23:33:40 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 665A23858D28 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1681083220; bh=pa2KPYmgBWIrg0Ga1PzUnwm/w4dGbb6uClEA3mK0IC0=; h=From:To:Subject:Date:In-Reply-To:References:From; b=tXquHBFlvQ3WR9jGPNg43OSxXwWPUqyNTUKxaJO4bw+6iujuuVLrC1JtiL/fpdPjZ g6/gXLmY/ZiBWQFAQn+6UpgKT4Gq0F+/aM5Snifbqmh9rSceVJtHTtrEx5Idy0pA6W mDFIoZcoBMz3YmVPQWIEsvYEWyV1bVU+gIqK3Vqc= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/68894] Recognition min/max pattern with multiple arguments. Date: Sun, 09 Apr 2023 23:33:39 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 6.0 X-Bugzilla-Keywords: missed-optimization, TREE X-Bugzilla-Severity: enhancement X-Bugzilla-Who: pinskia at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: pinskia at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: assigned_to bug_status Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D68894 Andrew Pinski changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|unassigned at gcc dot gnu.org |pinskia at gcc dot = gnu.org Status|NEW |ASSIGNED --- Comment #7 from Andrew Pinski --- Mine, working on improving phi-opt here; though the hoisting of the load is something which needs to be looked into further. I have the match.pd pattern for what is mentioned in comment #3: /* These was part of minmax phiopt. */ /* Optimize (a CMP b) ? minmax : minmax to minmax, c> */ (for minmax (min max) (for cmp (lt le gt ge) (simplify (cond (cmp @1 @3) (minmax:c @1 @4) (minmax:c @2 @4)) (with { tree_code code =3D minmax_from_comparison (cmp, @1, @2, @1, @3); } (if (code =3D=3D MIN_EXPR) (minmax (min @1 @2) @4) (if (code =3D=3D MAX_EXPR) (minmax (max @1 @2) @4))))))) I also have the improvements to match_simplify_replacement which are needed= to use those patterns too. I will be submitting them for GCC 14.=