| 1 |
/* Test AAPCS layout (alignment) for callee. */ |
| 2 |
|
| 3 |
/* { dg-do run { target arm_eabi } } */ |
| 4 |
/* { dg-require-effective-target arm32 } */ |
| 5 |
/* { dg-options "-O2 -fno-inline" } */ |
| 6 |
|
| 7 |
/* Test AAPCS layout (alignment) for callee. */ |
| 8 |
|
| 9 |
extern int memcmp (const void *s1, const void *s2, __SIZE_TYPE__ n); |
| 10 |
extern void abort (void); |
| 11 |
|
| 12 |
|
| 13 |
/* Struct will be aligned to 8. */ |
| 14 |
struct s |
| 15 |
{ |
| 16 |
int x; |
| 17 |
/* 4 bytes padding here. */ |
| 18 |
__attribute__((aligned (8))) int y; |
| 19 |
/* 4 bytes padding here. */ |
| 20 |
}; |
| 21 |
|
| 22 |
typedef struct s __attribute__((aligned (4))) underaligned; |
| 23 |
|
| 24 |
underaligned a = { 1, 4 }; |
| 25 |
underaligned b = { 9, 16 }; |
| 26 |
|
| 27 |
void |
| 28 |
f (int r0, underaligned r2, int stack8, underaligned stack16) |
| 29 |
{ |
| 30 |
if (r0 != 3 || stack8 != 6) |
| 31 |
abort (); |
| 32 |
if (memcmp ((void *) &r2, (void *)&a, sizeof (underaligned))) |
| 33 |
abort (); |
| 34 |
if (memcmp ((void *)&stack16, (void *)&b, sizeof (underaligned))) |
| 35 |
abort (); |
| 36 |
} |
| 37 |
|
| 38 |
int |
| 39 |
main (int argc, char **argv) |
| 40 |
{ |
| 41 |
f (3, a, 6, b); |
| 42 |
return 0; |
| 43 |
} |