This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[patch] h8300: Compute the costs of AND in RTX_COSTS.
- From: Kazu Hirata <kazu at cs dot umass dot edu>
- To: gcc-patches at gcc dot gnu dot org
- Date: Thu, 28 Nov 2002 09:08:56 -0500 (EST)
- Subject: [patch] h8300: Compute the costs of AND in RTX_COSTS.
Hi,
Attached is a patch to compute the costs of AND in RTX_COSTS.
Tested on h8300 port. Committed.
Kazu Hirata
2002-11-28 Kazu Hirata <kazu@cs.umass.edu>
* config/h8300/h8300.c (h8300_and_costs): New.
* config/h8300/h8300.h (RTX_COSTS): Use h8300_and_costs.
* config/h8300/h8300-protos.h: Add a prototype for
h8300_and_costs.
Index: h8300.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/h8300/h8300.c,v
retrieving revision 1.165
diff -u -r1.165 h8300.c
--- h8300.c 27 Nov 2002 22:21:11 -0000 1.165
+++ h8300.c 28 Nov 2002 14:02:09 -0000
@@ -1136,6 +1136,26 @@
}
int
+h8300_and_costs (x)
+ rtx x;
+{
+ rtx operands[4];
+
+ if (GET_MODE (x) == QImode)
+ return 1;
+
+ if (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_logical_op_length (GET_MODE (x), operands);
+}
+
+int
h8300_shift_costs (x)
rtx x;
{
Index: h8300.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/h8300/h8300.h,v
retrieving revision 1.120
diff -u -r1.120 h8300.h
--- h8300.h 27 Nov 2002 22:41:36 -0000 1.120
+++ h8300.h 28 Nov 2002 14:02:10 -0000
@@ -1022,6 +1022,8 @@
switch on CODE. */
#define RTX_COSTS(RTX, CODE, OUTER_CODE) \
+ case AND: \
+ return COSTS_N_INSNS (h8300_and_costs (RTX)); \
case MOD: \
case DIV: \
return 60; \
Index: h8300-protos.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/h8300/h8300-protos.h,v
retrieving revision 1.33
diff -u -r1.33 h8300-protos.h
--- h8300-protos.h 27 Nov 2002 22:21:11 -0000 1.33
+++ h8300-protos.h 28 Nov 2002 14:02:10 -0000
@@ -32,6 +32,7 @@
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_and_costs PARAMS ((rtx));
extern int h8300_shift_costs PARAMS ((rtx));
extern void print_operand PARAMS ((FILE *, rtx, int));
extern void final_prescan_insn PARAMS ((rtx, rtx *, int));