public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* use -mno-strict-align for strlenopt-80.c on powerpc
@ 2021-03-10  5:41 Alexandre Oliva
  2021-03-12  2:58 ` Segher Boessenkool
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Alexandre Oliva @ 2021-03-10  5:41 UTC (permalink / raw)
  To: gcc-patches; +Cc: Rainer Orth, Mike Stump, Segher Boessenkool, David Edelsohn


ppc configurations that have -mstrict-align enabled by default fail
gcc.dg/strlenopt-80.c, because some memcpy calls don't get turned into
MEM_REFs, which defeats the tested-for strlen optimization.

This was regstrapped on x86_64-linux-gnu, tested with a cross to a
ppc64-vxworks7r2 configured with -mstrict-align enabled by default,
and I'm now also regstrapping on ppc64-linux-gnu just to be sure.
Ok to install?


for  gcc/testsuite/ChangeLog

	* gcc.dg/strlenopt-80.c: Add -mno-strict-align on ppc.
---
 gcc/testsuite/gcc.dg/strlenopt-80.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/gcc/testsuite/gcc.dg/strlenopt-80.c b/gcc/testsuite/gcc.dg/strlenopt-80.c
index 9124fe4740a1b..9978f5cf3bc56 100644
--- a/gcc/testsuite/gcc.dg/strlenopt-80.c
+++ b/gcc/testsuite/gcc.dg/strlenopt-80.c
@@ -5,7 +5,11 @@
    such a store.
    { dg-do compile { target aarch64*-*-* i?86-*-* powerpc*-*-* x86_64-*-* } }
 
-   { dg-options "-O2 -Wall -fdump-tree-optimized" } */
+   { dg-options "-O2 -Wall -fdump-tree-optimized" }
+
+   On powerpc configurations that have -mstrict-align by default,
+   the memcpy calls for ncpylog >= 3 are not turned into MEM_REFs.
+   { dg-additional-options "-mno-strict-align" { target powerpc*-*-* } }  */
 
 #define CHAR_BIT      __CHAR_BIT__
 #define SIZE_MAX      __SIZE_MAX__


-- 
Alexandre Oliva, happy hacker  https://FSFLA.org/blogs/lxo/
   Free Software Activist         GNU Toolchain Engineer
        Vim, Vi, Voltei pro Emacs -- GNUlius Caesar

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

* Re: use -mno-strict-align for strlenopt-80.c on powerpc
  2021-03-10  5:41 use -mno-strict-align for strlenopt-80.c on powerpc Alexandre Oliva
@ 2021-03-12  2:58 ` Segher Boessenkool
  2021-03-12 13:33   ` Iain Sandoe
  2021-03-12  7:55 ` Richard Biener
  2023-10-20  3:16 ` [PATCH] testsuite: check for and use -mno-strict-align where needed Alexandre Oliva
  2 siblings, 1 reply; 6+ messages in thread
From: Segher Boessenkool @ 2021-03-12  2:58 UTC (permalink / raw)
  To: Alexandre Oliva; +Cc: gcc-patches, Rainer Orth, Mike Stump, David Edelsohn

On Wed, Mar 10, 2021 at 02:41:50AM -0300, Alexandre Oliva wrote:
> ppc configurations that have -mstrict-align enabled by default fail
> gcc.dg/strlenopt-80.c, because some memcpy calls don't get turned into
> MEM_REFs, which defeats the tested-for strlen optimization.
> 
> This was regstrapped on x86_64-linux-gnu, tested with a cross to a
> ppc64-vxworks7r2 configured with -mstrict-align enabled by default,
> and I'm now also regstrapping on ppc64-linux-gnu just to be sure.
> Ok to install?

The -mstrict-align option is defined in sysv4.opt, which is not used in
all configurations (like, powerpc64-darwin*, and the AIX configs).  So
no, sorry; you'll need more work here.

Btw, aarch64 has this same option.


Segher

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

* Re: use -mno-strict-align for strlenopt-80.c on powerpc
  2021-03-10  5:41 use -mno-strict-align for strlenopt-80.c on powerpc Alexandre Oliva
  2021-03-12  2:58 ` Segher Boessenkool
@ 2021-03-12  7:55 ` Richard Biener
  2023-10-20  3:16 ` [PATCH] testsuite: check for and use -mno-strict-align where needed Alexandre Oliva
  2 siblings, 0 replies; 6+ messages in thread
From: Richard Biener @ 2021-03-12  7:55 UTC (permalink / raw)
  To: Alexandre Oliva; +Cc: GCC Patches, David Edelsohn, Segher Boessenkool

