public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/111121] New: AArch64: MOPS memmove operand corruption
@ 2023-08-23 14:25 wilco at gcc dot gnu.org
  2023-08-23 14:26 ` [Bug target/111121] " wilco at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: wilco at gcc dot gnu.org @ 2023-08-23 14:25 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 111121
           Summary: AArch64: MOPS memmove operand corruption
           Product: gcc
           Version: 12.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: ---

Since GCC 12.0 the following example corrupts x0 when built with -O2
-march=armv8.6-a+mops:

int *f (int *p, int *q, long n) { memmove (p, q, n); return p; }

f:
        cpyp    [x0]!, [x1]!, x2!
        cpym    [x0]!, [x1]!, x2!
        cpye    [x0]!, [x1]!, x2!
        ret

The expansion for memcpy works differently and inserts a copy to a temporary.

-mstrict-align is ignored with small constant-sized memcpy if MOPS is enabled:

void g(int *p, int *q) { memcpy (p, q, 32); }

g:
        ldp     q0, q1, [x1]
        stp     q0, q1, [x0]
        ret

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2023-09-29 12:25 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-23 14:25 [Bug target/111121] New: AArch64: MOPS memmove operand corruption wilco at gcc dot gnu.org
2023-08-23 14:26 ` [Bug target/111121] " wilco at gcc dot gnu.org
2023-08-23 14:26 ` wilco at gcc dot gnu.org
2023-08-23 17:34 ` pinskia at gcc dot gnu.org
2023-08-24  6:44 ` rguenth at gcc dot gnu.org
2023-09-28 15:34 ` cvs-commit at gcc dot gnu.org
2023-09-29 12:14 ` cvs-commit at gcc dot gnu.org
2023-09-29 12:15 ` cvs-commit at gcc dot gnu.org
2023-09-29 12:25 ` wilco at gcc dot gnu.org

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).