NetBSD-Users archive

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

Re: gcc, march and sse



Joel Carnat wrote:
Le Mer 3 décembre 2008 16:40, Dennis den Brok a écrit :
Joel Carnat <joel%carnat.net@localhost> schrieb:
Hello,

I read that Slackware Linux compiles most of its packages with
"-march=i486 -mtune=i686". As far as I understood gcc's manpage, this
means "keep code compatible with 486 CPU but allow the use pentiumpro
special features", right ?

Still from the man page, MMX is supported since "pentium2 (or
pentium-mmx
only)", SSE since "pentium3", SSE2 since "pentium-m", SSE3 since
"prescott".

I tweaked my mk.conf to compile pkgsrc (on a domU) using "-O2 -march=486
-mtune=686" but I'm now wondering if any on those compiled programs will
use MMX or SSE when running on my laptop or intel-based servers (intel
core2duo).

Then second question, in case the previous thought is correct, if I use
"-march=i486 -mtune=nocona", is there a way to see which instruction the
program uses ? For example, if I compile xorg/firefox/mplayer and then
run
it in a special manner, can I see that the core2duo uses MMX/SSE*
instruction while the C3 only use MMX instruction (from the same binary)
?

-march specifies the instruction set the compiler may use; thus, neither
MMX
nor SSE will be used. There may be exceptions, however, because some
pkgsrc

hum... then what would be the point in setting "mtune" ?

Isn't that obvious? Tune for optimal performance on that variant.
But you cannot use instructions that aren't allowed by march, because then it won't run on march (if so, what was the point of march?).

But different instruction sequences can be the optimal on different implementations of an instruction set.

        Johnny



Home | Main Index | Thread Index | Old Index