| 1 |
/* Test AAPCS layout (alignment). */ |
| 2 |
|
| 3 |
/* { dg-do run { target aarch64*-*-* } } */ |
| 4 |
|
| 5 |
#ifndef IN_FRAMEWORK |
| 6 |
#define TESTFILE "test_align-10.c" |
| 7 |
|
| 8 |
struct s |
| 9 |
{ |
| 10 |
/* Should have 128-bit alignment. */ |
| 11 |
__int128 y : 65; |
| 12 |
char z: 7; |
| 13 |
}; |
| 14 |
|
| 15 |
typedef struct s T; |
| 16 |
|
| 17 |
#define EXPECTED_STRUCT_SIZE 16 |
| 18 |
extern void link_failure (void); |
| 19 |
int |
| 20 |
foo () |
| 21 |
{ |
| 22 |
/* Optimization gets rid of this before linking. */ |
| 23 |
if (sizeof (struct s) != EXPECTED_STRUCT_SIZE) |
| 24 |
link_failure (); |
| 25 |
} |
| 26 |
|
| 27 |
T a = { 1, 4 }; |
| 28 |
T b = { 9, 16 }; |
| 29 |
T c = { 25, 36 }; |
| 30 |
|
| 31 |
#include "abitest.h" |
| 32 |
#else |
| 33 |
ARG (int, 3, W0) |
| 34 |
ARG (T, a, X2) |
| 35 |
ARG (int, 5, W4) |
| 36 |
ARG (T, b, X6) |
| 37 |
#ifndef __AAPCS64_BIG_ENDIAN__ |
| 38 |
ARG (int, 7, STACK) |
| 39 |
#else |
| 40 |
ARG (int, 7, STACK + 4) |
| 41 |
#endif |
| 42 |
/* Natural alignment should be 16. */ |
| 43 |
LAST_ARG (T, c, STACK + 16) |
| 44 |
#endif |