https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120964
Bug ID: 120964
Summary: aarch64 be failed with pr78542.c
Product: gcc
Version: 14.3.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: hanwei62 at huawei dot com
Target Milestone: ---
target: aarch64 big-endian
compile option: -O0
Hi, i found gcc 14.3 could not pass pr78542.c
souce code:
/* { dg-do run } */
/* { dg-additional-options "-w -Wno-psabi" } */
#include <stdio.h>
typedef unsigned V __attribute__ ((vector_size (16)));
V
foo (unsigned x, V v)
{
do {
v %= x;
x = 1;
} while (v[1]);
return v;
}
int
main ()
{
V x = foo (5, (V) { 0, 1 }); //{0, 1, 0, 0}
printf("x[0]: %d, x[1]: %d, x[2]: %d, x[3]: %d\n", x[0], x[1], x[2], x[3]);
if (x[0] || x[1] || x[2] || x[3])
__builtin_abort();
return 0;
}
qemu result
gcc 14.3: x[0]: 1, x[1]: 0, x[2]: 0, x[3]: 0
gcc 7.3: x[0]: 0, x[1]: 0, x[2]: 0, x[3]: 0
When I examined the assembly code, I found that the issue might lie with the
zip1 instruction. GCC 14.3 little endian is ok with pr78542.c。It is possible
that the GCC 14.3 code generation phase did not adapt the zip1 instruction for
big-endian systems.
https://godbolt.org/z/T9qx1ve6v
thanks
