1  /* Test AAPCS64 layout and __builtin_va_arg.
       2  
       3     This test is focus on certain unnamed homogeneous floating-point aggregate
       4     types passed in fp/simd registers.  */
       5  
       6  /* { dg-do run { target aarch64*-*-* } } */
       7  
       8  #ifndef IN_FRAMEWORK
       9  #define AAPCS64_TEST_STDARG
      10  #define TESTFILE "va_arg-5.c"
      11  #include "type-def.h"
      12  
      13  struct hfa_fx1_t hfa_fx1 = {12.345f};
      14  struct hfa_fx2_t hfa_fx2 = {123.456f, 234.456f};
      15  struct hfa_dx2_t hfa_dx2 = {234.567, 345.678};
      16  struct hfa_dx4_t hfa_dx4 = {1234.123, 2345.234, 3456.345, 4567.456};
      17  struct hfa_ldx3_t hfa_ldx3 = {123456.7890, 234567.8901, 345678.9012};
      18  struct hfa_ffs_t hfa_ffs;
      19  union hfa_union_t hfa_union;
      20  struct hfa_f16x2_t hfa_f16x2 = {2.0f, 4.0f};
      21  struct hfa_f16x3_t hfa_f16x3 = {2.0f, 4.0f, 8.0f};
      22  
      23  #define HAS_DATA_INIT_FUNC
      24  void init_data ()
      25  {
      26    hfa_union.s.a = 37.f;
      27    hfa_union.s.b = 38.f;
      28    hfa_union.c   = 39.f;
      29  
      30    hfa_ffs.a = 42.f;
      31    hfa_ffs.b = 43.f;
      32    hfa_ffs.c.a = 44.f;
      33    hfa_ffs.c.b = 45.f;
      34  }
      35  
      36  #include "abitest.h"
      37  #else
      38    ARG      (int, 1, W0, LAST_NAMED_ARG_ID)
      39    DOTS
      40    /* HFA passed in fp/simd registers or on stack.  */
      41    ANON     (struct hfa_dx4_t  , hfa_dx4  , D0      , 0)
      42    ANON     (struct hfa_ldx3_t , hfa_ldx3 , Q4      , 1)
      43    ANON     (struct hfa_ffs_t  , hfa_ffs  , STACK   , 2)
      44    ANON     (union  hfa_union_t, hfa_union, STACK+16, 3)
      45    ANON     (struct hfa_fx1_t  , hfa_fx1  , STACK+24, 4)
      46    ANON     (struct hfa_fx2_t  , hfa_fx2  , STACK+32, 5)
      47    ANON     (struct hfa_dx2_t  , hfa_dx2  , STACK+40, 6)
      48    /* HFA of __fp16 passed on stack, directed __fp16 test is va_arg-10.c.  */
      49    ANON     (struct hfa_f16x2_t, hfa_f16x2, STACK+56, 7)
      50    ANON     (struct hfa_f16x3_t, hfa_f16x3, STACK+64, 8)
      51    LAST_ANON(double            , 1.0      , STACK+72, 9)
      52  #endif