Commit e6fffade by Richard Earnshaw Committed by Richard Earnshaw

re PR target/21397 (arm: -march overrides -mtune)

	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.

From-SVN: r99441
parent f77a5578
2005-05-09 Richard Earnshaw <rearnsha@arm.com>
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 <nathan@codesourcery.com> 2005-05-09 Nathan Sidwell <nathan@codesourcery.com>
* config/iq2000/iq2000.c (abort_with_insn): Use fancy_abort. * config/iq2000/iq2000.c (abort_with_insn): Use fancy_abort.
......
...@@ -596,6 +596,10 @@ static struct arm_cpu_select arm_select[] = ...@@ -596,6 +596,10 @@ static struct arm_cpu_select arm_select[] =
{ NULL, "-mtune=", all_cores } { 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. */ /* The name of the proprocessor macro to define for this architecture. */
...@@ -852,6 +856,7 @@ void ...@@ -852,6 +856,7 @@ void
arm_override_options (void) arm_override_options (void)
{ {
unsigned i; unsigned i;
enum processor_type target_arch_cpu = arm_none;
/* Set up the flags based on the cpu/architecture selected by the user. */ /* Set up the flags based on the cpu/architecture selected by the user. */
for (i = ARRAY_SIZE (arm_select); i--;) for (i = ARRAY_SIZE (arm_select); i--;)
...@@ -866,22 +871,25 @@ arm_override_options (void) ...@@ -866,22 +871,25 @@ arm_override_options (void)
if (streq (ptr->string, sel->name)) if (streq (ptr->string, sel->name))
{ {
/* Set the architecture define. */ /* Set the architecture define. */
if (i != 2) if (i != ARM_OPT_SET_TUNE)
sprintf (arm_arch_name, "__ARM_ARCH_%s__", sel->arch); sprintf (arm_arch_name, "__ARM_ARCH_%s__", sel->arch);
/* Determine the processor core for which we should /* Determine the processor core for which we should
tune code-generation. */ tune code-generation. */
if (/* -mcpu= is a sensible default. */ if (/* -mcpu= is a sensible default. */
i == 0 i == ARM_OPT_SET_CPU
/* If -march= is used, and -mcpu= has not been used,
assume that we should tune for a representative
CPU from that architecture. */
|| i == 1
/* -mtune= overrides -mcpu= and -march=. */ /* -mtune= overrides -mcpu= and -march=. */
|| i == 2) || i == ARM_OPT_SET_TUNE)
arm_tune = (enum processor_type) (sel - ptr->processors); 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 /* If we have been given an architecture and a processor
make sure that they are compatible. We only generate make sure that they are compatible. We only generate
...@@ -902,6 +910,10 @@ arm_override_options (void) ...@@ -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 the user did not specify a processor, choose one for them. */
if (insn_flags == 0) if (insn_flags == 0)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment