From patchwork Thu May 19 19:43:54 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Enkovich X-Patchwork-Id: 624218 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3r9hP43NN9z9s9n for ; Fri, 20 May 2016 05:45:12 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=dSNMi2DD; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:mime-version:content-type; q=dns; s= default; b=guaZe7QFC9bW6Ewq8vnKewaqesUEZLoKo1M4ZF6zjLFjEqXX59DIs sfsSxO33XX+HD2I6IYyBnFamRbObA4TsKqCVbJQlwdjJRCOgurtdRTVF/xZ8MZJr k0t7ShNQTMfHxLcgkhQK35dnFUhnsZJ6T8g3JUQ6Kf4R3SxhTD4b8o= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:mime-version:content-type; s= default; bh=p49pwNxCplOACXXw7o6LM/N0nDY=; b=dSNMi2DD51RjlxfdB4xv 1hYuthmG1W6b+/SS0FLvgBpCDkPVpCJ6kM7tT4igv3NRF4//X3la4exUirrBS5UN abt8+7tIXvrLnmswefx7TcFXzUgOcWAWHMNFtXuQyJznyqfS2IaM4m/9FNlQSDaq 1ryrEYQ+57lDazWCgYe9bSA= Received: (qmail 6702 invoked by alias); 19 May 2016 19:45:02 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 6649 invoked by uid 89); 19 May 2016 19:45:01 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 spammy=ilya.enkovich@intel.com, ilyaenkovichintelcom, 6336, 633, 6 X-HELO: mail-io0-f180.google.com Received: from mail-io0-f180.google.com (HELO mail-io0-f180.google.com) (209.85.223.180) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Thu, 19 May 2016 19:44:56 +0000 Received: by mail-io0-f180.google.com with SMTP id p64so29617587ioi.2 for ; Thu, 19 May 2016 12:44:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:subject:message-id:mime-version :content-disposition:user-agent; bh=VVbPX7n02P9H46M3RhaYcqdh/DK4xnX3dvTsYDc5qls=; b=TC+su/9BK2PVZfZJckM1bWyGol4xLGOg0U0Eu0unkSC2quIEk7FSkF/oCN3HwxiYDS pQ/qfZOs96po2oI7Pp8gpkLovK5q6VGlkEuQadiV7ahfA4i/BHCENWdso/j+blu14QSR dKt4qdhmTuH8GaSwJ97k+C6qAw8z955wooI4YiTvASgXFCZAxFfztNMlmN57MgCIyvsp dadOvPZNDB5F4W3qROyC0yDKVkEXPOVa8rHdXjSSn08sDCElA2H9aRvV0Pn2ppMElfim tfHPO4oGWh3xTXE99e5+EVC1A+nfCP2CkFtNl8VKMWWwKFYXeqAFXq3kdKkVwJ5Eq9LQ +V3w== X-Gm-Message-State: AOPr4FUrJAAfsFsJ6ndDVW+Ak+Ks8ZVr7zNNtV0aIuhe9/ucSi9eCeJQSdjXrKWkdkVZaA== X-Received: by 10.107.57.135 with SMTP id g129mr12075416ioa.182.1463687093918; Thu, 19 May 2016 12:44:53 -0700 (PDT) Received: from msticlxl57.ims.intel.com (irdmzpr01-ext.ir.intel.com. [192.198.151.36]) by smtp.gmail.com with ESMTPSA id f194sm252453ite.1.2016.05.19.12.44.52 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 May 2016 12:44:53 -0700 (PDT) Date: Thu, 19 May 2016 22:43:54 +0300 From: Ilya Enkovich To: gcc-patches@gcc.gnu.org Subject: [PATCH, vec-tails 06/10] Mark the first vector store generated for a scalar store Message-ID: <20160519194354.GG40563@msticlxl57.ims.intel.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) X-IsSubscribed: yes Hi, This patch STMT_VINFO_FIRST_COPY_P field to statement vec info. This is used to find the first vector store generated for a scalar one. For other statements I use original scalar statement to find the first and following vector statement. For stores original scalar statement is removed and this new fiels is used to mark a chain start. Also original data reference and vector type are preserved in the first vector statement for masking purposes. Thanks, Ilya --- gcc/ 2016-05-19 Ilya Enkovich * tree-vect-stmts.c (vectorizable_mask_load_store): Mark the first copy of generated vector stores. (vectorizable_store): Mark the first copy of generated vector stores and provide it with vectype and the original data reference. * tree-vectorizer.h (struct _stmt_vec_info): Add first_copy_p field. (STMT_VINFO_FIRST_COPY_P): New. diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c index 91ebe5a..84f4dc81 100644 --- a/gcc/tree-vect-stmts.c +++ b/gcc/tree-vect-stmts.c @@ -2131,7 +2131,10 @@ vectorizable_mask_load_store (gimple *stmt, gimple_stmt_iterator *gsi, ptr, vec_mask, vec_rhs); vect_finish_stmt_generation (stmt, new_stmt, gsi); if (i == 0) - STMT_VINFO_VEC_STMT (stmt_info) = *vec_stmt = new_stmt; + { + STMT_VINFO_VEC_STMT (stmt_info) = *vec_stmt = new_stmt; + STMT_VINFO_FIRST_COPY_P (vinfo_for_stmt (new_stmt)) = true; + } else STMT_VINFO_RELATED_STMT (prev_stmt_info) = new_stmt; prev_stmt_info = vinfo_for_stmt (new_stmt); @@ -6203,7 +6206,16 @@ vectorizable_store (gimple *stmt, gimple_stmt_iterator *gsi, gimple **vec_stmt, if (!slp) { if (j == 0) - STMT_VINFO_VEC_STMT (stmt_info) = *vec_stmt = new_stmt; + { + STMT_VINFO_VEC_STMT (stmt_info) = *vec_stmt = new_stmt; + STMT_VINFO_FIRST_COPY_P (vinfo_for_stmt (new_stmt)) = true; + /* Original statement is replaced with the first vector one. + Keep data reference and original vectype in the first + vector copy for masking purposes. */ + STMT_VINFO_DATA_REF (vinfo_for_stmt (new_stmt)) + = STMT_VINFO_DATA_REF (stmt_info); + STMT_VINFO_VECTYPE (vinfo_for_stmt (new_stmt)) = vectype; + } else STMT_VINFO_RELATED_STMT (prev_stmt_info) = new_stmt; prev_stmt_info = vinfo_for_stmt (new_stmt); diff --git a/gcc/tree-vectorizer.h b/gcc/tree-vectorizer.h index 86c5371..3702c5d 100644 --- a/gcc/tree-vectorizer.h +++ b/gcc/tree-vectorizer.h @@ -633,6 +633,10 @@ typedef struct _stmt_vec_info { /* For both loads and stores. */ bool simd_lane_access_p; + /* True for the first vector statement copy when scalar + statement is vectorized into several vector ones. */ + bool first_copy_p; + /* For reduction loops, this is the type of reduction. */ enum vect_reduction_type v_reduc_type; @@ -666,6 +670,7 @@ STMT_VINFO_BB_VINFO (stmt_vec_info stmt_vinfo) #define STMT_VINFO_GATHER_SCATTER_P(S) (S)->gather_scatter_p #define STMT_VINFO_STRIDED_P(S) (S)->strided_p #define STMT_VINFO_SIMD_LANE_ACCESS_P(S) (S)->simd_lane_access_p +#define STMT_VINFO_FIRST_COPY_P(S) (S)->first_copy_p #define STMT_VINFO_VEC_REDUCTION_TYPE(S) (S)->v_reduc_type #define STMT_VINFO_DR_BASE_ADDRESS(S) (S)->dr_base_address