From patchwork Wed Jun 23 21:05:31 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Kuvyrkov X-Patchwork-Id: 56719 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]) by ozlabs.org (Postfix) with SMTP id 01EB0B6EF7 for ; Thu, 24 Jun 2010 07:05:49 +1000 (EST) Received: (qmail 8183 invoked by alias); 23 Jun 2010 21:05:45 -0000 Received: (qmail 8090 invoked by uid 22791); 23 Jun 2010 21:05:40 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL, BAYES_00, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (38.113.113.100) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 23 Jun 2010 21:05:35 +0000 Received: (qmail 5601 invoked from network); 23 Jun 2010 21:05:34 -0000 Received: from unknown (HELO ?172.16.1.24?) (maxim@127.0.0.2) by mail.codesourcery.com with ESMTPA; 23 Jun 2010 21:05:34 -0000 Message-ID: <4C22771B.9000904@codesourcery.com> Date: Thu, 24 Jun 2010 01:05:31 +0400 From: Maxim Kuvyrkov User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.1.10) Gecko/20100512 Thunderbird/3.0.5 MIME-Version: 1.0 To: Richard Earnshaw CC: gcc-patches Subject: Fix thumb1 size cost of small constants References: <4C18F225.2040509@codesourcery.com> <4C227243.9080104@codesourcery.com> In-Reply-To: <4C227243.9080104@codesourcery.com> X-IsSubscribed: yes 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 This patch fixes thumb1 size cost of small constants. Currently, the cost of SET of a constant is set to zero, which is odd considering that it still takes one instruction to do the operation. The code for Thumb2 and ARM modes returns COSTS_N_INSNS (1) for similar case, so the patch makes Thumb1 cost agree with ARM and Thumb2 cost. OK to check in? Thank you, diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index d846557..b2186d8 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -6941,7 +6941,7 @@ thumb1_size_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer) if (outer == SET) { if ((unsigned HOST_WIDE_INT) INTVAL (x) < 256) - return 0; + return COSTS_N_INSNS (1); /* See split "TARGET_THUMB1 && satisfies_constraint_J". */ if (INTVAL (x) >= -255 && INTVAL (x) <= -1) return COSTS_N_INSNS (2);