* config/m68hc11/m68hc11.h (CONST_COSTS): Make the cost of
authorciceron <ciceron@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 4 May 2001 18:08:36 +0000 (18:08 +0000)
committerciceron <ciceron@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 4 May 2001 18:08:36 +0000 (18:08 +0000)
constants cheap after reload.
* config/m68hc11/m68hc11.c (m68hc11_shift_cost): Shift by 16 and 32
are cheap.
(m68hc11_rtx_costs): Cost of multiplication by 65536 is expensive
so that gcc prefers a shift by 16.
(m6811_cost, m6812_cost): Make the shift cheap compared to an add.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@41834 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/config/m68hc11/m68hc11.c
gcc/config/m68hc11/m68hc11.h

index 5cb1ffc..47cdf86 100644 (file)
@@ -1,3 +1,13 @@
+2001-05-04  Stephane Carrez  <Stephane.Carrez@worldnet.fr>
+
+       * config/m68hc11/m68hc11.h (CONST_COSTS): Make the cost of
+       constants cheap after reload.
+       * config/m68hc11/m68hc11.c (m68hc11_shift_cost): Shift by 16 and 32
+       are cheap.
+       (m68hc11_rtx_costs): Cost of multiplication by 65536 is expensive
+       so that gcc prefers a shift by 16.
+       (m6811_cost, m6812_cost): Make the shift cheap compared to an add.
+
 2001-05-04  Nick Clifton  <nickc@cambridge.redhat.com>
 
        * config/arm/elf.h (ASM_OUTPUT_ALIGNED_COMMON): Define.
index 1ae3979..f649b9f 100644 (file)
@@ -136,7 +136,7 @@ struct processor_costs m6811_cost = {
     COSTS_N_INSNS (2), COSTS_N_INSNS (1) },
 
   /* shiftHI const */
-  { COSTS_N_INSNS (0), COSTS_N_INSNS (2), COSTS_N_INSNS (4),
+  { COSTS_N_INSNS (0), COSTS_N_INSNS (1), COSTS_N_INSNS (4),
     COSTS_N_INSNS (6), COSTS_N_INSNS (8), COSTS_N_INSNS (6),
     COSTS_N_INSNS (4), COSTS_N_INSNS (2),
     COSTS_N_INSNS (2), COSTS_N_INSNS (4),
@@ -171,7 +171,7 @@ struct processor_costs m6812_cost = {
     COSTS_N_INSNS (2), COSTS_N_INSNS (1) },
 
   /* shiftHI const */
-  { COSTS_N_INSNS (0), COSTS_N_INSNS (2), COSTS_N_INSNS (4),
+  { COSTS_N_INSNS (0), COSTS_N_INSNS (1), COSTS_N_INSNS (4),
     COSTS_N_INSNS (6), COSTS_N_INSNS (8), COSTS_N_INSNS (6),
     COSTS_N_INSNS (4), COSTS_N_INSNS (2),
     COSTS_N_INSNS (2), COSTS_N_INSNS (4), COSTS_N_INSNS (6),
@@ -4975,7 +4975,7 @@ m68hc11_shift_cost (mode, x, shift)
     }
 
   /* For SI and others, the cost is higher.  */
-  if (GET_MODE_SIZE (mode) > 2)
+  if (GET_MODE_SIZE (mode) > 2 && (shift % 16) != 0)
     total *= GET_MODE_SIZE (mode) / 2;
 
   /* When optimizing for size, make shift more costly so that
@@ -5081,10 +5081,6 @@ m68hc11_rtx_costs (x, code, outer_code)
           break;
 
         case SImode:
-          if (GET_CODE (XEXP (x, 1)) == CONST_INT
-              && INTVAL (XEXP (x, 1)) == 65536)
-            break;
-
         default:
           total += m68hc11_cost->multSI;
           break;
index f58183c..3114a47 100644 (file)
@@ -1481,14 +1481,16 @@ extern unsigned char m68hc11_reg_valid_for_index[FIRST_PSEUDO_REGISTER];
      /* with two registers.  */                                        \
      /* 'clr' is slow */                                       \
    if ((OUTER_CODE) == SET && (RTX) == const0_rtx)             \
-     return 1;                                                 \
+     /* After reload, the reload_cse pass checks the cost */    \
+     /* to change a SET into a PLUS.  Make const0 cheap.  */    \
+     return 1 - reload_completed;                              \
    else                                                                \
      return 0;                                                 \
  case CONST:                                                   \
  case LABEL_REF:                                               \
  case SYMBOL_REF:                                              \
    if ((OUTER_CODE) == SET)                                    \
-      return 1;                                                        \
+      return 1 - reload_completed;                             \
    return 0;                                                   \
  case CONST_DOUBLE:                                            \
    return 0;