summaryrefslogtreecommitdiff
path: root/gcc/config/sparc/sparc.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@sunset.davemloft.net>2006-03-02 22:47:02 +0000
committerDavid S. Miller <davem@gcc.gnu.org>2006-03-02 14:47:02 -0800
commit4c837a1e98526a4835700c70dcee15c62e6afbd2 (patch)
tree2f68ab667ce3481cc45315d855ec15047d6b4d5d /gcc/config/sparc/sparc.c
parent2434ab1da2a1f6230207f5e57ef2f3beb3baa6cd (diff)
downloadgcc-4c837a1e98526a4835700c70dcee15c62e6afbd2.tar.gz
Sun Niagara specific optimizations.
* config.gcc: Recognize niagara as target. * config/sparc/sparc.h (SPARC_RELAXED_ORDERING): Mention Niagara. (TARGET_CPU_niagara): Define. (CPP_CPU64_DEFAULT_SPEC): Define __sparc_v9__ for Niagara. (ASM_CPU64_DEFAULT_SPEC): Pass -Av9b for Niagara. (CPP_CPU_SPEC): Handle -mcpu=niagara. (ASM_CPU_SPEC): Likewise. (PROCESSOR_NIAGARA): New enum entry. (REGISTER_MOVE_COST): Handle Niagara. (BRANCH_COST, PREFETCH_BLOCK, SIMULTANEOUS_PREFETCHES): Likewise. * config/sparc/sparc.c (niagara_costs): New processor_costs entry. (sparc_override_options): Recognize "niagara", set appropriate default MASK_* values for it, and align functions to 32-bytes by default just like ULTRASPARC/ULTRASPARC3. (sparc_initialize_trampoline): Handle niagara like ultrasparc. (sparc64_initialize_trampoline): Likewise. (sparc_use_sched_lookahead): Use zero for niagara. (sparc_issue_rate): Use one for niagara. * config/sparc/niagara.md: New file. * config/sparc/sparc.md: Include it. * config/sparc/sol2-bi.h (CPP_CPU64_DEFAULT_SPEC, ASM_CPU32_DEFAULT_SPEC, ASM_CPU64_DEFAULT_SPEC): Set appropriately when default cpu is niagara. (CPP_CPU_SPEC): Handle -mcpu=niagara. (ASM_CPU_SPEC): Likewise. * config/sparc/sol2.h (ASM_CPU_DEFAULT_SPEC): Set appropriately when default cpu is niagara. (ASM_CPU_SPEC): Handle -mcpu=niagara. * config/sparc/linux64.h: Handle a default of TARGET_CPU_niagara just like v9/ultrasparc/ultrasparc3. * doc/invoke.texi: Add documentation for "niagara" and improve existing documentation for ultrasparc variants. From-SVN: r111648
Diffstat (limited to 'gcc/config/sparc/sparc.c')
-rw-r--r--gcc/config/sparc/sparc.c42
1 files changed, 39 insertions, 3 deletions
diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c
index f44c6d0ad19..709a92b518e 100644
--- a/gcc/config/sparc/sparc.c
+++ b/gcc/config/sparc/sparc.c
@@ -197,6 +197,30 @@ struct processor_costs ultrasparc3_costs = {
0, /* shift penalty */
};
+static const
+struct processor_costs niagara_costs = {
+ COSTS_N_INSNS (3), /* int load */
+ COSTS_N_INSNS (3), /* int signed load */
+ COSTS_N_INSNS (3), /* int zeroed load */
+ COSTS_N_INSNS (9), /* float load */
+ COSTS_N_INSNS (8), /* fmov, fneg, fabs */
+ COSTS_N_INSNS (8), /* fadd, fsub */
+ COSTS_N_INSNS (26), /* fcmp */
+ COSTS_N_INSNS (8), /* fmov, fmovr */
+ COSTS_N_INSNS (29), /* fmul */
+ COSTS_N_INSNS (54), /* fdivs */
+ COSTS_N_INSNS (83), /* fdivd */
+ COSTS_N_INSNS (100), /* fsqrts - not implemented in hardware */
+ COSTS_N_INSNS (100), /* fsqrtd - not implemented in hardware */
+ COSTS_N_INSNS (11), /* imul */
+ COSTS_N_INSNS (11), /* imulX */
+ 0, /* imul bit factor */
+ COSTS_N_INSNS (72), /* idiv */
+ COSTS_N_INSNS (72), /* idivX */
+ COSTS_N_INSNS (1), /* movcc/movr */
+ 0, /* shift penalty */
+};
+
const struct processor_costs *sparc_costs = &cypress_costs;
#ifdef HAVE_AS_RELAX_OPTION
@@ -597,6 +621,7 @@ sparc_override_options (void)
{ TARGET_CPU_v9, "v9" },
{ TARGET_CPU_ultrasparc, "ultrasparc" },
{ TARGET_CPU_ultrasparc3, "ultrasparc3" },
+ { TARGET_CPU_niagara, "niagara" },
{ 0, 0 }
};
const struct cpu_default *def;
@@ -632,6 +657,8 @@ sparc_override_options (void)
/* TI ultrasparc III */
/* ??? Check if %y issue still holds true in ultra3. */
{ "ultrasparc3", PROCESSOR_ULTRASPARC3, MASK_ISA, MASK_V9|MASK_DEPRECATED_V8_INSNS},
+ /* UltraSPARC T1 */
+ { "niagara", PROCESSOR_NIAGARA, MASK_ISA, MASK_V9|MASK_DEPRECATED_V8_INSNS},
{ 0, 0, 0, 0 }
};
const struct cpu_table *cpu;
@@ -741,7 +768,8 @@ sparc_override_options (void)
/* Supply a default value for align_functions. */
if (align_functions == 0
&& (sparc_cpu == PROCESSOR_ULTRASPARC
- || sparc_cpu == PROCESSOR_ULTRASPARC3))
+ || sparc_cpu == PROCESSOR_ULTRASPARC3
+ || sparc_cpu == PROCESSOR_NIAGARA))
align_functions = 32;
/* Validate PCC_STRUCT_RETURN. */
@@ -790,6 +818,9 @@ sparc_override_options (void)
case PROCESSOR_ULTRASPARC3:
sparc_costs = &ultrasparc3_costs;
break;
+ case PROCESSOR_NIAGARA:
+ sparc_costs = &niagara_costs;
+ break;
};
#ifdef TARGET_DEFAULT_LONG_DOUBLE_128
@@ -7099,7 +7130,8 @@ sparc_initialize_trampoline (rtx tramp, rtx fnaddr, rtx cxt)
aligned on a 16 byte boundary so one flush clears it all. */
emit_insn (gen_flush (validize_mem (gen_rtx_MEM (SImode, tramp))));
if (sparc_cpu != PROCESSOR_ULTRASPARC
- && sparc_cpu != PROCESSOR_ULTRASPARC3)
+ && sparc_cpu != PROCESSOR_ULTRASPARC3
+ && sparc_cpu != PROCESSOR_NIAGARA)
emit_insn (gen_flush (validize_mem (gen_rtx_MEM (SImode,
plus_constant (tramp, 8)))));
@@ -7141,7 +7173,8 @@ sparc64_initialize_trampoline (rtx tramp, rtx fnaddr, rtx cxt)
emit_insn (gen_flushdi (validize_mem (gen_rtx_MEM (DImode, tramp))));
if (sparc_cpu != PROCESSOR_ULTRASPARC
- && sparc_cpu != PROCESSOR_ULTRASPARC3)
+ && sparc_cpu != PROCESSOR_ULTRASPARC3
+ && sparc_cpu != PROCESSOR_NIAGARA)
emit_insn (gen_flushdi (validize_mem (gen_rtx_MEM (DImode, plus_constant (tramp, 8)))));
/* Call __enable_execute_stack after writing onto the stack to make sure
@@ -7321,6 +7354,8 @@ sparc_sched_init (FILE *dump ATTRIBUTE_UNUSED,
static int
sparc_use_sched_lookahead (void)
{
+ if (sparc_cpu == PROCESSOR_NIAGARA)
+ return 0;
if (sparc_cpu == PROCESSOR_ULTRASPARC
|| sparc_cpu == PROCESSOR_ULTRASPARC3)
return 4;
@@ -7336,6 +7371,7 @@ sparc_issue_rate (void)
{
switch (sparc_cpu)
{
+ case PROCESSOR_NIAGARA:
default:
return 1;
case PROCESSOR_V9: