diff mbox series

middle-end: skip vectorization check on ilp32 on vect-early-break_124-pr114403.c

Message ID patch-18418-tamar@arm.com
State New
Headers show
Series middle-end: skip vectorization check on ilp32 on vect-early-break_124-pr114403.c | expand

Commit Message

Tamar Christina April 16, 2024, 5:41 a.m. UTC
Hi all,

The testcase seems to fail vectorization on -m32 since the access pattern is
determined as too complex.  This skips the vectorization check on ilp32 systems
as I couldn't find a better proxy for being able to do strided 64-bit loads and
I suspect it would fail on all 32-bit targets.

Regtested on x86_64-pc-linux-gnu with -m32 and no issues.

Ok for master?

Thanks,
Tamar

gcc/testsuite/ChangeLog:

	PR tree-optimization/114403
	* gcc.dg/vect/vect-early-break_124-pr114403.c: Skip in ilp32.

---




--

Comments

Richard Biener April 16, 2024, 7 a.m. UTC | #1
On Tue, 16 Apr 2024, Tamar Christina wrote:

> Hi all,
> 
> The testcase seems to fail vectorization on -m32 since the access pattern is
> determined as too complex.  This skips the vectorization check on ilp32 systems
> as I couldn't find a better proxy for being able to do strided 64-bit loads and
> I suspect it would fail on all 32-bit targets.

You could try having Val aligned to 64bits in the structure (likely
32bit targets have it not aligned).

