| 1 |
/* Test AAPCS64 layout and __builtin_va_arg. |
| 2 |
|
| 3 |
This test covers homogeneous floating-point aggregate types and homogeneous |
| 4 |
short-vector aggregate types as described in AAPCS64 \S 4.3.5. */ |
| 5 |
|
| 6 |
/* { dg-do run { target aarch64*-*-* } } */ |
| 7 |
|
| 8 |
#ifndef IN_FRAMEWORK |
| 9 |
#define AAPCS64_TEST_STDARG |
| 10 |
#define TESTFILE "va_arg-4.c" |
| 11 |
#include "type-def.h" |
| 12 |
|
| 13 |
struct hfa_dfx1_t hfa_dfx1 = {12.345df}; |
| 14 |
struct hfa_dfx2_t hfa_dfx2 = {123.456df, 234.456df}; |
| 15 |
struct hfa_ddx2_t hfa_ddx2 = {234.567dd, 345.678dd}; |
| 16 |
struct hfa_ddx4_t hfa_ddx4 = {1234.123dd, 2345.234dd, 3456.345dd, 4567.456dd}; |
| 17 |
struct hfa_dldx3_t hfa_dldx3 = {123456.7890dl, 234567.8901dl, 345678.9012dl}; |
| 18 |
struct non_hfa_dfx5_t non_hfa_dfx5 = {456.789df, 567.890df, 678.901df, 789.012df, 890.123df}; |
| 19 |
struct hfa_dffs_t hfa_dffs; |
| 20 |
struct non_hfa_dffs_t non_hfa_dffs; |
| 21 |
struct non_hfa_dffs_2_t non_hfa_dffs_2; |
| 22 |
struct hva_vdf2x1_t hva_vdf2x1; |
| 23 |
struct hva_vdf2x2_t hva_vdf2x2; |
| 24 |
struct non_hfa_dffd_t non_hfa_dffd = {23.df, 24.df, 25.0dd}; |
| 25 |
struct non_hfa_dffvf2_t non_hfa_dffvf2; |
| 26 |
struct non_hfa_dfffd_t non_hfa_dfffd = {33.df, 34.df, 35.df, 36.0dd}; |
| 27 |
union hfa_dunion_t hfa_dunion; |
| 28 |
union non_hfa_union_t non_hfa_union; |
| 29 |
|
| 30 |
#define HAS_DATA_INIT_FUNC |
| 31 |
void init_data () |
| 32 |
{ |
| 33 |
hva_vdf2x1.a = (vdf2_t){17.df, 18.df}; |
| 34 |
hva_vdf2x2.a = (vdf2_t){19.df, 20.df}; |
| 35 |
hva_vdf2x2.b = (vdf2_t){21.df, 22.df}; |
| 36 |
|
| 37 |
non_hfa_dffvf2.a = 29.df; |
| 38 |
non_hfa_dffvf2.b = 30.df; |
| 39 |
non_hfa_dffvf2.c = (vdf2_t){31.df, 32.df}; |
| 40 |
|
| 41 |
hfa_dunion.s.a = 37.df; |
| 42 |
hfa_dunion.s.b = 38.df; |
| 43 |
hfa_dunion.c = 39.df; |
| 44 |
|
| 45 |
non_hfa_dunion.a = 40.0dd; |
| 46 |
non_hfa_dunion.b = 41.df; |
| 47 |
|
| 48 |
hfa_dffs.a = 42.df; |
| 49 |
hfa_dffs.b = 43.df; |
| 50 |
hfa_dffs.c.a = 44.df; |
| 51 |
hfa_dffs.c.b = 45.df; |
| 52 |
|
| 53 |
non_hfa_dffs.a = 46.df; |
| 54 |
non_hfa_dffs.b = 47.df; |
| 55 |
non_hfa_dffs.c.a = 48.0dd; |
| 56 |
non_hfa_dffs.c.b = 49.0dd; |
| 57 |
|
| 58 |
non_hfa_dffs_2.s.a = 50; |
| 59 |
non_hfa_dffs_2.s.b = 51; |
| 60 |
non_hfa_dffs_2.c = 52.df; |
| 61 |
non_hfa_dffs_2.d = 53.df; |
| 62 |
} |
| 63 |
|
| 64 |
#include "abitest.h" |
| 65 |
#else |
| 66 |
ARG (int , 1, W0, LAST_NAMED_ARG_ID) |
| 67 |
DOTS |
| 68 |
/* HFA or HVA passed in fp/simd registers or on stack. */ |
| 69 |
ANON (struct hfa_dfx1_t , hfa_dfx1, S0 , 0) |
| 70 |
ANON (struct hfa_dfx2_t , hfa_dfx2, S1 , 1) |
| 71 |
ANON (struct hfa_ddx2_t , hfa_ddx2, D3 , 2) |
| 72 |
ANON (struct hva_vdf2x1_t, hva_vdf2x1, D5 , 11) |
| 73 |
ANON (struct hfa_ddx4_t , hfa_ddx4, STACK , 3) |
| 74 |
ANON (struct hfa_dffs_t , hfa_dffs , STACK+32, 4) |
| 75 |
ANON (union hfa_dunion_t, hfa_dunion, STACK+48, 5) |
| 76 |
ANON (struct hfa_dldx3_t, hfa_dldx3, STACK+64, 6) |
| 77 |
/* Non-H[FV]A passed in general registers or on stack or via reference. */ |
| 78 |
PTR_ANON (struct non_hfa_dfx5_t , non_hfa_dfx5 , X1 , 10) |
| 79 |
ANON (struct non_hfa_dffd_t , non_hfa_dffd , X2 , 13) |
| 80 |
ANON (struct non_hfa_dffvf2_t, non_hfa_dffvf2, X6 , 16) |
| 81 |
PTR_ANON (struct non_hfa_dfffd_t, non_hfa_dfffd, STACK+112, 17) |
| 82 |
PTR_ANON (struct non_hfa_dffs_t , non_hfa_dffs , STACK+120, 18) |
| 83 |
ANON (struct non_hfa_dffs_2_t, non_hfa_dffs_2, STACK+128, 19) |
| 84 |
ANON (union non_hfa_dunion_t, non_hfa_dunion, STACK+144, 20) |
| 85 |
#ifndef __AAPCS64_BIG_ENDIAN__ |
| 86 |
LAST_ANON(int , 2 , STACK+152, 30) |
| 87 |
#else |
| 88 |
LAST_ANON(int , 2 , STACK+156, 30) |
| 89 |
#endif |
| 90 |
#endif |