From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by sourceware.org (Postfix) with ESMTPS id 2B5EE3858CDB for ; Thu, 20 Jul 2023 12:54:31 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 2B5EE3858CDB Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 2125022C65; Thu, 20 Jul 2023 12:54:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1689857670; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=WiKhLu1ny4d84AUKE+2iawBVTk/kfqyYDDKIfUS1meo=; b=tOOZXjzBE0OqOO4aUgdk7OR0oWzjeL0M6h97vQg7NJ/eJMHccWmOy5QNtBuQ50XZFW/UoV hG4oV/F31tqbGYvMJy2Vmoy/gwPG1oeWYVRVQDepzwTZWUmubXiWU1CTPIMucdhKGEBqpr eQiAyZfLx+6Eny0eOvMeCGB1aYWHE+I= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1689857670; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=WiKhLu1ny4d84AUKE+2iawBVTk/kfqyYDDKIfUS1meo=; b=s4wD3YMZE/NZJgm9mNfnu4wX0OPfzljumzi2uTx6omO4y3KqNLcipanBo1eY0iJcYZKpUR ArkcspeSvuGm1kDQ== Received: from wotan.suse.de (wotan.suse.de [10.160.0.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id E73842C143; Thu, 20 Jul 2023 12:54:29 +0000 (UTC) Date: Thu, 20 Jul 2023 12:54:29 +0000 (UTC) From: Richard Biener To: "juzhe.zhong@rivai.ai" cc: gcc-patches , "richard.sandiford" Subject: Re: [PATCH] CODE STRUCTURE: Refine codes in Vectorizer In-Reply-To: <17D1D233544F89AE+2023072020451277703933@rivai.ai> Message-ID: References: <20230720080629.1060969-1-juzhe.zhong@rivai.ai> <17D1D233544F89AE+2023072020451277703933@rivai.ai> User-Agent: Alpine 2.22 (LSU 394 2020-01-19) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-11.0 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,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Thu, 20 Jul 2023, juzhe.zhong@rivai.ai wrote: > Just finish Bootstrap and regression on X86. > > Ok for trunk ? OK. Not an issue currently but I think LEN_MASK should be checked before MASK. Richard. > > juzhe.zhong@rivai.ai > > From: juzhe.zhong > Date: 2023-07-20 16:06 > To: gcc-patches > CC: richard.sandiford; rguenther; Ju-Zhe Zhong > Subject: [PATCH] CODE STRUCTURE: Refine codes in Vectorizer > From: Ju-Zhe Zhong > > Hi, Richard and Richi. > > I plan to refine the codes that I recently support for RVV auto-vectorization. > This patch is inspired last review comments from Richard: > https://patchwork.sourceware.org/project/gcc/patch/20230712042124.111818-1-juzhe.zhong@rivai.ai/ > > Richard said he prefer the the code structure as follows: > > Please instead switch the if condition so that the structure is: > > if (...) > vect_record_loop_mask (...) > else if (...) > vect_record_loop_len (...) > else > can't use partial vectors > > This is his last comments. > > So, I come back to refine this piece of codes. > > Does it look reasonable ? > > This next refine patch is change all names of "LEN_MASK" into "MASK_LEN" but should come after this > patch. > > gcc/ChangeLog: > > * tree-vect-stmts.cc (check_load_store_for_partial_vectors): Refine code structure. > > --- > gcc/tree-vect-stmts.cc | 38 +++++++++++++++++--------------------- > 1 file changed, 17 insertions(+), 21 deletions(-) > > diff --git a/gcc/tree-vect-stmts.cc b/gcc/tree-vect-stmts.cc > index cb86d544313..b86e159ae4c 100644 > --- a/gcc/tree-vect-stmts.cc > +++ b/gcc/tree-vect-stmts.cc > @@ -1605,6 +1605,7 @@ check_load_store_for_partial_vectors (loop_vec_info loop_vinfo, tree vectype, > nvectors = vect_get_num_copies (loop_vinfo, vectype); > vec_loop_masks *masks = &LOOP_VINFO_MASKS (loop_vinfo); > + vec_loop_lens *lens = &LOOP_VINFO_LENS (loop_vinfo); > machine_mode vecmode = TYPE_MODE (vectype); > bool is_load = (vls_type == VLS_LOAD); > if (memory_access_type == VMAT_LOAD_STORE_LANES) > @@ -1631,33 +1632,29 @@ check_load_store_for_partial_vectors (loop_vec_info loop_vinfo, tree vectype, > internal_fn ifn = (is_load > ? IFN_MASK_GATHER_LOAD > : IFN_MASK_SCATTER_STORE); > - if (!internal_gather_scatter_fn_supported_p (ifn, vectype, > - gs_info->memory_type, > - gs_info->offset_vectype, > - gs_info->scale)) > - { > - ifn = (is_load > - ? IFN_LEN_MASK_GATHER_LOAD > - : IFN_LEN_MASK_SCATTER_STORE); > - if (internal_gather_scatter_fn_supported_p (ifn, vectype, > - gs_info->memory_type, > - gs_info->offset_vectype, > - gs_info->scale)) > - { > - vec_loop_lens *lens = &LOOP_VINFO_LENS (loop_vinfo); > - vect_record_loop_len (loop_vinfo, lens, nvectors, vectype, 1); > - return; > - } > + internal_fn len_ifn = (is_load > + ? IFN_LEN_MASK_GATHER_LOAD > + : IFN_LEN_MASK_SCATTER_STORE); > + if (internal_gather_scatter_fn_supported_p (ifn, vectype, > + gs_info->memory_type, > + gs_info->offset_vectype, > + gs_info->scale)) > + vect_record_loop_mask (loop_vinfo, masks, nvectors, vectype, > + scalar_mask); > + else if (internal_gather_scatter_fn_supported_p (len_ifn, vectype, > + gs_info->memory_type, > + gs_info->offset_vectype, > + gs_info->scale)) > + vect_record_loop_len (loop_vinfo, lens, nvectors, vectype, 1); > + else > + { > if (dump_enabled_p ()) > dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, > "can't operate on partial vectors because" > " the target doesn't have an appropriate" > " gather load or scatter store instruction.\n"); > LOOP_VINFO_CAN_USE_PARTIAL_VECTORS_P (loop_vinfo) = false; > - return; > } > - vect_record_loop_mask (loop_vinfo, masks, nvectors, vectype, > - scalar_mask); > return; > } > @@ -1703,7 +1700,6 @@ check_load_store_for_partial_vectors (loop_vec_info loop_vinfo, tree vectype, > if (get_len_load_store_mode (vecmode, is_load).exists (&vmode)) > { > nvectors = group_memory_nvectors (group_size * vf, nunits); > - vec_loop_lens *lens = &LOOP_VINFO_LENS (loop_vinfo); > unsigned factor = (vecmode == vmode) ? 1 : GET_MODE_UNIT_SIZE (vecmode); > vect_record_loop_len (loop_vinfo, lens, nvectors, vectype, factor); > using_partial_vectors_p = true; > -- Richard Biener SUSE Software Solutions Germany GmbH, Frankenstrasse 146, 90461 Nuernberg, Germany; GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman; HRB 36809 (AG Nuernberg)