* How to tune gcc for different x86 host and target cpus?
@ 2004-04-23 11:50 Michael Roth
2004-04-25 0:56 ` Ian Lance Taylor
0 siblings, 1 reply; 3+ messages in thread
From: Michael Roth @ 2004-04-23 11:50 UTC (permalink / raw)
To: gcc-help
Hello,
as far as I understand, when building gcc, I can use --with-arch=pentium
to tell configure that the resulting compiler should emit code optimized
for pentium processors.
But how can I tell the configure script that the compiler itself should
be optimized for a different cpu architecture?
Example #1: Host and build are athlon-xp, target should be pentium.
Example #2: Build is pentium4, Host should be pentium-mmx, target should
be 386.
What configure options should I use? (Host, build and target are all
linux systems, but I think this apply to every system with x86 processor
variants?)
Michael Roth
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: How to tune gcc for different x86 host and target cpus?
2004-04-23 11:50 How to tune gcc for different x86 host and target cpus? Michael Roth
@ 2004-04-25 0:56 ` Ian Lance Taylor
2004-05-12 19:45 ` Michael Roth
0 siblings, 1 reply; 3+ messages in thread
From: Ian Lance Taylor @ 2004-04-25 0:56 UTC (permalink / raw)
To: Michael Roth; +Cc: gcc-help
Michael Roth <mroth@nessie.de> writes:
> as far as I understand, when building gcc, I can use
> --with-arch=pentium to tell configure that the resulting compiler
> should emit code optimized for pentium processors.
>
> But how can I tell the configure script that the compiler itself
> should be optimized for a different cpu architecture?
One way is to set CFLAGS when you compile. The default value for
CFLAGS is "-g -O2" (when compiling with gcc).
> Example #1: Host and build are athlon-xp, target should be pentium.
make CFLAGS="-g -O2 -march=athlon"
> Example #2: Build is pentium4, Host should be pentium-mmx, target
> should be 386.
make CFLAGS="-g -O2 -march=pentium-mmx"
If you really want to optimize the build programs, you can use
CFLAGS_FOR_BUILD=-march=pentium4. That will only affect the time it
takes to build the compiler itself, though, and is unlikely to make
any noticeable difference at that.
> What configure options should I use? (Host, build and target are all
> linux systems, but I think this apply to every system with x86
> processor variants?)
I think that if you set the environment variable CFLAGS when you run
configure, it will be picked up and stored in the Makefile. Try it by
looking at the definition of CFLAGS in the top level Makefile after
you run configure.
Ian
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: How to tune gcc for different x86 host and target cpus?
2004-04-25 0:56 ` Ian Lance Taylor
@ 2004-05-12 19:45 ` Michael Roth
0 siblings, 0 replies; 3+ messages in thread
From: Michael Roth @ 2004-05-12 19:45 UTC (permalink / raw)
To: Ian Lance Taylor; +Cc: gcc-help
Ian Lance Taylor wrote:
> Michael Roth <mroth@nessie.de> writes:
>
>>But how can I tell the configure script that the compiler itself
>>should be optimized for a different cpu architecture?
>
>
> One way is to set CFLAGS when you compile. The default value for
> CFLAGS is "-g -O2" (when compiling with gcc).
>
>
>>Example #1: Host and build are athlon-xp, target should be pentium.
>
>
> make CFLAGS="-g -O2 -march=athlon"
Thank you. This did the job.
> I think that if you set the environment variable CFLAGS when you run
> configure, it will be picked up and stored in the Makefile. Try it by
> looking at the definition of CFLAGS in the top level Makefile after
> you run configure.
I'm not sure, I tried this before I posted to this list, and I think it
didn't worked well. But I could be wrong.
Michael
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2004-05-12 19:45 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-04-23 11:50 How to tune gcc for different x86 host and target cpus? Michael Roth
2004-04-25 0:56 ` Ian Lance Taylor
2004-05-12 19:45 ` Michael Roth
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).