This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Default ix86_arch = i386

On Tue, Jul 09, 2002 at 12:03:17PM -0400, Kelley Cook wrote:
> Note that no matter which system you built the compiler with, unless you
> manually supply an -march= line (or change the specs file to always do so), gcc
> will default to creating a binary that will run on an i386 (though the
> instructions will be optimally scheduled for whatever the target-triple says)
> and therefore will not use newer instructions, such as the useful CMOVcc family
> which was introduced with the PentiumPro.

Thanks for the reply Kelley.

However, I'm quite sure it actually has changed. Consider the
following snippet from "gcc/gcc/config/i386/i386.c" taken from
the gcc-2.95 branch:-

  if (ix86_arch_string == 0)
      ix86_arch_string = PROCESSOR_PENTIUM_STRING;
      if (ix86_cpu_string == 0)
        ix86_cpu_string = PROCESSOR_DEFAULT_STRING;

It clearly states that the default arch is equivalent to i586.

Now consider the same thing from gcc-3.1 and it looks like:-

  if (!ix86_cpu_string && ix86_arch_string)
    ix86_cpu_string = ix86_arch_string;
  if (!ix86_cpu_string)
    ix86_cpu_string = cpu_names [TARGET_CPU_DEFAULT];
  if (!ix86_arch_string)
    ix86_arch_string = TARGET_64BIT ? "athlon-4" : "i386";

It now clearly defaults to i386. My suspicions are confirmed
by running a simple test under each version of the compiler.

gcc -S -fverbose-asm hello.c

The output backs up my observation that gcc-2.95.x outputs
code generated with -march=pentium by default whereas gcc-3.1
outputs code generated with -march=i386 by default.

Anyway, its no biggie. I was just curious as to why the gcc
developers made the change. But I suppose it actually makes
sense to default to the lowest common denominator. (but
i386's are bloody old these days :-)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]