From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by sourceware.org (Postfix) with ESMTPS id C4FC3389364F for ; Tue, 5 Jan 2021 14:54:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org C4FC3389364F Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=rguenther@suse.de X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id AC4D3ACC6 for ; Tue, 5 Jan 2021 14:54:36 +0000 (UTC) Date: Tue, 5 Jan 2021 15:54:35 +0100 (CET) From: Richard Biener Sender: rguenther@ryzen.fritz.box To: gcc-patches@gcc.gnu.org Subject: [PATCH] tree-optimization/98381 - fix live bool vector extract Message-ID: User-Agent: Alpine 2.21 (LSU 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-11.2 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Jan 2021 14:54:39 -0000 This fixes extraction of live bool vector results for the case of integer mode vectors. Bootstrapped and tested on x86_64-unknown-linux-gnu (and i386.exp with SDE), pushed. 2021-01-05 Richard Biener PR tree-optimization/98381 * tree.c (vector_element_bits): Properly compute bool vector element size. * tree-vect-loop.c (vectorizable_live_operation): Properly compute the last lane bit offset. --- gcc/tree-vect-loop.c | 5 ++--- gcc/tree.c | 9 +++++++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c index 830531f48b8..965cc164f6e 100644 --- a/gcc/tree-vect-loop.c +++ b/gcc/tree-vect-loop.c @@ -8494,7 +8494,7 @@ vectorizable_live_operation (vec_info *vinfo, { loop_vec_info loop_vinfo = dyn_cast (vinfo); imm_use_iterator imm_iter; - tree lhs, lhs_type, bitsize, vec_bitsize; + tree lhs, lhs_type, bitsize; tree vectype = (slp_node ? SLP_TREE_VECTYPE (slp_node) : STMT_VINFO_VECTYPE (stmt_info)); @@ -8637,7 +8637,6 @@ vectorizable_live_operation (vec_info *vinfo, lhs_type = TREE_TYPE (lhs); bitsize = vector_element_bits_tree (vectype); - vec_bitsize = TYPE_SIZE (vectype); /* Get the vectorized lhs of STMT and the lane to use (counted in bits). */ tree vec_lhs, bitstart; @@ -8661,7 +8660,7 @@ vectorizable_live_operation (vec_info *vinfo, vec_lhs = gimple_get_lhs (vec_stmt); /* Get the last lane in the vector. */ - bitstart = int_const_binop (MINUS_EXPR, vec_bitsize, bitsize); + bitstart = int_const_binop (MULT_EXPR, bitsize, bitsize_int (nunits - 1)); } if (loop_vinfo) diff --git a/gcc/tree.c b/gcc/tree.c index 421a2b4bc02..e0a1d512019 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -14021,8 +14021,13 @@ vector_element_bits (const_tree type) { gcc_checking_assert (VECTOR_TYPE_P (type)); if (VECTOR_BOOLEAN_TYPE_P (type)) - return vector_element_size (tree_to_poly_uint64 (TYPE_SIZE (type)), - TYPE_VECTOR_SUBPARTS (type)); + { + if (VECTOR_MODE_P (TYPE_MODE (type))) + return vector_element_size (tree_to_poly_uint64 (TYPE_SIZE (type)), + TYPE_VECTOR_SUBPARTS (type)); + else + return 1; + } return tree_to_uhwi (TYPE_SIZE (TREE_TYPE (type))); } -- 2.26.2