public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "wilco at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug target/113618] New: [14 Regression] AArch64: memmove idiom regression Date: Fri, 26 Jan 2024 14:49:54 +0000 [thread overview] Message-ID: <bug-113618-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113618 Bug ID: 113618 Summary: [14 Regression] AArch64: memmove idiom regression Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: wilco at gcc dot gnu.org Target Milestone: --- The following is often used as an idiom for memmove since GCC mid-end and most back-ends have no support for inlining memmove: void move64 (char *a, char *b) { char temp[64]; memcpy (temp, a, 64); memcpy (b, temp, 64); } On trunk this generates: ldp q30, q31, [x0] sub sp, sp, #64 ldp q28, q29, [x0, 32] stp q30, q31, [sp] ldp q30, q31, [sp] stp q28, q29, [sp, 32] ldp q28, q29, [sp, 32] stp q30, q31, [x1] stp q28, q29, [x1, 32] add sp, sp, 64 ret This is a significant regression from GCC13 which has redundant stores but avoids load-after-store forwarding penalties: ldp q2, q3, [x0] sub sp, sp, #64 ldp q0, q1, [x0, 32] stp q2, q3, [sp] stp q2, q3, [x1] stp q0, q1, [sp, 32] stp q0, q1, [x1, 32] add sp, sp, 64 ret LLVM avoids writing to the temporary and removes the stackframe altogether: ldp q1, q0, [x0, #32] ldp q2, q3, [x0] stp q1, q0, [x1, #32] stp q2, q3, [x1] ret The reason for the regression appears to be the changed RTL representation of LDP/STP. The RTL optimizer does not understand LDP/STP, so emitting LDP/STP early in memcpy expansion means it cannot remove the redundant stack stores. A possible fix would be to avoid emitting LDP/STP in memcpy/memmove/memset expansions.
next reply other threads:[~2024-01-26 14:49 UTC|newest] Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top 2024-01-26 14:49 wilco at gcc dot gnu.org [this message] 2024-01-26 15:05 ` [Bug target/113618] " acoplan at gcc dot gnu.org 2024-01-26 16:51 ` pinskia at gcc dot gnu.org 2024-01-29 7:55 ` rguenth at gcc dot gnu.org 2024-01-29 11:51 ` wilco at gcc dot gnu.org 2024-01-31 16:58 ` wilco at gcc dot gnu.org 2024-03-07 20:44 ` law at gcc dot gnu.org 2024-03-07 21:25 ` cvs-commit at gcc dot gnu.org 2024-03-13 14:36 ` wilco at gcc dot gnu.org
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-113618-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).