summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/s390/atomic-align-2.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.target/s390/atomic-align-2.c')
-rw-r--r--gcc/testsuite/gcc.target/s390/atomic-align-2.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.target/s390/atomic-align-2.c b/gcc/testsuite/gcc.target/s390/atomic-align-2.c
new file mode 100644
index 00000000000..0bf17341bf8
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/atomic-align-2.c
@@ -0,0 +1,18 @@
+/* { dg-do compile { target int128 } } */
+/* { dg-options "-O -std=c11" } */
+/* { dg-final { scan-assembler-not {abort} } } */
+
+/* The stack is 8 byte aligned which means GCC has to manually align a 16 byte
+ aligned object. This is done by allocating not 16 but rather 24 bytes for
+ variable X and then manually aligning a pointer inside the memory block.
+ Validate this by ensuring that the if-statement is optimized out. */
+
+void bar (_Atomic unsigned __int128 *ptr);
+
+void foo (void) {
+ _Atomic unsigned __int128 x;
+ unsigned long n = (unsigned long)&x;
+ if (n % 16 != 0)
+ __builtin_abort ();
+ bar (&x);
+}