Gcc

From CourvilleWiki

Jump to: navigation, search

Contents

GCC optimizations

Warning

All what is described here is only valid for the Ezra and Nehemia versions of the C3 processor (i.e. mostly for M9000 & M10000 owners)...

General considerations on C3 processors

Now gcc-3.3 support ezra -march=c3 and nehemiah -march=c3-2 architectures. I.e., in gcc/config/i386/i386.c we have:

const processor_alias_table[] =
...
{"c3", PROCESSOR_I486, PTA_MMX | PTA_3DNOW},
{"c3-2", PROCESSOR_PENTIUMPRO, PTA_MMX | PTA_PREFETCH_SSE | PTA_SSE},
{"pentium3", PROCESSOR_PENTIUMPRO, PTA_MMX | PTA_SSE | PTA_PREFETCH_SSE},

It is worth mentioning that though ezra and nehemiah are claimed to be C3 processors, a code compiled with -march=c3 will segfault on a nehemiah since 3dnow! is not supported.

Compilation options for Ezra:

c3 Ezra seems to be a i686 architecture without the x86_cmove instruction Too bad that gcc doesn't implement yet the correct x86_ table... Note that with a patched version of gcc where in gcc/config/i386/i386.c, m_PPRO is removed in x86_cmove (freevix approach) you can safely use -march=i686 -mcpu=i686 -mmmx -m3dnow.

Compilation options for Ezra

According the processor table from gcc source, for the moment nehemiah simply undergoes pentium3 optimizations.

Recommended option for C3 Ezra and Nehemiah

  • Ezra old gcc CFLAGS="-march=i586 -pipe -O2 -fomit-frame-pointer -ffast-math -finline-functions"
  • Ezra newer gcc CFLAGS="-march=c3 -pipe -O2 -fomit-frame-pointer -ffast-math -finline-functions"
  • Nehemiah old gcc CFLAGS="-march=i686 -O2 -pipe -fomit-frame-pointer -ffast-math -finline-functions -msse -mfpmath=sse,387 -mmmx"
  • Nehemiah newer gcc CFLAGS="-march=c3-2 -O2 -pipe -fomit-frame-pointer -ffast-math -finline-functions -mfpmath=sse,387"

Further stuff to be investigated

Since nehemiah and ezra processors have only a 64ko cache which is relatively small optimization -Os has been reported to be more efficient than -O2 or -O3. The reason why is that loop unwinding to gain in speed is likely to cause a cache overflow which penalizes speed: in that case reducing size is beeter speed wise. This is why also -funroll-loops will not help.

Note that people have reported better success with the following flags:

  • Ezra: CFLAGS="-march=i586 -pipe -O2 -fomit-frame-pointer -ffast-math -finline-functions -mmmx -m3dnow"
  • Nehemiah: CFLAGS="-march=i686 -O2 -pipe -fomit-frame-pointer -ffast-math -finline-functions -msse -mfpmath=sse,387"


Optimized XFree compilation for Ezra

  1. Look in xc/config/cf/xf86site.def to determine syntax.
  2. handle local modification (host) in either site.def or host.def as advised by freevix

for ezra:

#define DefaultGcc2i386Opt -march=c3 -O2 fomit-frame-pointer -ffast-math -finline-functions -mmmx -m3dnow
/* #define BuildServersOnly YES */
#define GccWarningOptions -pipe
#define HasMTRRSupport YES
#define HasMMXSupport YES
#define Has3DNowSupport YES
#define HasSSESupport NO
#define ProjectRoot /opt/X11R6-ezra
#define NothingOutsideProjectRoot YES
#define EtcX11Directory ProjectRoot/etc

for nehemiah:

#define DefaultGcc2i386Opt -march=i686 -O2 -fomit-frame-pointer -ffast-math -finline-functions -msse -mfpmath=sse,387
/* #define BuildServersOnly YES */
#define GccWarningOptions -pipe
#define HasMTRRSupport YES
#define HasMMXSupport YES
#define Has3DNowSupport NO
#define HasSSESupport YES
#define ProjectRoot /opt/X11R6-nehemiah
#define NothingOutsideProjectRoot YES
#define EtcX11Directory ProjectRoot/etc
  1. and then issue a make World &> make.log. It is a good idea to use a make Everything >& make.log instead of a make World &> make.log after

For debian installation please refer to http://www.tuxmobil.org/debian_xfree43.html General XFree compilation instructions can be found at http://www.x