On Wed, Mar 10, 2021 at 7:04 AM Alexandre Oliva <oliva@adacore.com> wrote:
>
>
> ppc configurations that have -mstrict-align enabled by default fail
> gcc.dg/strlenopt-80.c, because some memcpy calls don't get turned into
> MEM_REFs, which defeats the tested-for strlen optimization.
>
> This was regstrapped on x86_64-linux-gnu, tested with a cross to a
> ppc64-vxworks7r2 configured with -mstrict-align enabled by default,
> and I'm now also regstrapping on ppc64-linux-gnu just to be sure.
> Ok to install?

Btw, I asked during two stage1s whether relaxing the folding to also
apply to strict-align targets would be OK.  But I didn't receive any
answers and thus dropped the ball ...

Basically for the folding turning integer-mode sized copies into
separate load + store also allow the load/store to be not aligned
according to their mode (and rely on RTL expansion to perform
bitfield load/store ops for them).

Richard.

>
> for  gcc/testsuite/ChangeLog
>
>         * gcc.dg/strlenopt-80.c: Add -mno-strict-align on ppc.
> ---
>  gcc/testsuite/gcc.dg/strlenopt-80.c |    6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/gcc/testsuite/gcc.dg/strlenopt-80.c b/gcc/testsuite/gcc.dg/strlenopt-80.c
> index 9124fe4740a1b..9978f5cf3bc56 100644
> --- a/gcc/testsuite/gcc.dg/strlenopt-80.c
> +++ b/gcc/testsuite/gcc.dg/strlenopt-80.c
> @@ -5,7 +5,11 @@
>     such a store.
>     { dg-do compile { target aarch64*-*-* i?86-*-* powerpc*-*-* x86_64-*-* } }
>
> -   { dg-options "-O2 -Wall -fdump-tree-optimized" } */
> +   { dg-options "-O2 -Wall -fdump-tree-optimized" }
> +
> +   On powerpc configurations that have -mstrict-align by default,
> +   the memcpy calls for ncpylog >= 3 are not turned into MEM_REFs.
> +   { dg-additional-options "-mno-strict-align" { target powerpc*-*-* } }  */
>
>  #define CHAR_BIT      __CHAR_BIT__
>  #define SIZE_MAX      __SIZE_MAX__
>
>
> --
> Alexandre Oliva, happy hacker  https://FSFLA.org/blogs/lxo/
>    Free Software Activist         GNU Toolchain Engineer
>         Vim, Vi, Voltei pro Emacs -- GNUlius Caesar

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

* Re: use -mno-strict-align for strlenopt-80.c on powerpc
  2021-03-12  2:58 ` Segher Boessenkool
@ 2021-03-12 13:33   ` Iain Sandoe
  0 siblings, 0 replies; 6+ messages in thread
From: Iain Sandoe @ 2021-03-12 13:33 UTC (permalink / raw)
  To: Alexandre Oliva; +Cc: gcc-patches, David Edelsohn, Segher Boessenkool

Segher Boessenkool <segher@kernel.crashing.org> wrote:

> On Wed, Mar 10, 2021 at 02:41:50AM -0300, Alexandre Oliva wrote:
>> ppc configurations that have -mstrict-align enabled by default fail
>> gcc.dg/strlenopt-80.c, because some memcpy calls don't get turned into
>> MEM_REFs, which defeats the tested-for strlen optimization.
>>
>> This was regstrapped on x86_64-linux-gnu, tested with a cross to a
>> ppc64-vxworks7r2 configured with -mstrict-align enabled by default,
>> and I'm now also regstrapping on ppc64-linux-gnu just to be sure.
>> Ok to install?
>
> The -mstrict-align option is defined in sysv4.opt, which is not used in
> all configurations (like, powerpc64-darwin*, and the AIX configs).

this works for me on powerpc-darwin, I haven’t tried to test AIX.

Iain

diff --git a/gcc/testsuite/gcc.target/powerpc/prefix-ds-dq.c  
b/gcc/testsuite/gcc.target/powerpc/prefix-ds-dq.c
index 554cd0c..6d51ea8 100644
--- a/gcc/testsuite/gcc.target/powerpc/prefix-ds-dq.c
+++ b/gcc/testsuite/gcc.target/powerpc/prefix-ds-dq.c
@@ -1,7 +1,9 @@
  /* { dg-do compile } */
  /* { dg-require-effective-target powerpc_prefixed_addr } */
  /* { dg-require-effective-target lp64 } */
