From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 8B2CF3858D1E; Sun, 6 Feb 2022 09:19:57 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8B2CF3858D1E From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/104405] Inefficient register allocation on complex arithmetic Date: Sun, 06 Feb 2022 09:19:57 +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: 12.0 X-Bugzilla-Keywords: missed-optimization, ra X-Bugzilla-Severity: normal X-Bugzilla-Who: pinskia at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cf_reconfirmed_on keywords everconfirmed 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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Feb 2022 09:19:57 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D104405 Andrew Pinski changed: What |Removed |Added ---------------------------------------------------------------------------- Last reconfirmed| |2022-02-06 Keywords| |ra Ever confirmed|0 |1 Status|UNCONFIRMED |NEW --- Comment #2 from Andrew Pinski --- This has nothing to do with expansion of IMAGPART_EXPR here but rather the reuturn side. Note the x86 issue is different from the aarch64 issue Here is a testcase which shows it is just return side related: _Complex double=20 f1 ( double ar, double ai, double br, double bi, double *t) { double _14, _16, _17, _3; _14 =3D ai * bi; _16 =3D ai * br; _17 =3D -(ar*br)+_14; _3 =3D (-(ar*bi)-_16); return __builtin_complex(_3, _17); } Also adding -fno-schedule-insns for the above testcase removes all of the e= xtra move instructions. The big question becomes now is really an issue in real world code or just a toy benchmark which is testing argument/return passing optimizations?=