public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH 03/11] aarch64, testsuite: Fix up auto-init-padding tests
@ 2023-11-16 18:07 Alex Coplan
  2023-11-21 12:04 ` Richard Sandiford
  0 siblings, 1 reply; 2+ messages in thread
From: Alex Coplan @ 2023-11-16 18:07 UTC (permalink / raw)
  To: gcc-patches; +Cc: Richard Sandiford, Kyrylo Tkachov

[-- Attachment #1: Type: text/plain, Size: 1177 bytes --]

The tests currently depending on memcpy lowering forming stps at -O0,
but we no longer want to form stps during memcpy lowering, but instead
in the 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.

OK for trunk?

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 | 8 +++++---
 gcc/testsuite/gcc.target/aarch64/auto-init-padding-2.c | 2 +-
 gcc/testsuite/gcc.target/aarch64/auto-init-padding-3.c | 7 ++++---
 gcc/testsuite/gcc.target/aarch64/auto-init-padding-4.c | 4 ++--
 gcc/testsuite/gcc.target/aarch64/auto-init-padding-9.c | 7 ++++---
 5 files changed, 16 insertions(+), 12 deletions(-)


[-- Attachment #2: 0003-aarch64-testsuite-Fix-up-auto-init-padding-tests.patch --]
[-- Type: text/x-patch, Size: 4062 bytes --]

diff --git a/gcc/testsuite/gcc.target/aarch64/auto-init-padding-1.c b/gcc/testsuite/gcc.target/aarch64/auto-init-padding-1.c
index c747ebdcdf7..7027454dc74 100644
--- a/gcc/testsuite/gcc.target/aarch64/auto-init-padding-1.c
+++ b/gcc/testsuite/gcc.target/aarch64/auto-init-padding-1.c
@@ -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 } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/auto-init-padding-2.c b/gcc/testsuite/gcc.target/aarch64/auto-init-padding-2.c
index 6e280904da1..d3b6591c9b0 100644
--- a/gcc/testsuite/gcc.target/aarch64/auto-init-padding-2.c
+++ b/gcc/testsuite/gcc.target/aarch64/auto-init-padding-2.c
@@ -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;
diff --git a/gcc/testsuite/gcc.target/aarch64/auto-init-padding-3.c b/gcc/testsuite/gcc.target/aarch64/auto-init-padding-3.c
index 9ddea58b468..aad4bb8944f 100644
--- a/gcc/testsuite/gcc.target/aarch64/auto-init-padding-3.c
+++ b/gcc/testsuite/gcc.target/aarch64/auto-init-padding-3.c
@@ -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 } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/auto-init-padding-4.c b/gcc/testsuite/gcc.target/aarch64/auto-init-padding-4.c
index 75bba82ed34..efd310f054d 100644
--- a/gcc/testsuite/gcc.target/aarch64/auto-init-padding-4.c
+++ b/gcc/testsuite/gcc.target/aarch64/auto-init-padding-4.c
@@ -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 } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/auto-init-padding-9.c b/gcc/testsuite/gcc.target/aarch64/auto-init-padding-9.c
index 0f1930f813e..64ed8f11fe6 100644
--- a/gcc/testsuite/gcc.target/aarch64/auto-init-padding-9.c
+++ b/gcc/testsuite/gcc.target/aarch64/auto-init-padding-9.c
@@ -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 } } */

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH 03/11] aarch64, testsuite: Fix up auto-init-padding tests
  2023-11-16 18:07 [PATCH 03/11] aarch64, testsuite: Fix up auto-init-padding tests Alex Coplan
@ 2023-11-21 12:04 ` Richard Sandiford
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Sandiford @ 2023-11-21 12:04 UTC (permalink / raw)
  To: Alex Coplan; +Cc: gcc-patches, Kyrylo Tkachov

Alex Coplan <alex.coplan@arm.com> writes:
> The tests currently depending on memcpy lowering forming stps at -O0,
> but we no longer want to form stps during memcpy lowering, but instead
> in the 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.
>
> OK for trunk?
>
> 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.

OK, thanks.

Richard

> ---
>  gcc/testsuite/gcc.target/aarch64/auto-init-padding-1.c | 8 +++++---
>  gcc/testsuite/gcc.target/aarch64/auto-init-padding-2.c | 2 +-
>  gcc/testsuite/gcc.target/aarch64/auto-init-padding-3.c | 7 ++++---
>  gcc/testsuite/gcc.target/aarch64/auto-init-padding-4.c | 4 ++--
>  gcc/testsuite/gcc.target/aarch64/auto-init-padding-9.c | 7 ++++---
>  5 files changed, 16 insertions(+), 12 deletions(-)
>
> diff --git a/gcc/testsuite/gcc.target/aarch64/auto-init-padding-1.c b/gcc/testsuite/gcc.target/aarch64/auto-init-padding-1.c
> index c747ebdcdf7..7027454dc74 100644
> --- a/gcc/testsuite/gcc.target/aarch64/auto-init-padding-1.c
> +++ b/gcc/testsuite/gcc.target/aarch64/auto-init-padding-1.c
> @@ -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 } } */
> diff --git a/gcc/testsuite/gcc.target/aarch64/auto-init-padding-2.c b/gcc/testsuite/gcc.target/aarch64/auto-init-padding-2.c
> index 6e280904da1..d3b6591c9b0 100644
> --- a/gcc/testsuite/gcc.target/aarch64/auto-init-padding-2.c
> +++ b/gcc/testsuite/gcc.target/aarch64/auto-init-padding-2.c
> @@ -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;
> diff --git a/gcc/testsuite/gcc.target/aarch64/auto-init-padding-3.c b/gcc/testsuite/gcc.target/aarch64/auto-init-padding-3.c
> index 9ddea58b468..aad4bb8944f 100644
> --- a/gcc/testsuite/gcc.target/aarch64/auto-init-padding-3.c
> +++ b/gcc/testsuite/gcc.target/aarch64/auto-init-padding-3.c
> @@ -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 } } */
> diff --git a/gcc/testsuite/gcc.target/aarch64/auto-init-padding-4.c b/gcc/testsuite/gcc.target/aarch64/auto-init-padding-4.c
> index 75bba82ed34..efd310f054d 100644
> --- a/gcc/testsuite/gcc.target/aarch64/auto-init-padding-4.c
> +++ b/gcc/testsuite/gcc.target/aarch64/auto-init-padding-4.c
> @@ -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 } } */
> diff --git a/gcc/testsuite/gcc.target/aarch64/auto-init-padding-9.c b/gcc/testsuite/gcc.target/aarch64/auto-init-padding-9.c
> index 0f1930f813e..64ed8f11fe6 100644
> --- a/gcc/testsuite/gcc.target/aarch64/auto-init-padding-9.c
> +++ b/gcc/testsuite/gcc.target/aarch64/auto-init-padding-9.c
> @@ -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 } } */

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-11-21 12:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-16 18:07 [PATCH 03/11] aarch64, testsuite: Fix up auto-init-padding tests Alex Coplan
2023-11-21 12:04 ` Richard Sandiford

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).