This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Code generation clarification (Submodels)
- From: Arturas Moskvinas <arturas dot moskvinas at gmail dot com>
- To: Andrew Walrond <andrew at walrond dot org>
- Cc: gcc-help at gcc dot gnu dot org
- Date: Tue, 3 May 2005 19:36:25 +0300
- Subject: Re: Code generation clarification (Submodels)
- References: <200505030728.41454.andrew@walrond.org>
- Reply-to: Arturas Moskvinas <arturas dot moskvinas at gmail dot com>
> 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.
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)).
> What about 32bit code generated with x86_64 targeted gcc (with -m32)?
>From the same gcc manual:
These -m switches are supported in addition to the above on AMD x86-64
processors in 64-bit environments.
-m32
-m64
Generate code for a 32-bit or 64-bit environment. The 32-bit
environment sets int, long and pointer to 32 bits and generates code
that runs on any i386 system. The 64-bit environment sets int to 32
bits and long and pointer to 64 bits and generates code for AMD's
x86-64 architecture.
Arturas Moskvinas
P.S.: for more specific i386 optimization and options read:
http://gcc.gnu.org/onlinedocs/gcc-3.4.3/gcc/i386-and-x86_002d64-Options.html