public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Adjust ix86 tuning for TARGET_64BIT
@ 2004-07-09 22:07 Daniel Jacobowitz
  2004-07-10  2:13 ` Richard Henderson
  0 siblings, 1 reply; 2+ messages in thread
From: Daniel Jacobowitz @ 2004-07-09 22:07 UTC (permalink / raw)
  To: gcc-patches

I tried to build a compiler today which supported both i386 and amd64,
defaulting to i386.  It rejected -m64 with this error:
  error ("CPU you selected does not support x86-64 instruction set");

The default for ix86_arch_string is set based on TARGET_64BIT, but the
default for ix86_tune_string isn't.  This patch overrides TARGET_CPU_DEFAULT
if -m64 is specified and TARGET_CPU_DEFAULT does not support 64-bit
instructions.

OK?

-- 
Daniel Jacobowitz

2004-07-09  Daniel Jacobowitz  <dan@debian.org>

	* config/i386/i386.c (override_options): Pick a 64-bit CPU
	for the default tuning if TARGET_64BIT.

Index: i386.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/i386/i386.c,v
retrieving revision 1.685
diff -u -p -r1.685 i386.c
--- i386.c	8 Jul 2004 05:53:38 -0000	1.685
+++ i386.c	9 Jul 2004 21:03:55 -0000
@@ -1097,6 +1097,8 @@ void
 override_options (void)
 {
   int i;
+  int ix86_tune_defaulted = 0;
+
   /* Comes from final.c -- no real reason to change it.  */
 #define MAX_CODE_ALIGN 16
 
@@ -1221,7 +1223,10 @@ override_options (void)
   if (!ix86_tune_string && ix86_arch_string)
     ix86_tune_string = ix86_arch_string;
   if (!ix86_tune_string)
-    ix86_tune_string = cpu_names [TARGET_CPU_DEFAULT];
+    {
+      ix86_tune_string = cpu_names [TARGET_CPU_DEFAULT];
+      ix86_tune_defaulted = 1;
+    }
   if (!ix86_arch_string)
     ix86_arch_string = TARGET_64BIT ? "x86-64" : "i386";
 
@@ -1305,7 +1310,20 @@ override_options (void)
       {
 	ix86_tune = processor_alias_table[i].processor;
 	if (TARGET_64BIT && !(processor_alias_table[i].flags & PTA_64BIT))
-	  error ("CPU you selected does not support x86-64 instruction set");
+	  {
+	    if (ix86_tune_defaulted)
+	      {
+		ix86_tune_string = "x86-64";
+		for (i = 0; i < pta_size; i++)
+		  if (! strcmp (ix86_tune_string,
+				processor_alias_table[i].name))
+		    break;
+		ix86_tune = processor_alias_table[i].processor;
+	      }
+	    else
+	      error ("CPU you selected does not support x86-64 "
+		     "instruction set");
+	  }
 	break;
       }
   if (i == pta_size)

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

* Re: Adjust ix86 tuning for TARGET_64BIT
  2004-07-09 22:07 Adjust ix86 tuning for TARGET_64BIT Daniel Jacobowitz
@ 2004-07-10  2:13 ` Richard Henderson
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Henderson @ 2004-07-10  2:13 UTC (permalink / raw)
  To: gcc-patches

On Fri, Jul 09, 2004 at 05:09:12PM -0400, Daniel Jacobowitz wrote:
> 	* config/i386/i386.c (override_options): Pick a 64-bit CPU
> 	for the default tuning if TARGET_64BIT.

Ok.


r~

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

end of thread, other threads:[~2004-07-10  0:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-07-09 22:07 Adjust ix86 tuning for TARGET_64BIT Daniel Jacobowitz
2004-07-10  2:13 ` Richard Henderson

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).