Re: Code generation clarification (Submodels)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Arturas,

On Tuesday 03 May 2005 17:36, Arturas Moskvinas wrote:
> > Simple question, but I'm not entirely clear from reading the
> > documentation
> >
> > If I have a gcc configured for i686-* target system and I use that
> > compiler to build a package without any -m submodel options , is the
> > generated code 1) only suitable for i686 and better, or
> >  2) tuned for i686 and better but still OK for i386
>
> From gcc manual:
> 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.

Yes, I have read that, but it does _not_ answer my question, which is 
concerned with the default behaviour of a compiler configured and built for a 
specific sub-model target. :)

> It means even if you make -march=pentium-4 and run this code on 386 it
> will run (maybe you'll have problems with SSE (but i think gcc inserts
> code to bypass sse if you do not have it)).

No - you are wrong here. If you use -mpcu or mtune, it will run on i386, but 
if you use -march, it most certainly will not.

>
> > What about 32bit code generated with x86_64 targeted gcc (with -m32)?
>
> From the same gcc manual:

Yes, I have read this but it still doesn't answer my question ;)

This, from Ian Lance Taylor on the main gcc ML, answers my question:

> Andrew Walrond <andrew@xxxxxxxxxxx> writes:
> > If I have a gcc configured for i686-* target system and I use that
> > compiler to build a package without any -m submodel options , is the
> > generated code 1) only suitable for i686 and better, or
> >  2) tuned for i686 and better but still OK for i386
>
> The latter.  Configuring for i686-* is equivalent to configuring for
> i386-* with the option --with-cpu=i686.  This causes the compiler to
> be built as though you specified -mtune=i686 for each compile which
> does not explicitly use -mtune, -march, or -mcpu.
>
> > Whatever the answer, is it a generic rule that holds true for submodels
> > of all architectures?
>
> It should always be true, although of course there may be bugs.
>
> > What about 32bit code generated with x86_64 targeted gcc (with -m32)?
>
> If you configure for x86-64, I believe the default architecture will
> be MMX, SSE, and SSE2.  I believe that will apply even if you use
> -m32.  But I haven't really tested it.
>
> Ian

Thanks for the reply though. I admit Ian had to read between the lines to 
understand exactly what I was getting at :)

Andrew Walrond

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux