From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 37374 invoked by alias); 23 Nov 2015 08:34:42 -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 37364 invoked by uid 89); 23 Nov 2015 08:34:41 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.3 required=5.0 tests=AWL,BAYES_00,KAM_ASCII_DIVIDERS,RCVD_IN_DNSWL_LOW,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mx2.suse.de Received: from mx2.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, 23 Nov 2015 08:34:40 +0000 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id A1084AC6D for ; Mon, 23 Nov 2015 08:33:34 +0000 (UTC) Date: Mon, 23 Nov 2015 08:34:00 -0000 From: Richard Biener To: gcc-patches@gcc.gnu.org Subject: [PATCH] Fix PR68445 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-11/txt/msg02650.txt.bz2 The following fixes PR68445, SLP permutation being confused by a permutation only using the "first" vector. Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to trunk. Richard. 2015-11-23 Richard Biener PR tree-optimization/68445 * tree-vect-slp.c (vect_create_mask_and_perm): Properly use two different strides. * gcc.dg/vect/pr68445.c: New testcase. Index: gcc/tree-vect-slp.c =================================================================== *** gcc/tree-vect-slp.c (revision 230653) --- gcc/tree-vect-slp.c (working copy) *************** vect_create_mask_and_perm (gimple *stmt, *** 3177,3186 **** { tree perm_dest; gimple *perm_stmt = NULL; ! int i, stride; tree first_vec, second_vec, data_ref; ! stride = SLP_TREE_NUMBER_OF_VEC_STMTS (node) / ncopies; /* Initialize the vect stmts of NODE to properly insert the generated stmts later. */ --- 3206,3216 ---- { tree perm_dest; gimple *perm_stmt = NULL; ! int i, stride_in, stride_out; tree first_vec, second_vec, data_ref; ! stride_out = SLP_TREE_NUMBER_OF_VEC_STMTS (node) / ncopies; ! stride_in = dr_chain.length () / ncopies; /* Initialize the vect stmts of NODE to properly insert the generated stmts later. */ *************** vect_create_mask_and_perm (gimple *stmt, *** 3202,3211 **** vect_finish_stmt_generation (stmt, perm_stmt, gsi); /* Store the vector statement in NODE. */ ! SLP_TREE_VEC_STMTS (node)[stride * i + vect_stmts_counter] = perm_stmt; ! first_vec_indx += stride; ! second_vec_indx += stride; } } --- 3232,3242 ---- vect_finish_stmt_generation (stmt, perm_stmt, gsi); /* Store the vector statement in NODE. */ ! SLP_TREE_VEC_STMTS (node)[stride_out * i + vect_stmts_counter] ! = perm_stmt; ! first_vec_indx += stride_in; ! second_vec_indx += stride_in; } } Index: gcc/testsuite/gcc.dg/vect/pr68445.c =================================================================== *** gcc/testsuite/gcc.dg/vect/pr68445.c (revision 0) --- gcc/testsuite/gcc.dg/vect/pr68445.c (working copy) *************** *** 0 **** --- 1,19 ---- + /* { dg-do compile } */ + /* { dg-require-effective-target vect_int } */ + + void IMB_double_fast_x (int *destf, int *dest, int y, int *p1f) + { + int i; + for (i = y; i > 0; i--) + { + *dest++ = 0; + destf[0] = destf[4] = p1f[0]; + destf[1] = destf[5] = p1f[1]; + destf[2] = destf[6] = p1f[2]; + destf[3] = destf[7] = p1f[3]; + destf += 8; + p1f += 4; + } + } + + /* { dg-final { scan-tree-dump "vectorizing stmts using SLP" "vect" } } */