-/* { dg-options "-O2 -mdejagnu-cpu=power10" } */
+/* { dg-options "-O2 -mdejagnu-cpu=power10 -mfloat128 " } */
+/* { dg-additional-options "-mno-strict-align" { target { ! { *-*-darwin*  
*-*-aix* } } } } */
+/* { dg-prune-output ".-mfloat128. option may not be fully supported" } */
 
  /* Tests whether we generate a prefixed load/store operation for addresses that
     don't meet DS/DQ offset constraints.  64-bit is needed for testing the use


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

* [PATCH] testsuite: check for and use -mno-strict-align where needed
  2021-03-10  5:41 use -mno-strict-align for strlenopt-80.c on powerpc Alexandre Oliva
  2021-03-12  2:58 ` Segher Boessenkool
  2021-03-12  7:55 ` Richard Biener
@ 2023-10-20  3:16 ` Alexandre Oliva
  2023-11-05 20:48   ` Mike Stump
  2 siblings, 1 reply; 6+ messages in thread
From: Alexandre Oliva @ 2023-10-20  3:16 UTC (permalink / raw)
  To: gcc-patches; +Cc: Rainer Orth, Mike Stump, Segher Boessenkool, David Edelsohn

On Mar 10, 2021, Alexandre Oliva <oliva@adacore.com> wrote:

> ppc configurations that have -mstrict-align enabled by default fail
> gcc.dg/strlenopt-80.c, because some memcpy calls don't get turned into
> MEM_REFs, which defeats the tested-for strlen optimization.

I've combined this patch with other patches that added -mno-strict-align
to tests that needed it on targets configured with -mstrict-align
enabled by default, and conditioned the use of the flag to targets that
support it.

Regstrapped on x86_64-linux-gnu, ppc64le-linux-gnu, also tested on a
ppc-vx7r2 configured with -mstrict-align.  Ok to install?

----

Various tests fail on powerpc if the toolchain is configured to enable
-mstrict-align by default.  This patch introduces -mno-strict-align on
tests found to fail that way, when the target supports this option.

I suppose !non_strict_align could be used to skip tests, instead of or
in addition to this tweak, and that might be desirable if they still
fail on targets that do no support -mno-strict-align, but I haven't
observed such scenarios.


The p9-vec-length tests expect vectorization on loop bodies and
epilogues that reference arrays that are not known to be more aligned
than their small element types.

Though VSX vectors work best with 32- or 64-bit alignment, unaligned
vector loads and stores are expected by the tests.  However, with
-mstrict-align by default, vector loads and stores not known to be
aligned end up open coded, which doesn't match the asm output
expectations coded in the tests.


for  gcc/ChangeLog

	* doc/sourcebuild.texi (opt_mstrict_align): New target.

for  gcc/testsuite/ChangeLog

	* lib/target-supports.exp
	(check_effective_target_opt_mstrict_align): New.
	* gcc.dg/strlenopt-80.c: Add -mno-strict-align if supported.
	* gcc.target/powerpc/prefix-ds-dq.c: Likewise.
	* gcc.target/powerpc/p9-vec-length-epil-1.c: Likewise.
	* gcc.target/powerpc/p9-vec-length-epil-2.c: Likewise.
	* gcc.target/powerpc/p9-vec-length-epil-3.c: Likewise.
	* gcc.target/powerpc/p9-vec-length-epil-4.c: Likewise.
	* gcc.target/powerpc/p9-vec-length-epil-5.c: Likewise.
	* gcc.target/powerpc/p9-vec-length-epil-6.c: Likewise.
	* gcc.target/powerpc/p9-vec-length-epil-7.c: Likewise.
	* gcc.target/powerpc/p9-vec-length-epil-8.c: Likewise.
	* gcc.target/powerpc/p9-vec-length-epil-run-1.c: Likewise.
	* gcc.target/powerpc/p9-vec-length-epil-run-2.c: Likewise.
	* gcc.target/powerpc/p9-vec-length-epil-run-3.c: Likewise.
	* gcc.target/powerpc/p9-vec-length-epil-run-4.c: Likewise.
	* gcc.target/powerpc/p9-vec-length-epil-run-5.c: Likewise.
	* gcc.target/powerpc/p9-vec-length-epil-run-6.c: Likewise.
	* gcc.target/powerpc/p9-vec-length-epil-run-7.c: Likewise.
	* gcc.target/powerpc/p9-vec-length-epil-run-8.c: Likewise.
	* gcc.target/powerpc/p9-vec-length-full-1.c: Likewise.
	* gcc.target/powerpc/p9-vec-length-full-2.c: Likewise.
	* gcc.target/powerpc/p9-vec-length-full-3.c: Likewise.
	* gcc.target/powerpc/p9-vec-length-full-4.c: Likewise.
	* gcc.target/powerpc/p9-vec-length-full-5.c: Likewise.
	* gcc.target/powerpc/p9-vec-length-full-6.c: Likewise.
	* gcc.target/powerpc/p9-vec-length-full-7.c: Likewise.
	* gcc.target/powerpc/p9-vec-length-full-8.c: Likewise.
	* gcc.target/powerpc/p9-vec-length-full-run-1.c: Likewise.
	* gcc.target/powerpc/p9-vec-length-full-run-2.c: Likewise.
	* gcc.target/powerpc/p9-vec-length-full-run-3.c: Likewise.
	* gcc.target/powerpc/p9-vec-length-full-run-4.c: Likewise.
	* gcc.target/powerpc/p9-vec-length-full-run-5.c: Likewise.
	* gcc.target/powerpc/p9-vec-length-full-run-6.c: Likewise.
	* gcc.target/powerpc/p9-vec-length-full-run-7.c: Likewise.
	* gcc.target/powerpc/p9-vec-length-full-run-8.c: Likewise.
---
 gcc/doc/sourcebuild.texi                           |    3 +++
 gcc/testsuite/gcc.dg/strlenopt-80.c                |    4 ++++
 .../gcc.target/powerpc/p9-vec-length-epil-1.c      |    2 ++
 .../gcc.target/powerpc/p9-vec-length-epil-2.c      |    2 ++
 .../gcc.target/powerpc/p9-vec-length-epil-3.c      |    2 ++
 .../gcc.target/powerpc/p9-vec-length-epil-4.c      |    2 ++
 .../gcc.target/powerpc/p9-vec-length-epil-5.c      |    2 ++
 .../gcc.target/powerpc/p9-vec-length-epil-6.c      |    2 ++
 .../gcc.target/powerpc/p9-vec-length-epil-7.c      |    2 ++
 .../gcc.target/powerpc/p9-vec-length-epil-8.c      |    2 ++
 .../gcc.target/powerpc/p9-vec-length-epil-run-1.c  |    2 ++
 .../gcc.target/powerpc/p9-vec-length-epil-run-2.c  |    2 ++
 .../gcc.target/powerpc/p9-vec-length-epil-run-3.c  |    2 ++
 .../gcc.target/powerpc/p9-vec-length-epil-run-4.c  |    2 ++
 .../gcc.target/powerpc/p9-vec-length-epil-run-5.c  |    2 ++
 .../gcc.target/powerpc/p9-vec-length-epil-run-6.c  |    2 ++
 .../gcc.target/powerpc/p9-vec-length-epil-run-7.c  |    2 ++
 .../gcc.target/powerpc/p9-vec-length-epil-run-8.c  |    2 ++
 .../gcc.target/powerpc/p9-vec-length-full-1.c      |    2 ++
 .../gcc.target/powerpc/p9-vec-length-full-2.c      |    2 ++
 .../gcc.target/powerpc/p9-vec-length-full-3.c      |    2 ++
 .../gcc.target/powerpc/p9-vec-length-full-4.c      |    2 ++
 .../gcc.target/powerpc/p9-vec-length-full-5.c      |    2 ++
 .../gcc.target/powerpc/p9-vec-length-full-6.c      |    2 ++
 .../gcc.target/powerpc/p9-vec-length-full-7.c      |    2 ++
 .../gcc.target/powerpc/p9-vec-length-full-8.c      |    2 ++
 .../gcc.target/powerpc/p9-vec-length-full-run-1.c  |    2 ++
 .../gcc.target/powerpc/p9-vec-length-full-run-2.c  |    2 ++
 .../gcc.target/powerpc/p9-vec-length-full-run-3.c  |    2 ++
 .../gcc.target/powerpc/p9-vec-length-full-run-4.c  |    2 ++
 .../gcc.target/powerpc/p9-vec-length-full-run-5.c  |    2 ++
 .../gcc.target/powerpc/p9-vec-length-full-run-6.c  |    2 ++
 .../gcc.target/powerpc/p9-vec-length-full-run-7.c  |    2 ++
 .../gcc.target/powerpc/p9-vec-length-full-run-8.c  |    2 ++
 gcc/testsuite/gcc.target/powerpc/prefix-ds-dq.c    |    2 ++
 gcc/testsuite/lib/target-supports.exp              |    8 ++++++++
 36 files changed, 81 insertions(+)

diff --git a/gcc/doc/sourcebuild.texi b/gcc/doc/sourcebuild.texi
index c20af31c64237..d6c7a2f93102d 100644
--- a/gcc/doc/sourcebuild.texi
+++ b/gcc/doc/sourcebuild.texi
@@ -2580,6 +2580,9 @@ Target supports FPU instructions.
 @item non_strict_align
 Target does not require strict alignment.
 
+@item opt_mstrict_align
+Target supports @option{-mstrict-align} and @option{-mno-strict-align}.
+
 @item pie_copyreloc
 The x86-64 target linker supports PIE with copy reloc.
 
diff --git a/gcc/testsuite/gcc.dg/strlenopt-80.c b/gcc/testsuite/gcc.dg/strlenopt-80.c
index a8adbf1eed549..63d4eb17e4c3f 100644
--- a/gcc/testsuite/gcc.dg/strlenopt-80.c
+++ b/gcc/testsuite/gcc.dg/strlenopt-80.c
@@ -8,6 +8,10 @@
    { dg-options "-O2 -Wall -fdump-tree-optimized" }
    { dg-additional-options "-msse" { target i?86-*-* x86_64-*-* } } */
 
