From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21025 invoked by alias); 4 May 2015 11:14:01 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 21016 invoked by uid 89); 4 May 2015 11:14:00 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=AWL,BAYES_00,KAM_ASCII_DIVIDERS,KAM_LAZY_DOMAIN_SECURITY,T_RP_MATCHES_RCVD autolearn=no version=3.3.2 X-HELO: mx2.suse.de Received: from cantor2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (CAMELLIA256-SHA encrypted) ESMTPS; Mon, 04 May 2015 11:13:59 +0000 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 97592ACE9 for ; Mon, 4 May 2015 11:13:56 +0000 (UTC) Date: Mon, 04 May 2015 11:14:00 -0000 From: Richard Biener To: gcc-patches@gcc.gnu.org Subject: [PATCH] Fix PR65965 Message-ID: User-Agent: Alpine 2.11 (LSU 23 2013-08-11) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-SW-Source: 2015-05/txt/msg00207.txt.bz2 We don't support vectorizing group stores with gaps - so the natural thing is to just split groups at such boundaries which enables more BB vectorization (and likely loop vectorization as well, though that would be some weird cases I suspect). Bootstrap and regtest running on x86_64-unknown-linux-gnu. Richard. 2015-05-04 Richard Biener PR tree-optimization/65965 * tree-vect-data-refs.c (vect_analyze_data_ref_accesses): Split store groups at gaps. * gcc.dg/vect/bb-slp-33.c: New testcase. Index: gcc/tree-vect-data-refs.c =================================================================== --- gcc/tree-vect-data-refs.c (revision 222758) +++ gcc/tree-vect-data-refs.c (working copy) @@ -2602,6 +2602,15 @@ vect_analyze_data_ref_accesses (loop_vec if ((init_b - init_a) % type_size_a != 0) break; + /* If we have a store, the accesses are adjacent. This splits + groups into chunks we support (we don't support vectorization + of stores with gaps). */ + if (!DR_IS_READ (dra) + && (((unsigned HOST_WIDE_INT)init_b + - TREE_INT_CST_LOW (DR_INIT (datarefs_copy[i-1]))) + != type_size_a)) + break; + /* The step (if not zero) is greater than the difference between data-refs' inits. This splits groups into suitable sizes. */ HOST_WIDE_INT step = tree_to_shwi (DR_STEP (dra)); Index: gcc/testsuite/gcc.dg/vect/bb-slp-33.c =================================================================== --- gcc/testsuite/gcc.dg/vect/bb-slp-33.c (revision 0) +++ gcc/testsuite/gcc.dg/vect/bb-slp-33.c (working copy) @@ -0,0 +1,49 @@ +/* { dg-require-effective-target vect_int } */ + +#include "tree-vect.h" + +extern void abort (void); + +void __attribute__((noinline,noclone)) +test(int *__restrict__ a, int *__restrict__ b) +{ + a[0] = b[0]; + a[1] = b[1]; + a[2] = b[2]; + a[3] = b[3]; + a[5] = 0; + a[6] = 0; + a[7] = 0; + a[8] = 0; +} + +int main() +{ + int a[9]; + int b[4]; + b[0] = 1; + __asm__ volatile (""); + b[1] = 2; + __asm__ volatile (""); + b[2] = 3; + __asm__ volatile (""); + b[3] = 4; + __asm__ volatile (""); + a[4] = 7; + check_vect (); + test(a, b); + if (a[0] != 1 + || a[1] != 2 + || a[2] != 3 + || a[3] != 4 + || a[4] != 7 + || a[5] != 0 + || a[6] != 0 + || a[7] != 0 + || a[8] != 0) + abort (); + return 0; +} + +/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 2 "slp2" { target { vect_element_align || vect_hw_misalign } } } } */ +/* { dg-final { cleanup-tree-dump "slp2" } } */