[KLUG Members] Re: Compiler optimization for CPU arch?

Bruce Smith members@kalamazoolinux.org
17 Dec 2002 15:08:24 -0500


> > For the average user (whatever that is), how much difference does
> > compiling for higher level CPU's really make?
> > I know Mandrake compiles their entire distribution for i586.  Is that
> > _noticeably_ faster than Redhat's i386 binaries?
> 
> Depends on the CPU.  Most clone x86 processors are designed for optimal i386/486
> instruction execution.

They why does Mandrake do it?  Just marketing hype?

Why does Redhat do on on the kernel, glibc & openssl?
It must make some significant difference.

> > And if one was to recompile certain packages (like Mozilla), is it
> > worth making an i686 version AND an athlon version for AMD CPU PC's?
> > Or would i686 be good enough for both?  (or how much more gain would
> > -march=athlon gain me over -march=i686 on an Athlon)?
> 
> Er, probably not. 

To which question?  :-)

> The "-march" option targets the processor family directly.  I
> bet some opcodes are not supported on the Athlon -- even outside of the SIMD
> instructions (which purposely reuse old i386/486 opcodes for incompatibility).
> 
> And it won't be the same as Athlon-optimizations.  Pentium Pro and Athlon are
> quite different, and the Athlon offers more execution units that are best
> optimized in the compiler (as with any CPU).

So having both *.i686.rpm and *.athlon.rpm for some packages 
would be a good thing?

> FURTHERMORE:  If you really want "speed," you want Intel's commercial optimizing
> compilers.  Their latest 7.0 releases now offer "drop-in" replacement for GCC
> (which version though???).  Intel clearly designs some nice optimizing compilers.

So it's possible (likely?) that Netscape compiled version 7.01 
with the Intel compiler?

> This is different than the kernel, where compiling a kernel for a "generic i686"
> platform will run perfectly on Athlon.

Huh?  On my Athlon at home:  

# rpm -qa --qf="%{ARCH} %{NAME}\n" \
	| grep -v -e ^i386 -e ^noarch

athlon mplayer
i586 xfce
i686 RealPlayer
i686 glibc
i686 openssl
athlon kernel

That leads me to believe that i686 RPMs runs fine on Athlon's since 
Redhat's installer installed some of those i686 packages for me.

> > And what's the limit of what will run where?  Will -march=athlon run
> > on a i686?
> 
> Definitely not!  The Pentium Pro+ pre-fetch won't be able to handle certain
> codings for the Athlon.

Okay.

> > How about the other way around?  With either run on a i586 CPU?
> 
> Again, we're not talking the kernel here, but actual CPU object code via the
> "arch" option.

So, will an i686.rpm package run on a P5?

> > Anyone got any good links handy for reading about this stuff?  TIA!
> 
> Yeah ...  ;-p  
>    http://www.google.com  

Been there, got the T-shirt.  :-)

> Seriously now, check out the GCC project page:
>    http://gcc.gnu.org

I haven't found anything useful in the docs.  I'm dreading going through
the mailing list archives.  Was hoping for a nice article about it.  :-)

It boils down to this:  I'm looking to recompile some packages with
higher CPU optimizations, and possibly replace some of them on BSware.

Given the fact that I do NOT care about i386, i486, and i586 CPU's.
I'm only interested in P-II/III/IV and Athlon CPU's.  Do I:

A)  Go with i586 only so it runs everywhere I do care about.

B)  Go with i686 only. (which should run on P6 & Athlon both?)

C)  Make both i686 & athlon RPM's, and 2 different BSware distros.

--------------------------------------------
Bruce Smith                bruce@armintl.com
System Administrator / Network Administrator
Armstrong International, Inc.
Three Rivers, Michigan  49093  USA
http://www.armstrong-intl.com/
--------------------------------------------