public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/99960] New: MVE: Wrong code storing V2DI vector
@ 2021-04-07 15:41 acoplan at gcc dot gnu.org
  2021-04-07 21:19 ` [Bug target/99960] " acoplan at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: acoplan at gcc dot gnu.org @ 2021-04-07 15:41 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 99960
           Summary: MVE: Wrong code storing V2DI vector
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: acoplan at gcc dot gnu.org
  Target Milestone: ---

For the following testcase:

typedef long long v2di __attribute((vector_size(16)));
void foo(v2di *p)
{
  *p = (v2di){ 1, 2 };
}

we miscompile it at -O2 -march=armv8.1-m.main+mve -mfloat-abi=hard. Looking at
the generated code:

foo:
        @ args = 0, pretend = 0, frame = 0
        @ frame_needed = 0, uses_anonymous_args = 0
        @ link register save eliminated.
        vldr.64 d6, .L3
        vldr.64 d7, .L3+8
        vstr.64 d6, [r0]
        bx      lr
.L4:
        .align  3
.L3:
        .word   1
        .word   0
        .word   2
        .word   0
        .size   foo, .-foo

it looks like we're missing a store of d7. Here's a full testcase:

typedef long long v2di __attribute((vector_size(16)));

__attribute((noipa))
void stvec (v2di *p) {
  *p = (v2di){ 1, 2 };
}

int main () {
  v2di v;
  stvec(&v);
  if (v[1] != 2)
    __builtin_abort ();
}

I originally noticed this while investigating an execution failure for
gcc.c-torture/execute/pr92618.c. FWIW, clang does:

foo:
        adr     r1, .LCPI0_0
        vldrw.u32       q0, [r1]
        vstrw.32        q0, [r0]
        bx      lr
.LCPI0_0:
        .long   1                               @ 0x1
        .long   0                               @ 0x0
        .long   2                               @ 0x2
        .long   0                               @ 0x0

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

end of thread, other threads:[~2021-09-17  6:37 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-07 15:41 [Bug target/99960] New: MVE: Wrong code storing V2DI vector acoplan at gcc dot gnu.org
2021-04-07 21:19 ` [Bug target/99960] " acoplan at gcc dot gnu.org
2021-04-20  8:05 ` acoplan at gcc dot gnu.org
2021-05-10  8:47 ` cvs-commit at gcc dot gnu.org
2021-05-10  8:49 ` acoplan at gcc dot gnu.org
2021-05-24 13:58 ` cvs-commit at gcc dot gnu.org
2021-05-25 12:38 ` cvs-commit at gcc dot gnu.org
2021-05-25 12:38 ` acoplan at gcc dot gnu.org
2021-09-17  6:37 ` pinskia 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).