diff options
author | davem <davem@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-05-04 05:36:40 +0000 |
---|---|---|
committer | davem <davem@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-05-04 05:36:40 +0000 |
commit | 7c27ad86195d8cb9bde4885c0c7bc3e44a88170c (patch) | |
tree | 992960f5f3bec737872394785ac833cb45924f67 /gcc/config/sparc | |
parent | aa5841a80f6d177672330041a580ad98f604f251 (diff) | |
download | gcc-7c27ad86195d8cb9bde4885c0c7bc3e44a88170c.tar.gz |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@53147 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/config/sparc')
-rw-r--r-- | gcc/config/sparc/sparc-protos.h | 1 | ||||
-rw-r--r-- | gcc/config/sparc/sparc.c | 65 | ||||
-rw-r--r-- | gcc/config/sparc/sparc.h | 68 |
3 files changed, 79 insertions, 55 deletions
diff --git a/gcc/config/sparc/sparc-protos.h b/gcc/config/sparc/sparc-protos.h index fd372ded33c..427aaba1864 100644 --- a/gcc/config/sparc/sparc-protos.h +++ b/gcc/config/sparc/sparc-protos.h @@ -121,6 +121,7 @@ extern char *sparc_v8plus_shift PARAMS ((rtx *, rtx, const char *)); extern int sparc_check_64 PARAMS ((rtx, rtx)); extern rtx gen_df_reg PARAMS ((rtx, 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 /* __SPARC_PROTOS_H__ */ diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c index 11e7ceca30f..0405726969f 100644 --- a/gcc/config/sparc/sparc.c +++ b/gcc/config/sparc/sparc.c @@ -8085,3 +8085,68 @@ sparc_extra_constraint_check (op, c, strict) 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(); + }; +} diff --git a/gcc/config/sparc/sparc.h b/gcc/config/sparc/sparc.h index f807be89e54..fd6312a6b45 100644 --- a/gcc/config/sparc/sparc.h +++ b/gcc/config/sparc/sparc.h @@ -2645,33 +2645,6 @@ do { \ of the libgcc2 functions is used. */ #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 and another. */ #define GENERAL_OR_I64(C) ((C) == GENERAL_REGS || (C) == I64_REGS) @@ -2699,37 +2672,22 @@ do { \ : (sparc_cpu == PROCESSOR_ULTRASPARC3 \ ? 9 : 3)) -/* Provide the costs of a rtl expression. This is in the body of a - switch on CODE. The purpose for the cost of MULT is to encourage - `synth_mult' to find a synthetic multiply when reasonable. +/* The cases that RTX_COSTS handles. */ - If we need more than 12 insns to do a multiply, then go out-of-line, - since the call overhead will be < 10% of the cost of the multiply. */ +#define RTX_COSTS_CASES \ +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) \ - 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; + RTX_COSTS_CASES \ + return sparc_rtx_costs(X,CODE,OUTER_CODE); + +#define ADDRESS_COST(RTX) 1 #define PREFETCH_BLOCK \ ((sparc_cpu == PROCESSOR_ULTRASPARC \ |