public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "michael.kenzel at gmail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/115351] New: [14 regression] pointless movs when passing by value on x86-64 Date: Wed, 05 Jun 2024 03:14:54 +0000 [thread overview] Message-ID: <bug-115351-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115351 Bug ID: 115351 Summary: [14 regression] pointless movs when passing by value on x86-64 Product: gcc Version: 14.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: michael.kenzel at gmail dot com Target Milestone: --- When passing structs of certain shape by value on x86-64 (seems to be specific to this target), gcc 14 emits (fails to optimize away?) a number of redundant moves: struct complex { double real; double imag; }; complex blub(complex z) { return { z.real * z.real - z.imag * z.imag, 2 * z.real * z.imag }; } on gcc 13 with -O3 results in blub(complex): movapd xmm3, xmm1 movapd xmm2, xmm0 mulsd xmm3, xmm1 addsd xmm2, xmm2 mulsd xmm0, xmm0 mulsd xmm1, xmm2 subsd xmm0, xmm3 ret gcc 14 and later with -O3 emit blub(complex): movq rax, xmm1 movq rdx, xmm0 xchg rdx, rax movq xmm2, rax movq xmm1, rdx movapd xmm0, xmm2 movapd xmm3, xmm1 mulsd xmm3, xmm1 mulsd xmm0, xmm2 addsd xmm2, xmm2 mulsd xmm1, xmm2 subsd xmm0, xmm3 ret godbolt: https://godbolt.org/z/hzEfs3ob4
next reply other threads:[~2024-06-05 3:14 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top 2024-06-05 3:14 michael.kenzel at gmail dot com [this message] 2024-06-05 7:10 ` [Bug rtl-optimization/115351] [14/15 " rguenth at gcc dot gnu.org 2024-06-05 7:21 ` liuhongt at gcc dot gnu.org 2024-06-05 23:33 ` [Bug target/115351] " roger at nextmovesoftware dot com 2024-06-07 13:04 ` cvs-commit at gcc dot gnu.org 2024-06-08 14:51 ` [Bug target/115351] [14 " roger at nextmovesoftware dot com
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-115351-4@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).