[arm] Fix arm_tune

Paul Brook paul@codesourcery.com
Tue Apr 20 21:23:00 GMT 2004


We currently set arm_tune incorrectly when the user specifies -march=. We were 
using indices of all_architectures as an index into all_codes.

Patch below makes use the member added for this purpose.

Tested with cross-compiler to arm-none-elf.
Ok?

Paul

2004-04-20  Paul Brook  <paul@codesourcery.com>

	* config/arm/arm.c (all_cores): Set core.
	(arm_override_options): Set arm_tune to sel->core.

Index: arm.c
===================================================================
RCS file: /var/cvsroot/gcc-cvs/gcc/gcc/config/arm/arm.c,v
retrieving revision 1.348
diff -u -p -r1.348 arm.c
--- a/arm.c	20 Apr 2004 14:18:39 -0000	1.348
+++ b/arm.c	20 Apr 2004 20:57:24 -0000
@@ -428,7 +428,7 @@ static const struct processors all_cores
 {
   /* ARM Cores */
 #define ARM_CORE(NAME, FLAGS, COSTS) \
-  {#NAME, arm_none, FLAGS, arm_##COSTS##_rtx_costs},
+  {#NAME, NAME, FLAGS, arm_##COSTS##_rtx_costs},
 #include "arm-cores.def"
 #undef ARM_CORE
   {NULL, arm_none, 0, NULL}
@@ -564,9 +564,9 @@ arm_override_options (void)
   for (i = ARRAY_SIZE (arm_select); i--;)
     {
       struct arm_cpu_select * ptr = arm_select + i;
-      
+
       if (ptr->string != NULL && ptr->string[0] != '\0')
-        {
+	{
 	  const struct processors * sel;
 
           for (sel = ptr->processors; sel->name != NULL; sel++)
@@ -574,15 +574,7 @@ arm_override_options (void)
               {
 		/* 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
-		    /* -mtune= overrides -mcpu= and -march=.  */
-		    || i == 2)
-		  arm_tune = (enum processor_type) (sel - ptr->processors);
+		arm_tune = sel->core;
 
 		if (i != 2)
 		  {
@@ -729,7 +721,7 @@ arm_override_options (void)
 	  insn_flags = sel->flags;
 	}
       if (arm_tune == arm_none)
-	arm_tune = (enum processor_type) (sel - all_cores);
+	arm_tune = sel->core;
     }
   
   /* The processor for which we should tune should now have been



More information about the Gcc-patches mailing list