From patchwork Wed Jun 23 21:05:31 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: Fix thumb1 size cost of small constants Date: Wed, 23 Jun 2010 11:05:31 -0000 From: Maxim Kuvyrkov X-Patchwork-Id: 56719 Message-Id: <4C22771B.9000904@codesourcery.com> To: Richard Earnshaw Cc: gcc-patches 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);