aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/aarch64/aapcs64/rec_align-9.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.target/aarch64/aapcs64/rec_align-9.c')
-rw-r--r--gcc/testsuite/gcc.target/aarch64/aapcs64/rec_align-9.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.target/aarch64/aapcs64/rec_align-9.c b/gcc/testsuite/gcc.target/aarch64/aapcs64/rec_align-9.c
new file mode 100644
index 00000000000..81139f58269
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/aapcs64/rec_align-9.c
@@ -0,0 +1,41 @@
+/* Test AAPCS layout (alignment) for callee. */
+
+/* { dg-do run { target aarch64*-*-* } } */
+
+extern int memcmp (const void *s1, const void *s2, __SIZE_TYPE__ n);
+extern void abort (void);
+
+struct s
+ {
+ /* This forces the alignment and size of the struct to 16. */
+ __attribute__ ((__aligned__ (16))) long x;
+ int y;
+ /* 4 bytes padding. */
+ };
+
+typedef struct s __attribute__ ((__aligned__ (8))) underaligned;
+
+underaligned a = { 1, 4 };
+underaligned b = { 9, 16 };
+underaligned c = { 25, 36 };
+
+void
+test_underaligned_struct (int x0, underaligned x2, int x4, underaligned x6,
+ int stack, underaligned stack16)
+{
+ if (x0 != 3 || x4 != 5 || stack != 7)
+ abort ();
+ if (memcmp ((void *) &x2, (void *)&a, sizeof (underaligned)))
+ abort ();
+ if (memcmp ((void *)&x6, (void *)&b, sizeof (underaligned)))
+ abort ();
+ if (memcmp ((void *)&stack16, (void *)&c, sizeof (underaligned)))
+ abort ();
+}
+
+int
+main (int argc, char **argv)
+{
+ test_underaligned_struct (3, a, 5, b, 7, c);
+ return 0;
+}