Patchwork Fix vectorizer testsuite failures, including PR 46312

login
register
mail settings
Submitter Ira Rosen
Date Nov. 16, 2010, 10:20 a.m.
Message ID <OFA55DF28D.2D8EF43F-ONC22577DD.003765F2-C22577DD.0038D042@il.ibm.com>
Download mbox | patch
Permalink /patch/71381/
State New
Headers show

Comments

Ira Rosen - Nov. 16, 2010, 10:20 a.m.
"H.J. Lu" <hjl.tools@gmail.com> wrote on 15/11/2010 05:39:17 PM:
> >
> > But vect-scal-opt*.c use /* { dg-options "-O -fdump-tree-veclower" }
*/, so
> > we may need to remove it and run the tests with vect.exp options.
>
> Won't it also enable vectorizer? Maybe we should add -msse2 for
> i?86-*-* targets.
>

Not necessary. Please see the updated patch.

Tested on powerpc64-suse-linux and x86_64-suse-linux.
I'll commit it tomorrow if nobody objects.

Thanks,
Ira

testsuite/ChangeLog:

	PR tree-optimization/46312
	* gcc.dg/vect/vect-scal-opt2.c: Rename to...
	* gcc.dg/vect/vec-scal-opt2.c: ... this. Expect to pass only
	on targets that support vector shifts with scalar shift argument.
	Remove dg-options.
	* gcc.dg/vect/vect-scal-opt.c: Rename to...
	* gcc.dg/vect/vec-scal-opt.c: ... this, and change likewise.
	* gcc.dg/vect/vect-scal-opt1.c: Rename to...
	* gcc.dg/vect/vec-scal-opt1.c: ... this, and change likewise.
	* gcc.dg/vect/vect.exp: Run vec-scal-* tests with relevant flags.
	* gcc.dg/vect/vect-114.c: Expect to pass only on targets that
	support misaligned data accesses.
	* gcc.dg/vect/pr43432.c, gcc.dg/vect/vect-15.c: Likewise.
	* gcc.dg/vect/pr43430-2.c: Remove dg-options.
	* lib/target-supports.exp
	(check_effective_target_vect_shift_scalar): New.


 #
 # This can change for different subtargets so do not cache the result.

Patch

Index: testsuite/gcc.dg/vect/vect-scal-opt2.c
===================================================================
--- testsuite/gcc.dg/vect/vect-scal-opt2.c      (revision 166743)
+++ testsuite/gcc.dg/vect/vect-scal-opt2.c      (working copy)
@@ -1,21 +0,0 @@ 
-/* { dg-do compile } */
-/* { dg-require-effective-target vect_shift } */
-/* { dg-require-effective-target vect_int } */
-/* { dg-options "-O -fdump-tree-veclower" } */
-
-#define vidx(type, vec, idx) (*((type *) &(vec) + idx))
-#define vector(elcount, type)  \
-__attribute__((vector_size((elcount)*sizeof(type)))) type
-
-int main (int argc, char *argv[]) {
-   vector(8, short) v0 = {argc,1,2,3,4,5,6,7};
-   vector(8, short) v1 = {2,2,2,2,2,2,2,2};
-   vector(8, short) r1;
-
-   r1 = v0 >> v1;
-
-   return vidx(short, r1, 0);
-}
-
-/* { dg-final { scan-tree-dump-times ">> 2" 1 "veclower" } } */
-/* { dg-final { cleanup-tree-dump "veclower" } } */
Index: testsuite/gcc.dg/vect/vect-114.c
===================================================================
--- testsuite/gcc.dg/vect/vect-114.c    (revision 166749)
+++ testsuite/gcc.dg/vect/vect-114.c    (working copy)
@@ -34,7 +34,7 @@  int main (void)
   return main1 ();
 }

-/* { dg-final { scan-tree-dump-times "vectorized 0 loops" 1
"vect" { target { ! vect_perm } } } } */
-/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1
"vect" { target vect_perm } } } */
+/* { dg-final { scan-tree-dump-times "vectorized 0 loops" 1
"vect" { target { ! { vect_perm && vect_hw_misalign } } } } } */
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1
"vect" { target { vect_perm && vect_hw_misalign } } } } */
 /* { dg-final { cleanup-tree-dump "vect" } } */

Index: testsuite/gcc.dg/vect/pr43432.c
===================================================================
--- testsuite/gcc.dg/vect/pr43432.c     (revision 166749)
+++ testsuite/gcc.dg/vect/pr43432.c     (working copy)
@@ -10,5 +10,5 @@  int len){
         dst[i] = src0[i] * src1[-i];
 }

-/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1
"vect" { target { vect_perm } } } } */
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1
"vect" { target { vect_perm && vect_hw_misalign } } } } */
 /* { dg-final { cleanup-tree-dump "vect" } } */