+/* On powerpc configurations that have -mstrict-align by default,
+   the memcpy calls for ncpylog >= 3 are not turned into MEM_REFs.
+   { dg-additional-options "-mno-strict-align" { target opt_mstrict_align } }  */
+
 #define CHAR_BIT      __CHAR_BIT__
 #define SIZE_MAX      __SIZE_MAX__
 #define LEN_MAX       (__PTRDIFF_MAX__ - 2)
diff --git a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-1.c b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-1.c
index dfcc0e9532058..f57d9457bd94c 100644
--- a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-1.c
+++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-1.c
@@ -3,6 +3,8 @@
 
 /* { dg-additional-options "--param=vect-partial-vector-usage=1" } */
 
+/* { dg-additional-options "-mno-strict-align" { target opt_mstrict_align } } */
+
 /* Test for that only vectorize the epilogue with vector access with length,
    the main body still use normal vector load/store.  */
 
diff --git a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-2.c b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-2.c
index e63f1bf23722e..19856407d277e 100644
--- a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-2.c
+++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-2.c
@@ -3,6 +3,8 @@
 
 /* { dg-additional-options "--param=vect-partial-vector-usage=1" } */
 
+/* { dg-additional-options "-mno-strict-align" { target opt_mstrict_align } } */
+
 /* Test for that only vectorize the epilogue with vector access with length,
    the main body still use normal vector load/store.  */
 
