| 1 |
/* Test AAPCS layout (alignment) for callee. */ |
| 2 |
|
| 3 |
/* { dg-do run { target aarch64*-*-* } } */ |
| 4 |
|
| 5 |
extern int memcmp (const void *s1, const void *s2, __SIZE_TYPE__ n); |
| 6 |
extern void abort (void); |
| 7 |
|
| 8 |
/* The alignment also gives this size 32, so will be passed by reference. */ |
| 9 |
typedef struct __attribute__ ((__aligned__ (32))) |
| 10 |
{ |
| 11 |
long x; |
| 12 |
long y; |
| 13 |
} overaligned; |
| 14 |
|
| 15 |
overaligned a = { 2, 3 }; |
| 16 |
|
| 17 |
void |
| 18 |
test_pass_by_ref (int x0, overaligned x1, int x2) |
| 19 |
{ |
| 20 |
if (x0 != 7 || x2 != 9) |
| 21 |
abort (); |
| 22 |
if (memcmp ((void *) &x1, (void *)&a, sizeof (overaligned))) |
| 23 |
abort (); |
| 24 |
long addr = ((long) &x1) & 31; |
| 25 |
if (addr != 0) |
| 26 |
{ |
| 27 |
__builtin_printf ("Alignment was %d\n", addr); |
| 28 |
abort (); |
| 29 |
} |
| 30 |
} |
| 31 |
|
| 32 |
int |
| 33 |
main (int argc, char **argv) |
| 34 |
{ |
| 35 |
test_pass_by_ref (7, a, 9); |
| 36 |
return 0; |
| 37 |
} |