[Bug middle-end/89544] Argument marshalling incorrectly assumes stack slots are naturally aligned.
bernd.edlinger at hotmail dot de
gcc-bugzilla@gcc.gnu.org
Sat Aug 17 07:15:00 GMT 2019
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89544
--- Comment #6 from Bernd Edlinger <bernd.edlinger at hotmail dot de> ---
This is half fixed now:
Since r274531 the original test case no longer generates wrong code,
but only slightly non-optimal code.
I had so far two test cases:
$ cat unaligned-argument-1.c
/* { dg-do compile } */
/* { dg-require-effective-target arm_arm_ok } */
/* { dg-require-effective-target arm_ldrd_strd_ok } */
/* { dg-options "-marm -mno-unaligned-access -O3" } */
struct s {
int a, b;
} __attribute__((aligned(8)));
struct s f0;
void f(int a, int b, int c, int d, struct s f)
{
f0 = f;
}
/* { dg-final { scan-assembler-times "ldrd" 1 } } */
/* { dg-final { scan-assembler-times "strd" 1 } } */
/* { dg-final { scan-assembler-times "stm" 0 } } */
$ cat unaligned-argument-2.c
/* { dg-do compile } */
/* { dg-require-effective-target arm_arm_ok } */
/* { dg-require-effective-target arm_ldrd_strd_ok } */
/* { dg-options "-marm -mno-unaligned-access -O3" } */
struct s {
int a, b;
} __attribute__((aligned(8)));
struct s f0;
void f(int a, int b, int c, int d, int e, struct s f)
{
f0 = f;
}
/* { dg-final { scan-assembler-times "ldrd" 0 } } */
/* { dg-final { scan-assembler-times "strd" 0 } } */
/* { dg-final { scan-assembler-times "stm" 1 } } */
the remaining issue is that the fist one should generate ldrd/strd
instead of stm.
More information about the Gcc-bugs
mailing list