diff --git a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-3.c b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-3.c
index 4a99e3a326549..eaea96d1eadd1 100644
--- a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-3.c
+++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-3.c
@@ -3,6 +3,8 @@
 
 /* { dg-additional-options "--param=vect-partial-vector-usage=1" } */
 
+/* { dg-additional-options "-mno-strict-align" { target opt_mstrict_align } } */
+
 /* Test for that only vectorize the epilogue with vector access with length,
    the main body still use normal vector load/store.  */
 
diff --git a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-4.c b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-4.c
index 9fbee6a4324b5..01991325ca8b6 100644
--- a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-4.c
+++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-4.c
@@ -3,6 +3,8 @@
 
 /* { dg-additional-options "--param=vect-partial-vector-usage=1" } */
 
+/* { dg-additional-options "-mno-strict-align" { target opt_mstrict_align } } */
+
 /* Test for that only vectorize the epilogue with vector access with length,
    the main body still use normal vector load/store.  */
 
diff --git a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-5.c b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-5.c
index d023a998c3ba3..c68faa8c557a9 100644
--- a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-5.c
+++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-5.c
@@ -3,6 +3,8 @@
 
 /* { dg-additional-options "--param=vect-partial-vector-usage=1" } */
 
+/* { dg-additional-options "-mno-strict-align" { target opt_mstrict_align } } */
+
 /* Test for that only vectorize the epilogue with vector access with length,
    the main body still use normal vector load/store.  */
 
diff --git a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-6.c b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-6.c
index dbce90757e362..18076cc8218cf 100644
--- a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-6.c
+++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-6.c
@@ -3,6 +3,8 @@
 
 /* { dg-additional-options "--param=vect-partial-vector-usage=1" } */
 
+/* { dg-additional-options "-mno-strict-align" { target opt_mstrict_align } } */
+
 /* Test for that only vectorize the epilogue with vector access with length,
    the main body still use normal vector load/store.  */
 
diff --git a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-7.c b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-7.c
index 011b731f7c5a0..4e37c0a0095d3 100644
--- a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-7.c
+++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-7.c
@@ -5,6 +5,8 @@
 
 /* { dg-additional-options "--param=vect-partial-vector-usage=1" } */
 
+/* { dg-additional-options "-mno-strict-align" { target opt_mstrict_align } } */
+
 /* Test for that only vectorize the epilogue with vector access with length,
    the main body still use normal vector load/store.  */
 
diff --git a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-8.c b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-8.c
index e56fd55f623f3..0f3cd07226829 100644
--- a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-8.c
+++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-8.c
@@ -3,6 +3,8 @@
 
 /* { dg-additional-options "--param=vect-partial-vector-usage=1" } */
 
+/* { dg-additional-options "-mno-strict-align" { target opt_mstrict_align } } */
+
 /* Test for that only vectorize the epilogue with vector access with length,
    the main body still use normal vector load/store.  */
 
diff --git a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-run-1.c b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-run-1.c
index d1cd67f0c4d96..2f091a3114708 100644
--- a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-run-1.c
+++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-run-1.c
@@ -3,6 +3,8 @@
 
 /* { dg-additional-options "--param=vect-partial-vector-usage=1" } */
 
+/* { dg-additional-options "-mno-strict-align" { target opt_mstrict_align } } */
+
 /* Check whether it runs successfully if we only vectorize the epilogue
    with vector access with length.  */
 
diff --git a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-run-2.c b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-run-2.c
index 815867b51d05d..03b172521a8fd 100644
--- a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-run-2.c
+++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-run-2.c
@@ -3,6 +3,8 @@
 
 /* { dg-additional-options "--param=vect-partial-vector-usage=1" } */
 
