public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] MIPS gas: Allow simultan use of -mpu amd -mipsX again
@ 2001-07-21 15:38 Thiemo Seufer
       [not found] ` <mailpost.995755521.17470@postal.sibyte.com>
  2001-07-30  3:57 ` Eric Christopher
  0 siblings, 2 replies; 10+ messages in thread
From: Thiemo Seufer @ 2001-07-21 15:38 UTC (permalink / raw)
  To: binutils

Hi All,

this patch re-allows using the -mcpu backward-compatibility switch
in combination with -mipsX, where it was silently ignored as a
side-effect of the recent introduction of -march and -tune.

It also adds warnings if one of -march/-mtune/-mcpu is specified
more than once, what can happen under the hood even for e.g.
"-m4650 -march=r4000".


Thiemo


2001-07-22  Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>

	/gas/ChangeLog
	* config/tc-mips.c (md_begin): Take -mcpu value into account even when
	-mipsX is specified. Make both -mcpu/-march and -mcpu/-mtune pairs
	mutually exclusive (if they are different).
	(md_parse_option): Warn if an -march/-mtune/-mcpu option is set more
	than once.


diff -BurPX /bigdisk/src/binutils-exclude src-orig/gas/config/tc-mips.c src/gas/config/tc-mips.c
--- src-orig/gas/config/tc-mips.c	Wed Jul  4 14:44:12 2001
+++ src/gas/config/tc-mips.c	Sun Jul 22 00:02:59 2001
@@ -939,6 +967,33 @@
   if (mips_opts.mips16 < 0)
     mips_opts.mips16 = target_cpu_had_mips16;
 
+  /* Backward compatibility for historic -mcpu= option.  Check for
+     incompatible options, warn if -mcpu is used.  */
+  if (mips_cpu != CPU_UNKNOWN
+      && mips_arch != CPU_UNKNOWN
+      && mips_cpu != mips_arch)
+    {
+      as_fatal (_("The -mcpu option can't be used together with -march. "
+		  "Use -mtune instead of -mcpu."));
+    }
+
+  if (mips_cpu != CPU_UNKNOWN
+      && mips_tune != CPU_UNKNOWN
+      && mips_cpu != mips_tune)
+    {
+      as_fatal (_("The -mcpu option can't be used together with -mtune. "
+		  "Use -march instead of -mcpu."));
+    }
+
+  if (mips_arch == CPU_UNKNOWN && mips_cpu != CPU_UNKNOWN)
+    {
+      ci = mips_cpu_info_from_cpu (mips_cpu);
+      assert (ci != NULL);
+      mips_arch = ci->cpu;
+      as_warn (_("The -mcpu option is deprecated.  Please use -march and "
+		 "-mtune instead."));
+    }
+
   /* At this point, mips_arch will either be CPU_UNKNOWN if no ARCH was
      specified on the command line, or some other value if one was.
      Similarly, mips_opts.isa will be ISA_UNKNOWN if not specified on
@@ -961,19 +1016,6 @@
       assert (ci != NULL);
       mips_arch = ci->cpu;
     }
-  else if (mips_arch == CPU_UNKNOWN
-	   && mips_opts.isa == ISA_UNKNOWN
-	   && mips_cpu != CPU_UNKNOWN)
-    {
-      /* Historic -mcpu= option.  Warn.  */
-      ci = mips_cpu_info_from_cpu (mips_cpu);
-      assert (ci != NULL);
-      mips_arch = ci->cpu;
-      mips_tune = ci->cpu;
-      mips_opts.isa = ci->isa;
-      as_warn (_("The -mcpu option is deprecated.  Please use -march and -mtune instead."));
-
-    }
   else
     {
       /* We need to set both ISA and ARCH from target cpu.  */
@@ -9080,12 +9219,21 @@
 	switch (c)
 	  {
 	  case OPTION_MTUNE:
+	    if (mips_tune != CPU_UNKNOWN && mips_tune != cpu)
+	      as_warn(_("A different -mtune= was already specified, is now "
+			"-mtune=%s"), arg);
 	    mips_tune = cpu;
 	    break;
 	  case OPTION_MARCH:
+	    if (mips_arch != CPU_UNKNOWN && mips_arch != cpu)
+	      as_warn(_("A different -march= was already specified, is now "
+			"-march=%s"), arg);
 	    mips_arch = cpu;
 	    break;
 	  case OPTION_MCPU:
+	    if (mips_cpu != CPU_UNKNOWN && mips_cpu != cpu)
+	      as_warn(_("A different -mcpu= was already specified, is now "
+			"-mcpu=%s"), arg);
 	    mips_cpu = cpu;
 	  }
       }

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] MIPS gas: Allow simultan use of -mpu amd -mipsXagain
       [not found] ` <mailpost.995755521.17470@postal.sibyte.com>
@ 2001-07-22 11:18   ` cgd
  2001-07-23  9:14     ` [PATCH] MIPS gas: Allow simultan use of -mpu amd -mipsX again Thiemo Seufer
  0 siblings, 1 reply; 10+ messages in thread
From: cgd @ 2001-07-22 11:18 UTC (permalink / raw)
  To: ica2_ts; +Cc: binutils

ica2_ts@csv.ica.uni-stuttgart.de ("Thiemo Seufer") writes:
> It also adds warnings if one of -march/-mtune/-mcpu is specified
> more than once, what can happen under the hood even for e.g.
> "-m4650 -march=r4000".

Is this really worthy of generating a warning?  In general, isn't the
last option given supposed to 'win'?

I'd think that it might ... cause lots of unnecessary warnings if
e.g. there were a way to set the built-in default configuration (i've
not looked how that's done in the new code), or if somebody did e.g.:

	AS="mips-elf-as -march=r4000"

then later explicitly coded things in their makefiles as:

	$(AS) -march=...




cgd

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] MIPS gas: Allow simultan use of -mpu amd -mipsX again
  2001-07-22 11:18   ` [PATCH] MIPS gas: Allow simultan use of -mpu amd -mipsXagain cgd
