diff mbox

Fix thumb1 size cost of small constants

Message ID 4C22771B.9000904@codesourcery.com
State New
Headers show

Commit Message

Maxim Kuvyrkov June 23, 2010, 9:05 p.m. UTC
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,

Comments

Richard Earnshaw June 24, 2010, 10:22 a.m. UTC | #1
On Thu, 2010-06-24 at 01:05 +0400, Maxim Kuvyrkov wrote:
> 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,

OK.

R.
diff mbox

Patch

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);