OSDN Git Service

* config/h8300/h8300.c (h8300_shift_costs): New.
authorkazu <kazu@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 27 Nov 2002 22:21:11 +0000 (22:21 +0000)
committerkazu <kazu@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 27 Nov 2002 22:21:11 +0000 (22:21 +0000)
* config/h8300/h8300.h (RTX_COSTS): Use h8300_shift_costs.
* config/h8300/h8300-protos.h: Add a prototype for
h8300_shift_costs.

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

gcc/ChangeLog
gcc/config/h8300/h8300-protos.h
gcc/config/h8300/h8300.c
gcc/config/h8300/h8300.h

index fd733e4..34753fb 100644 (file)
@@ -1,3 +1,10 @@
+2002-11-27  Kazu Hirata  <kazu@cs.umass.edu>
+
+       * config/h8300/h8300.c (h8300_shift_costs): New.
+       * config/h8300/h8300.h (RTX_COSTS): Use h8300_shift_costs.
+       * config/h8300/h8300-protos.h: Add a prototype for
+       h8300_shift_costs.
+
 2002-11-27  Jim Wilson  <wilson@redhat.com>
 
         * config/rs6000/spe.md (spu_evsplatfi, spu_evsplati): Swap operands
index b88ade0..c9f506a 100644 (file)
@@ -32,6 +32,7 @@ extern const char *emit_a_rotate PARAMS ((enum rtx_code, rtx *));
 extern const char *output_simode_bld PARAMS ((int, rtx[]));
 extern void print_operand_address PARAMS ((FILE *, rtx));
 extern int const_costs PARAMS ((rtx, enum rtx_code, enum rtx_code));
+extern int h8300_shift_costs PARAMS ((rtx));
 extern void print_operand PARAMS ((FILE *, rtx, int));
 extern void final_prescan_insn PARAMS ((rtx, rtx *, int));
 extern int do_movsi PARAMS ((rtx[]));
index 54dc57d..93807a0 100644 (file)
@@ -1134,6 +1134,24 @@ const_costs (r, c, outer_code)
       return 4;
     }
 }
+
+int
+h8300_shift_costs (x)
+     rtx x;
+{
+  rtx operands[4];
+
+  if (GET_MODE (x) != QImode
+      && GET_MODE (x) != HImode
+      && GET_MODE (x) != SImode)
+    return 100;
+
+  operands[0] = NULL;
+  operands[1] = NULL;
+  operands[2] = XEXP (x, 1);
+  operands[3] = x;
+  return compute_a_shift_length (NULL, operands);
+}
 \f
 /* Documentation for the machine specific operand escapes:
 
index 96cd0bb..6388680 100644 (file)
@@ -1020,20 +1020,20 @@ struct cum_arg
 
 /* Provide the costs of a rtl expression.  This is in the body of a
    switch on CODE.  */
-/* ??? Shifts need to have a *much* higher cost than this.  */
-
-#define RTX_COSTS(RTX, CODE, OUTER_CODE)       \
-  case MOD:                                    \
-  case DIV:                                    \
-    return 60;                                 \
-  case MULT:                                   \
-    return 20;                                 \
-  case ASHIFT:                                 \
-  case ASHIFTRT:                               \
-  case LSHIFTRT:                               \
-  case ROTATE:                                 \
-  case ROTATERT:                               \
-    if (GET_MODE (RTX) == HImode) return 2;    \
+
+#define RTX_COSTS(RTX, CODE, OUTER_CODE)               \
+  case MOD:                                            \
+  case DIV:                                            \
+    return 60;                                         \
+  case MULT:                                           \
+    return 20;                                         \
+  case ASHIFT:                                         \
+  case ASHIFTRT:                                       \
+  case LSHIFTRT:                                       \
+    return COSTS_N_INSNS (h8300_shift_costs (RTX));    \
+  case ROTATE:                                         \
+  case ROTATERT:                                       \
+    if (GET_MODE (RTX) == HImode) return 2;            \
     return 8;
 
 /* Tell final.c how to eliminate redundant test instructions.  */