diff mbox

[testsuite] Fix vectorizer testsuite failures on ARM

Message ID BANLkTimb5zs8eCUCQ2eyZFw-d=FerEY9Wg@mail.gmail.com
State New
Headers show

Commit Message

Ira Rosen June 9, 2011, 10 a.m. UTC
Hi,

This patch fixes several vectorizer testsuite failures on ARM:
- vect-16.c checks that the vectorization fails without -ffast-math,
but -ffast-math is a default flag for vector tests on ARM. I renamed
the test to no-fast-math-vect-16.c to avoid the use of the flag for
it.
- vect-peel-3.c and vect-peel-4.c test vectorizer's peeling heuristics
ignoring double-word vectors. This patch changes the misalignment
values of the data-refs.
- bb-slp-10.c contains a misaligned store supported not only on
vect_hw_misalign targets, but also on vect_element_align targets. The
patch fixes that.

Tested on arm-linux-gnueabi, powerpc64-suse-linux and x86_64-suse-linux.
OK for mainline?

Thanks,
Ira

testsuite/ChangeLog:

       * gcc.dg/vect/vect-16.c: Rename to ...
       * gcc.dg/vect/no-fast-math-vect16.c: ... this.
       * gcc.dg/vect/vect-peel-3.c: Adjust misalignment values
       for double-word vectors.
       * gcc.dg/vect/vect-peel-4.c: Likewise.
       * gcc.dg/vect/bb-slp-10.c: Replace vect_hw_misalign with
       vect_element_align.
       * gcc.dg/vect/vect.exp: Run no-fast-math-* tests with
       -fno-fast-math.

Comments

Ira Rosen June 13, 2011, 7:37 a.m. UTC | #1
On 9 June 2011 13:00, Ira Rosen <ira.rosen@linaro.org> wrote:
> Hi,
>
> This patch fixes several vectorizer testsuite failures on ARM:
> - vect-16.c checks that the vectorization fails without -ffast-math,
> but -ffast-math is a default flag for vector tests on ARM. I renamed
> the test to no-fast-math-vect-16.c to avoid the use of the flag for
> it.
> - vect-peel-3.c and vect-peel-4.c test vectorizer's peeling heuristics
> ignoring double-word vectors. This patch changes the misalignment
> values of the data-refs.
> - bb-slp-10.c contains a misaligned store supported not only on
> vect_hw_misalign targets, but also on vect_element_align targets. The
> patch fixes that.
>
> Tested on arm-linux-gnueabi, powerpc64-suse-linux and x86_64-suse-linux.
> OK for mainline?
>

I'll commit this patch tomorrow if nobody objects.

Thanks,
Ira

> Thanks,
> Ira
>
> testsuite/ChangeLog:
>
>       * gcc.dg/vect/vect-16.c: Rename to ...
>       * gcc.dg/vect/no-fast-math-vect16.c: ... this.
>       * gcc.dg/vect/vect-peel-3.c: Adjust misalignment values
>       for double-word vectors.
>       * gcc.dg/vect/vect-peel-4.c: Likewise.
>       * gcc.dg/vect/bb-slp-10.c: Replace vect_hw_misalign with
>       vect_element_align.
>       * gcc.dg/vect/vect.exp: Run no-fast-math-* tests with
>       -fno-fast-math.
>
Steve Ellcey June 15, 2011, 5:15 p.m. UTC | #2
> testsuite/ChangeLog:
> 
>        * gcc.dg/vect/vect-16.c: Rename to ...
>        * gcc.dg/vect/no-fast-math-vect16.c: ... this.
>        * gcc.dg/vect/vect-peel-3.c: Adjust misalignment values
>        for double-word vectors.
>        * gcc.dg/vect/vect-peel-4.c: Likewise.
>        * gcc.dg/vect/bb-slp-10.c: Replace vect_hw_misalign with
>        vect_element_align.
>        * gcc.dg/vect/vect.exp: Run no-fast-math-* tests with
>        -fno-fast-math.

Ira,

This change broke vect-peel-3.c and vect-peel-4.c on IA64 HP-UX.
I get these failures:

	FAIL: gcc.dg/vect/vect-peel-3.c -flto scan-tree-dump-times vect "Alignment of access forced using peeling" 1
	FAIL: gcc.dg/vect/vect-peel-3.c -flto scan-tree-dump-times vect "vectorized 1 loops" 1
	FAIL: gcc.dg/vect/vect-peel-3.c scan-tree-dump-times vect "Alignment of access forced using peeling" 1
	FAIL: gcc.dg/vect/vect-peel-3.c scan-tree-dump-times vect "vectorized 1 loops" 1
	FAIL: gcc.dg/vect/vect-peel-4.c -flto scan-tree-dump-times vect "vectorized 1 loops" 1
	FAIL: gcc.dg/vect/vect-peel-4.c scan-tree-dump-times vect "vectorized 1 loops" 1

