diff mbox series

S/390: Emit vector alignment hints for z13

Message ID 20200528182425.1762359-1-stefansf@linux.ibm.com
State New
Headers show
Series S/390: Emit vector alignment hints for z13 | expand

Commit Message

Stefan Schulze Frielinghaus May 28, 2020, 6:24 p.m. UTC
Vector alignment hints are fully supported since z14.  On z13 alignment
hints have no effect, however, instructions with alignment hints are
still legal.  Thus, emit alignment hints also for z13 targets so that if
the binary is actually run on a z14 or later it benefits from such
hints.

Note, this requires gas including commit f687f5f563 of the binutils
repository.

gcc/ChangeLog:

	* config/s390/s390.c (print_operand): Emit vector alignment
	hints for z13.

gcc/testsuite/ChangeLog:

	* gcc.target/s390/vector/align-1.c: Change target architecture
	to z13.
	* gcc.target/s390/vector/align-2.c: Change target architecture
	to z13.
---
 gcc/config/s390/s390.c                         | 7 ++++++-
 gcc/testsuite/gcc.target/s390/vector/align-1.c | 2 +-
 gcc/testsuite/gcc.target/s390/vector/align-2.c | 2 +-
 3 files changed, 8 insertions(+), 3 deletions(-)

Comments

Stefan Schulze Frielinghaus May 28, 2020, 6:38 p.m. UTC | #1
Forgot to mention:

Bootstrapped and regtested on z13 and z14 with gas including f687f5f563

Ok for master?