@ 2001-07-23  9:14     ` Thiemo Seufer
  2001-07-30  0:40       ` Eric Christopher
  0 siblings, 1 reply; 10+ messages in thread
From: Thiemo Seufer @ 2001-07-23  9:14 UTC (permalink / raw)
  To: binutils

cgd@sibyte.com wrote:
> ica2_ts@csv.ica.uni-stuttgart.de ("Thiemo Seufer") writes:
> > It also adds warnings if one of -march/-mtune/-mcpu is specified
> > more than once, what can happen under the hood even for e.g.
> > "-m4650 -march=r4000".
> 
> Is this really worthy of generating a warning?  In general, isn't the
> last option given supposed to 'win'?

IMHO at least one of both should happen, preferably the latter one.
Unfortuantly, "-m4650 -march=r4000" ends up being the same as
"-march=r4000 -mtune=4650", so the last option hasn't really won.

As far as I understand, the -m<cpu> options are only useful when
they set both -march and -mtune to their value. Since I haven't found
a easy way to fix this, I introduced the warnings.

> I'd think that it might ... cause lots of unnecessary warnings if
> e.g. there were a way to set the built-in default configuration (i've
> not looked how that's done in the new code), or if somebody did e.g.:
> 
> 	AS="mips-elf-as -march=r4000"
> 
> then later explicitly coded things in their makefiles as:
> 
> 	$(AS) -march=...

The one should fix his code. :-)

We have now -march, -mtune, -mcpu, -m<cpu>. It's a mess, and warn
about seemingly unintended use might help to standardize on the
first two.


Thiemo

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] MIPS gas: Allow simultan use of -mpu amd -mipsX again
  2001-07-23  9:14     ` [PATCH] MIPS gas: Allow simultan use of -mpu amd -mipsX again Thiemo Seufer
@ 2001-07-30  0:40       ` Eric Christopher
  2001-07-30  2:12         ` Thiemo Seufer
  0 siblings, 1 reply; 10+ messages in thread
From: Eric Christopher @ 2001-07-30  0:40 UTC (permalink / raw)
  To: Thiemo Seufer; +Cc: binutils

> As far as I understand, the -m<cpu> options are only useful when
> they set both -march and -mtune to their value. Since I haven't found
> a easy way to fix this, I introduced the warnings.
> 

mips_arch = FOO;
mips_tune = FOO;

or am I missing the point of this comment? :)


> 
> We have now -march, -mtune, -mcpu, -m<cpu>. It's a mess, and warn
> about seemingly unintended use might help to standardize on the
> first two.

Right.  I plan on deprecating -mcpu as soon as I get a chance.

-eric

--
Look out behind you!

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] MIPS gas: Allow simultan use of -mpu amd -mipsX again
  2001-07-30  0:40       ` Eric Christopher
@ 2001-07-30  2:12         ` Thiemo Seufer
  2001-07-30  2:17           ` Eric Christopher
  0 siblings, 1 reply; 10+ messages in thread
