This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
-mtune != -march (>=) - optimizing for a higher architecture
- From: Tom Alsberg <alsbergt at cs dot huji dot ac dot il>
- To: GCC Mailing List <gcc at gcc dot gnu dot org>
- Date: Sat, 25 Sep 2004 11:06:51 +0200
- Subject: -mtune != -march (>=) - optimizing for a higher architecture
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.