On Thu, May 28, 2020 at 08:24:26PM +0200, Stefan Schulze Frielinghaus via Gcc-patches wrote:
> Vector alignment hints are fully supported since z14.  On z13 alignment
> hints have no effect, however, instructions with alignment hints are
> still legal.  Thus, emit alignment hints also for z13 targets so that if
> the binary is actually run on a z14 or later it benefits from such
> hints.
> 
> Note, this requires gas including commit f687f5f563 of the binutils
> repository.
> 
> gcc/ChangeLog:
> 
> 	* config/s390/s390.c (print_operand): Emit vector alignment
> 	hints for z13.
> 
> gcc/testsuite/ChangeLog:
> 
> 	* gcc.target/s390/vector/align-1.c: Change target architecture
> 	to z13.
> 	* gcc.target/s390/vector/align-2.c: Change target architecture
> 	to z13.
> ---
>  gcc/config/s390/s390.c                         | 7 ++++++-
>  gcc/testsuite/gcc.target/s390/vector/align-1.c | 2 +-
>  gcc/testsuite/gcc.target/s390/vector/align-2.c | 2 +-
>  3 files changed, 8 insertions(+), 3 deletions(-)
> 
> diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c
> index 4de3129f88e..b5fd5a2f3ed 100644
> --- a/gcc/config/s390/s390.c
> +++ b/gcc/config/s390/s390.c
> @@ -7854,7 +7854,12 @@ print_operand (FILE *file, rtx x, int code)
>      {
>      case 'A':
>  #ifdef HAVE_AS_VECTOR_LOADSTORE_ALIGNMENT_HINTS
> -      if (TARGET_Z14 && MEM_P (x))
> +      /* Vector alignment hints are fully supported since z14.  On z13
> +	 alignment hints have no effect, however, instructions with alignment
> +	 hints are still legal.  Thus, emit alignment hints also for z13
> +	 targets so that if the binary is actually run on a z14 or later it
> +	 benefits from such hints.  */
> +      if (TARGET_Z13 && MEM_P (x))
>  	{
>  	  if (MEM_ALIGN (x) >= 128)
>  	    fprintf (file, ",4");
> diff --git a/gcc/testsuite/gcc.target/s390/vector/align-1.c b/gcc/testsuite/gcc.target/s390/vector/align-1.c
> index cc7777ad22a..6997af2ddcd 100644
> --- a/gcc/testsuite/gcc.target/s390/vector/align-1.c
> +++ b/gcc/testsuite/gcc.target/s390/vector/align-1.c
> @@ -1,5 +1,5 @@
>  /* { dg-do compile } */
> -/* { dg-options "-O3 -mzarch -march=z14" } */
> +/* { dg-options "-O3 -mzarch -march=z13" } */
>  
>  /* The user alignment ends up in DECL_ALIGN of the VAR_DECL and is
>     currently ignored if it is smaller than the alignment of the type.
> diff --git a/gcc/testsuite/gcc.target/s390/vector/align-2.c b/gcc/testsuite/gcc.target/s390/vector/align-2.c
> index e4e2fba6a58..00e09d3eadb 100644
> --- a/gcc/testsuite/gcc.target/s390/vector/align-2.c
> +++ b/gcc/testsuite/gcc.target/s390/vector/align-2.c
> @@ -1,5 +1,5 @@
>  /* { dg-do compile } */
> -/* { dg-options "-O3 -mzarch -march=z14" } */
> +/* { dg-options "-O3 -mzarch -march=z13" } */
>  
>  /* The user alignment ends up in TYPE_ALIGN of the type of the
>     VAR_DECL.  */
> -- 
> 2.25.3
>
Andreas Krebbel May 29, 2020, 11:57 a.m. UTC | #2
On 28.05.20 20:24, Stefan Schulze Frielinghaus wrote:
> Vector alignment hints are fully supported since z14.  On z13 alignment
> hints have no effect, however, instructions with alignment hints are
> still legal.  Thus, emit alignment hints also for z13 targets so that if
> the binary is actually run on a z14 or later it benefits from such
> hints.

More precisely the alignment hints don't have any effect before z15, are described already in the
z14 architecture but actually are also accepted by z13 hardware.

> 
> Note, this requires gas including commit f687f5f563 of the binutils
> repository.
> 
> gcc/ChangeLog:
> 
> 	* config/s390/s390.c (print_operand): Emit vector alignment
> 	hints for z13.
> 
> gcc/testsuite/ChangeLog:
> 
> 	* gcc.target/s390/vector/align-1.c: Change target architecture
> 	to z13.
> 	* gcc.target/s390/vector/align-2.c: Change target architecture
> 	to z13.

Ok. Thanks!

Andreas

> ---
>  gcc/config/s390/s390.c                         | 7 ++++++-
>  gcc/testsuite/gcc.target/s390/vector/align-1.c | 2 +-
>  gcc/testsuite/gcc.target/s390/vector/align-2.c | 2 +-
>  3 files changed, 8 insertions(+), 3 deletions(-)
> 
> diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c
> index 4de3129f88e..b5fd5a2f3ed 100644
> --- a/gcc/config/s390/s390.c
> +++ b/gcc/config/s390/s390.c
> @@ -7854,7 +7854,12 @@ print_operand (FILE *file, rtx x, int code)
>      {
>      case 'A':
>  #ifdef HAVE_AS_VECTOR_LOADSTORE_ALIGNMENT_HINTS
> -      if (TARGET_Z14 && MEM_P (x))
> +      /* Vector alignment hints are fully supported since z14.  On z13
> +	 alignment hints have no effect, however, instructions with alignment
> +	 hints are still legal.  Thus, emit alignment hints also for z13
> +	 targets so that if the binary is actually run on a z14 or later it
> +	 benefits from such hints.  */
> +      if (TARGET_Z13 && MEM_P (x))
>  	{
>  	  if (MEM_ALIGN (x) >= 128)
>  	    fprintf (file, ",4");
> diff --git a/gcc/testsuite/gcc.target/s390/vector/align-1.c b/gcc/testsuite/gcc.target/s390/vector/align-1.c
> index cc7777ad22a..6997af2ddcd 100644
> --- a/gcc/testsuite/gcc.target/s390/vector/align-1.c
> +++ b/gcc/testsuite/gcc.target/s390/vector/align-1.c
> @@ -1,5 +1,5 @@
>  /* { dg-do compile } */
> -/* { dg-options "-O3 -mzarch -march=z14" } */
> +/* { dg-options "-O3 -mzarch -march=z13" } */
>  
>  /* The user alignment ends up in DECL_ALIGN of the VAR_DECL and is
>     currently ignored if it is smaller than the alignment of the type.
> diff --git a/gcc/testsuite/gcc.target/s390/vector/align-2.c b/gcc/testsuite/gcc.target/s390/vector/align-2.c
> index e4e2fba6a58..00e09d3eadb 100644
> --- a/gcc/testsuite/gcc.target/s390/vector/align-2.c
> +++ b/gcc/testsuite/gcc.target/s390/vector/align-2.c
> @@ -1,5 +1,5 @@
>  /* { dg-do compile } */
> -/* { dg-options "-O3 -mzarch -march=z14" } */
> +/* { dg-options "-O3 -mzarch -march=z13" } */
>  
>  /* The user alignment ends up in TYPE_ALIGN of the type of the
>     VAR_DECL.  */
>
Stefan Schulze Frielinghaus June 2, 2020, 10:37 a.m. UTC | #3
On Fri, May 29, 2020 at 01:57:30PM +0200, Andreas Krebbel wrote:
> On 28.05.20 20:24, Stefan Schulze Frielinghaus wrote:
> > Vector alignment hints are fully supported since z14.  On z13 alignment
> > hints have no effect, however, instructions with alignment hints are
> > still legal.  Thus, emit alignment hints also for z13 targets so that if
> > the binary is actually run on a z14 or later it benefits from such
> > hints.
> 
> More precisely the alignment hints don't have any effect before z15, are described already in the
> z14 architecture but actually are also accepted by z13 hardware.

True, I removed the confusing comment and pushed.

Thanks, Stefan

> 
> > 
> > Note, this requires gas including commit f687f5f563 of the binutils
> > repository.
> > 
> > gcc/ChangeLog:
> > 
> > 	* config/s390/s390.c (print_operand): Emit vector alignment
> > 	hints for z13.
> > 
> > gcc/testsuite/ChangeLog:
> > 
> > 	* gcc.target/s390/vector/align-1.c: Change target architecture
> > 	to z13.
> > 	* gcc.target/s390/vector/align-2.c: Change target architecture
> > 	to z13.
> 
> Ok. Thanks!
> 
> Andreas
> 
> > ---
> >  gcc/config/s390/s390.c                         | 7 ++++++-
> >  gcc/testsuite/gcc.target/s390/vector/align-1.c | 2 +-
> >  gcc/testsuite/gcc.target/s390/vector/align-2.c | 2 +-
> >  3 files changed, 8 insertions(+), 3 deletions(-)
> > 
> > diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c
> > index 4de3129f88e..b5fd5a2f3ed 100644
> > --- a/gcc/config/s390/s390.c
> > +++ b/gcc/config/s390/s390.c
> > @@ -7854,7 +7854,12 @@ print_operand (FILE *file, rtx x, int code)
> >      {
> >      case 'A':
> >  #ifdef HAVE_AS_VECTOR_LOADSTORE_ALIGNMENT_HINTS
> > -      if (TARGET_Z14 && MEM_P (x))
> > +      /* Vector alignment hints are fully supported since z14.  On z13
> > +	 alignment hints have no effect, however, instructions with alignment
> > +	 hints are still legal.  Thus, emit alignment hints also for z13
> > +	 targets so that if the binary is actually run on a z14 or later it
> > +	 benefits from such hints.  */
> > +      if (TARGET_Z13 && MEM_P (x))
> >  	{
> >  	  if (MEM_ALIGN (x) >= 128)
> >  	    fprintf (file, ",4");
> > diff --git a/gcc/testsuite/gcc.target/s390/vector/align-1.c b/gcc/testsuite/gcc.target/s390/vector/align-1.c
> > index cc7777ad22a..6997af2ddcd 100644
> > --- a/gcc/testsuite/gcc.target/s390/vector/align-1.c
> > +++ b/gcc/testsuite/gcc.target/s390/vector/align-1.c
> > @@ -1,5 +1,5 @@
> >  /* { dg-do compile } */
> > -/* { dg-options "-O3 -mzarch -march=z14" } */
> > +/* { dg-options "-O3 -mzarch -march=z13" } */
> >  
> >  /* The user alignment ends up in DECL_ALIGN of the VAR_DECL and is
> >     currently ignored if it is smaller than the alignment of the type.
> > diff --git a/gcc/testsuite/gcc.target/s390/vector/align-2.c b/gcc/testsuite/gcc.target/s390/vector/align-2.c
> > index e4e2fba6a58..00e09d3eadb 100644
> > --- a/gcc/testsuite/gcc.target/s390/vector/align-2.c
> > +++ b/gcc/testsuite/gcc.target/s390/vector/align-2.c
> > @@ -1,5 +1,5 @@
> >  /* { dg-do compile } */
> > -/* { dg-options "-O3 -mzarch -march=z14" } */
> > +/* { dg-options "-O3 -mzarch -march=z13" } */
> >  
> >  /* The user alignment ends up in TYPE_ALIGN of the type of the
> >     VAR_DECL.  */
> > 
>
diff mbox series

Patch

diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c
index 4de3129f88e..b5fd5a2f3ed 100644
--- a/gcc/config/s390/s390.c
+++ b/gcc/config/s390/s390.c
@@ -7854,7 +7854,12 @@  print_operand (FILE *file, rtx x, int code)
     {
     case 'A':
 #ifdef HAVE_AS_VECTOR_LOADSTORE_ALIGNMENT_HINTS
-      if (TARGET_Z14 && MEM_P (x))
+      /* Vector alignment hints are fully supported since z14.  On z13
+	 alignment hints have no effect, however, instructions with alignment
+	 hints are still legal.  Thus, emit alignment hints also for z13
+	 targets so that if the binary is actually run on a z14 or later it
+	 benefits from such hints.  */
+      if (TARGET_Z13 && MEM_P (x))
 	{
 	  if (MEM_ALIGN (x) >= 128)
 	    fprintf (file, ",4");
diff --git a/gcc/testsuite/gcc.target/s390/vector/align-1.c b/gcc/testsuite/gcc.target/s390/vector/align-1.c
index cc7777ad22a..6997af2ddcd 100644
--- a/gcc/testsuite/gcc.target/s390/vector/align-1.c
+++ b/gcc/testsuite/gcc.target/s390/vector/align-1.c
@@ -1,5 +1,5 @@ 
 /* { dg-do compile } */
-/* { dg-options "-O3 -mzarch -march=z14" } */
+/* { dg-options "-O3 -mzarch -march=z13" } */
 
 /* The user alignment ends up in DECL_ALIGN of the VAR_DECL and is
    currently ignored if it is smaller than the alignment of the type.
diff --git a/gcc/testsuite/gcc.target/s390/vector/align-2.c b/gcc/testsuite/gcc.target/s390/vector/align-2.c
index e4e2fba6a58..00e09d3eadb 100644
--- a/gcc/testsuite/gcc.target/s390/vector/align-2.c
+++ b/gcc/testsuite/gcc.target/s390/vector/align-2.c
@@ -1,5 +1,5 @@ 
 /* { dg-do compile } */
-/* { dg-options "-O3 -mzarch -march=z14" } */
+/* { dg-options "-O3 -mzarch -march=z13" } */
 
 /* The user alignment ends up in TYPE_ALIGN of the type of the
    VAR_DECL.  */