From: Thiemo Seufer @ 2001-07-30  2:12 UTC (permalink / raw)
  To: binutils

Eric Christopher wrote:
> > As far as I understand, the -m<cpu> options are only useful when
> > they set both -march and -mtune to their value. Since I haven't found
> > a easy way to fix this, I introduced the warnings.
> 
> mips_arch = FOO;
> mips_tune = FOO;
> 
> or am I missing the point of this comment? :)

That is what I tried to say. :-)


Thiemo

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] MIPS gas: Allow simultan use of -mpu amd -mipsX again
  2001-07-30  2:12         ` Thiemo Seufer
@ 2001-07-30  2:17           ` Eric Christopher
  2001-07-30  4:19             ` Thiemo Seufer
  0 siblings, 1 reply; 10+ messages in thread
From: Eric Christopher @ 2001-07-30  2:17 UTC (permalink / raw)
  To: Thiemo Seufer; +Cc: binutils

On 30 Jul 2001 11:12:48 +0200, Thiemo Seufer wrote:
> Eric Christopher wrote:
> > > As far as I understand, the -m<cpu> options are only useful when
> > > they set both -march and -mtune to their value. Since I haven't found
> > > a easy way to fix this, I introduced the warnings.
> > 
> > mips_arch = FOO;
> > mips_tune = FOO;
> > 
> > or am I missing the point of this comment? :)
> 
> That is what I tried to say. :-)
> 

Heh.  But I missed what you were really trying to say :)

Anyhow, I believe that -m<FOO> and the -march/tune options should warn.
IMHO the only reason that we should support the -m<FOO> at all is for
gcc.

-eric  


--
Look out behind you!

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] MIPS gas: Allow simultan use of -mpu amd -mipsX again
  2001-07-21 15:38 [PATCH] MIPS gas: Allow simultan use of -mpu amd -mipsX again Thiemo Seufer
       [not found] ` <mailpost.995755521.17470@postal.sibyte.com>
@ 2001-07-30  3:57 ` Eric Christopher
  1 sibling, 0 replies; 10+ messages in thread
From: Eric Christopher @ 2001-07-30  3:57 UTC (permalink / raw)
  To: Thiemo Seufer; +Cc: binutils

> 
> 2001-07-22  Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
> 
> 	/gas/ChangeLog
> 	* config/tc-mips.c (md_begin): Take -mcpu value into account even when
> 	-mipsX is specified. Make both -mcpu/-march and -mcpu/-mtune pairs
> 	mutually exclusive (if they are different).
> 	(md_parse_option): Warn if an -march/-mtune/-mcpu option is set more
> 	than once.
> 
> 

Thanks!

Ok.

-eric


--
Look out behind you!

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] MIPS gas: Allow simultan use of -mpu amd -mipsX again
  2001-07-30  2:17           ` Eric Christopher
