Patchwork [testsuite] Fix ppc and spu vectorization tests

login
register
mail settings
Submitter Ira Rosen
Date July 4, 2010, 12:34 p.m.
Message ID <OF97E08577.25DCC34C-ONC2257756.00438ADD-C2257756.00450CE3@il.ibm.com>
Download mbox | patch
Permalink /patch/57841/
State New
Headers show

Comments

Ira Rosen - July 4, 2010, 12:34 p.m.
Hi,

This patch removes two vectorization cost model tests for ppc: the loops
are either unrolled or the vectorization is always profitable with bigger
loop bounds.
It also increases loop bounds in two other cost model tests.

In pr35821-altivec.c the loop is optimized out. I can't change the code in
such way that the loop is not optimized out and there is an ICE without the
patch for pr35821. So, I suggest to remove this testcase, and pr35821-spu.c
as well.

Tested on powerpc64-suse-linux.
OK for trunk?

Thanks,
Ira

testsuite/ChangeLog:

      * gcc.dg/vect/costmodel/ppc/costmodel-vect-31d.c: Remove.
      * gcc.dg/vect/costmodel/ppc/costmodel-vect-76a.c: Increase loop
bound.
      * gcc.dg/vect/costmodel/ppc/costmodel-vect-76b.c: Likewise.
      * gcc.dg/vect/costmodel/ppc/costmodel-vect-68d.c: Remove.
      * gcc.dg/vect/pr35821-altivec.c, gcc.dg/vect/pr35821-spu.c: Likewise.

(See attached file: tests.txt)
Richard Guenther - July 4, 2010, 1:37 p.m.
On Sun, Jul 4, 2010 at 2:34 PM, Ira Rosen <IRAR@il.ibm.com> wrote:
>
> Hi,
>
> This patch removes two vectorization cost model tests for ppc: the loops
> are either unrolled or the vectorization is always profitable with bigger
> loop bounds.
> It also increases loop bounds in two other cost model tests.
>
> In pr35821-altivec.c the loop is optimized out. I can't change the code in
> such way that the loop is not optimized out and there is an ICE without the
> patch for pr35821. So, I suggest to remove this testcase, and pr35821-spu.c
> as well.
>
> Tested on powerpc64-suse-linux.
> OK for trunk?

Ok.

Richard.

> Thanks,
> Ira
>
> testsuite/ChangeLog:
>
>      * gcc.dg/vect/costmodel/ppc/costmodel-vect-31d.c: Remove.
>      * gcc.dg/vect/costmodel/ppc/costmodel-vect-76a.c: Increase loop
> bound.
>      * gcc.dg/vect/costmodel/ppc/costmodel-vect-76b.c: Likewise.
>      * gcc.dg/vect/costmodel/ppc/costmodel-vect-68d.c: Remove.
>      * gcc.dg/vect/pr35821-altivec.c, gcc.dg/vect/pr35821-spu.c: Likewise.
>
> (See attached file: tests.txt)

Patch

Index: testsuite/gcc.dg/vect/costmodel/ppc/costmodel-vect-31d.c
===================================================================
--- testsuite/gcc.dg/vect/costmodel/ppc/costmodel-vect-31d.c	(revision 161798)
+++ testsuite/gcc.dg/vect/costmodel/ppc/costmodel-vect-31d.c	(working copy)
@@ -1,51 +0,0 @@ 
-/* { dg-require-effective-target vect_int } */
-
-#include <stdarg.h>
-#include "../../tree-vect.h"
-
-#define N 5 
-
-struct t{
-  int k[N];
-  int l; 
-};
-  
-struct s{
-  char a;	/* aligned */
-  char b[N-1];  /* unaligned (offset 1B) */
-  char c[N];    /* aligned (offset NB) */
-  struct t d;   /* aligned (offset 2NB) */
-  struct t e;   /* unaligned (offset 2N+4N+4 B) */
-};
-
-int main1 ()
-{  
-  int i;
-  struct s tmp;
-
-  /* unaligned */
-  for (i = 0; i < N; i++)
-    {
-      tmp.e.k[i] = 8;
-    }
-
-  /* check results:  */
-  for (i = 0; i < N; i++)
-    {
-      if (tmp.e.k[i] != 8)
-        abort ();
-    }
-
-  return 0;
-}
-
-int main (void)
-{ 
-  check_vect ();
-  
-  return main1 ();
-} 
-
-/* { dg-final { scan-tree-dump-times "vectorization not profitable" 1 "vect" } } */
-/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 0 "vect" } } */
-/* { dg-final { cleanup-tree-dump "vect" } } */
Index: testsuite/gcc.dg/vect/costmodel/ppc/costmodel-vect-76a.c
===================================================================
--- testsuite/gcc.dg/vect/costmodel/ppc/costmodel-vect-76a.c	(revision 161798)
+++ testsuite/gcc.dg/vect/costmodel/ppc/costmodel-vect-76a.c	(working copy)
@@ -3,7 +3,7 @@ 
 #include <stdarg.h>
 #include "../../tree-vect.h"
 
