From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 99893 invoked by alias); 23 Jan 2016 07:31:02 -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 99879 invoked by uid 89); 23 Jan 2016 07:31: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,RCVD_IN_DNSWL_LOW,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:1865, HContent-Transfer-Encoding:8bit 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; Sat, 23 Jan 2016 07:31:00 +0000 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 7021CAAC1; Sat, 23 Jan 2016 07:30:56 +0000 (UTC) User-Agent: K-9 Mail for Android In-Reply-To: <20160122220906.GA3017@tucnak.redhat.com> References: <20160122220906.GA3017@tucnak.redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Subject: Re: [PATCH] Avoid unnecessary creation of VEC_COND_EXPR in the vectorizer From: Richard Biener Date: Sat, 23 Jan 2016 07:31:00 -0000 To: Jakub Jelinek CC: gcc-patches@gcc.gnu.org Message-ID: <7DEA1519-4F4F-4D8C-8BBD-1F26D75F628B@suse.de> X-SW-Source: 2016-01/txt/msg01803.txt.bz2 On January 22, 2016 11:09:06 PM GMT+01:00, Jakub Jelinek wrote: >Hi! > >I've noticed we create a VEC_COND_EXPR tree just to grab the arguments >from >it to construct a ternary gimple assign. > >The following patch fixes that by creating the ternary gimple assign >directly. Bootstrapped/regtested on x86_64-linux and i686-linux, ok >for >trunk? OK. Thanks, Richard. >2016-01-22 Jakub Jelinek > > * tree-vect-stmts.c (vectorizable_condition): Build a VEC_COND_EXPR > directly instead of building a temporary tree. > >--- gcc/tree-vect-stmts.c.jj 2016-01-20 15:39:08.000000000 +0100 >+++ gcc/tree-vect-stmts.c 2016-01-22 10:25:59.744444625 +0100 >@@ -7478,7 +7478,7 @@ vectorizable_condition (gimple *stmt, gi > tree comp_vectype = NULL_TREE; > tree vec_cond_lhs = NULL_TREE, vec_cond_rhs = NULL_TREE; > tree vec_then_clause = NULL_TREE, vec_else_clause = NULL_TREE; >- tree vec_compare, vec_cond_expr; >+ tree vec_compare; > tree new_temp; > loop_vec_info loop_vinfo = STMT_VINFO_LOOP_VINFO (stmt_info); > enum vect_def_type dt, dts[4]; >@@ -7691,12 +7691,10 @@ vectorizable_condition (gimple *stmt, gi > vec_compare = build2 (TREE_CODE (cond_expr), vec_cmp_type, > vec_cond_lhs, vec_cond_rhs); > } >- vec_cond_expr = build3 (VEC_COND_EXPR, vectype, >- vec_compare, vec_then_clause, vec_else_clause); >- >- new_stmt = gimple_build_assign (vec_dest, vec_cond_expr); >- new_temp = make_ssa_name (vec_dest, new_stmt); >- gimple_assign_set_lhs (new_stmt, new_temp); >+ new_temp = make_ssa_name (vec_dest); >+ new_stmt = gimple_build_assign (new_temp, VEC_COND_EXPR, >+ vec_compare, vec_then_clause, >+ vec_else_clause); > vect_finish_stmt_generation (stmt, new_stmt, gsi); > if (slp_node) > SLP_TREE_VEC_STMTS (slp_node).quick_push (new_stmt); > > Jakub