From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate.crashing.org (gate.crashing.org [63.228.1.57]) by sourceware.org (Postfix) with ESMTP id F15AC3858413 for ; Mon, 6 Sep 2021 23:44:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org F15AC3858413 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=kernel.crashing.org Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=kernel.crashing.org Received: from gate.crashing.org (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.14.1) with ESMTP id 186NhAL1031584; Mon, 6 Sep 2021 18:43:10 -0500 Received: (from segher@localhost) by gate.crashing.org (8.14.1/8.14.1/Submit) id 186Nh9E9031581; Mon, 6 Sep 2021 18:43:09 -0500 X-Authentication-Warning: gate.crashing.org: segher set sender to segher@kernel.crashing.org using -f Date: Mon, 6 Sep 2021 18:43:09 -0500 From: Segher Boessenkool To: "Kewen.Lin" Cc: will schmidt , Bill Schmidt , David Edelsohn , GCC Patches Subject: Re: [PATCH v2] rs6000: Add load density heuristic Message-ID: <20210906234308.GD1583@gate.crashing.org> References: <7b9f9bdf-1ed5-139b-de9c-511ee8454b85@linux.ibm.com> <3424a3d3-fa4e-16f9-89c6-0b07beec957d@linux.ibm.com> <101b1a2a18a6332b305e6259355d91772d0e02be.camel@vnet.ibm.com> <91063938-9ac4-93ed-c438-abf25d4eca05@linux.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <91063938-9ac4-93ed-c438-abf25d4eca05@linux.ibm.com> User-Agent: Mutt/1.4.2.3i X-Spam-Status: No, score=-5.6 required=5.0 tests=BAYES_00, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, TXREP, T_SPF_HELO_PERMERROR, T_SPF_PERMERROR autolearn=no 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-List-Received-Date: Mon, 06 Sep 2021 23:44:12 -0000 Hi! On Wed, Jul 28, 2021 at 10:59:50AM +0800, Kewen.Lin wrote: > >> +/* As a visitor function for each statement cost entry handled in > >> + function add_stmt_cost, gather some information and update its > >> + relevant fields in target cost accordingly. */ > > > > I got lost trying to parse that.. (could be just me :-) > > > > Possibly instead something like > > /* Helper function for add_stmt_cost ; gather information and update > > the target_cost fields accordingly. */ > > OK, will update. I was thinking for each entry handled in function > add_stmt_cost, this helper acts like a visitor, trying to visit each > entry and take some actions if some conditions are satisifed. It (thankfully!) has nothing to do with the "visitor pattern", so some other name might be better :-) > > Maybe clearer to read if you rearrange slightly and flatten it ? I > > defer to others on that.. > > > > if ((kind == vec_to_scalar > > || kind == vec_perm > > || kind == vec_promote_demote > > || kind == vec_construct > > || kind == scalar_to_vec) > > || (kind == vector_stmt && where == vect_body) > > This hunk is factored out from function rs6000_add_stmt_cost, maybe I > can keep the original formatting? The formatting tool isn't so smart, > and sometimes rearrange things to become unexpected (although it meets > the basic rule, not so elegant), sigh. It has too many parens, making grouping where there is none, that is the core issue. if (kind == vec_to_scalar || kind == vec_perm || kind == vec_promote_demote || kind == vec_construct || kind == scalar_to_vec || (kind == vector_stmt && where == vect_body)) Segher