public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Handle multiple vector sizes in BB vectorization
@ 2015-05-12  7:43 Richard Biener
  2015-05-19 11:19 ` Rainer Orth
  0 siblings, 1 reply; 3+ messages in thread
From: Richard Biener @ 2015-05-12  7:43 UTC (permalink / raw)
  To: gcc-patches


Well, not really - but at least don't fail vectorization because of that
but allow it to proceed the "build up from scalar pieces" path.

Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to trunk.

Richard.

2015-05-12  Richard Biener  <rguenther@suse.de>

	* tree-vect-slp.c (vect_build_slp_tree_1): For BB vectorization
	do not allow unrolling.

	* gcc.dg/vect/bb-slp-35.c: New testcase.

Index: gcc/tree-vect-slp.c
===================================================================
--- gcc/tree-vect-slp.c.orig	2015-05-11 15:25:59.385297283 +0200
+++ gcc/tree-vect-slp.c	2015-05-11 15:21:00.129581537 +0200
@@ -572,6 +572,19 @@ vect_build_slp_tree_1 (loop_vec_info loo
           return false;
         }
 
+      /* If populating the vector type requires unrolling then fail
+         before adjusting *max_nunits for basic-block vectorization.  */
+      if (bb_vinfo
+	  && TYPE_VECTOR_SUBPARTS (vectype) > group_size)
+	{
+	  dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, 
+			   "Build SLP failed: unrolling required "
+			   "in basic block SLP\n");
+	  /* Fatal mismatch.  */
+	  matches[0] = false;
+	  return false;
+	}
+
       /* In case of multiple types we need to detect the smallest type.  */
       if (*max_nunits < TYPE_VECTOR_SUBPARTS (vectype))
         {
Index: gcc/testsuite/gcc.dg/vect/bb-slp-35.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/bb-slp-35.c	(revision 0)
+++ gcc/testsuite/gcc.dg/vect/bb-slp-35.c	(working copy)
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target vect_int } */
+
+void foo (int * __restrict__ p, short * __restrict__ q)
+{
+  p[0] = q[0] + 1;
+  p[1] = q[1] + 1;
+  p[2] = q[2] + 1;
+  p[3] = q[3] + 1;
+}
+
+/* { dg-final { scan-tree-dump "basic block vectorized" "slp2" } } */
+/* { dg-final { cleanup-tree-dump "slp2" } } */

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

* Re: [PATCH] Handle multiple vector sizes in BB vectorization
  2015-05-12  7:43 [PATCH] Handle multiple vector sizes in BB vectorization Richard Biener
@ 2015-05-19 11:19 ` Rainer Orth
  2015-05-19 11:42   ` Richard Biener
  0 siblings, 1 reply; 3+ messages in thread
From: Rainer Orth @ 2015-05-19 11:19 UTC (permalink / raw)
  To: Richard Biener; +Cc: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 982 bytes --]

Richard Biener <rguenther@suse.de> writes:

> Well, not really - but at least don't fail vectorization because of that
> but allow it to proceed the "build up from scalar pieces" path.
>
> Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to trunk.

The testcase FAILs on Solaris/SPARC:

FAIL: gcc.dg/vect/bb-slp-35.c -flto -ffat-lto-objects  scan-tree-dump slp2 "basic block vectorized"
FAIL: gcc.dg/vect/bb-slp-35.c scan-tree-dump slp2 "basic block vectorized"

The dump

/vol/gcc/src/hg/trunk/local/gcc/testsuite/gcc.dg/vect/bb-slp-35.c:6:11: note: not vectorized: unsupported unaligned store.*p_6(D)
/vol/gcc/src/hg/trunk/local/gcc/testsuite/gcc.dg/vect/bb-slp-35.c:6:11: note: not vectorized: unsupported alignment in basic block.

suggests that the following adjustment is needed.  Tested on
sparc-sun-solaris2.11 on x86_64-unknown-linux-gnu.

Ok for mainline?

	Rainer


2015-05-19  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	* gcc.dg/vect/bb-slp-35.c: Adjust.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: testsuite-sparc-bb-slp-35.patch --]
[-- Type: text/x-patch, Size: 589 bytes --]

# HG changeset patch
# Parent 7e4562f46f5c81f1894e9efc36a5f6bd409b5a41
Fix gcc.dg/vect/bb-slp-35.c on SPARC

diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-35.c b/gcc/testsuite/gcc.dg/vect/bb-slp-35.c
--- a/gcc/testsuite/gcc.dg/vect/bb-slp-35.c
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-35.c
@@ -9,5 +9,5 @@ void foo (int * __restrict__ p, short * 
   p[3] = q[3] + 1;
 }
 
-/* { dg-final { scan-tree-dump "basic block vectorized" "slp2" } } */
+/* { dg-final { scan-tree-dump "basic block vectorized" "slp2" { target vect_hw_misalign } } } */
 /* { dg-final { cleanup-tree-dump "slp2" } } */

[-- Attachment #3: Type: text/plain, Size: 143 bytes --]


-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University

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

* Re: [PATCH] Handle multiple vector sizes in BB vectorization
  2015-05-19 11:19 ` Rainer Orth
@ 2015-05-19 11:42   ` Richard Biener
  0 siblings, 0 replies; 3+ messages in thread
From: Richard Biener @ 2015-05-19 11:42 UTC (permalink / raw)
  To: Rainer Orth; +Cc: gcc-patches

On Tue, 19 May 2015, Rainer Orth wrote:

> Richard Biener <rguenther@suse.de> writes:
> 
> > Well, not really - but at least don't fail vectorization because of that
> > but allow it to proceed the "build up from scalar pieces" path.
> >
> > Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to trunk.
> 
> The testcase FAILs on Solaris/SPARC:
> 
> FAIL: gcc.dg/vect/bb-slp-35.c -flto -ffat-lto-objects  scan-tree-dump slp2 "basic block vectorized"
> FAIL: gcc.dg/vect/bb-slp-35.c scan-tree-dump slp2 "basic block vectorized"
> 
> The dump
> 
> /vol/gcc/src/hg/trunk/local/gcc/testsuite/gcc.dg/vect/bb-slp-35.c:6:11: note: not vectorized: unsupported unaligned store.*p_6(D)
> /vol/gcc/src/hg/trunk/local/gcc/testsuite/gcc.dg/vect/bb-slp-35.c:6:11: note: not vectorized: unsupported alignment in basic block.
> 
> suggests that the following adjustment is needed.  Tested on
> sparc-sun-solaris2.11 on x86_64-unknown-linux-gnu.
> 
> Ok for mainline?

Ok.

Thanks,
Richard.

> 	Rainer
> 
> 
> 2015-05-19  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
> 
> 	* gcc.dg/vect/bb-slp-35.c: Adjust.

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

end of thread, other threads:[~2015-05-19 11:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-12  7:43 [PATCH] Handle multiple vector sizes in BB vectorization Richard Biener
2015-05-19 11:19 ` Rainer Orth
2015-05-19 11:42   ` Richard Biener

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