From dfc55d308ef79c55173542cd2bdea3ae92847a83 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Tue, 12 May 2015 07:40:00 +0000 Subject: [PATCH] tree-vect-slp.c (vect_build_slp_tree_1): For BB vectorization do not allow unrolling. 2015-05-12 Richard Biener * 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. From-SVN: r223033 --- gcc/ChangeLog | 5 +++++ gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/gcc.dg/vect/bb-slp-35.c | 13 +++++++++++++ gcc/tree-vect-slp.c | 13 +++++++++++++ 4 files changed, 35 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/vect/bb-slp-35.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f7d9856ab05..54f80c572b6 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2015-05-12 Richard Biener + + * tree-vect-slp.c (vect_build_slp_tree_1): For BB vectorization + do not allow unrolling. + 2015-05-11 Richard Henderson * config/i386/i386-modes.def (CCP): New. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 0c97ea2f841..3f5f347b5f5 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2015-05-12 Richard Biener + + * gcc.dg/vect/bb-slp-35.c: New testcase. + 2015-05-11 Mikael Morin PR fortran/66100 diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-35.c b/gcc/testsuite/gcc.dg/vect/bb-slp-35.c new file mode 100644 index 00000000000..7d67558245c --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/bb-slp-35.c @@ -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" } } */ diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c index fc96df31173..d6efe941c25 100644 --- a/gcc/tree-vect-slp.c +++ b/gcc/tree-vect-slp.c @@ -568,6 +568,19 @@ vect_build_slp_tree_1 (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo, 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)) { -- 2.30.2