+/* { dg-additional-options "-mno-strict-align" { target opt_mstrict_align } } */
+
 /* Check whether it runs successfully if we only vectorize the epilogue
    with vector access with length.  */
 
diff --git a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-run-3.c b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-run-3.c
index 5378d02c26975..5329422cd3aa0 100644
--- a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-run-3.c
+++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-run-3.c
@@ -3,6 +3,8 @@
 
 /* { dg-additional-options "--param=vect-partial-vector-usage=1" } */
 
+/* { dg-additional-options "-mno-strict-align" { target opt_mstrict_align } } */
+
 /* Check whether it runs successfully if we only vectorize the epilogue
    with vector access with length.  */
 
diff --git a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-run-4.c b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-run-4.c
index daed9a7774ee0..2021372c68b6f 100644
--- a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-run-4.c
+++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-run-4.c
@@ -3,6 +3,8 @@
 
 /* { dg-additional-options "--param=vect-partial-vector-usage=1" } */
 
+/* { dg-additional-options "-mno-strict-align" { target opt_mstrict_align } } */
+
 /* Check whether it runs successfully if we only vectorize the epilogue
    with vector access with length.  */
 
diff --git a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-run-5.c b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-run-5.c
index b5f24e68d8461..00ed61a5df167 100644
--- a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-run-5.c
+++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-run-5.c
@@ -3,6 +3,8 @@
 
 /* { dg-additional-options "--param=vect-partial-vector-usage=1" } */
 
+/* { dg-additional-options "-mno-strict-align" { target opt_mstrict_align } } */
+
 /* Check whether it runs successfully if we only vectorize the epilogue
    with vector access with length.  */
 
diff --git a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-run-6.c b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-run-6.c
index a3e6367384711..adbfd080c94e9 100644
--- a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-run-6.c
+++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-run-6.c
@@ -3,6 +3,8 @@
 
 /* { dg-additional-options "--param=vect-partial-vector-usage=1" } */
 
+/* { dg-additional-options "-mno-strict-align" { target opt_mstrict_align } } */
+
 /* Check whether it runs successfully if we only vectorize the epilogue
    with vector access with length.  */
 
diff --git a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-run-7.c b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-run-7.c
index f0b69d462a19f..79ba4a1757987 100644
--- a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-run-7.c
+++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-run-7.c
@@ -3,6 +3,8 @@
 
 /* { dg-additional-options "--param=vect-partial-vector-usage=1" } */
 
+/* { dg-additional-options "-mno-strict-align" { target opt_mstrict_align } } */
+
 /* Check whether it runs successfully if we only vectorize the epilogue
    with vector access with length.  */
 
diff --git a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-run-8.c b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-run-8.c
index 84abecf3f692a..6e09b07d41019 100644
--- a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-run-8.c
+++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-run-8.c
@@ -3,6 +3,8 @@
 
 /* { dg-additional-options "--param=vect-partial-vector-usage=1" } */
 
+/* { dg-additional-options "-mno-strict-align" { target opt_mstrict_align } } */
+
 /* Check whether it runs successfully if we only vectorize the epilogue
    with vector access with length.  */
 
diff --git a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-1.c b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-1.c
index f01f1c54fa566..2818bac36a2f6 100644
--- a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-1.c
+++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-1.c
@@ -3,6 +3,8 @@
 
 /* { dg-additional-options "--param=vect-partial-vector-usage=2" } */
 
+/* { dg-additional-options "-mno-strict-align" { target opt_mstrict_align } } */
+
 /* Test for fully with length, the loop body uses vector access with length,
    there should not be any epilogues.  */
 
diff --git a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-2.c b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-2.c
index f546e97fa7df4..b476910753f58 100644
--- a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-2.c
+++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-2.c
@@ -3,6 +3,8 @@
 
 /* { dg-additional-options "--param=vect-partial-vector-usage=2" } */
 
+/* { dg-additional-options "-mno-strict-align" { target opt_mstrict_align } } */
+
 /* Test for fully with length, the loop body uses vector access with length,
    there should not be any epilogues.  */
 
diff --git a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-3.c b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-3.c
index 65142b3fecd0b..0f502423c88ae 100644
--- a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-3.c
+++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-3.c
@@ -3,6 +3,8 @@
 
 /* { dg-additional-options "--param=vect-partial-vector-usage=2" } */
 
+/* { dg-additional-options "-mno-strict-align" { target opt_mstrict_align } } */
+
 /* Test for fully with length, the loop body uses vector access with length,
    there should not be any epilogues.  */
 
diff --git a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-4.c b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-4.c
index a4cc7aafaebb2..20ddfb392e11e 100644
--- a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-4.c
+++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-4.c
@@ -3,6 +3,8 @@
 
 /* { dg-additional-options "--param=vect-partial-vector-usage=2" } */
 
