From patchwork Mon Jun 6 13:26:42 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Plotnikov X-Patchwork-Id: 1756 Return-Path: Delivered-To: unknown Received: from imap.gmail.com (74.125.159.109) by localhost6.localdomain6 with IMAP4-SSL; 08 Jun 2011 14:55:32 -0000 Delivered-To: patches@linaro.org Received: by 10.52.181.10 with SMTP id ds10cs31658vdc; Mon, 6 Jun 2011 06:26:24 -0700 (PDT) Received: by 10.223.127.210 with SMTP id h18mr2682164fas.77.1307366783534; Mon, 06 Jun 2011 06:26:23 -0700 (PDT) Received: from smtp.ispras.ru (smtp.ispras.ru [83.149.198.202]) by mx.google.com with ESMTP id a19si4626142faa.32.2011.06.06.06.26.22; Mon, 06 Jun 2011 06:26:22 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of dplotnikov@ispras.ru designates 83.149.198.202 as permitted sender) client-ip=83.149.198.202; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of dplotnikov@ispras.ru designates 83.149.198.202 as permitted sender) smtp.mail=dplotnikov@ispras.ru Received: from ispserv.ispras.ru (ispserv.ispras.ru [83.149.198.72]) by smtp.ispras.ru (Postfix) with ESMTP id 3A2E85D406D; Mon, 6 Jun 2011 17:21:39 +0400 (MSD) Received: from [10.10.3.60] (winnie.ispras.ru [83.149.198.236]) by ispserv.ispras.ru (Postfix) with ESMTP id 0339B3FC48; Mon, 6 Jun 2011 17:26:20 +0400 (MSD) Message-ID: <4DECD592.2070708@ispras.ru> Date: Mon, 06 Jun 2011 17:26:42 +0400 From: Dmitry Plotnikov User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.17) Gecko/20110424 Thunderbird/3.1.10 MIME-Version: 1.0 To: Andrew Stubbs CC: Ramana Radhakrishnan , gcc-patches@gcc.gnu.org, patches@linaro.org, dm@ispras.ru Subject: Re: [PATCH][ARM] Add support for ADDW and SUBW instructions References: <4DAEFB5C.8020802@codesourcery.com> <4DE751DF.8080906@codesourcery.com> <4DECC4CB.2000500@ispras.ru> <4DECCAF8.5030406@codesourcery.com> In-Reply-To: <4DECCAF8.5030406@codesourcery.com> On 06/06/2011 04:41 PM, Andrew Stubbs wrote: > On 06/06/11 13:15, Dmitry Plotnikov wrote: >> + && (const_ok_for_op (INTVAL (x), outer) >> + || const_ok_for_op (~INTVAL (x), outer)))) > > The second call is redundant. const_ok_for_op should already do that. > Fixed patch is attached. Ok? 2011-06-06 Dmitry PLotnikov gcc/ * config/arm/arm.c (arm_rtx_costs_1): Fixed costs for CONST_INT in PLUS pattern. diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index 22ddcd2..9ef6f6d 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -7050,7 +7056,9 @@ arm_rtx_costs_1 (rtx x, enum rtx_code outer, int* total, bool speed) case CONST_INT: if (const_ok_for_arm (INTVAL (x)) - || const_ok_for_arm (~INTVAL (x))) + || const_ok_for_arm (~INTVAL (x)) + || (TARGET_THUMB2 && outer == PLUS + && (const_ok_for_op (INTVAL (x), outer)))) *total = COSTS_N_INSNS (1); else *total = COSTS_N_INSNS (arm_gen_constant (SET, mode, NULL_RTX,