-#define N 8
+#define N 16 
 #define OFF 4
 
 /* Check handling of accesses for which the "initial condition" -
Index: testsuite/gcc.dg/vect/costmodel/ppc/costmodel-vect-76b.c
===================================================================
--- testsuite/gcc.dg/vect/costmodel/ppc/costmodel-vect-76b.c	(revision 161798)
+++ testsuite/gcc.dg/vect/costmodel/ppc/costmodel-vect-76b.c	(working copy)
@@ -3,7 +3,7 @@ 
 #include <stdarg.h>
 #include "../../tree-vect.h"
 
-#define N 8
+#define N 16 
 #define OFF 4
 
 /* Check handling of accesses for which the "initial condition" -
Index: testsuite/gcc.dg/vect/costmodel/ppc/costmodel-vect-68d.c
===================================================================
--- testsuite/gcc.dg/vect/costmodel/ppc/costmodel-vect-68d.c	(revision 161798)
+++ testsuite/gcc.dg/vect/costmodel/ppc/costmodel-vect-68d.c	(working copy)
@@ -1,50 +0,0 @@ 
-/* { dg-require-effective-target vect_int } */
-
-#include <stdarg.h>
-#include "../../tree-vect.h"
-
-#define N 11 
-
-struct s{
-  int m;
-  int n[N][N][N];
-};
-
-struct test1{
-  struct s a; /* array a.n is unaligned */
-  int b;
-  int c;
-  struct s e; /* array e.n is aligned */
-};
-
-int main1 ()
-{  
-  int i,j;
-  struct test1 tmp1;
-
-  /* 4. unaligned */
-  for (i = 3; i < N-3; i++)
-    {
-      tmp1.e.n[1][2][i] = 8;
-    }
- 
-  /* check results:  */
-  for (i = 3; i <N-3; i++)
-    {
-      if (tmp1.e.n[1][2][i] != 8)
-        abort ();
-    }
-
-  return 0;
-}
-
-int main (void)
-{ 
-  check_vect ();
-  
-  return main1 ();
-} 
-
-/* { dg-final { scan-tree-dump-times "vectorization not profitable" 1 "vect" } } */
-/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 0 "vect" } } */
-/* { dg-final { cleanup-tree-dump "vect" } } */
Index: testsuite/gcc.dg/vect/pr35821-altivec.c
===================================================================
--- testsuite/gcc.dg/vect/pr35821-altivec.c	(revision 161798)
+++ testsuite/gcc.dg/vect/pr35821-altivec.c	(working copy)
@@ -1,24 +0,0 @@ 
-/* { dg-do compile { target { powerpc_altivec_ok } } } */
-
-#include "altivec.h"
-
-void
-foo (float f_gain1, int n_tail, float * __restrict__ f_in_hptr,
-     float * __restrict__ f_out_hptr)
-{
-  int i;
-  vector float *v_f_in_hptr, *v_f_out_hptr;
-
-  f_in_hptr = ( float* )v_f_in_hptr;
-  f_out_hptr = ( float* )v_f_out_hptr;
-
-  for( i = 0 ; i < n_tail ; i++ ) {
-   f_out_hptr[0] = f_in_hptr[0] * f_gain1;
-   f_in_hptr++;
-   f_out_hptr++;
-  }
-}
-
-/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
-/* { dg-final { cleanup-tree-dump "vect" } } */
-
Index: testsuite/gcc.dg/vect/pr35821-spu.c
===================================================================
--- testsuite/gcc.dg/vect/pr35821-spu.c	(revision 161798)
+++ testsuite/gcc.dg/vect/pr35821-spu.c	(working copy)
@@ -1,22 +0,0 @@ 
-/* { dg-do compile { target { spu-*-* } } } */
-
-void
-foo (float f_gain1, int n_tail, float * __restrict__ f_in_hptr,
-     float * __restrict__ f_out_hptr)
-{
-  int i;
-  __attribute__((__spu_vector__)) float *v_f_in_hptr, *v_f_out_hptr;
-
-  f_in_hptr = ( float* )v_f_in_hptr;
-  f_out_hptr = ( float* )v_f_out_hptr;
-
-  for( i = 0 ; i < n_tail ; i++ ) {
-   f_out_hptr[0] = f_in_hptr[0] * f_gain1;
-   f_in_hptr++;
-   f_out_hptr++;
-  }
-}
-
-/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
-/* { dg-final { cleanup-tree-dump "vect" } } */
-