Debian Codegraph @

gcc/testsuite/gcc.target/aarch64/aapcs64/test_align-9.c

raw
1 /* Test AAPCS layout (alignment). */
2
3 /* { dg-do run { target aarch64*-*-* } } */
4
5 #ifndef IN_FRAMEWORK
6 #define TESTFILE "test_align-9.c"
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 #define EXPECTED_STRUCT_SIZE 16
19 extern void link_failure (void);
20 int
21 foo ()
22 {
23 /* Optimization gets rid of this before linking. */
24 if (sizeof (struct s) != EXPECTED_STRUCT_SIZE)
25 link_failure ();
26 }
27
28 underaligned a = { 1, 4 };
29 underaligned b = { 9, 16 };
30 underaligned c = { 25, 36 };
31
32 #include "abitest.h"
33 #else
34 ARG (int, 3, W0)
35 /* Object alignment is 16, so skip X1. */
36 ARG (underaligned, a, X2)
37 ARG (int, 5, W4)
38 /* Object alignment is 16, so skip X5. */
39 ARG (underaligned, b, X6)
40 #ifndef __AAPCS64_BIG_ENDIAN__
41 ARG (int, 7, STACK)
42 #else
43 ARG (int, 7, STACK + 4)
44 #endif
45 /* Natural alignment should be 16. */
46 LAST_ARG (underaligned, c, STACK + 16)
47 #endif