I think that changing i+6 and i+2 to i+5 and i+1 broke things on HP-UX
because we are big-endian and the old values may not have worked on ARM
because it is little-endian (just guessing).

I am not sure what we want to do to make this test work on both platforms.
Do you have any ideas?

Steve Ellcey
sje@cup.hp.com
Ira Rosen June 16, 2011, 5:48 a.m. UTC | #3
Steve Ellcey <sje@cup.hp.com> wrote on 15/06/2011 08:15:27 PM:

>
> > testsuite/ChangeLog:
> >
> >        * gcc.dg/vect/vect-16.c: Rename to ...
> >        * gcc.dg/vect/no-fast-math-vect16.c: ... this.
> >        * gcc.dg/vect/vect-peel-3.c: Adjust misalignment values
> >        for double-word vectors.
> >        * gcc.dg/vect/vect-peel-4.c: Likewise.
> >        * gcc.dg/vect/bb-slp-10.c: Replace vect_hw_misalign with
> >        vect_element_align.
> >        * gcc.dg/vect/vect.exp: Run no-fast-math-* tests with
> >        -fno-fast-math.
>
> Ira,
>
> This change broke vect-peel-3.c and vect-peel-4.c on IA64 HP-UX.
> I get these failures:
>
>    FAIL: gcc.dg/vect/vect-peel-3.c -flto scan-tree-dump-times vect
> "Alignment of access forced using peeling" 1
>    FAIL: gcc.dg/vect/vect-peel-3.c -flto scan-tree-dump-times vect
> "vectorized 1 loops" 1
>    FAIL: gcc.dg/vect/vect-peel-3.c scan-tree-dump-times vect
> "Alignment of access forced using peeling" 1
>    FAIL: gcc.dg/vect/vect-peel-3.c scan-tree-dump-times vect
> "vectorized 1 loops" 1
>    FAIL: gcc.dg/vect/vect-peel-4.c -flto scan-tree-dump-times vect
> "vectorized 1 loops" 1
>    FAIL: gcc.dg/vect/vect-peel-4.c scan-tree-dump-times vect
> "vectorized 1 loops" 1
>
> I think that changing i+6 and i+2 to i+5 and i+1 broke things on HP-UX
> because we are big-endian and the old values may not have worked on ARM
> because it is little-endian (just guessing).
>
> I am not sure what we want to do to make this test work on both
platforms.
> Do you have any ideas?

I don't think it is related to endianess.
Could you please send me the dump files (created with
-fdump-tree-vect-details)?

Thanks,
Ira

>
> Steve Ellcey
> sje@cup.hp.com
Steve Ellcey June 16, 2011, 4:13 p.m. UTC | #4
On Thu, 2011-06-16 at 08:48 +0300, Ira Rosen wrote:

> > I am not sure what we want to do to make this test work on both
> platforms.
> > Do you have any ideas?
> 
> I don't think it is related to endianess.
> Could you please send me the dump files (created with
> -fdump-tree-vect-details)?
> 
> Thanks,
> Ira
> 
> >
> > Steve Ellcey
> > sje@cup.hp.com

I went ahead and created a bug report (PR 49443) and added the dump file
to that report as an attachment.

Steve Ellcey
sje@cup.hp.com
diff mbox

Patch

Index: gcc.dg/vect/vect-16.c
===================================================================
--- gcc.dg/vect/vect-16.c	(revision 174836)
+++ gcc.dg/vect/vect-16.c	(working copy)
@@ -1,38 +0,0 @@ 
-/* { dg-require-effective-target vect_float } */
-
-#include <stdarg.h>
-#include "tree-vect.h"
-
-#define N 16
-#define DIFF 240
-
-__attribute__ ((noinline))
-int main1 ()
-{
-  int i;
-  float b[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
-  float c[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
-  float diff;
-
-  diff = 0;
-  for (i = 0; i < N; i++) {
-    diff += (b[i] - c[i]);
-  }
-
-  /* check results:  */
-  if (diff != DIFF)
-    abort ();
-
-  return 0;
-}
-
-int main (void)
-{ 
-  check_vect ();
-  
-  return main1 ();
-}
-
-/* Requires fast-math.  */
-/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail *-*-* } } } */
-/* { dg-final { cleanup-tree-dump "vect" } } */
Index: gcc.dg/vect/vect-peel-3.c
===================================================================
--- gcc.dg/vect/vect-peel-3.c	(revision 174836)
+++ gcc.dg/vect/vect-peel-3.c	(working copy)
@@ -4,9 +4,7 @@ 
 #include "tree-vect.h"
 
 #define N 128
