From patchwork Tue Oct 26 11:28:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 46657 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B607D3858022 for ; Tue, 26 Oct 2021 11:29:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B607D3858022 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1635247742; bh=qyZlmi/div6dcpPCFh808CXYEsOdcqYj3We6rLQt+x8=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=b0da3N7d4XT2qqZ+k61V9sbRaASPh6fmer5TDq4POJWhoqRL3USm5g2N604xph2W0 ETu6KumHduHmCP2bNon5JQc+JPMv0JIxDEccqZwjkRUG0aybgIsqieeI9iqVv/9L+k +mfyBr0Q3Z/A4QSjxLS9PKaZSXgvjMgRdbxQhPAU= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by sourceware.org (Postfix) with ESMTPS id E53243858410 for ; Tue, 26 Oct 2021 11:28:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org E53243858410 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id B7E391FD4C for ; Tue, 26 Oct 2021 11:28:32 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id A541013BA8 for ; Tue, 26 Oct 2021 11:28:32 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id +kYmJ2Dmd2EVNgAAMHmgww (envelope-from ) for ; Tue, 26 Oct 2021 11:28:32 +0000 Date: Tue, 26 Oct 2021 13:28:32 +0200 (CEST) To: gcc-patches@gcc.gnu.org Subject: [PATCH] Unify offset and byte_offset for vect_create_addr_base_for_vector_ref Message-ID: MIME-Version: 1.0 X-Spam-Status: No, score=-11.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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-Patchwork-Original-From: Richard Biener via Gcc-patches From: Richard Biener Reply-To: Richard Biener Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" Now that both are measured in bytes we can unify the two parameters. Bootstrapped and tested on x86_64-unknown-linux-gnu, pushed. 2021-10-26 Richard Biener * tree-vectorizer.h (vect_create_addr_base_for_vector_ref): Remove byte_offset parameter. (vect_create_data_ref_ptr): Likewise. * tree-vect-data-refs.c (vect_create_addr_base_for_vector_ref): Likewise. (vect_create_data_ref_ptr): Likewise. * tree-vect-stmts.c (vectorizable_store): Adjust. (vectorizable_load): Likewise. --- gcc/tree-vect-data-refs.c | 21 ++++----------------- gcc/tree-vect-stmts.c | 18 +++++++++--------- gcc/tree-vectorizer.h | 4 ++-- 3 files changed, 15 insertions(+), 28 deletions(-) diff --git a/gcc/tree-vect-data-refs.c b/gcc/tree-vect-data-refs.c index cda89ef9725..2ea8e983fe6 100644 --- a/gcc/tree-vect-data-refs.c +++ b/gcc/tree-vect-data-refs.c @@ -4772,8 +4772,6 @@ vect_duplicate_ssa_name_ptr_info (tree name, dr_vec_info *dr_info) is as follows: if LOOP=i_loop: &in (relative to i_loop) if LOOP=j_loop: &in+i*2B (relative to j_loop) - BYTE_OFFSET: Optional, defaulted to NULL. If supplied, it is added to the - initial address. Both OFFSET and BYTE_OFFSET are measured in bytes. Output: 1. Return an SSA_NAME whose value is the address of the memory location of @@ -4786,8 +4784,7 @@ vect_duplicate_ssa_name_ptr_info (tree name, dr_vec_info *dr_info) tree vect_create_addr_base_for_vector_ref (vec_info *vinfo, stmt_vec_info stmt_info, gimple_seq *new_stmt_list, - tree offset, - tree byte_offset) + tree offset) { dr_vec_info *dr_info = STMT_VINFO_DR_INFO (stmt_info); struct data_reference *dr = dr_info->dr; @@ -4823,12 +4820,6 @@ vect_create_addr_base_for_vector_ref (vec_info *vinfo, stmt_vec_info stmt_info, base_offset = fold_build2 (PLUS_EXPR, sizetype, base_offset, offset); } - if (byte_offset) - { - byte_offset = fold_convert (sizetype, byte_offset); - base_offset = fold_build2 (PLUS_EXPR, sizetype, - base_offset, byte_offset); - } /* base + base_offset */ if (loop_vinfo) @@ -4882,10 +4873,6 @@ vect_create_addr_base_for_vector_ref (vec_info *vinfo, stmt_vec_info stmt_info, 5. BSI: location where the new stmts are to be placed if there is no loop 6. ONLY_INIT: indicate if ap is to be updated in the loop, or remain pointing to the initial address. - 7. BYTE_OFFSET (optional, defaults to NULL): a byte offset to be added - to the initial address accessed by the data-ref in STMT_INFO. This is - similar to OFFSET, but OFFSET is counted in elements, while BYTE_OFFSET - in bytes. 8. IV_STEP (optional, defaults to NULL): the amount that should be added to the IV during each iteration of the loop. NULL says to move by one copy of AGGR_TYPE up or down, depending on the step of the @@ -4920,7 +4907,7 @@ vect_create_data_ref_ptr (vec_info *vinfo, stmt_vec_info stmt_info, tree aggr_type, class loop *at_loop, tree offset, tree *initial_address, gimple_stmt_iterator *gsi, gimple **ptr_incr, bool only_init, - tree byte_offset, tree iv_step) + tree iv_step) { const char *base_name; loop_vec_info loop_vinfo = dyn_cast (vinfo); @@ -5048,11 +5035,11 @@ vect_create_data_ref_ptr (vec_info *vinfo, stmt_vec_info stmt_info, /* (2) Calculate the initial address of the aggregate-pointer, and set the aggregate-pointer to point to it before the loop. */ - /* Create: (&(base[init_val]+offset+byte_offset) in the loop preheader. */ + /* Create: (&(base[init_val]+offset) in the loop preheader. */ new_temp = vect_create_addr_base_for_vector_ref (vinfo, stmt_info, &new_stmt_list, - offset, byte_offset); + offset); if (new_stmt_list) { if (pe) diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c index 3cd338a73eb..bf07e7a9495 100644 --- a/gcc/tree-vect-stmts.c +++ b/gcc/tree-vect-stmts.c @@ -8110,7 +8110,7 @@ vectorizable_store (vec_info *vinfo, = vect_create_data_ref_ptr (vinfo, first_stmt_info, aggr_type, simd_lane_access_p ? loop : NULL, offset, &dummy, gsi, &ptr_incr, - simd_lane_access_p, NULL_TREE, bump); + simd_lane_access_p, bump); } else { @@ -8518,7 +8518,6 @@ vectorizable_load (vec_info *vinfo, unsigned int group_size; poly_uint64 group_gap_adj; tree msq = NULL_TREE, lsq; - tree byte_offset = NULL_TREE; tree realignment_token = NULL_TREE; gphi *phi = NULL; vec dr_chain = vNULL; @@ -9290,6 +9289,7 @@ vectorizable_load (vec_info *vinfo, bool diff_first_stmt_info = first_stmt_info_for_drptr && first_stmt_info != first_stmt_info_for_drptr; + tree offset = NULL_TREE; if ((alignment_support_scheme == dr_explicit_realign_optimized || alignment_support_scheme == dr_explicit_realign) && !compute_in_loop) @@ -9306,17 +9306,18 @@ vectorizable_load (vec_info *vinfo, if (alignment_support_scheme == dr_explicit_realign_optimized) { phi = as_a (SSA_NAME_DEF_STMT (msq)); - byte_offset = size_binop (MINUS_EXPR, TYPE_SIZE_UNIT (vectype), - size_one_node); + offset = size_binop (MINUS_EXPR, TYPE_SIZE_UNIT (vectype), + size_one_node); gcc_assert (!first_stmt_info_for_drptr); } } else at_loop = loop; - tree offset = NULL_TREE; if (!known_eq (poffset, 0)) - offset = size_int (poffset); + offset = (offset + ? size_binop (PLUS_EXPR, offset, size_int (poffset)) + : size_int (poffset)); tree bump; tree vec_offset = NULL_TREE; @@ -9374,7 +9375,7 @@ vectorizable_load (vec_info *vinfo, = vect_create_data_ref_ptr (vinfo, first_stmt_info_for_drptr, aggr_type, at_loop, offset, &dummy, gsi, &ptr_incr, simd_lane_access_p, - byte_offset, bump); + bump); /* Adjust the pointer by the difference to first_stmt. */ data_reference_p ptrdr = STMT_VINFO_DATA_REF (first_stmt_info_for_drptr); @@ -9406,8 +9407,7 @@ vectorizable_load (vec_info *vinfo, = vect_create_data_ref_ptr (vinfo, first_stmt_info, aggr_type, at_loop, offset, &dummy, gsi, &ptr_incr, - simd_lane_access_p, - byte_offset, bump); + simd_lane_access_p, bump); if (mask) vec_mask = vec_masks[0]; } diff --git a/gcc/tree-vectorizer.h b/gcc/tree-vectorizer.h index 52cdfbfae02..73347ce1f4e 100644 --- a/gcc/tree-vectorizer.h +++ b/gcc/tree-vectorizer.h @@ -2003,7 +2003,7 @@ extern tree vect_create_data_ref_ptr (vec_info *, stmt_vec_info, tree, class loop *, tree, tree *, gimple_stmt_iterator *, gimple **, bool, - tree = NULL_TREE, tree = NULL_TREE); + tree = NULL_TREE); extern tree bump_vector_ptr (vec_info *, tree, gimple *, gimple_stmt_iterator *, stmt_vec_info, tree); extern void vect_copy_ref_info (tree, tree); @@ -2028,7 +2028,7 @@ extern tree vect_get_new_ssa_name (tree, enum vect_var_kind, const char * = NULL); extern tree vect_create_addr_base_for_vector_ref (vec_info *, stmt_vec_info, gimple_seq *, - tree, tree = NULL_TREE); + tree); /* In tree-vect-loop.c. */ extern widest_int vect_iv_limit_for_partial_vectors (loop_vec_info loop_vinfo);