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

Re: Good optimize idea! (Re: ramblings about old hardware, gzip, bz2, and pentium opts)

On Tue, 7 Dec 1999, Goswin Brederlow wrote:

> Onno <Onno@Willem.Alexanderschool.nl> writes:
> > At 03:04 PM 12/6/99 +0100, Tomasz Wegrzanowski wrote:
> > [snip]
> > >Didnt mean : use 486-or-better-only instructions
> > >Mean : use optimalizations for 486 using only 386-or-better instructions
> > >Is this ok ?
> > >486 is much more similar to modern hardware than 386 was.
> > 
> > This sounds reasonable. 
> > 
> > The old i386 stuff can still run it, but the binaries are 
> > optimized for somewhat modern hardsware. 
> > 
> > Great idea indeed!
> gcc will ALWAYS produce code that runs on a i386, as I was
> told. 

you were told wrong. 

from gcc-2.95 manual:

`-mcpu=CPU TYPE'
     Assume the defaults for the machine type CPU TYPE when scheduling
     instructions.  The choices for CPU TYPE are:

     `i386'        `i486'        `i586'        `i686'        
     `pentium'     `pentiumpro'  `k6'                        

     While picking a specific CPU TYPE will schedule things
     appropriately for that particular chip, the compiler will not
     generate any code that does not run on the i386 without the
     `-march=CPU TYPE' option being used.  `i586' is equivalent to
     `pentium' and `i686' is equivalent to `pentiumpro'.  `k6' is the
     AMD chip as opposed to the Intel ones.

`-march=CPU TYPE'
     Generate instructions for the machine type CPU TYPE.  The choices
     for CPU TYPE are the same as for `-mcpu'.  Moreover, specifying
     `-march=CPU TYPE' implies `-mcpu=CPU TYPE'.

> Exceptions of cause are direct asm instructions in the code
> (like MMX optimizations).

i'm pretty sure comditional move will be emitted by gcc
if march=pentiumpro, and this code will NOT work on 386

> Its actually not a good idea, since slow systems will be even slower,
> fast systems will be slower and a very few machines with the exact
> hardware optimized for will gain a little bit.
> Also optimization is only worth for maybe 10-20 Package in Debian, so
> if you find one of them too slow patch it to compile for various
> optimizations and create multiple packages. (like gzip, gzip-mmx,
> gzip-P2 or similar).
> May the Source be with you.
> 			Goswin


Reply to: