-mcpu=i486 should not define __i486__

kingdon@redhat.com kingdon@redhat.com
Sat Jul 10 11:28:00 GMT 1999


Any news on the status of the following patch?  It strikes me as
something that is ready to check in (for 2.96.<mumble>) but I don't
know whether noone has gotten around to it or whether there is another
reason.

> In the info page for egcs it is documented:
> 
> --- quote ---
>    These `-m' options are defined for the i386 family of computers:
> 
> `-mcpu=CPU TYPE'
>      Assume the defaults for the machine type CPU TYPE when scheduling
>      instructions.  The choices for CPU TYPE are: `i386', `i486',
>      `i586' (`pentium'), `pentium', `i686' (`pentiumpro') and
>      `pentiumpro'. While picking a specific CPU TYPE will schedule
>      things appropriately for that particular chip, the compiler will
>      not generate any code that does not run on the i386 without the
>      `-march=CPU TYPE' option being used.
> 
> `-march=CPU TYPE'
>      Generate instructions for the machine type CPU TYPE.  The choices
>      for CPU TYPE are: `i386', `i486', `pentium', and `pentiumpro'.
>      Specifying `-march=CPU TYPE' implies `-mcpu=CPU TYPE'.
> 
> `-m386'
> `-m486'
> `-mpentium'
> `-mpentiumpro'
>      Synonyms for -mcpu=i386, -mcpu=i486, -mcpu=pentium, and
>      -mcpu=pentiumpro respectively.
> --- endquote ---
> 
> So after reading this thing one clearly gets the impression the saying
> -mcpu=i486 will affect the scheduler only, while egcs will still generate
> code that will run on i386, and -march=i486 will actually enable
> i486-specific instructions.
> 
> Well, the cpp does not concur to this idea and because of this the glibc
> headers that are testing for __i486__ (like the ones that define bswap32
> and bswap16) are getting confused.
> 
> A common sense rule says that using -mcpu=i486 should *not* define
> __i486__, because we don't want to use i486 specific code, we are only
> interested in the scheduler modifications.

I second the motion that this is a bug in gcc.  Any one else?


r~


	* i386.h (CC1_CPU_SPEC): Don't supply -march.
	(CPP_CPU_SPEC): Test -march not -mcpu.
	(CPP_CPU_DEFAULT_SPEC): Delete.
	(EXTRA_SPECS): Delete cpp_cpu_default.

--- egcs-1.1.2/gcc/config/i386/i386.h.cpu	Sat Jul 25 20:35:12 1998
+++ egcs-1.1.2/gcc/config/i386/i386.h	Thu Jun 24 15:07:59 1999
@@ -296,7 +296,7 @@
 %{!mcpu*: \
 %{m386:-mcpu=i386 -march=i386} \
 %{mno-486:-mcpu=i386 -march=i386} \
-%{m486:-mcpu=i486 -march=i486} \
+%{m486:-mcpu=i486} \
 %{mno-386:-mcpu=i486 -march=i486} \
 %{mno-pentium:-mcpu=i486 -march=i486} \
 %{mpentium:-mcpu=pentium} \
@@ -310,30 +310,13 @@
 #define CPP_686_SPEC "%{!ansi:-Di686 -Dpentiumpro} \
 	-D__i686 -D__i686__ -D__pentiumpro -D__pentiumpro__"
 
-#ifndef CPP_CPU_DEFAULT_SPEC
-#if TARGET_CPU_DEFAULT == 1
-#define CPP_CPU_DEFAULT_SPEC "%(cpp_486)"
-#else
-#if TARGET_CPU_DEFAULT == 2
-#define CPP_CPU_DEFAULT_SPEC "%(cpp_586)"
-#else
-#if TARGET_CPU_DEFAULT == 3
-#define CPP_CPU_DEFAULT_SPEC "%(cpp_686)"
-#else
-#define CPP_CPU_DEFAULT_SPEC ""
-#endif
-#endif
-#endif
-#endif /* CPP_CPU_DEFAULT_SPEC */
-
 #ifndef CPP_CPU_SPEC
 #define CPP_CPU_SPEC "\
 -Asystem(unix) -Acpu(i386) -Amachine(i386) \
 %{!ansi:-Di386} -D__i386 -D__i386__ \
-%{mcpu=i486:%(cpp_486)} %{m486:%(cpp_486)} \
-%{mpentium:%(cpp_586)} %{mcpu=pentium:%(cpp_586)} \
-%{mpentiumpro:%(cpp_686)} %{mcpu=pentiumpro:%(cpp_686)} \
-%{!mcpu*:%{!m486:%{!mpentium*:%(cpp_cpu_default)}}}"
+%{march=i486:%(cpp_486)} \
+%{march=pentium:%(cpp_586)} \
+%{march=pentiumpro:%(cpp_686)}"
 #endif
 
 #ifndef CC1_SPEC
@@ -358,7 +341,6 @@
   { "cpp_486", CPP_486_SPEC},						\
   { "cpp_586", CPP_586_SPEC},						\
   { "cpp_686", CPP_686_SPEC},						\
-  { "cpp_cpu_default",	CPP_CPU_DEFAULT_SPEC },				\
   { "cpp_cpu",	CPP_CPU_SPEC },						\
   { "cc1_cpu",  CC1_CPU_SPEC },						\
   SUBTARGET_EXTRA_SPECS


More information about the Gcc-patches mailing list