Jean Francois Martinez wrote: > The problem is that GCC is not (or at least wasn't when I tested it > on gcc 2.96) smart enough to optimize for processor X while restricting > to Y instruction set when Y is different from both X > and 386. Ie if you use "-mcpu=i686 -march=i586" (ie optimize for 686 > but restrict to Pentium instruction) it generates code > who runs at exactly the same speed that if you had typed "-mcpu=i686 > -march=i386". When I say exactly I mean within 0.1% or 0.2% margin (ie > within noise limits) and for EVERY test. The usual thing when > playing with compiler parms was that on at least one of my tests > one of the flags providing at least a 2 or 3% difference. Not > there. Complete equality. At this point the logical deduction is that > gcc "downgraded" to 386 mode because it was unable to generate > code using the 686 timetable and 586 instructions. > > As I said I tested the above on gcc 2.96 and haven't repeated the > experience on gcc 3.x > > > So except for marketing purposes it doesn't make sense to try > to compile "normal" packages with 586 as the minimal processor. > The packages where there will be a difference are those who > rely either on hand-written assembler like the kernel or glibc. Um. You seem to be assuming that the extra instructions in the Pentium will improve performance, and that therefore gcc is deficient. Might it not simply be that the (few) extra instructions really aren't that useful in improving performance? (Incidentally: which CPU were you using? I understand that not all of the new instructions provide a performance benefit on later processors: they tend to get broken back down to the same micro-ops.) The logical conclusion that Red Hat's engineers came to (and they're far more knowledgable about the whole thing than I am) is simply that none of the extra instructions that the Pentium makes available (and there aren't that many) are very useful in improving performance. The major exception comes in atomic locking instructions for NTPL. And that (for very good binary and source level compatibility reasons) is done in glibc, which *is* compiled to i586 or i686. See, for example, https://www.redhat.com/archives/fedora-devel-list/2004-June/msg00232.html and linked posts. James. -- James Wilkinson | "Luck is my middle name," said Rincewind, Exeter Devon UK | indistinctly. "Mind you, my first name is Bad." E-mail address: james | -- Terry Pratchett, Interesting Times @westexe.demon.co.uk |