From a3b815cb1bb29252693a3ac4cee54b8d82f7df10 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Fri, 15 Sep 2000 20:10:11 +0200 Subject: [PATCH] alpha.h (TARGET_CPU_EV5, [...]): Define. * config/alpha/alpha.h (TARGET_CPU_EV5, TARGET_CPU_EV6): Define. (TARGET_OPTIONS): Add tune=. (alpha_tune_string): Declare. * config/alpha/alpha.c (override_options): Add cpu_table. Use alpha_cpu_string first to set both alpha_cpu and target_flags and then alpha_tune_string to set alpha_cpu only. Replace tests for PROCESSOR_EV* with TARGET_CPU_EV* tests. * config/alpha/elf.h (ASM_FILE_START): Likewise. * config/alpha/osf.h (ASM_FILE_START): Likewise. * config/alpha/openbsd.h (ASM_FILE_START): Likewise. From-SVN: r36443 --- gcc/ChangeLog | 13 ++++++ gcc/config/alpha/alpha.c | 94 ++++++++++++++++++++------------------ gcc/config/alpha/alpha.h | 11 +++-- gcc/config/alpha/elf.h | 2 +- gcc/config/alpha/openbsd.h | 4 +- gcc/config/alpha/osf.h | 4 +- 6 files changed, 76 insertions(+), 52 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f57d5df63fb..c823362ca72 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,16 @@ +2000-09-15 Jakub Jelinek + + * config/alpha/alpha.h (TARGET_CPU_EV5, TARGET_CPU_EV6): Define. + (TARGET_OPTIONS): Add tune=. + (alpha_tune_string): Declare. + * config/alpha/alpha.c (override_options): Add cpu_table. + Use alpha_cpu_string first to set both alpha_cpu and target_flags + and then alpha_tune_string to set alpha_cpu only. + Replace tests for PROCESSOR_EV* with TARGET_CPU_EV* tests. + * config/alpha/elf.h (ASM_FILE_START): Likewise. + * config/alpha/osf.h (ASM_FILE_START): Likewise. + * config/alpha/openbsd.h (ASM_FILE_START): Likewise. + Fri Sep 15 19:45:55 MET DST 2000 Jan Hubicka * i386-protos.h (no_comparison_operator, uno_comparison_operator): diff --git a/gcc/config/alpha/alpha.c b/gcc/config/alpha/alpha.c index f14c3cf1430..04d8cc99c44 100644 --- a/gcc/config/alpha/alpha.c +++ b/gcc/config/alpha/alpha.c @@ -70,6 +70,7 @@ enum alpha_fp_trap_mode alpha_fptm; /* Strings decoded into the above options. */ const char *alpha_cpu_string; /* -mcpu= */ +const char *alpha_tune_string; /* -mtune= */ const char *alpha_tp_string; /* -mtrap-precision=[p|s|i] */ const char *alpha_fprm_string; /* -mfp-rounding-mode=[n|m|c|d] */ const char *alpha_fptm_string; /* -mfp-trap-mode=[n|u|su|sui] */ @@ -146,6 +147,31 @@ static rtx alpha_emit_xfloating_compare void override_options () { + int i; + static struct cpu_table { + const char *name; + enum processor_type processor; + int flags; + } cpu_table[] = { +#define EV5_MASK (MASK_CPU_EV5) +#define EV6_MASK (MASK_CPU_EV6|MASK_BWX|MASK_MAX|MASK_FIX) + { "ev4", PROCESSOR_EV4, 0 }, + { "ev45", PROCESSOR_EV4, 0 }, + { "21064", PROCESSOR_EV4, 0 }, + { "ev5", PROCESSOR_EV5, EV5_MASK }, + { "21164", PROCESSOR_EV5, EV5_MASK }, + { "ev56", PROCESSOR_EV5, EV5_MASK|MASK_BWX }, + { "21164a", PROCESSOR_EV5, EV5_MASK|MASK_BWX }, + { "pca56", PROCESSOR_EV5, EV5_MASK|MASK_BWX|MASK_MAX }, + { "21164PC",PROCESSOR_EV5, EV5_MASK|MASK_BWX|MASK_MAX }, + { "21164pc",PROCESSOR_EV5, EV5_MASK|MASK_BWX|MASK_MAX }, + { "ev6", PROCESSOR_EV6, EV6_MASK }, + { "21264", PROCESSOR_EV6, EV6_MASK }, + { "ev67", PROCESSOR_EV6, EV6_MASK|MASK_CIX }, + { "21264a", PROCESSOR_EV6, EV6_MASK|MASK_CIX }, + { 0, 0, 0 } + }; + alpha_tp = ALPHA_TP_PROG; alpha_fprm = ALPHA_FPRM_NORM; alpha_fptm = ALPHA_FPTM_N; @@ -209,61 +235,41 @@ override_options () if (alpha_cpu_string) { - if (! strcmp (alpha_cpu_string, "ev4") - || ! strcmp (alpha_cpu_string, "ev45") - || ! strcmp (alpha_cpu_string, "21064")) - { - alpha_cpu = PROCESSOR_EV4; - target_flags &= ~ (MASK_BWX | MASK_MAX | MASK_FIX | MASK_CIX); - } - else if (! strcmp (alpha_cpu_string, "ev5") - || ! strcmp (alpha_cpu_string, "21164")) - { - alpha_cpu = PROCESSOR_EV5; - target_flags &= ~ (MASK_BWX | MASK_MAX | MASK_FIX | MASK_CIX); - } - else if (! strcmp (alpha_cpu_string, "ev56") - || ! strcmp (alpha_cpu_string, "21164a")) - { - alpha_cpu = PROCESSOR_EV5; - target_flags |= MASK_BWX; - target_flags &= ~ (MASK_MAX | MASK_FIX | MASK_CIX); - } - else if (! strcmp (alpha_cpu_string, "pca56") - || ! strcmp (alpha_cpu_string, "21164PC") - || ! strcmp (alpha_cpu_string, "21164pc")) - { - alpha_cpu = PROCESSOR_EV5; - target_flags |= MASK_BWX | MASK_MAX; - target_flags &= ~ (MASK_FIX | MASK_CIX); - } - else if (! strcmp (alpha_cpu_string, "ev6") - || ! strcmp (alpha_cpu_string, "21264")) - { - alpha_cpu = PROCESSOR_EV6; - target_flags |= MASK_BWX | MASK_MAX | MASK_FIX; - target_flags &= ~ (MASK_CIX); - } - else if (! strcmp (alpha_cpu_string, "ev67") - || ! strcmp (alpha_cpu_string, "21264a")) - { - alpha_cpu = PROCESSOR_EV6; - target_flags |= MASK_BWX | MASK_MAX | MASK_FIX | MASK_CIX; - } - else + for (i = 0; cpu_table [i].name; i++) + if (! strcmp (alpha_cpu_string, cpu_table [i].name)) + { + alpha_cpu = cpu_table [i].processor; + target_flags &= ~ (MASK_BWX | MASK_MAX | MASK_FIX | MASK_CIX + | MASK_CPU_EV5 | MASK_CPU_EV6); + target_flags |= cpu_table [i].flags; + break; + } + if (! cpu_table [i].name) error ("bad value `%s' for -mcpu switch", alpha_cpu_string); } + if (alpha_tune_string) + { + for (i = 0; cpu_table [i].name; i++) + if (! strcmp (alpha_tune_string, cpu_table [i].name)) + { + alpha_cpu = cpu_table [i].processor; + break; + } + if (! cpu_table [i].name) + error ("bad value `%s' for -mcpu switch", alpha_tune_string); + } + /* Do some sanity checks on the above options. */ if ((alpha_fptm == ALPHA_FPTM_SU || alpha_fptm == ALPHA_FPTM_SUI) - && alpha_tp != ALPHA_TP_INSN && alpha_cpu != PROCESSOR_EV6) + && alpha_tp != ALPHA_TP_INSN && ! TARGET_CPU_EV6) { warning ("fp software completion requires -mtrap-precision=i"); alpha_tp = ALPHA_TP_INSN; } - if (alpha_cpu == PROCESSOR_EV6) + if (TARGET_CPU_EV6) { /* Except for EV6 pass 1 (not released), we always have precise arithmetic traps. Which means we can do software completion diff --git a/gcc/config/alpha/alpha.h b/gcc/config/alpha/alpha.h index 878a9c3a6b2..db8d4076ce9 100644 --- a/gcc/config/alpha/alpha.h +++ b/gcc/config/alpha/alpha.h @@ -156,12 +156,14 @@ extern enum alpha_fp_trap_mode alpha_fptm; #define MASK_CIX (1 << 11) #define TARGET_CIX (target_flags & MASK_CIX) -/* This means that the processor is an EV5, EV56, or PCA56. This is defined - only in TARGET_CPU_DEFAULT. */ +/* This means that the processor is an EV5, EV56, or PCA56. + Unlike alpha_cpu this is not affected by -mtune= setting. */ #define MASK_CPU_EV5 (1 << 28) +#define TARGET_CPU_EV5 (target_flags & MASK_CPU_EV5) /* Likewise for EV6. */ #define MASK_CPU_EV6 (1 << 29) +#define TARGET_CPU_EV6 (target_flags & MASK_CPU_EV6) /* This means we support the .arch directive in the assembler. Only defined in TARGET_CPU_DEFAULT. */ @@ -249,6 +251,7 @@ extern enum alpha_fp_trap_mode alpha_fptm; #define TARGET_OPTIONS { { "short-data-", &m88k_short_data } } */ extern const char *alpha_cpu_string; /* For -mcpu= */ +extern const char *alpha_tune_string; /* For -mtune= */ extern const char *alpha_fprm_string; /* For -mfp-rounding-mode=[n|m|c|d] */ extern const char *alpha_fptm_string; /* For -mfp-trap-mode=[n|u|su|sui] */ extern const char *alpha_tp_string; /* For -mtrap-precision=[p|f|i] */ @@ -257,7 +260,9 @@ extern const char *alpha_mlat_string; /* For -mmemory-latency= */ #define TARGET_OPTIONS \ { \ {"cpu=", &alpha_cpu_string, \ - N_("Generate code for a given CPU")}, \ + N_("Use features of and schedule given CPU")}, \ + {"tune=", &alpha_tune_string, \ + N_("Schedule given CPU")}, \ {"fp-rounding-mode=", &alpha_fprm_string, \ N_("Control the generated fp rounding mode")}, \ {"fp-trap-mode=", &alpha_fptm_string, \ diff --git a/gcc/config/alpha/elf.h b/gcc/config/alpha/elf.h index 7fad44621dd..e4b633adad7 100644 --- a/gcc/config/alpha/elf.h +++ b/gcc/config/alpha/elf.h @@ -61,7 +61,7 @@ do { \ if (TARGET_BWX | TARGET_MAX | TARGET_FIX | TARGET_CIX) \ { \ fprintf (FILE, "\t.arch %s\n", \ - (alpha_cpu == PROCESSOR_EV6 ? "ev6" \ + (TARGET_CPU_EV6 ? "ev6" \ : TARGET_MAX ? "pca56" : "ev56")); \ } \ } while (0) diff --git a/gcc/config/alpha/openbsd.h b/gcc/config/alpha/openbsd.h index 60591d554f5..72764ff343c 100644 --- a/gcc/config/alpha/openbsd.h +++ b/gcc/config/alpha/openbsd.h @@ -100,8 +100,8 @@ Boston, MA 02111-1307, USA. */ fprintf (FILE, "\t.set noat\n"); \ if (TARGET_SUPPORT_ARCH) \ fprintf (FILE, "\t.arch %s\n", \ - alpha_cpu == PROCESSOR_EV6 ? "ev6" \ - : (alpha_cpu == PROCESSOR_EV5 \ + TARGET_CPU_EV6 ? "ev6" \ + : (TARGET_CPU_EV5 \ ? (TARGET_MAX ? "pca56" : TARGET_BWX ? "ev56" : "ev5") \ : "ev4")); \ \ diff --git a/gcc/config/alpha/osf.h b/gcc/config/alpha/osf.h index c6760bc27a1..100b15314de 100644 --- a/gcc/config/alpha/osf.h +++ b/gcc/config/alpha/osf.h @@ -70,8 +70,8 @@ Boston, MA 02111-1307, USA. */ fprintf (FILE, "\t.set noat\n"); \ if (TARGET_SUPPORT_ARCH) \ fprintf (FILE, "\t.arch %s\n", \ - alpha_cpu == PROCESSOR_EV6 ? "ev6" \ - : (alpha_cpu == PROCESSOR_EV5 \ + TARGET_CPU_EV6 ? "ev6" \ + : (TARGET_CPU_EV5 \ ? (TARGET_MAX ? "pca56" : TARGET_BWX ? "ev56" : "ev5") \ : "ev4")); \ \ -- 2.30.2