(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.target/
aarch64/
aapcs64/
test_align_dfp-1.c
       1  /* Test AAPCS64 layout.
       2  
       3     Test the comformance to the alignment and padding requirements.
       4  
       5     B.4  If the argument type is a Composite Type then the size of the
       6          argument is rounded up to the nearest multiple of 8 bytes.
       7     C.4  If the argument is an HFA, a Quad-precision Floating-point or Short
       8  	Vector Type then the NSAA is rounded up to the larger of 8 or the
       9  	Natural Alignment of the argument's type.
      10     C.12 The NSAA is rounded up to the larger of 8 or the Natural Alignment
      11  	of the argument's type.
      12     C.14 If the size of the argument is less than 8 bytes then the size of
      13  	the argument is set ot 8 bytes.  The effect is as if the argument
      14  	was copied to the least significant bits of a 64-bit register and
      15  	the remaining bits filled with unspecified values.  */
      16  
      17  /* { dg-do run { target aarch64*-*-* } } */
      18  
      19  #ifndef IN_FRAMEWORK
      20  #define TESTFILE "test_align-1.c"
      21  #include "type-def.h"
      22  
      23  struct y
      24  {
      25    int p;
      26    int q;
      27    int r;
      28    int s;
      29  };
      30  
      31  struct y v1 = { 1, 2, 3, 4 };
      32  struct y v2 = { 5, 6, 7, 8 };
      33  struct y v3 = { 9, 10, 11, 12 };
      34  struct y v4 = { 13, 14, 15, 16 };
      35  
      36  struct z
      37  {
      38    _Decimal64 x[4];
      39  };
      40  
      41  struct z a = { 5.0dd, 6.0dd, 7.0dd, 8.0dd };
      42  struct z b = { 9.0dd, 10.0dd, 11.0dd, 12.0dd };
      43  
      44  vf4_t c = { 13.f, 14.f, 15.f, 16.f };
      45  
      46  struct x
      47  {
      48    vf4_t v;
      49  } w;
      50  
      51  char ch='a';
      52  short sh=13;
      53  int i=14;
      54  long long ll=15;
      55  
      56  struct s1
      57  {
      58    short sh[3];
      59  } s1;
      60  
      61  struct s2
      62  {
      63    int i[2];
      64    char c;
      65  } s2;
      66  
      67  struct ldx2_t
      68  {
      69    _Decimal128 ld[2];
      70  } ldx2 = { 12345.67890dl, 23456.78901dl };
      71  
      72  union u_t
      73  {
      74    _Decimal128 ld;
      75    _Decimal64 d[2];
      76  } u;
      77  
      78  #define HAS_DATA_INIT_FUNC
      79  void init_data ()
      80  {
      81    w.v = (vf4_t){ 17.f, 18.f, 19.f, 20.f };
      82    s1.sh[0] = 16;
      83    s1.sh[1] = 17;
      84    s1.sh[2] = 18;
      85    s2.i[0] = 19;
      86    s2.i[1] = 20;
      87    s2.c = 21;
      88    u.ld = 34567.89012L;
      89  }
      90  
      91  #include "abitest.h"
      92  #else
      93  
      94    ARG(struct y, v1, X0)
      95    ARG(struct y, v2, X2)
      96    ARG(struct y, v3, X4)
      97    ARG(struct y, v4, X6)
      98    ARG(struct z, a, D0)
      99    ARG(struct z, b, D4)
     100    ARG(_Decimal64, 12.5, STACK)
     101    ARG(vf4_t, c, STACK+16)       /* [C.4] 16-byte aligned short vector */
     102    ARG(_Decimal64, 17.0dd, STACK+32)
     103    ARG(struct x, w, STACK+48)    /* [C.12] 16-byte aligned small struct */
     104  #ifndef __AAPCS64_BIG_ENDIAN__
     105    ARG(char, ch, STACK+64)       /* [C.14] char  padded to the size of 8 bytes */
     106    ARG(short, sh, STACK+72)      /* [C.14] short padded to the size of 8 bytes */
     107    ARG(int, i, STACK+80)         /* [C.14] int   padded to the size of 8 bytes */
     108  #else
     109    ARG(char, ch, STACK+71)
     110    ARG(short, sh, STACK+78)
     111    ARG(int, i, STACK+84)
     112  #endif
     113    ARG(long long, ll, STACK+88)
     114    ARG(struct s1, s1, STACK+96)  /* [B.4] small struct padded to the size of 8 bytes */
     115    ARG(_Decimal64, 18.0dd, STACK+104)
     116    ARG(struct s2, s2, STACK+112) /* [B.4] small struct padded to the size of 16 bytes */
     117    ARG(_Decimal64, 19.0dd, STACK+128)
     118    ARG(_Decimal128, 30.0dl, STACK+144)  /* [C.4] 16-byte aligned quad-precision */
     119    ARG(_Decimal64, 31.0dd, STACK+160)
     120    ARG(struct ldx2_t, ldx2, STACK+176) /* [C.4] 16-byte aligned HFA */
     121    ARG(_Decimal64, 32.0dd, STACK+208)
     122    ARG(__int128, 33, STACK+224)  /* [C.12] 16-byte aligned 128-bit integer */
     123    ARG(_Decimal64, 34.0dd, STACK+240)
     124    ARG(union u_t, u, STACK+256)  /* [C.12] 16-byte aligned small composite (union in this case) */
     125    LAST_ARG_NONFLAT (int, 35.0, STACK+272, i32in64)
     126  #endif