From c37752cc1a0a371a5d1cd4bb0fe4fd8ae69bec43 Mon Sep 17 00:00:00 2001 From: rearnsha Date: Mon, 9 May 2005 14:15:47 +0000 Subject: [PATCH] PR target/21397 * arm.c (ARM_OPT_SET_CPU, ARM_OPT_SET_ARCH, ARM_OPT_SET_TUNE): Define. (arm_override_options): Use them instead of manifest constants. Don't allow -march to override the -mtune setting. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@99441 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 7 +++++++ gcc/config/arm/arm.c | 28 ++++++++++++++++++++-------- 2 files changed, 27 insertions(+), 8 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 0a923745fbf..33aae284a0e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2005-05-09 Richard Earnshaw + + PR target/21397 + * arm.c (ARM_OPT_SET_CPU, ARM_OPT_SET_ARCH, ARM_OPT_SET_TUNE): Define. + (arm_override_options): Use them instead of manifest constants. Don't + allow -march to override the -mtune setting. + 2005-05-09 Nathan Sidwell * config/iq2000/iq2000.c (abort_with_insn): Use fancy_abort. diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index 4a71420144a..1743980b1cf 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -596,6 +596,10 @@ static struct arm_cpu_select arm_select[] = { NULL, "-mtune=", all_cores } }; +/* Defines representing the indexes into the above table. */ +#define ARM_OPT_SET_CPU 0 +#define ARM_OPT_SET_ARCH 1 +#define ARM_OPT_SET_TUNE 2 /* The name of the proprocessor macro to define for this architecture. */ @@ -852,6 +856,7 @@ void arm_override_options (void) { unsigned i; + enum processor_type target_arch_cpu = arm_none; /* Set up the flags based on the cpu/architecture selected by the user. */ for (i = ARRAY_SIZE (arm_select); i--;) @@ -866,22 +871,25 @@ arm_override_options (void) if (streq (ptr->string, sel->name)) { /* Set the architecture define. */ - if (i != 2) + if (i != ARM_OPT_SET_TUNE) sprintf (arm_arch_name, "__ARM_ARCH_%s__", sel->arch); /* Determine the processor core for which we should tune code-generation. */ if (/* -mcpu= is a sensible default. */ - i == 0 - /* If -march= is used, and -mcpu= has not been used, - assume that we should tune for a representative - CPU from that architecture. */ - || i == 1 + i == ARM_OPT_SET_CPU /* -mtune= overrides -mcpu= and -march=. */ - || i == 2) + || i == ARM_OPT_SET_TUNE) arm_tune = (enum processor_type) (sel - ptr->processors); - if (i != 2) + /* Remember the CPU associated with this architecture. + If no other option is used to set the CPU type, + we'll use this to guess the most suitable tuning + options. */ + if (i == ARM_OPT_SET_ARCH) + target_arch_cpu = sel->core; + + if (i != ARM_OPT_SET_TUNE) { /* If we have been given an architecture and a processor make sure that they are compatible. We only generate @@ -902,6 +910,10 @@ arm_override_options (void) } } + /* Guess the tuning options from the architecture if necessary. */ + if (arm_tune == arm_none) + arm_tune = target_arch_cpu; + /* If the user did not specify a processor, choose one for them. */ if (insn_flags == 0) { -- 2.11.4.GIT