From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 01A723896C18; Fri, 21 Jun 2024 06:43:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 01A723896C18 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1718952183; bh=ni8mzmcN7bYt7SZQZiYpyLaxmJtV+QvMA4gXbofrFpY=; h=From:To:Subject:Date:In-Reply-To:References:From; b=g0dbhWahlXPYK+uj4zrQ21UpstbsImC9fQ0YnbVs2zYp++Usu/7ZbVEsOAH4PFPAI dvgHakiYrJ08c2SAgEeR2zBGlh/bExKkbfhnhwJGJZFMDEfkAtwYsz8nq7qd1lDKi3 4oBAU6AjstPTwepYhqcnk4spH/OLgRQNQwFQVJIY= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/68855] PAREN_EXPR not "ignored" where possible Date: Fri, 21 Jun 2024 06:43:01 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Version: 6.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: enhancement X-Bugzilla-Who: cvs-commit 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: 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=3D68855 --- Comment #11 from GCC Commits --- The trunk branch has been updated by Andrew Pinski : https://gcc.gnu.org/g:59221dc587f369695d9b0c2f73aedf8458931f0f commit r15-1508-g59221dc587f369695d9b0c2f73aedf8458931f0f Author: Andrew Pinski Date: Thu Jun 20 15:52:05 2024 -0700 complex-lowering: Better handling of PAREN_EXPR [PR68855] When PAREN_EXPR tree code was added in r0-85884-gdedd42d511b6e4, a simplified handling was added to complex lowering. Which means we would get: ``` _9 =3D COMPLEX_EXPR <_15, _14>; _11 =3D ((_9)); _19 =3D REALPART_EXPR <_11>; _20 =3D IMAGPART_EXPR <_11>; ``` In many cases instead of just simply: ``` _19 =3D ((_15)); _20 =3D ((_14)); ``` So this adds full support for PAREN_EXPR to complex lowering. It is handled very similar as NEGATE_EXPR; except creating PAREN_EXPR instead of NEGATE_EXPR for the real/imag parts. This allows for more optimizations including vectorization, especially with -ffast-math. gfortran.dg/vect/pr68855.f90 is an example where this could show up. It also shows up in SPEC CPU 2006's 465.tonto; though I have not done any benchmarking there. Bootstrapped and tested on x86_64-linux-gnu with no regressions. gcc/ChangeLog: PR tree-optimization/68855 * tree-complex.cc (init_dont_simulate_again): Handle PAREN_EXPR like NEGATE_EXPR. (complex_propagate::visit_stmt): Likewise. (expand_complex_move): Don't handle PAREN_EXPR. (expand_complex_paren): New function. (expand_complex_operations_1): Handle PAREN_EXPR like NEGATE_EXPR. And call expand_complex_paren for PAREN_EXPR. gcc/testsuite/ChangeLog: * gcc.dg/vect/pr68855.c: New test. * gfortran.dg/vect/pr68855.f90: New test. Signed-off-by: Andrew Pinski =