+/* { dg-additional-options "-mno-strict-align" { target opt_mstrict_align } } */
+
 /* Test for fully with length, the loop body uses vector access with length,
    there should not be any epilogues.  */
 
diff --git a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-5.c b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-5.c
index 4b0b9070c84d7..0bad6938bf8c5 100644
--- a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-5.c
+++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-5.c
@@ -3,6 +3,8 @@
 
 /* { dg-additional-options "--param=vect-partial-vector-usage=2" } */
 
+/* { dg-additional-options "-mno-strict-align" { target opt_mstrict_align } } */
+
 /* Test for fully with length, the loop body uses vector access with length,
    there should not be any epilogues.  */
 
diff --git a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-6.c b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-6.c
index 65ddf2b098a69..a73178e3ad394 100644
--- a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-6.c
+++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-6.c
@@ -3,6 +3,8 @@
 
 /* { dg-additional-options "--param=vect-partial-vector-usage=2" } */
 
+/* { dg-additional-options "-mno-strict-align" { target opt_mstrict_align } } */
+
 /* Test for fully with length, the loop body uses vector access with length,
    there should not be any epilogues.  */
 
diff --git a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-7.c b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-7.c
index e0e51d9a9724c..b50ff3cf6ef22 100644
--- a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-7.c
+++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-7.c
@@ -5,6 +5,8 @@
 
 /* { dg-additional-options "--param=vect-partial-vector-usage=2" } */
 
+/* { dg-additional-options "-mno-strict-align" { target opt_mstrict_align } } */
+
 /* Test for fully with length, the loop body uses vector access with length,
    there should not be any epilogues.  */
 
diff --git a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-8.c b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-8.c
index 7fe0dd0043181..94f2aa48f57fc 100644
--- a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-8.c
+++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-8.c
@@ -3,6 +3,8 @@
 
 /* { dg-additional-options "--param=vect-partial-vector-usage=2" } */
 
+/* { dg-additional-options "-mno-strict-align" { target opt_mstrict_align } } */
+
 /* Test for fully with length, the loop body uses vector access with length,
    there should not be any epilogues.  */
 
diff --git a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-run-1.c b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-run-1.c
index 4e9bd0fbad303..8950392d29b6c 100644
--- a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-run-1.c
+++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-run-1.c
@@ -3,6 +3,8 @@
 
 /* { dg-additional-options "--param=vect-partial-vector-usage=2" } */
 
+/* { dg-additional-options "-mno-strict-align" { target opt_mstrict_align } } */
+
 /* Check whether it runs successfully if we vectorize the loop fully
    with vector access with length.  */
 
diff --git a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-run-2.c b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-run-2.c
index 8e06b1b9304a8..1f295ae9d696b 100644
--- a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-run-2.c
+++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-run-2.c
@@ -3,6 +3,8 @@
 
 /* { dg-additional-options "--param=vect-partial-vector-usage=2" } */
 
+/* { dg-additional-options "-mno-strict-align" { target opt_mstrict_align } } */
+
 /* Check whether it runs successfully if we vectorize the loop fully
    with vector access with length.  */
 
diff --git a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-run-3.c b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-run-3.c
index 0b86f62834fb4..1cb9b8f97c210 100644
--- a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-run-3.c
+++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-run-3.c
@@ -3,6 +3,8 @@
 
 /* { dg-additional-options "--param=vect-partial-vector-usage=2" } */
 
+/* { dg-additional-options "-mno-strict-align" { target opt_mstrict_align } } */
+
 /* Check whether it runs successfully if we vectorize the loop fully
    with vector access with length.  */
 
diff --git a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-run-4.c b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-run-4.c
index 359f31c9ed5ec..029454afd27bf 100644
--- a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-run-4.c
+++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-run-4.c
@@ -3,6 +3,8 @@
 
 /* { dg-additional-options "--param=vect-partial-vector-usage=2" } */
 
+/* { dg-additional-options "-mno-strict-align" { target opt_mstrict_align } } */
+
 /* Check whether it runs successfully if we vectorize the loop fully
    with vector access with length.  */
 
diff --git a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-run-5.c b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-run-5.c
index 7aa468e5b4e4b..02bb0a8964b87 100644
--- a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-run-5.c
+++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-run-5.c
@@ -3,6 +3,8 @@
 
 /* { dg-additional-options "--param=vect-partial-vector-usage=2" } */
 
+/* { dg-additional-options "-mno-strict-align" { target opt_mstrict_align } } */
+
 /* Check whether it runs successfully if we vectorize the loop fully
    with vector access with length.  */
 
diff --git a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-run-6.c b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-run-6.c
index 53a2ad07fb324..9839ad9e1d918 100644
--- a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-run-6.c
+++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-run-6.c
@@ -3,6 +3,8 @@
 
 /* { dg-additional-options "--param=vect-partial-vector-usage=2" } */
 
