aboutsummaryrefslogtreecommitdiff
path: root/gcc/config/sparc/sparc.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@redhat.com>2002-05-03 22:36:40 -0700
committerDavid S. Miller <davem@gcc.gnu.org>2002-05-03 22:36:40 -0700
commit2ce04b6bafc8775b51d8bc77b259f9c987b53a72 (patch)
tree992960f5f3bec737872394785ac833cb45924f67 /gcc/config/sparc/sparc.c
parenta1d9bd0c06f3b079ce0061f383403877a84126ed (diff)
downloadgcc-2ce04b6bafc8775b51d8bc77b259f9c987b53a72.zip
gcc-2ce04b6bafc8775b51d8bc77b259f9c987b53a72.tar.gz
gcc-2ce04b6bafc8775b51d8bc77b259f9c987b53a72.tar.bz2
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
Diffstat (limited to 'gcc/config/sparc/sparc.c')
-rw-r--r--gcc/config/sparc/sparc.c65
1 files changed, 65 insertions, 0 deletions
diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c
index 11e7cec..0405726 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();
+ };
+}