Index: testsuite/gcc.dg/vect/vec-scal-opt1.c
===================================================================
--- testsuite/gcc.dg/vect/vec-scal-opt1.c       (revision 0)
+++ testsuite/gcc.dg/vect/vec-scal-opt1.c       (revision 0)
@@ -0,0 +1,21 @@ 
+/* { dg-do compile } */
+/* { dg-require-effective-target vect_shift } */
+/* { dg-require-effective-target vect_int } */
+
+#define vidx(type, vec, idx) (*((type *) &(vec) + idx))
+#define vector(elcount, type)  \
+__attribute__((vector_size((elcount)*sizeof(type)))) type
+
+short k;
+
+int main (int argc, char *argv[]) {
+   vector(8, short) v0 = {argc,1,2,3,4,5,6,7};
+   vector(8, short) r1;
+
+   r1 = v0 >> (vector(8, short)){2,2,2,2,2,2,2,2};
+
+   return vidx(short, r1, 0);
+}
+
+/* { dg-final { scan-tree-dump-times ">> 2" 1 "veclower" { target
vect_shift_scalar } } } */
+/* { dg-final { cleanup-tree-dump "veclower" } } */
Index: testsuite/gcc.dg/vect/pr43430-2.c
===================================================================
--- testsuite/gcc.dg/vect/pr43430-2.c   (revision 166749)
+++ testsuite/gcc.dg/vect/pr43430-2.c   (working copy)
@@ -1,6 +1,5 @@ 
 /* { dg-do compile } */
 /* { dg-require-effective-target vect_int } */
-/* { dg-options "-O3 -fno-vect-cost-model -fdump-tree-vect-details" } */
 typedef unsigned char uint8_t;
 vsad16_c (void *c, uint8_t * s1, uint8_t * s2, int stride, int h)
 {
Index: testsuite/gcc.dg/vect/vec-scal-opt2.c
===================================================================
--- testsuite/gcc.dg/vect/vec-scal-opt2.c       (revision 0)
+++ testsuite/gcc.dg/vect/vec-scal-opt2.c       (revision 0)
@@ -0,0 +1,20 @@ 
+/* { dg-do compile } */
+/* { dg-require-effective-target vect_shift } */
+/* { dg-require-effective-target vect_int } */
+
+#define vidx(type, vec, idx) (*((type *) &(vec) + idx))
+#define vector(elcount, type)  \
+__attribute__((vector_size((elcount)*sizeof(type)))) type
+
+int main (int argc, char *argv[]) {
+   vector(8, short) v0 = {argc,1,2,3,4,5,6,7};
+   vector(8, short) v1 = {2,2,2,2,2,2,2,2};
+   vector(8, short) r1;
+
+   r1 = v0 >> v1;
+
+   return vidx(short, r1, 0);
+}
+
+/* { dg-final { scan-tree-dump-times ">> 2" 1 "veclower" { target
vect_shift_scalar } } } */
+/* { dg-final { cleanup-tree-dump "veclower" } } */
Index: testsuite/gcc.dg/vect/vect-scal-opt.c
===================================================================
--- testsuite/gcc.dg/vect/vect-scal-opt.c       (revision 166743)
+++ testsuite/gcc.dg/vect/vect-scal-opt.c       (working copy)
@@ -1,24 +0,0 @@ 
-/* { dg-do compile } */
-/* { dg-require-effective-target vect_shift } */
-/* { dg-require-effective-target vect_int } */
-/* { dg-options "-O -fdump-tree-veclower" } */
-
-#define vidx(type, vec, idx) (*((type *) &(vec) + idx))
-#define vector(elcount, type)  \
-__attribute__((vector_size((elcount)*sizeof(type)))) type
-
-short k;
-
-int main (int argc, char *argv[]) {
-   k = argc;
-   vector(8, short) v0 = {argc,1,2,3,4,5,6,7};
-   vector(8, short) v2 = {k,   k,k,k,k,k,k,k};
-   vector(8, short) r1;
-
-   r1 = v0 >> v2;
-
-   return vidx(short, r1, 0);
-}
-
-/* { dg-final { scan-tree-dump-times ">> k.\[0-9_\]*" 1 "veclower" } } */
-/* { dg-final { cleanup-tree-dump "veclower" } } */
Index: testsuite/gcc.dg/vect/vec-scal-opt.c
===================================================================
--- testsuite/gcc.dg/vect/vec-scal-opt.c        (revision 0)
+++ testsuite/gcc.dg/vect/vec-scal-opt.c        (revision 0)
@@ -0,0 +1,23 @@ 
+/* { dg-do compile } */
+/* { dg-require-effective-target vect_shift } */
+/* { dg-require-effective-target vect_int } */
+
+#define vidx(type, vec, idx) (*((type *) &(vec) + idx))
+#define vector(elcount, type)  \
+__attribute__((vector_size((elcount)*sizeof(type)))) type
+
+short k;
+
+int main (int argc, char *argv[]) {
+   k = argc;
+   vector(8, short) v0 = {argc,1,2,3,4,5,6,7};
+   vector(8, short) v2 = {k,   k,k,k,k,k,k,k};
+   vector(8, short) r1;
+
+   r1 = v0 >> v2;
+
+   return vidx(short, r1, 0);
+}
+
+/* { dg-final { scan-tree-dump-times ">> k.\[0-9_\]*" 1
"veclower" { target vect_shift_scalar } } } */
+/* { dg-final { cleanup-tree-dump "veclower" } } */
Index: testsuite/gcc.dg/vect/vect.exp
===================================================================
--- testsuite/gcc.dg/vect/vect.exp      (revision 166749)
+++ testsuite/gcc.dg/vect/vect.exp      (working copy)
@@ -23,9 +23,6 @@  load_lib gcc-dg.exp
 # Set up flags used for tests that don't specify options.
 set DEFAULT_VECTCFLAGS ""

-# These flags are used for all targets.
-lappend DEFAULT_VECTCFLAGS "-ftree-vectorize" "-fno-vect-cost-model"
-
 # If the target system supports vector instructions, the default action
 # for a test is 'run', otherwise it's 'compile'.  Save current default.
 # Executing vector instructions on a system without hardware vector
support
@@ -118,6 +115,12 @@  if  [istarget "powerpc-*paired*"]  {
     return
 }

+global VEC_FLAGS
+set VEC_FLAGS $DEFAULT_VECTCFLAGS
+
+# These flags are used for all targets.
+lappend DEFAULT_VECTCFLAGS "-ftree-vectorize" "-fno-vect-cost-model"
+
 # Initialize `dg'.
 dg-init

@@ -137,6 +140,11 @@  lappend DEFAULT_VECTCFLAGS "-O2"
 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/nodump-*.\[cS\]]]  \
        "" $DEFAULT_VECTCFLAGS

