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