@ 2001-07-30  4:19             ` Thiemo Seufer
  2001-07-30  4:33               ` Eric Christopher
  2001-08-07  5:47               ` Thiemo Seufer
  0 siblings, 2 replies; 10+ messages in thread
From: Thiemo Seufer @ 2001-07-30  4:19 UTC (permalink / raw)
  To: binutils

Eric Christopher wrote:
> On 30 Jul 2001 11:12:48 +0200, Thiemo Seufer wrote:
> > Eric Christopher wrote:
> > > > As far as I understand, the -m<cpu> options are only useful when
> > > > they set both -march and -mtune to their value. Since I haven't found
> > > > a easy way to fix this, I introduced the warnings.
> > > 
> > > mips_arch = FOO;
> > > mips_tune = FOO;
> > > 
> > > or am I missing the point of this comment? :)
> > 
> > That is what I tried to say. :-)
> 
> Heh.  But I missed what you were really trying to say :)

Err, well, next try:

-m<FOO> sets both mips_arch and mips_tune, and is required to do so.
If there are conflicting options given, it's the usual strategy to
let the last option win. So if one of mips_arch and mips_tune is
changed by a later option, the other value should be adjusted
somehow, too, as long as it was set by an -m<FOO> immediately before.

To safeguard against all cases introduced with this logic is IMHO
way too complicated, and a warning about seemlingly unintended
use (indicated by different or conflicting -m<FOO>/-march/-tune/-mcpu)
is a good idea also.

> Anyhow, I believe that -m<FOO> and the -march/tune options should warn.
> IMHO the only reason that we should support the -m<FOO> at all is for
> gcc.

-mcpu should warn also, as in my patch. The warning for -m<FOO>
works there also, as long as it isn't given after an conflicting
option. It's easy to change this, what I did in the patch below.


Thiemo


2001-07-30  Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>

	/gas/ChangeLog
	* config/tc-mips.c (md_begin): Take -mcpu value into account even when
	-mipsX is specified. Make both -mcpu/-march and -mcpu/-mtune pairs
	mutually exclusive (if they are different).
	(md_parse_option): Warn if an -march/-mtune/-mcpu/-m<cpu> option is
	set more than once.


diff -BurPX /bigdisk/src/binutils-exclude src-orig/gas/config/tc-mips.c src/gas/config/tc-mips.c
--- src-orig/gas/config/tc-mips.c	Wed Jul  4 14:44:12 2001
+++ src/gas/config/tc-mips.c	Sun Jul 22 00:02:59 2001
@@ -939,6 +967,33 @@
   if (mips_opts.mips16 < 0)
     mips_opts.mips16 = target_cpu_had_mips16;
 
+  /* Backward compatibility for historic -mcpu= option.  Check for
+     incompatible options, warn if -mcpu is used.  */
+  if (mips_cpu != CPU_UNKNOWN
+      && mips_arch != CPU_UNKNOWN
+      && mips_cpu != mips_arch)
+    {
+      as_fatal (_("The -mcpu option can't be used together with -march. "
+		  "Use -mtune instead of -mcpu."));
+    }
+
+  if (mips_cpu != CPU_UNKNOWN
+      && mips_tune != CPU_UNKNOWN
+      && mips_cpu != mips_tune)
+    {
+      as_fatal (_("The -mcpu option can't be used together with -mtune. "
+		  "Use -march instead of -mcpu."));
+    }
+
+  if (mips_arch == CPU_UNKNOWN && mips_cpu != CPU_UNKNOWN)
+    {
+      ci = mips_cpu_info_from_cpu (mips_cpu);
+      assert (ci != NULL);
+      mips_arch = ci->cpu;
+      as_warn (_("The -mcpu option is deprecated.  Please use -march and "
+		 "-mtune instead."));
+    }
+
   /* At this point, mips_arch will either be CPU_UNKNOWN if no ARCH was
      specified on the command line, or some other value if one was.
      Similarly, mips_opts.isa will be ISA_UNKNOWN if not specified on
@@ -961,19 +1016,6 @@
       assert (ci != NULL);
       mips_arch = ci->cpu;
     }
-  else if (mips_arch == CPU_UNKNOWN
-	   && mips_opts.isa == ISA_UNKNOWN
-	   && mips_cpu != CPU_UNKNOWN)
-    {
-      /* Historic -mcpu= option.  Warn.  */
-      ci = mips_cpu_info_from_cpu (mips_cpu);
-      assert (ci != NULL);
-      mips_arch = ci->cpu;
-      mips_tune = ci->cpu;
-      mips_opts.isa = ci->isa;
-      as_warn (_("The -mcpu option is deprecated.  Please use -march and -mtune instead."));
-
-    }
   else
     {
       /* We need to set both ISA and ARCH from target cpu.  */
@@ -9080,18 +9219,31 @@
 	switch (c)
 	  {
 	  case OPTION_MTUNE:
+	    if (mips_tune != CPU_UNKNOWN && mips_tune != cpu)
+	      as_warn(_("A different -mtune= was already specified, is now "
+			"-mtune=%s"), arg);
 	    mips_tune = cpu;
 	    break;
 	  case OPTION_MARCH:
+	    if (mips_arch != CPU_UNKNOWN && mips_arch != cpu)
+	      as_warn(_("A different -march= was already specified, is now "
+			"-march=%s"), arg);
 	    mips_arch = cpu;
 	    break;
 	  case OPTION_MCPU:
+	    if (mips_cpu != CPU_UNKNOWN && mips_cpu != cpu)
+	      as_warn(_("A different -mcpu= was already specified, is now "
+			"-mcpu=%s"), arg);
 	    mips_cpu = cpu;
 	  }
       }
       break;
 
     case OPTION_M4650:
+      if ((mips_arch != CPU_UNKNOWN && mips_arch != CPU_R4650)
+	  || (mips_tune != CPU_UNKNOWN && mips_tune != CPU_R4650))
+        as_warn(_("A different -march= or -mtune= was already specified, "
+		  "is now -m4650"));
       mips_arch = CPU_R4650;
       mips_tune = CPU_R4650;
       break;
@@ -9100,6 +9252,10 @@
       break;
 
     case OPTION_M4010:
+      if ((mips_arch != CPU_UNKNOWN && mips_arch != CPU_R4010)
+	  || (mips_tune != CPU_UNKNOWN && mips_tune != CPU_R4010))
+        as_warn(_("A different -march= or -mtune= was already specified, "
+		  "is now -m4010"));
       mips_arch = CPU_R4010;
       mips_tune = CPU_R4010;
       break;
@@ -9108,6 +9264,10 @@
       break;
 
     case OPTION_M4100:
+      if ((mips_arch != CPU_UNKNOWN && mips_arch != CPU_VR4100)
+	  || (mips_tune != CPU_UNKNOWN && mips_tune != CPU_VR4100))
+        as_warn(_("A different -march= or -mtune= was already specified, "
+		  "is now -m4100"));
       mips_arch = CPU_VR4100;
       mips_tune = CPU_VR4100;
       break;
@@ -9116,6 +9276,10 @@
       break;
 
     case OPTION_M3900:
+      if ((mips_arch != CPU_UNKNOWN && mips_arch != CPU_R3900)
+	  || (mips_tune != CPU_UNKNOWN && mips_tune != CPU_R3900))
+        as_warn(_("A different -march= or -mtune= was already specified, "
+		  "is now -m3900"));
       mips_arch = CPU_R3900;
       mips_tune = CPU_R3900;
       break;

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] MIPS gas: Allow simultan use of -mpu amd -mipsX again
  2001-07-30  4:19             ` Thiemo Seufer
