1  /* Test AAPCS64 function result return.
       2  
       3     This test covers most composite types as described in AAPCS64 \S 4.3.
       4     Homogeneous floating-point aggregate types are covered in func-ret-3.c.  */
       5  
       6  /* { dg-do run { target aarch64*-*-* } } */
       7  /* { dg-additional-sources "abitest.S" } */
       8  
       9  #ifndef IN_FRAMEWORK
      10  #define TESTFILE "func-ret-2.c"
      11  
      12  struct x0
      13  {
      14    char ch;
      15    int i;
      16  } ys0 = { 'a', 12345 };
      17  
      18  struct x1
      19  {
      20    int a;
      21    unsigned int b;
      22    unsigned int c;
      23    unsigned int d;
      24  } ys1 = { 0xdeadbeef, 0xcafebabe, 0x87654321, 0xbcedf975 };
      25  
      26  struct x2
      27  {
      28    long long a;
      29    long long b;
      30    char ch;
      31  } y2 = { 0x12, 0x34, 0x56 };
      32  
      33  union x3
      34  {
      35    char ch;
      36    int i;
      37    long long ll;
      38  } y3;
      39  
      40  union x4
      41  {
      42    int i;
      43    struct x2 y2;
      44  } y4;
      45  
      46  #define HAS_DATA_INIT_FUNC
      47  void init_data ()
      48  {
      49    /* Init small union.  */
      50    y3.ll = 0xfedcba98LL;
      51  
      52    /* Init big union.  */
      53    y4.y2.a = 0x78;
      54    y4.y2.b = 0x89;
      55    y4.y2.ch= 0x9a;
      56  }
      57  
      58  
      59  #include "abitest-2.h"
      60  #else
      61    /* Composite smaller than or equal to 16 bytes returned in X0 and X1.  */
      62  FUNC_VAL_CHECK ( 0, struct x0, ys0, X0, flat)
      63  FUNC_VAL_CHECK ( 1, struct x1, ys1, X0, flat)
      64  FUNC_VAL_CHECK ( 2, union  x3, y3, X0, flat)
      65  
      66    /* Composite larger than 16 bytes returned in the caller-reserved memory
      67       block of which the address is passed as an additional argument to the
      68       function in X8.  */
      69  FUNC_VAL_CHECK (10, struct x2, y2, X8, flat)
      70  FUNC_VAL_CHECK (11, union  x4, y4, X8, flat)
      71  #endif