1 /* Test AAPCS layout (alignment) for callee. */
2
3 /* { dg-do run { target aarch64*-*-* } } */
4
5 extern int memcmp (const void *s1, const void *s2, __SIZE_TYPE__ n);
6 extern void abort (void);
7
8 struct s
9 {
10 /* This forces the alignment and size of the struct to 16. */
11 __attribute__ ((__aligned__ (16))) long x;
12 int y;
13 /* 4 bytes padding. */
14 };
15
16 typedef struct s __attribute__ ((__aligned__ (8))) underaligned;
17
18 underaligned a = { 1, 4 };
19 underaligned b = { 9, 16 };
20 underaligned c = { 25, 36 };
21
22 void
test_underaligned_struct(int x0,underaligned x2,int x4,underaligned x6,int stack,underaligned stack16)23 test_underaligned_struct (int x0, underaligned x2, int x4, underaligned x6,
24 int stack, underaligned stack16)
25 {
26 if (x0 != 3 || x4 != 5 || stack != 7)
27 abort ();
28 if (memcmp ((void *) &x2, (void *)&a, sizeof (underaligned)))
29 abort ();
30 if (memcmp ((void *)&x6, (void *)&b, sizeof (underaligned)))
31 abort ();
32 if (memcmp ((void *)&stack16, (void *)&c, sizeof (underaligned)))
33 abort ();
34 }
35
36 int
main(int argc,char ** argv)37 main (int argc, char **argv)
38 {
39 test_underaligned_struct (3, a, 5, b, 7, c);
40 return 0;
41 }
42