From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 114265 invoked by alias); 27 Apr 2017 15:30:38 -0000 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 Received: (qmail 114044 invoked by uid 89); 27 Apr 2017 15:30:27 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=exceedingly, principle, solid, cheap X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 27 Apr 2017 15:30:25 +0000 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 926517073F; Thu, 27 Apr 2017 15:30:17 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 926517073F Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=law@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 926517073F Received: from localhost.localdomain (ovpn-117-12.phx2.redhat.com [10.3.117.12]) by smtp.corp.redhat.com (Postfix) with ESMTP id 353D217AE9; Thu, 27 Apr 2017 15:30:17 +0000 (UTC) Subject: Re: [PATCH GCC8][14/33]Handle more cheap operations in force_expr_to_var_cost To: Richard Biener , Bin Cheng Cc: "gcc-patches@gcc.gnu.org" , nd References: From: Jeff Law Message-ID: <34eb71c0-0320-0515-d49c-1c05fe587d90@redhat.com> Date: Thu, 27 Apr 2017 15:55:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2017-04/txt/msg01411.txt.bz2 On 04/26/2017 06:58 AM, Richard Biener wrote: > On Tue, Apr 18, 2017 at 12:44 PM, Bin Cheng > wrote: >> Hi, This patch handles more cheap cases in function >> force_expr_to_var_cost, specifically, TRUNC_DIV_EXPR, BIT_AND_EXPR, >> BIT_IOR_EXPR, RSHIFT_EXPR and BIT_NOT_EXPR. >> >> Is it OK? > > I wonder if using add_cost is good here. TRUNC_DIV by power of two > better matches shift_cost, no, or div_pow2_cheap? Likewise for > LSHIFT/RSHIFT. We do have [us]div_cost as well btw. And we have > neg_cost. In an ideal world, we'd have a canoncial form and just handle hte canonical form. But that hasn't ever really panned out for this kind of stuff in RTL -- the decision about what is the preferred form of an expression changes based on use context. I don't think these problems are as bad at the gimple level, but clearly they still exist. The more we query the target, the less predictable the compiler's behavior will be over time. It was a huge problem in RTL leading us to a point where it became exceedingly difficult to predict how a change in a pass would ultimately affect the performance across targets. That led to a guiding principle that we want to avoid querying the target in gimple as much as possible. We've relaxed that somewhat (we have to be pragmatic), but we need to be real careful here. So my recommendation would be to define a set of costs for gimple and get those as solid as we can given an "ideal" target. Only query the target for cases where it's critical. Jeff