| 1 |
/* Test AAPCS64 layout and __builtin_va_arg. |
| 2 |
|
| 3 |
This test covers most composite types as described in AAPCS64 \S 4.3. |
| 4 |
Homogeneous floating-point aggregate types are covered in other tests. */ |
| 5 |
|
| 6 |
/* { dg-do run { target aarch64*-*-* } } */ |
| 7 |
|
| 8 |
#ifndef IN_FRAMEWORK |
| 9 |
#define AAPCS64_TEST_STDARG |
| 10 |
#define TESTFILE "va_arg-3.c" |
| 11 |
#include "type-def.h" |
| 12 |
|
| 13 |
struct x0 |
| 14 |
{ |
| 15 |
char ch; |
| 16 |
int i; |
| 17 |
} y0 = { 'a', 12345 }; |
| 18 |
|
| 19 |
struct x1 |
| 20 |
{ |
| 21 |
int a; |
| 22 |
int b; |
| 23 |
int c; |
| 24 |
int d; |
| 25 |
} y1 = { 0xdeadbeef, 0xcafebabe, 0x87654321, 0xabcedf975 }; |
| 26 |
|
| 27 |
struct x2 |
| 28 |
{ |
| 29 |
long long a; |
| 30 |
long long b; |
| 31 |
char ch; |
| 32 |
} y2 = { 0x12, 0x34, 0x56 }; |
| 33 |
|
| 34 |
union x3 |
| 35 |
{ |
| 36 |
char ch; |
| 37 |
int i; |
| 38 |
long long ll; |
| 39 |
} y3; |
| 40 |
|
| 41 |
union x4 |
| 42 |
{ |
| 43 |
int i; |
| 44 |
struct x2 y2; |
| 45 |
} y4; |
| 46 |
|
| 47 |
struct x5 |
| 48 |
{ |
| 49 |
union int128_t qword; |
| 50 |
} y5; |
| 51 |
|
| 52 |
#define HAS_DATA_INIT_FUNC |
| 53 |
void init_data () |
| 54 |
{ |
| 55 |
/* Init small union. */ |
| 56 |
y3.ll = 0xfedcba98LL; |
| 57 |
|
| 58 |
/* Init big union. */ |
| 59 |
y4.y2.a = 0x78; |
| 60 |
y4.y2.b = 0x89; |
| 61 |
y4.y2.ch= 0x9a; |
| 62 |
|
| 63 |
/* Init signed quad-word integer. */ |
| 64 |
y5.qword.l64 = 0xfdb9753102468aceLL; |
| 65 |
y5.qword.h64 = 0xeca8642013579bdfLL; |
| 66 |
} |
| 67 |
|
| 68 |
#include "abitest.h" |
| 69 |
#else |
| 70 |
ARG (_Decimal32 ,1.0df, S0, LAST_NAMED_ARG_ID) |
| 71 |
DOTS |
| 72 |
ANON (struct x0, y0, X0, 1) |
| 73 |
ANON (struct x1, y1, X1, 2) |
| 74 |
PTR_ANON (struct x2, y2, X3, 3) |
| 75 |
ANON (union x3, y3, X4, 4) |
| 76 |
PTR_ANON (union x4, y4, X5, 5) |
| 77 |
ANON (struct x5, y5, X6, 6) |
| 78 |
ANON (struct x0, y0, STACK, 7) |
| 79 |
ANON (struct x1, y1, STACK+8, 8) |
| 80 |
PTR_ANON (struct x2, y2, STACK+24, 9) |
| 81 |
ANON (union x3, y3, STACK+32, 10) |
| 82 |
PTR_ANON (union x4, y4, STACK+40, 11) |
| 83 |
#ifndef __AAPCS64_BIG_ENDIAN__ |
| 84 |
ANON (int , 1, STACK+48, 12) |
| 85 |
#else |
| 86 |
ANON (int , 1, STACK+52, 12) |
| 87 |
#endif |
| 88 |
ANON (struct x5, y5, STACK+64, 13) |
| 89 |
#ifndef __AAPCS64_BIG_ENDIAN__ |
| 90 |
LAST_ANON(int , 2, STACK+80, 14) |
| 91 |
#else |
| 92 |
LAST_ANON(int , 2, STACK+84, 14) |
| 93 |
#endif |
| 94 |
#endif |