> Regtested on x86_64-pc-linux-gnu with -m32 and no issues.
> 
> Ok for master?
> 
> Thanks,
> Tamar
> 
> gcc/testsuite/ChangeLog:
> 
> 	PR tree-optimization/114403
> 	* gcc.dg/vect/vect-early-break_124-pr114403.c: Skip in ilp32.
> 
> ---
> diff --git a/gcc/testsuite/gcc.dg/vect/vect-early-break_124-pr114403.c b/gcc/testsuite/gcc.dg/vect/vect-early-break_124-pr114403.c
> index 1751296ab813fe85eaab1f58dc674bac10f6eb7a..db8e00556f116ca81c5a6558ec6ecd3b222ec93d 100644
> --- a/gcc/testsuite/gcc.dg/vect/vect-early-break_124-pr114403.c
> +++ b/gcc/testsuite/gcc.dg/vect/vect-early-break_124-pr114403.c
> @@ -2,11 +2,11 @@
>  /* { dg-require-effective-target vect_early_break_hw } */
>  /* { dg-require-effective-target vect_long_long } */
>  
> -/* { dg-final { scan-tree-dump "LOOP VECTORIZED" "vect" } } */
> +/* { dg-final { scan-tree-dump "LOOP VECTORIZED" "vect" { target { ! ilp32 } } } } */
>  
>  #include "tree-vect.h"
>  
> -typedef unsigned long PV;
> +typedef unsigned long long PV;
>  typedef struct _buff_t {
>      int foo;
>      PV Val;
> 
> 
> 
> 
>
Jakub Jelinek April 16, 2024, 7:06 a.m. UTC | #2
On Tue, Apr 16, 2024 at 09:00:53AM +0200, Richard Biener wrote:
> > 	PR tree-optimization/114403
> > 	* gcc.dg/vect/vect-early-break_124-pr114403.c: Skip in ilp32.
> > 
> > ---
> > diff --git a/gcc/testsuite/gcc.dg/vect/vect-early-break_124-pr114403.c b/gcc/testsuite/gcc.dg/vect/vect-early-break_124-pr114403.c
> > index 1751296ab813fe85eaab1f58dc674bac10f6eb7a..db8e00556f116ca81c5a6558ec6ecd3b222ec93d 100644
> > --- a/gcc/testsuite/gcc.dg/vect/vect-early-break_124-pr114403.c
> > +++ b/gcc/testsuite/gcc.dg/vect/vect-early-break_124-pr114403.c
> > @@ -2,11 +2,11 @@
> >  /* { dg-require-effective-target vect_early_break_hw } */
> >  /* { dg-require-effective-target vect_long_long } */
> >  
> > -/* { dg-final { scan-tree-dump "LOOP VECTORIZED" "vect" } } */
> > +/* { dg-final { scan-tree-dump "LOOP VECTORIZED" "vect" { target { ! ilp32 } } } } */
> >  
> >  #include "tree-vect.h"
> >  
> > -typedef unsigned long PV;
> > +typedef unsigned long long PV;
> >  typedef struct _buff_t {
> >      int foo;
> >      PV Val;

As discussed on IRC, I think we want
--- gcc/testsuite/gcc.dg/vect/vect-early-break_124-pr114403.c.jj	2024-04-16 08:43:36.001729192 +0200
+++ gcc/testsuite/gcc.dg/vect/vect-early-break_124-pr114403.c	2024-04-16 08:55:11.296214959 +0200
@@ -64,8 +64,8 @@ int main ()
 
   int store_size = sizeof(PV);
 #pragma GCC novector
-  for (int i = 0; i < NUM - 1; i+=store_size)
-    if (0 != __builtin_memcmp (buffer+i, (char*)&tmp[i].Val, store_size))
+  for (int i = 0; i < NUM - 1; i++)
+    if (0 != __builtin_memcmp (buffer+i*store_size, (char*)&tmp[i].Val, store_size))
       __builtin_abort ();
 
   return 0;

instead (and then I think there is no need to switch PV from unsigned long
to unsigned long long, nor disabling on ilp32.

	Jakub
Tamar Christina April 16, 2024, 7:12 a.m. UTC | #3
> On Tue, Apr 16, 2024 at 09:00:53AM +0200, Richard Biener wrote:
> > > 	PR tree-optimization/114403
> > > 	* gcc.dg/vect/vect-early-break_124-pr114403.c: Skip in ilp32.
> > >
> > > ---
> > > diff --git a/gcc/testsuite/gcc.dg/vect/vect-early-break_124-pr114403.c
> b/gcc/testsuite/gcc.dg/vect/vect-early-break_124-pr114403.c
> > > index
> 1751296ab813fe85eaab1f58dc674bac10f6eb7a..db8e00556f116ca81c5a6558e
> c6ecd3b222ec93d 100644
> > > --- a/gcc/testsuite/gcc.dg/vect/vect-early-break_124-pr114403.c
> > > +++ b/gcc/testsuite/gcc.dg/vect/vect-early-break_124-pr114403.c
> > > @@ -2,11 +2,11 @@
> > >  /* { dg-require-effective-target vect_early_break_hw } */
> > >  /* { dg-require-effective-target vect_long_long } */
> > >
> > > -/* { dg-final { scan-tree-dump "LOOP VECTORIZED" "vect" } } */
> > > +/* { dg-final { scan-tree-dump "LOOP VECTORIZED" "vect" { target { ! ilp32 } } }
> } */
> > >
> > >  #include "tree-vect.h"
> > >
> > > -typedef unsigned long PV;
> > > +typedef unsigned long long PV;
> > >  typedef struct _buff_t {
> > >      int foo;
> > >      PV Val;
> 
> As discussed on IRC, I think we want
> --- gcc/testsuite/gcc.dg/vect/vect-early-break_124-pr114403.c.jj	2024-04-
> 16 08:43:36.001729192 +0200
> +++ gcc/testsuite/gcc.dg/vect/vect-early-break_124-pr114403.c	2024-04-
> 16 08:55:11.296214959 +0200
> @@ -64,8 +64,8 @@ int main ()
> 
>    int store_size = sizeof(PV);
>  #pragma GCC novector
> -  for (int i = 0; i < NUM - 1; i+=store_size)
> -    if (0 != __builtin_memcmp (buffer+i, (char*)&tmp[i].Val, store_size))
> +  for (int i = 0; i < NUM - 1; i++)
> +    if (0 != __builtin_memcmp (buffer+i*store_size, (char*)&tmp[i].Val, store_size))
>        __builtin_abort ();
> 
>    return 0;
> 
> instead (and then I think there is no need to switch PV from unsigned long
> to unsigned long long, nor disabling on ilp32.
> 

Regtested on x86_64-pc-linux-gnu with -m32,-m64 and no issues.

Ok for master?

Thanks,
Tamar

gcc/testsuite/ChangeLog:

	PR tree-optimization/114403
	* gcc.dg/vect/vect-early-break_124-pr114403.c: Fix check loop.

-- inline copy of patch --

diff --git a/gcc/testsuite/gcc.dg/vect/vect-early-break_124-pr114403.c b/gcc/testsuite/gcc.dg/vect/vect-early-break_124-pr114403.c
index 1751296ab813fe85eaab1f58dc674bac10f6eb7a..51abf245ccb51b85f06916a8a0238698911ab551 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-early-break_124-pr114403.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-early-break_124-pr114403.c
@@ -68,8 +68,8 @@ int main ()
 
   int store_size = sizeof(PV);
 #pragma GCC novector
-  for (int i = 0; i < NUM - 1; i+=store_size)
-    if (0 != __builtin_memcmp (buffer+i, (char*)&tmp[i].Val, store_size))
+  for (int i = 0; i < NUM - 1; i++)
+    if (0 != __builtin_memcmp (buffer+(i*store_size), (char*)&tmp[i].Val, store_size))
       __builtin_abort ();
 
   return 0;
Jakub Jelinek April 16, 2024, 1:44 p.m. UTC | #4
On Tue, Apr 16, 2024 at 07:12:23AM +0000, Tamar Christina wrote:
> Regtested on x86_64-pc-linux-gnu with -m32,-m64 and no issues.
> 
> Ok for master?
> 
> Thanks,
> Tamar
> 
> gcc/testsuite/ChangeLog:
> 
> 	PR tree-optimization/114403
> 	* gcc.dg/vect/vect-early-break_124-pr114403.c: Fix check loop.
> 
> -- inline copy of patch --
> 
> diff --git a/gcc/testsuite/gcc.dg/vect/vect-early-break_124-pr114403.c b/gcc/testsuite/gcc.dg/vect/vect-early-break_124-pr114403.c
> index 1751296ab813fe85eaab1f58dc674bac10f6eb7a..51abf245ccb51b85f06916a8a0238698911ab551 100644
> --- a/gcc/testsuite/gcc.dg/vect/vect-early-break_124-pr114403.c
> +++ b/gcc/testsuite/gcc.dg/vect/vect-early-break_124-pr114403.c
> @@ -68,8 +68,8 @@ int main ()
>  
>    int store_size = sizeof(PV);
>  #pragma GCC novector
> -  for (int i = 0; i < NUM - 1; i+=store_size)
> -    if (0 != __builtin_memcmp (buffer+i, (char*)&tmp[i].Val, store_size))
> +  for (int i = 0; i < NUM - 1; i++)
> +    if (0 != __builtin_memcmp (buffer+(i*store_size), (char*)&tmp[i].Val, store_size))
>        __builtin_abort ();
>  
>    return 0;

LGTM.

	Jakub
diff mbox series

Patch

diff --git a/gcc/testsuite/gcc.dg/vect/vect-early-break_124-pr114403.c b/gcc/testsuite/gcc.dg/vect/vect-early-break_124-pr114403.c
index 1751296ab813fe85eaab1f58dc674bac10f6eb7a..db8e00556f116ca81c5a6558ec6ecd3b222ec93d 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-early-break_124-pr114403.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-early-break_124-pr114403.c
@@ -2,11 +2,11 @@ 
 /* { dg-require-effective-target vect_early_break_hw } */
 /* { dg-require-effective-target vect_long_long } */
 
-/* { dg-final { scan-tree-dump "LOOP VECTORIZED" "vect" } } */
+/* { dg-final { scan-tree-dump "LOOP VECTORIZED" "vect" { target { ! ilp32 } } } } */
 
 #include "tree-vect.h"
 
-typedef unsigned long PV;
+typedef unsigned long long PV;
 typedef struct _buff_t {
     int foo;
     PV Val;