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] [14 Regression] AArch64: memmove idiom regression
Date: Mon, 29 Jan 2024 11:51:28 +0000	[thread overview]
Message-ID: <bug-113618-4-byabT3LpGv@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-113618-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113618

--- Comment #3 from Wilco <wilco at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #2)
> It might be good to recognize this pattern in strlenopt or a related pass.
> 
> A purely local transform would turn it into
> 
>     memcpy (temp, a, 64);
>     memmove (b, a, 64);
> 
> relying on DSE to eliminate the copy to temp if possible.  Not sure if
> that possibly would be a bad transform if copying to temp is required.

This would only be beneficial if you know memmove is inlined if memcpy is - on
almost all targets memmove becomes a library call, so the transformation would
be worse if memcpy can be inlined.

>         stp     q30, q31, [sp]
>         ldp     q30, q31, [sp]
> 
> why is CSE not able to catch this?

The new RTL now has UNSPECs in them, so CSE doesn't know it is a plain
load/store:

STP: 

(insn 12 11 13 2 (set (mem/c:V2x16QI (reg:DI 102) [0 +0 S32 A128])
        (unspec:V2x16QI [
                (reg:V4SI 104)
                (reg:V4SI 105)
            ] UNSPEC_STP)) "/app/example.c":5:5 -1
     (nil))

LDP:

(insn 16 15 17 2 (parallel [
            (set (reg:V4SI 108)
                (unspec:V4SI [
                        (mem/c:V2x16QI (reg:DI 107) [0 +0 S32 A128])
                    ] UNSPEC_LDP_FST))
            (set (reg:V4SI 109)
                (unspec:V4SI [
                        (mem/c:V2x16QI (reg:DI 107) [0 +0 S32 A128])
                    ] UNSPEC_LDP_SND))
        ]) "/app/example.c":6:5 -1
     (nil))

  parent reply	other threads:[~2024-01-29 11:51 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-26 14:49 [Bug target/113618] New: " wilco at gcc dot gnu.org
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 [this message]
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-byabT3LpGv@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: link
Be 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).