From patchwork Mon Mar 24 17:21:00 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kyrylo Tkachov X-Patchwork-Id: 333103 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 A3CD3140098 for ; Tue, 25 Mar 2014 04:21:12 +1100 (EST) 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=TeGkr8Zek4jP/0mj4+JMPWbuuhlHz+uotiXWsqmw1kf /WDovulHhXR5Mh7h+nPPcOGfXLUZTuCpqbIbO4OORDiOop1J4LG2UR8LW2Jjc2Xg 2045fET5G0IA0uDAUWnyDSxrSO6PbhlNFmDvJC5z++bAtreJB1P4SLjzaijm3CGQ = 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=ciFgtbnsLcO/5VnFan4zOC5N/8E=; b=fW96mhzFGOC+Gdo01 cIyd+BxVE78thd4WtGM3ifE56dbqPznGJz49Ka8mBCPsclafijgHAHGVrFmBybIt UdBzmz5+OYX94fP9J9613v/lZRmL2IObuu/UAjTcZpzfIot6ThOUhZgldfXb1btg tlzWpwYSW6FlH7R62sf6ViCY4E= Received: (qmail 18793 invoked by alias); 24 Mar 2014 17:21:06 -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 18769 invoked by uid 89); 24 Mar 2014 17:21:06 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: service87.mimecast.com Received: from service87.mimecast.com (HELO service87.mimecast.com) (91.220.42.44) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 24 Mar 2014 17:21:04 +0000 Received: from cam-owa2.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.21]) by service87.mimecast.com; Mon, 24 Mar 2014 17:21:01 +0000 Received: from [10.1.208.24] ([10.1.255.212]) by cam-owa2.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.3959); Mon, 24 Mar 2014 17:21:15 +0000 Message-ID: <5330697C.3000002@arm.com> Date: Mon, 24 Mar 2014 17:21:00 +0000 From: Kyrill Tkachov User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130804 Thunderbird/17.0.8 MIME-Version: 1.0 To: GCC Patches CC: Ramana Radhakrishnan , Richard Earnshaw Subject: [PATCH][ARM] Handle simple SImode PLUS and MINUS operations in rtx costs X-MC-Unique: 114032417210103401 X-IsSubscribed: yes Hi all, I noticed that we don't handle simple reg-to-reg arithmetic operations in the arm rtx cost functions. We should be adding the cost of alu.arith to the costs of the operands. This patch does that. Since we don't have any cost tables yet that have a non-zero value for that field it shouldn't affect code-gen for any current cores. Bootstrapped and tested on arm-none-linux-gnueabihf. Ok for next stage1? Thanks, Kyrill 2014-03-24 Kyrylo Tkachov * config/arm/arm.c (arm_new_rtx_costs): Handle reg-to-reg PLUS and MINUS RTXs. diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index bf5d1b2..3102b67 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -9428,6 +9428,14 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code, *cost += rtx_cost (XEXP (x, 1), code, 1, speed_p); return true; } + else if (REG_P (XEXP (x, 0))) + { + *cost += rtx_cost (XEXP (x, 0), code, 0, speed_p) + + rtx_cost (XEXP (x, 1), code, 1, speed_p); + if (speed_p) + *cost += extra_cost->alu.arith; + return true; + } return false; } @@ -9663,6 +9671,14 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code, *cost += rtx_cost (XEXP (x, 0), PLUS, 0, speed_p); return true; } + else if (REG_P (XEXP (x, 1))) + { + *cost += rtx_cost (XEXP (x, 0), PLUS, 0, speed_p) + + rtx_cost (XEXP (x, 1), PLUS, 1, speed_p); + if (speed_p) + *cost += extra_cost->alu.arith; + return true; + } return false; }