Commit 2ce04b6b by David S. Miller Committed by David S. Miller

sparc-protos.h (sparc_rtx_costs): New.

2002-05-03  David S. Miller  <davem@redhat.com>

	* config/sparc/sparc-protos.h (sparc_rtx_costs): New.
	* config/sparc/sparc.c (sparc_rtx_costs): New function
	implementing RTX_COSTS and CONST_COSTS.
	* config/sparc/sparc.h (CONST_COSTS): Delete.
	(RTX_COSTS_CASES): Define.
	(RTX_COSTS): Expand RTX_COSTS_CASES and use sparc_rtx_costs to do
	the work.

From-SVN: r53147
parent a1d9bd0c
2002-05-03 David S. Miller <davem@redhat.com> 2002-05-03 David S. Miller <davem@redhat.com>
* config/sparc/sparc-protos.h (sparc_rtx_costs): New.
* config/sparc/sparc.c (sparc_rtx_costs): New function
implementing RTX_COSTS and CONST_COSTS.
* config/sparc/sparc.h (CONST_COSTS): Delete.
(RTX_COSTS_CASES): Define.
(RTX_COSTS): Expand RTX_COSTS_CASES and use sparc_rtx_costs to do
the work.
* config/sparc/sparc.md (DFA schedulers): Split out... * config/sparc/sparc.md (DFA schedulers): Split out...
* config/sparc/cypress.md, config/sparc/hypersparc.md, * config/sparc/cypress.md, config/sparc/hypersparc.md,
config/sparc/sparclet.md, config/sparc/supersparc.md, config/sparc/sparclet.md, config/sparc/supersparc.md,
......
...@@ -121,6 +121,7 @@ extern char *sparc_v8plus_shift PARAMS ((rtx *, rtx, const char *)); ...@@ -121,6 +121,7 @@ extern char *sparc_v8plus_shift PARAMS ((rtx *, rtx, const char *));
extern int sparc_check_64 PARAMS ((rtx, rtx)); extern int sparc_check_64 PARAMS ((rtx, rtx));
extern rtx gen_df_reg PARAMS ((rtx, int)); extern rtx gen_df_reg PARAMS ((rtx, int));
extern int sparc_extra_constraint_check PARAMS ((rtx, int, int)); extern int sparc_extra_constraint_check PARAMS ((rtx, int, int));
extern int sparc_rtx_costs PARAMS ((rtx, enum rtx_code, enum rtx_code));
#endif /* RTX_CODE */ #endif /* RTX_CODE */
#endif /* __SPARC_PROTOS_H__ */ #endif /* __SPARC_PROTOS_H__ */
...@@ -8085,3 +8085,68 @@ sparc_extra_constraint_check (op, c, strict) ...@@ -8085,3 +8085,68 @@ sparc_extra_constraint_check (op, c, strict)
return reload_ok_mem; return reload_ok_mem;
} }
int
sparc_rtx_costs (x, code, outer_code)
rtx x;
enum rtx_code code, outer_code;
{
switch (code)
{
case MULT:
if (sparc_cpu == PROCESSOR_ULTRASPARC)
return (GET_MODE (x) == DImode ?
COSTS_N_INSNS (34) : COSTS_N_INSNS (19));
if (sparc_cpu == PROCESSOR_ULTRASPARC3)
return COSTS_N_INSNS (6);
return (TARGET_HARD_MUL
? COSTS_N_INSNS (5)
: COSTS_N_INSNS (25));
case DIV:
case UDIV:
case MOD:
case UMOD:
if (sparc_cpu == PROCESSOR_ULTRASPARC)
return (GET_MODE (x) == DImode ?
COSTS_N_INSNS (68) : COSTS_N_INSNS (37));
if (sparc_cpu == PROCESSOR_ULTRASPARC3)
return (GET_MODE (x) == DImode ?
COSTS_N_INSNS (71) : COSTS_N_INSNS (40));
return COSTS_N_INSNS (25);
/* Make FLOAT and FIX more expensive than CONST_DOUBLE,
so that cse will favor the latter. */
case FLOAT:
case FIX:
return 19;
case CONST_INT:
if (INTVAL (x) < 0x1000 && INTVAL (x) >= -0x1000)
return 0;
/* fallthru */
case HIGH:
return 2;
case CONST:
case LABEL_REF:
case SYMBOL_REF:
return 4;
case CONST_DOUBLE:
if (GET_MODE (x) == DImode)
if ((XINT (x, 3) == 0
&& (unsigned) XINT (x, 2) < 0x1000)
|| (XINT (x, 3) == -1
&& XINT (x, 2) < 0
&& XINT (x, 2) >= -0x1000))
return 0;
return 8;
default:
abort();
};
}
...@@ -2645,33 +2645,6 @@ do { \ ...@@ -2645,33 +2645,6 @@ do { \
of the libgcc2 functions is used. */ of the libgcc2 functions is used. */
#define FLOAT_LIB_COMPARE_RETURNS_BOOL(MODE, COMPARISON) ((MODE) == TFmode) #define FLOAT_LIB_COMPARE_RETURNS_BOOL(MODE, COMPARISON) ((MODE) == TFmode)
/* Compute the cost of computing a constant rtl expression RTX
whose rtx-code is CODE. The body of this macro is a portion
of a switch statement. If the code is computed here,
return it with a return statement. Otherwise, break from the switch. */
#define CONST_COSTS(RTX,CODE,OUTER_CODE) \
case CONST_INT: \
if (INTVAL (RTX) < 0x1000 && INTVAL (RTX) >= -0x1000) \
return 0; \
case HIGH: \
return 2; \
case CONST: \
case LABEL_REF: \
case SYMBOL_REF: \
return 4; \
case CONST_DOUBLE: \
if (GET_MODE (RTX) == DImode) \
if ((XINT (RTX, 3) == 0 \
&& (unsigned) XINT (RTX, 2) < 0x1000) \
|| (XINT (RTX, 3) == -1 \
&& XINT (RTX, 2) < 0 \
&& XINT (RTX, 2) >= -0x1000)) \
return 0; \
return 8;
#define ADDRESS_COST(RTX) 1
/* Compute extra cost of moving data between one register class /* Compute extra cost of moving data between one register class
and another. */ and another. */
#define GENERAL_OR_I64(C) ((C) == GENERAL_REGS || (C) == I64_REGS) #define GENERAL_OR_I64(C) ((C) == GENERAL_REGS || (C) == I64_REGS)
...@@ -2699,37 +2672,22 @@ do { \ ...@@ -2699,37 +2672,22 @@ do { \
: (sparc_cpu == PROCESSOR_ULTRASPARC3 \ : (sparc_cpu == PROCESSOR_ULTRASPARC3 \
? 9 : 3)) ? 9 : 3))
/* Provide the costs of a rtl expression. This is in the body of a /* The cases that RTX_COSTS handles. */
switch on CODE. The purpose for the cost of MULT is to encourage
`synth_mult' to find a synthetic multiply when reasonable.
If we need more than 12 insns to do a multiply, then go out-of-line, #define RTX_COSTS_CASES \
since the call overhead will be < 10% of the cost of the multiply. */ case MULT: case DIV: case UDIV: case MOD: case UMOD: \
case FLOAT: case FIX: \
case CONST_INT: case HIGH: case CONST: \
case LABEL_REF: case SYMBOL_REF: case CONST_DOUBLE:
/* Provide the costs of a rtl expression. This is in the body of a
switch on CODE. */
#define RTX_COSTS(X,CODE,OUTER_CODE) \ #define RTX_COSTS(X,CODE,OUTER_CODE) \
case MULT: \ RTX_COSTS_CASES \
if (sparc_cpu == PROCESSOR_ULTRASPARC) \ return sparc_rtx_costs(X,CODE,OUTER_CODE);
return (GET_MODE (X) == DImode ? \
COSTS_N_INSNS (34) : COSTS_N_INSNS (19)); \ #define ADDRESS_COST(RTX) 1
if (sparc_cpu == PROCESSOR_ULTRASPARC3) \
return COSTS_N_INSNS (6); \
return TARGET_HARD_MUL ? COSTS_N_INSNS (5) : COSTS_N_INSNS (25); \
case DIV: \
case UDIV: \
case MOD: \
case UMOD: \
if (sparc_cpu == PROCESSOR_ULTRASPARC) \
return (GET_MODE (X) == DImode ? \
COSTS_N_INSNS (68) : COSTS_N_INSNS (37)); \
if (sparc_cpu == PROCESSOR_ULTRASPARC3) \
return (GET_MODE (X) == DImode ? \
COSTS_N_INSNS (71) : COSTS_N_INSNS (40)); \
return COSTS_N_INSNS (25); \
/* Make FLOAT and FIX more expensive than CONST_DOUBLE,\
so that cse will favor the latter. */ \
case FLOAT: \
case FIX: \
return 19;
#define PREFETCH_BLOCK \ #define PREFETCH_BLOCK \
((sparc_cpu == PROCESSOR_ULTRASPARC \ ((sparc_cpu == PROCESSOR_ULTRASPARC \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment