From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 48F8F3858D3C; Sun, 3 Oct 2021 14:01:34 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 48F8F3858D3C From: "gabravier at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/102575] New: Failure to optimize double _Complex stores to use largest loads/stores possible Date: Sun, 03 Oct 2021 14:01:34 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 12.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: gabravier at gmail dot com X-Bugzilla-Status: UNCONFIRMED 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: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: 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, 03 Oct 2021 14:01:34 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D102575 Bug ID: 102575 Summary: Failure to optimize double _Complex stores to use largest loads/stores possible Product: gcc Version: 12.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: gabravier at gmail dot com Target Milestone: --- void test(double _Complex *a) { a[0] =3D 1; a[1] =3D 1; } With -O3, on AMD64 GCC outputs this: test(double _Complex*): movsd xmm1, QWORD PTR .LC0[rip] movsd xmm0, QWORD PTR .LC0[rip+8] movsd QWORD PTR [rdi], xmm1 movsd QWORD PTR [rdi+8], xmm0 movsd QWORD PTR [rdi+16], xmm1 movsd QWORD PTR [rdi+24], xmm0 ret Clang instead outputs this: test(double _Complex*): movsd xmm0, qword ptr [rip + .LCPI0_0] # xmm0 =3D mem[0],zero movups xmmword ptr [rdi], xmm0 movups xmmword ptr [rdi + 16], xmm0 ret It seems to me like the second output should always be faster. PS: The difference is even larger with `-mavx2`.=