@ 2001-07-30  4:33               ` Eric Christopher
  2001-08-07  5:47               ` Thiemo Seufer
  1 sibling, 0 replies; 10+ messages in thread
From: Eric Christopher @ 2001-07-30  4:33 UTC (permalink / raw)
  To: Thiemo Seufer; +Cc: binutils

> 
> Err, well, next try:
> 

Oh, I'd figured it out, but thanks for the explaination.  Anyone besides
me think that this would be a good addition to the docs in invoke.texi?


> 2001-07-30  Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
> 
> 	/gas/ChangeLog
> 	* config/tc-mips.c (md_begin): Take -mcpu value into account even when
> 	-mipsX is specified. Make both -mcpu/-march and -mcpu/-mtune pairs
> 	mutually exclusive (if they are different).
> 	(md_parse_option): Warn if an -march/-mtune/-mcpu/-m<cpu> option is
> 	set more than once.
> 

Ok.

-eric


--
Look out behind you!

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] MIPS gas: Allow simultan use of -mpu amd -mipsX again
  2001-07-30  4:19             ` Thiemo Seufer
  2001-07-30  4:33               ` Eric Christopher
@ 2001-08-07  5:47               ` Thiemo Seufer
  1 sibling, 0 replies; 10+ messages in thread
From: Thiemo Seufer @ 2001-08-07  5:47 UTC (permalink / raw)
  To: binutils

Thiemo Seufer wrote:
[snip]
> 2001-07-30  Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
> 
> 	/gas/ChangeLog
> 	* config/tc-mips.c (md_begin): Take -mcpu value into account even when
> 	-mipsX is specified. Make both -mcpu/-march and -mcpu/-mtune pairs
> 	mutually exclusive (if they are different).
> 	(md_parse_option): Warn if an -march/-mtune/-mcpu/-m<cpu> option is
> 	set more than once.

There were no objections, so I checked this in.


Thiemo

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2001-08-07  5:47 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-07-21 15:38 [PATCH] MIPS gas: Allow simultan use of -mpu amd -mipsX again Thiemo Seufer
     [not found] ` <mailpost.995755521.17470@postal.sibyte.com>
2001-07-22 11:18   ` [PATCH] MIPS gas: Allow simultan use of -mpu amd -mipsXagain cgd
2001-07-23  9:14     ` [PATCH] MIPS gas: Allow simultan use of -mpu amd -mipsX again Thiemo Seufer
2001-07-30  0:40       ` Eric Christopher
2001-07-30  2:12         ` Thiemo Seufer
2001-07-30  2:17           ` Eric Christopher
2001-07-30  4:19             ` Thiemo Seufer
2001-07-30  4:33               ` Eric Christopher
2001-08-07  5:47               ` Thiemo Seufer
2001-07-30  3:57 ` Eric Christopher

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).