* config/i386/avx512fintrin.h (_mm512_set_epi16, _mm512_set_epi8,
[official-gcc.git] / gcc / testsuite / gcc.target / aarch64 / aapcs64 / test_align-1.c
blobf22fca6deb2e0aa05d519d5534811b5cea5f9c61
1 /* Test AAPCS64 layout.
3 Test the comformance to the alignment and padding requirements.
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. */
17 /* { dg-do run { target aarch64*-*-* } } */
19 #ifndef IN_FRAMEWORK
20 #define TESTFILE "test_align-1.c"
21 #include "type-def.h"
23 struct y
25 int p;
26 int q;
27 int r;
28 int s;
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 };
36 struct z
38 double x[4];
41 struct z a = { 5.0, 6.0, 7.0, 8.0 };
42 struct z b = { 9.0, 10.0, 11.0, 12.0 };
44 vf4_t c = { 13.f, 14.f, 15.f, 16.f };
46 struct x
48 vf4_t v;
49 } w;
51 char ch='a';
52 short sh=13;
53 int i=14;
54 long long ll=15;
56 struct s1
58 short sh[3];
59 } s1;
61 struct s2
63 int i[2];
64 char c;
65 } s2;
67 struct ldx2_t
69 long double ld[2];
70 } ldx2 = { 12345.67890L, 23456.78901L };
72 union u_t
74 long double ld;
75 double d[2];
76 } u;
78 #define HAS_DATA_INIT_FUNC
79 void init_data ()
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;
91 #include "abitest.h"
92 #else
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(double, 12.5, STACK)
101 ARG(vf4_t, c, STACK+16) /* [C.4] 16-byte aligned short vector */
102 ARG(double, 17.0, 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(double, 18.0, STACK+104)
116 ARG(struct s2, s2, STACK+112) /* [B.4] small struct padded to the size of 16 bytes */
117 ARG(double, 19.0, STACK+128)
118 ARG(long double, 30.0L, STACK+144) /* [C.4] 16-byte aligned quad-precision */
119 ARG(double, 31.0, STACK+160)
120 ARG(struct ldx2_t, ldx2, STACK+176) /* [C.4] 16-byte aligned HFA */
121 ARG(double, 32.0, STACK+208)
122 ARG(__int128, 33, STACK+224) /* [C.12] 16-byte aligned 128-bit integer */
123 ARG(double, 34.0, 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