+/* { dg-additional-options "-mno-strict-align" { target opt_mstrict_align } } */
+
 /* Check whether it runs successfully if we vectorize the loop fully
    with vector access with length.  */
 
diff --git a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-run-7.c b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-run-7.c
index 0c21d137b9d58..10ce7740fa789 100644
--- a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-run-7.c
+++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-run-7.c
@@ -3,6 +3,8 @@
 
 /* { dg-additional-options "--param=vect-partial-vector-usage=2" } */
 
+/* { dg-additional-options "-mno-strict-align" { target opt_mstrict_align } } */
+
 /* Check whether it runs successfully if we vectorize the loop fully
    with vector access with length.  */
 
diff --git a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-run-8.c b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-run-8.c
index 910784260677d..163bfb2f9bc12 100644
--- a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-run-8.c
+++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-run-8.c
@@ -3,6 +3,8 @@
 
 /* { dg-additional-options "--param=vect-partial-vector-usage=2" } */
 
+/* { dg-additional-options "-mno-strict-align" { target opt_mstrict_align } } */
+
 /* Check whether it runs successfully if we vectorize the loop fully
    with vector access with length.  */
 
diff --git a/gcc/testsuite/gcc.target/powerpc/prefix-ds-dq.c b/gcc/testsuite/gcc.target/powerpc/prefix-ds-dq.c
index 554cd0c1beac0..3f477a07cb326 100644
--- a/gcc/testsuite/gcc.target/powerpc/prefix-ds-dq.c
+++ b/gcc/testsuite/gcc.target/powerpc/prefix-ds-dq.c
@@ -2,6 +2,8 @@
 /* { dg-require-effective-target powerpc_prefixed_addr } */
 /* { dg-require-effective-target lp64 } */
 /* { dg-options "-O2 -mdejagnu-cpu=power10" } */
+/* If -mstrict-align is enabled by default, we don't get the expected opcodes.
+   { dg-additional-options "-mno-strict-align" { target opt_mstrict_align } } */
 
 /* Tests whether we generate a prefixed load/store operation for addresses that
    don't meet DS/DQ offset constraints.  64-bit is needed for testing the use
diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index f0b692a2e19ba..1a563cacfb239 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -11468,6 +11468,14 @@ proc check_effective_target_non_strict_align {} {
     } "-Wcast-align"]
 }
 
+# Return 1 if the target supports -mstrict-align (and -mno-strict-align).
+
+proc check_effective_target_opt_mstrict_align {} {
+    return [check_no_compiler_messages opt_mstrict_align assembly {
+	void foo(void) {}
+    } "-mstrict-align -mno-strict-align"]
+}
+
 # Return 1 if the target has <ucontext.h>.
 
 proc check_effective_target_ucontext_h { } {


-- 
Alexandre Oliva, happy hacker            https://FSFLA.org/blogs/lxo/
   Free Software Activist                   GNU Toolchain Engineer
More tolerance and less prejudice are key for inclusion and diversity
Excluding neuro-others for not behaving ""normal"" is *not* inclusive

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

* Re: [PATCH] testsuite: check for and use -mno-strict-align where needed
  2023-10-20  3:16 ` [PATCH] testsuite: check for and use -mno-strict-align where needed Alexandre Oliva
@ 2023-11-05 20:48   ` Mike Stump
  0 siblings, 0 replies; 6+ messages in thread
From: Mike Stump @ 2023-11-05 20:48 UTC (permalink / raw)
  To: Alexandre Oliva
  Cc: gcc-patches, Rainer Orth, Segher Boessenkool, David Edelsohn

On Oct 19, 2023, at 8:16 PM, Alexandre Oliva <oliva@adacore.com> wrote:
> 
> On Mar 10, 2021, Alexandre Oliva <oliva@adacore.com> wrote:
> 
>> ppc configurations that have -mstrict-align enabled by default fail
>> gcc.dg/strlenopt-80.c, because some memcpy calls don't get turned into
>> MEM_REFs, which defeats the tested-for strlen optimization.
> 
> I've combined this patch with other patches that added -mno-strict-align
> to tests that needed it on targets configured with -mstrict-align
> enabled by default, and conditioned the use of the flag to targets that
> support it.
> 
> Regstrapped on x86_64-linux-gnu, ppc64le-linux-gnu, also tested on a
> ppc-vx7r2 configured with -mstrict-align.  Ok to install?

Ok.


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

end of thread, other threads:[~2023-11-05 20:48 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-10  5:41 use -mno-strict-align for strlenopt-80.c on powerpc Alexandre Oliva
2021-03-12  2:58 ` Segher Boessenkool
2021-03-12 13:33   ` Iain Sandoe
2021-03-12  7:55 ` Richard Biener
2023-10-20  3:16 ` [PATCH] testsuite: check for and use -mno-strict-align where needed Alexandre Oliva
2023-11-05 20:48   ` Mike Stump

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).