+# "-O -fdump-tree-veclower"
+lappend VEC_FLAGS "-O" "-fdump-tree-veclower"
+dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/vec-scal-*.\[cS\]]]  \
+        "" $VEC_FLAGS
+
 set VECT_SLP_CFLAGS $DEFAULT_VECTCFLAGS

 lappend DEFAULT_VECTCFLAGS "-fdump-tree-vect-details"
Index: testsuite/gcc.dg/vect/vect-scal-opt1.c
===================================================================
--- testsuite/gcc.dg/vect/vect-scal-opt1.c      (revision 166743)
+++ testsuite/gcc.dg/vect/vect-scal-opt1.c      (working copy)
@@ -1,22 +0,0 @@ 
-/* { dg-do compile } */
-/* { dg-require-effective-target vect_shift } */
-/* { dg-require-effective-target vect_int } */
-/* { dg-options "-O -fdump-tree-veclower" } */
-
-#define vidx(type, vec, idx) (*((type *) &(vec) + idx))
-#define vector(elcount, type)  \
-__attribute__((vector_size((elcount)*sizeof(type)))) type
-
-short k;
-
-int main (int argc, char *argv[]) {
-   vector(8, short) v0 = {argc,1,2,3,4,5,6,7};
-   vector(8, short) r1;
-
-   r1 = v0 >> (vector(8, short)){2,2,2,2,2,2,2,2};
-
-   return vidx(short, r1, 0);
-}
-
-/* { dg-final { scan-tree-dump-times ">> 2" 1 "veclower" } } */
-/* { dg-final { cleanup-tree-dump "veclower" } } */
Index: testsuite/gcc.dg/vect/vect-15.c
===================================================================
--- testsuite/gcc.dg/vect/vect-15.c     (revision 166749)
+++ testsuite/gcc.dg/vect/vect-15.c     (working copy)
@@ -35,5 +35,5 @@  int main (void)
   return main1 ();
 }

-/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1
"vect" { target vect_perm } } } */
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1
"vect" { target { vect_perm && vect_hw_misalign } } } } */
 /* { dg-final { cleanup-tree-dump "vect" } } */
Index: testsuite/lib/target-supports.exp
===================================================================
--- testsuite/lib/target-supports.exp   (revision 166743)
+++ testsuite/lib/target-supports.exp   (working copy)
@@ -2258,6 +2258,27 @@  proc check_effective_target_vect_shift { } {
     return $et_vect_shift_saved
 }

+# Return 1 if the target supports hardware vector shift operation with
+# scalar shift argument.
+
+proc check_effective_target_vect_shift_scalar { } {
+    global et_vect_shift_scalar_saved
+
+    if [info exists et_vect_shift_scalar_saved] {
+        verbose "check_effective_target_vect_shift_scalar: using cached
result" 2
+    } else {
+        set et_vect_shift_scalar_saved 0
+        if { [istarget x86_64-*-*]
+             || [istarget i?86-*-*] } {
+           set et_vect_shift_scalar_saved 1
+        }
+    }
+
+    verbose "check_effective_target_vect_shift_scalar: returning
$et_vect_shift_scalar_saved" 2
+    return $et_vect_shift_scalar_saved
+}
+
+
 # Return 1 if the target supports hardware vectors of long, 0 otherwise.