-#define RES 21888 
-
-/* unaligned store.  */
+#define RES 21640 
 
 int ib[N+10];
 int ia[N+10];
@@ -18,11 +16,11 @@  int main1 ()
   int i, suma = 0, sumb = 0, sumc = 0;
 
   /* ib and ic have same misalignment, we peel to align them.  */
-  for (i = 1; i <= N; i++)
+  for (i = 0; i <= N; i++)
     {
       suma += ia[i];
-      sumb += ib[i+6];
-      sumc += ic[i+2];
+      sumb += ib[i+5];
+      sumc += ic[i+1];
     }
 
   /* check results:  */
Index: gcc.dg/vect/vect-peel-4.c
===================================================================
--- gcc.dg/vect/vect-peel-4.c	(revision 174836)
+++ gcc.dg/vect/vect-peel-4.c	(working copy)
@@ -16,13 +16,13 @@  int main1 ()
   /* Don't peel keeping one load and the store aligned.  */
   for (i = 0; i <= N; i++)
     {
-      ia[i] = ib[i] + ib[i+6];
+      ia[i] = ib[i] + ib[i+5];
     }
 
   /* check results:  */
   for (i = 1; i <= N; i++)
     {
-      if (ia[i] != ib[i] + ib[i+6])
+      if (ia[i] != ib[i] + ib[i+5])
         abort ();
     }
 
Index: gcc.dg/vect/no-fast-math-vect16.c
===================================================================
--- gcc.dg/vect/no-fast-math-vect16.c	(revision 0)
+++ gcc.dg/vect/no-fast-math-vect16.c	(revision 0)
@@ -0,0 +1,38 @@ 
+/* { dg-require-effective-target vect_float } */
+
+#include <stdarg.h>
+#include "tree-vect.h"
+
+#define N 16
+#define DIFF 240
+
+__attribute__ ((noinline))
+int main1 ()
+{
+  int i;
+  float b[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
+  float c[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
+  float diff;
+
+  diff = 0;
+  for (i = 0; i < N; i++) {
+    diff += (b[i] - c[i]);
+  }
+
+  /* check results:  */
+  if (diff != DIFF)
+    abort ();
+
+  return 0;
+}
+
+int main (void)
+{ 
+  check_vect ();
+  
+  return main1 ();
+}
+
+/* Requires fast-math.  */
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail *-*-* } } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
Index: gcc.dg/vect/bb-slp-10.c
===================================================================
--- gcc.dg/vect/bb-slp-10.c	(revision 174836)
+++ gcc.dg/vect/bb-slp-10.c	(working copy)
@@ -49,7 +49,7 @@  int main (void)
   return 0;
 }
 
-/* { dg-final { scan-tree-dump-times "unsupported alignment in basic block." 1 "slp" { xfail vect_hw_misalign } } } */
-/* { dg-final { scan-tree-dump-times "basic block vectorized using SLP" 1 "slp" { target vect_hw_misalign } } } */
+/* { dg-final { scan-tree-dump-times "unsupported alignment in basic block." 1 "slp" { xfail vect_element_align } } } */
+/* { dg-final { scan-tree-dump-times "basic block vectorized using SLP" 1 "slp" { target vect_element_align } } } */
 /* { dg-final { cleanup-tree-dump "slp" } } */
   
Index: gcc.dg/vect/vect.exp
===================================================================
--- gcc.dg/vect/vect.exp	(revision 174836)
+++ gcc.dg/vect/vect.exp	(working copy)
@@ -107,6 +107,12 @@  lappend DEFAULT_VECTCFLAGS "-ffast-math"
 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/fast-math-*.\[cS\]]]  \
 	"" $DEFAULT_VECTCFLAGS
 
+# -fno-fast-math tests
+set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
+lappend DEFAULT_VECTCFLAGS "-fno-fast-math"
+dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-fast-math-*.\[cS\]]]  \
+        "" $DEFAULT_VECTCFLAGS
+
 # -fno-math-errno tests
 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
 lappend DEFAULT_VECTCFLAGS "-fno-math-errno"