| 1 |
/* Test AAPCS layout (alignment). */ |
| 2 |
|
| 3 |
/* { dg-do run { target arm_eabi } } */ |
| 4 |
/* { dg-require-effective-target arm32 } */ |
| 5 |
/* { dg-options "-O3" } */ |
| 6 |
|
| 7 |
#ifndef IN_FRAMEWORK |
| 8 |
#define TESTFILE "align3.c" |
| 9 |
|
| 10 |
/* Struct will be aligned to 8. */ |
| 11 |
struct s |
| 12 |
{ |
| 13 |
int x; |
| 14 |
/* 4 bytes padding here. */ |
| 15 |
__attribute__((aligned (8))) int y; |
| 16 |
/* 4 bytes padding here. */ |
| 17 |
}; |
| 18 |
|
| 19 |
typedef struct s __attribute__((aligned (4))) underaligned; |
| 20 |
|
| 21 |
#define EXPECTED_STRUCT_SIZE 16 |
| 22 |
extern void link_failure (void); |
| 23 |
int |
| 24 |
foo () |
| 25 |
{ |
| 26 |
/* Optimization gets rid of this before linking. */ |
| 27 |
if (sizeof (struct s) != EXPECTED_STRUCT_SIZE) |
| 28 |
link_failure (); |
| 29 |
} |
| 30 |
|
| 31 |
underaligned a = { 1, 4 }; |
| 32 |
underaligned b = { 9, 16 }; |
| 33 |
|
| 34 |
#include "abitest.h" |
| 35 |
#else |
| 36 |
ARG (int, 3, R0) |
| 37 |
/* Object alignment is 8, so split between 2 regs and 8 on stack. */ |
| 38 |
ARG (underaligned, a, R2) |
| 39 |
ARG (int, 6, STACK + 8) |
| 40 |
/* Object alignment is 8, so skip over STACK + 12. */ |
| 41 |
LAST_ARG (underaligned, b, STACK + 16) |
| 42 |
#endif |