From patchwork Tue Oct 27 13:55:35 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kyrylo Tkachov X-Patchwork-Id: 55603 Delivered-To: patch@linaro.org Received: by 10.112.59.35 with SMTP id w3csp1810446lbq; Tue, 27 Oct 2015 06:55:56 -0700 (PDT) X-Received: by 10.66.196.168 with SMTP id in8mr27891862pac.27.1445954155942; Tue, 27 Oct 2015 06:55:55 -0700 (PDT) Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id wv1si62007612pab.150.2015.10.27.06.55.55 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 27 Oct 2015 06:55:55 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-return-411678-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; spf=pass (google.com: domain of gcc-patches-return-411678-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-411678-patch=linaro.org@gcc.gnu.org; dkim=pass header.i=@gcc.gnu.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:cc:subject:content-type; q=dns; s=default; b=qEreceBK+7jKCitQxa3G0R5iJSpVW5m8wUG9YzPNU5L halqYtkYUuqU6JN/PwYVzrJx8ZJ57l7xmvqwh2XCqroEudRnzgA38RCjxbd6xRyR GBq0D47sTqjMFGBDZTUI7ZXtk7xGA9rezRnP2h1qUEFD7TiY/ilQjs9lrr4IfB2k = DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:cc:subject:content-type; s=default; bh=QpW7LkBYFurNQZju+SaLscUlWUs=; b=uOFE9s0j/FyzV0u/H 4sndqX7y8J0n1Yx47pcN+NkT1glGDOtVdwK5w8wdeTG/mQ4Jvq7ObykPXQm+530r lSVdH2YHuC/8kD/Iy1b3lRjt0U2pQlGwT55tKKoKZ+GCJC7KQXl8MqDj4JBw8QDW qqfIOiJ538vQj4OFkQ54L5MZA8= Received: (qmail 127255 invoked by alias); 27 Oct 2015 13:55:44 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 127244 invoked by uid 89); 27 Oct 2015 13:55:43 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=AWL, BAYES_00, SPF_PASS autolearn=ham version=3.3.2 X-HELO: eu-smtp-delivery-143.mimecast.com Received: from eu-smtp-delivery-143.mimecast.com (HELO eu-smtp-delivery-143.mimecast.com) (146.101.78.143) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 27 Oct 2015 13:55:42 +0000 Received: from cam-owa1.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.140]) by eu-smtp-1.mimecast.com with ESMTP id uk-mta-25-HE5QmO4gRZOs5TO4h3tyrA-1; Tue, 27 Oct 2015 13:55:35 +0000 Received: from [10.2.207.50] ([10.1.2.79]) by cam-owa1.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.3959); Tue, 27 Oct 2015 13:55:35 +0000 Message-ID: <562F8257.6080006@arm.com> Date: Tue, 27 Oct 2015 13:55:35 +0000 From: Kyrill Tkachov User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: GCC Patches CC: Ramana Radhakrishnan , Richard Earnshaw Subject: [PATCH][ARM] Fix costing of vmul+vcvt combine pattern X-MC-Unique: HE5QmO4gRZOs5TO4h3tyrA-1 X-IsSubscribed: yes Hi all, This patch allows us to handle the *combine_vcvtf2i pattern in rtx costs by properly identifying it as a toint coversion. Before this I saw a pattern like: (set (reg/i:SI 0 r0) (fix:SI (fix:SF (mult:SF (reg:SF 16 s0 [ a ]) (const_double:SF 3.2e+1 [0x0.8p+6]))))) being assigned a cost of 40 because the costs blindly recursed into the operands. With this patch for -mcpu=cortex-a57 I see it being assigned a cost of 4. Bootstrapped and tested on arm-none-linux-gnueabihf. Ok for trunk? Thanks, Kyrill 2015-10-27 Kyrylo Tkachov * config/arm/arm.c (arm_new_rtx_costs, FIX case): Handle combine_vcvtf2i pattern. commit 1e040710d1022ce816eac9b4f6065bc7aa2be9cf Author: Kyrylo Tkachov Date: Wed Oct 14 11:26:07 2015 +0100 [ARM] Fix costing of vmul+vcvt combine pattern diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index b37b507..33ad433 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -11064,6 +11064,23 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code, case UNSIGNED_FIX: if (TARGET_HARD_FLOAT) { + /* The *combine_vcvtf2i reduces a vmul+vcvt into + a vcvt fixed-point conversion. */ + if (code == FIX && mode == SImode + && GET_CODE (XEXP (x, 0)) == FIX + && GET_MODE (XEXP (x, 0)) == SFmode + && GET_CODE (XEXP (XEXP (x, 0), 0)) == MULT + && vfp3_const_double_for_bits (XEXP (XEXP (XEXP (x, 0), 0), 1)) + > 0) + { + if (speed_p) + *cost += extra_cost->fp[0].toint; + + *cost += rtx_cost (XEXP (XEXP (XEXP (x, 0), 0), 0), mode, + code, 0, speed_p); + return true; + } + if (GET_MODE_CLASS (mode) == MODE_INT) { mode = GET_MODE (XEXP (x, 0));