On Mon, 21 Oct 2002, Markku Kolkka wrote: >> On Mon, 21 Oct 2002, Andrew Smith wrote: >> >Interesting if you take that to the next step - it means that there >> >are NO extra useful instruction or optimisations in a 486 or a >> >Pentium (586) procesor over a 386 processor (...) >> Well, there are new instructions in i486, and i586, however most >> of them just are not useful in general purpose code. > >The optimizations for i586 aren't related to instruction set, but to >instruction scheduling. It depends on what specific commandline optimization switch you're refering to though. The following is more for others, than it is for you, as you already know the following (based on your final paragraph). There are two different gcc commandline options which I've stated in previous mails on this thread. -march, and -mcpu. The latter option "-mcpu" chooses instruction scheduling, and in Red Hat Linux, the whole distribution is compiled with i686 instruction scheduling. The -march option selects the instruction set, however in the case of i586, there are no new i586 instructions used by gcc, so the option isn't very useful. Note also the following: If you use: -march and -mcpu together, you are explicitly instructing the compiler to use a specific instruction set, and a specific scheduling. The best code generation for a real Intel i586, would likely be: -march=i386 -mcpu=i586 If one just specifies "-mcpu=i586" and doesn't specify -march, you'll end up with the same result. If you specify "-march=i586" gcc doesn't use any i586 specific instructions anyway, so it doesn't help. If you don't specify -mcpu, but do specify -march, then -mcpu is implied to be the same. So: -march=i586 is the same as: -march=i586 -mcpu=i586 And also the same (in reality) as: -march=i386 -mcpu-i586 So if someone really really wanted to optimize the distribution for a real original Intel Pentium processor, rebuilding everything with: "rpmbuild --rebuild --target i586" wouldn't do anything really useful at all, however doing: RPM_OPT_FLAGS='-O2 -march=i386 -mcpu=i586' rpmbuild --rebuild foo.src.rpm Would generate binaries with i386 compatible instructions, but optimized specifically for an original Pentium's instruction scheduling. This would generate the best code for a Pentium (other compiler flags notwithstanding), but if ran on an i686 processor, they'd run slower than the existing packages in Red Hat Linux. Not really worthwhile to do IMHO, except perhaps as an experiment by someone who is really interested. It might be worthwhile to do it for a handful of packages though. >Pentium is a dual-issue superscalar CPU without out-of-order >execution. This means that the compiler needs to carefully >arrange the instruction stream to keep both pipelines busy, and >sometimes even insert NOPs in the instruction stream. This >causes code that's optimally scheduled for i586 to run slower >both on single-pipeline CPUs like i386 and i486, and more >advanced superscalar CPUs like i686 and Athlon. That's correct. This is the reason why Red Hat Linux is currently built with "-march=i386 -mcpu=i686". We choose to use an instruction set which is compatible with all supported CPU types, but to optimize the instruction scheduling for the most commonly used processor architecture generation, which is i686. If I had my choice, I'd have it changed to: -march=i386 -mcpu=athlon ;o) Only after confirming with our gcc guys that -mcpu=athlon is more than a no-op of course. ;o) Take care, TTYL -- Mike A. Harris ftp://people.redhat.com/mharris OS Systems Engineer XFree86 maintainer Red Hat Inc. -- Psyche-list mailing list Psyche-list@redhat.com https://listman.redhat.com/mailman/listinfo/psyche-list