-mtune != -march (>=) - optimizing for a higher architecture
Tom Alsberg
alsbergt@cs.huji.ac.il
Sat Sep 25 11:44:00 GMT 2004
Hi there...
Recently I built GCC 3.4.2 for Linux, and read through a bit of its
documentation. In (gcc.info)i386 and x86-63 Options, it is said under
`-march=CPU-TYPE': specifying `-march=CPU-TYPE' implies
`-mtune=CPU-TYPE'.
I wonder, then - how could I compile code that would be optimized for
one x86 CPU family member (say, pentium3), but that would run on all
x86 CPUs since some older one (say, i586), and fully take advantage of
that older (but still newer than i386) one's instruction and register
set, etc?
For example, how could I compile code to take advantage, of, say,
pentium instructions and registers, but optimize instruction
scheduling, cache and pipeline usage, etc. for, say, pentium3?
I used to compile code specifying -mcpu=pentiumpro -march=pentium,
believing that this would make it optimized for the i686 but would
run on and take advantage of i586 instructions...
If I understand correctly now, only specifying -mtune will generate
code that will run on i386 (and thus not take advantage of newer
instructions, etc.), but be optimized for some newer CPU-TYPE...
But I'm not sure how to take the lower limit somewhat higher than the
i386, while still optimizing for something yet newer than that...
I'm sorry if that's a FAQ or some misunderstanding of me... I couldn't
find any answer, though, and didn't feel like going through the source
of GCC...
Thanks,
-- Tom
--
Tom Alsberg - hacker (being the best description fitting this space)
Web page: http://www.cs.huji.ac.il/~alsbergt/
DISCLAIMER: The above message does not even necessarily represent what
my fingers have typed on the keyboard, save anything further.
More information about the Gcc
mailing list