]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
aarch64, testsuite: Fix up auto-init-padding tests
authorAlex Coplan <alex.coplan@arm.com>
Wed, 15 Nov 2023 10:24:41 +0000 (10:24 +0000)
committerAlex Coplan <alex.coplan@arm.com>
Fri, 15 Dec 2023 19:59:58 +0000 (19:59 +0000)
The tests currently depend on memcpy lowering forming stps at -O0,
but we no longer want to form stps during memcpy lowering, but instead
in the upcoming load/store pair fusion pass.

This patch therefore tweaks affected tests to enable optimizations
(-O1), and adjusts the tests to avoid parts of the structures being
optimized away where necessary.

gcc/testsuite/ChangeLog:

* gcc.target/aarch64/auto-init-padding-1.c: Add -O to options,
adjust test to work with optimizations enabled.
* gcc.target/aarch64/auto-init-padding-2.c: Add -O to options.
* gcc.target/aarch64/auto-init-padding-3.c: Add -O to options,
adjust test to work with optimizations enabled.
* gcc.target/aarch64/auto-init-padding-4.c: Likewise.
* gcc.target/aarch64/auto-init-padding-9.c: Likewise.

gcc/testsuite/gcc.target/aarch64/auto-init-padding-1.c
gcc/testsuite/gcc.target/aarch64/auto-init-padding-2.c
gcc/testsuite/gcc.target/aarch64/auto-init-padding-3.c
gcc/testsuite/gcc.target/aarch64/auto-init-padding-4.c
gcc/testsuite/gcc.target/aarch64/auto-init-padding-9.c

index c747ebdcdf7d87ff5ffbb0c0f6eb7ff0e6862d56..7027454dc746cc6110e375500819d214c644cafe 100644 (file)
@@ -1,17 +1,19 @@
 /* Verify zero initialization for structure type automatic variables with
    padding.  */
 /* { dg-do compile } */
-/* { dg-options "-ftrivial-auto-var-init=zero" } */
+/* { dg-options "-O -ftrivial-auto-var-init=zero" } */
 
 struct test_aligned {
         int internal1;
         long long internal2;
 } __attribute__ ((aligned(64)));
 
-int foo ()
+void bar (struct test_aligned *);
+
+void foo ()
 {
   struct test_aligned var;
-  return var.internal1;
+  bar(&var);
 }
 
 /* { dg-final { scan-assembler-times {stp\tq[0-9]+, q[0-9]+,} 2 } } */
index 6e280904da1eb6a398e5ab1429ea124247ea2bd6..d3b6591c9b09be29a62a12194db2760b37dbb50e 100644 (file)
@@ -1,7 +1,7 @@
 /* Verify pattern initialization for structure type automatic variables with
    padding.  */
 /* { dg-do compile } */
-/* { dg-options "-ftrivial-auto-var-init=pattern" } */
+/* { dg-options "-O -ftrivial-auto-var-init=pattern" } */
 
 struct test_aligned {
         int internal1;
index 9ddea58b468afde66d7ea66ca93938b0df0160ff..aad4bb8944fe7c73e07509de81069b5601f5b3fd 100644 (file)
@@ -1,7 +1,7 @@
 /* Verify zero initialization for nested structure type automatic variables with
    padding.  */
 /* { dg-do compile } */
-/* { dg-options "-ftrivial-auto-var-init=zero" } */
+/* { dg-options "-O -ftrivial-auto-var-init=zero" } */
 
 struct test_aligned {
         unsigned internal1;
@@ -16,11 +16,12 @@ struct test_big_hole {
         struct test_aligned four;
 } __attribute__ ((aligned(64)));
 
+void bar (struct test_big_hole *);
 
-int foo ()
+void foo ()
 {
   struct test_big_hole var;
-  return var.four.internal1;
+  bar (&var);
 }
 
 /* { dg-final { scan-assembler-times {stp\tq[0-9]+, q[0-9]+,} 4 } } */
index 75bba82ed34151f606f90467a40d5e1ad52b37b2..efd310f054d1fd9d93237c9895d42c5fbb15b85b 100644 (file)
@@ -1,7 +1,7 @@
 /* Verify pattern initialization for nested structure type automatic variables with
    padding.  */
 /* { dg-do compile } */
-/* { dg-options "-ftrivial-auto-var-init=pattern" } */
+/* { dg-options "-O -ftrivial-auto-var-init=pattern" } */
 
 struct test_aligned {
         unsigned internal1;
@@ -23,4 +23,4 @@ int foo ()
   return var.four.internal1;
 }
 
-/* { dg-final { scan-assembler-times {stp\tq[0-9]+, q[0-9]+,} 5 } } */
+/* { dg-final { scan-assembler-times {stp\tq[0-9]+, q[0-9]+,} 4 } } */
index 0f1930f813e78d5e40e12af8fae2d72f6ed2e3d6..64ed8f11fe6e1baed6a195c4e3a8250fbd36f7ea 100644 (file)
@@ -1,7 +1,7 @@
 /* Verify zero initialization for array type with structure element with
    padding.  */ 
 /* { dg-do compile } */
-/* { dg-options "-ftrivial-auto-var-init=zero" } */
+/* { dg-options "-O -ftrivial-auto-var-init=zero" } */
 
 struct test_trailing_hole {
         int one;
@@ -11,11 +11,12 @@ struct test_trailing_hole {
         /* "sizeof(unsigned long) - 1" byte padding hole here. */
 };
 
+void bar (void *);
 
-int foo ()
+void foo ()
 {
   struct test_trailing_hole var[10]; 
-  return var[2].four;
+  bar (var);
 }
 
 /* { dg-final { scan-assembler-times {stp\tq[0-9]+, q[0-9]+,} 5 } } */