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: 536633 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 2E2451412F9 for ; Wed, 28 Oct 2015 00:55:51 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=Vyz+qzpm; dkim-atps=neutral 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=S0memn07MFHdJbNZYoFVoC6x14XiDUckGS+dqTmQmo2 pKenBe3Yr5qBOQu89+Zs9k5b5PkYX4bAus9XiaAVvwSq0d9x6edgxmueNXQufW08 n1XcUyEbumpKQtZ11yyF08Slf3a3b8caCPrfqCBPyo1YaMzBDj4HoyJN7OK62zcY = 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=Vyz+qzpmMzlPluY6I CtASet4zk6Zbgi95HDN/a4FLRpLd8C94CXzbTXuKI6KLFNKjo/Ca/G71C6YE8t6S r0ajILenJnweEGZMg8wPa0nbLV9AFMqAGEdWmDVbh8y1SVDO0u+CoblLBVvaq+GZ TmgNiAko+kRyh3cY3NAWweeXPc= 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));