From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13833 invoked by alias); 20 May 2011 17:07:15 -0000 Received: (qmail 13821 invoked by uid 22791); 20 May 2011 17:07:14 -0000 X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=AWL,BAYES_00,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from nikam.ms.mff.cuni.cz (HELO nikam.ms.mff.cuni.cz) (195.113.20.16) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 20 May 2011 17:06:59 +0000 Received: by nikam.ms.mff.cuni.cz (Postfix, from userid 29025) id 246D59AC82F; Fri, 20 May 2011 19:06:58 +0200 (CEST) Date: Fri, 20 May 2011 20:09:00 -0000 From: Zdenek Dvorak To: Tom de Vries Cc: gcc-patches@gcc.gnu.org Subject: Re: [PATCH PR45098, 9/10] Cheap shift-add. Message-ID: <20110520170658.GA21018@kam.mff.cuni.cz> References: <4DD21F6E.4050308@codesourcery.com> <4DD221FC.7060303@codesourcery.com> <4DD4006E.406@codesourcery.com> <20110518212018.GA28543@kam.mff.cuni.cz> <4DD6323B.6030308@codesourcery.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4DD6323B.6030308@codesourcery.com> User-Agent: Mutt/1.5.18 (2008-05-17) 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 X-SW-Source: 2011-05/txt/msg01498.txt.bz2 Hi, > On 05/18/2011 11:20 PM, Zdenek Dvorak wrote: > >> + sa_cost = (TREE_CODE (expr) != MINUS_EXPR > >> + ? shiftadd_cost[speed][mode][m] > >> + : (mult == op1 > >> + ? shiftsub1_cost[speed][mode][m] > >> + : shiftsub0_cost[speed][mode][m])); > >> + res = new_cost (sa_cost, 0); > >> + res = add_costs (res, mult == op1 ? cost0 : cost1); > > > > just forgetting the cost of the other operand does not seem correct -- what > > if it contains some more complicated subexpression? > > > > True. I now added the cost of TREE_OPERAND (mult, 0). OK, Zdenek