[mythtv] Compiler opt flags
linux.news at bucksch.org
Fri May 16 07:52:31 EDT 2003
I see that strong optimizing tops are enabled in settigns.pro for
"release" (optimized) builds. That's a good idea, given that MythTV is
Given that gcc 3.0 and later has special optimizations for Athlon, even
distinguishing between Athlon types as I just saw, maybe add a note
about that to the HOWTO
But more importantly, it seems to me that avcodec and avformat, which
are used to compress the video and do the actual hard and CPU-intensive
work (right?), don't use these flags. The only opt flag I noticed was
-O3, no CPU opt. The step from -march=pentium to -march=pentiumpro can
mean 5-10% performance increase (tested with gcc 2.95 and Mozilla), so
it seems significant, esp. considering that you build the rest of MythTV
with those flags anyways.
To use these flags for avcodec, I use the following command:
CFLAGS="-funroll-loops -fexpensive-optimizations -O6 -march=athlon"
Maybe someone else can figure out a saner way.
man gcc (3.2)
Intel 386 and AMD x86-64 Options
These -m options are defined for the i386 and x86-64 family of
Tune to cpu-type everything applicable about the generated
code, except for the
ABI and the set of available instructions. The choices for
cpu-type are i386,
i486, i586, i686, pentium, pentium-mmx, pentiumpro, pentium2,
k6, k6-2, k6-3, athlon, athlon-tbird, athlon-4, athlon-xp and
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 pen-
tium and i686 is equivalent to pentiumpro. k6 and athlon are
the AMD chips as
opposed to the Intel ones.
Generate instructions for the machine type cpu-type. The
choices for cpu-type
are the same as for -mcpu. Moreover, specifying
generate floating point arithmetics for selected unit unit.
the choices for unit
sse Use scalar floating point instructions present in the SSE
This instruction set is supported by Pentium3 and newer
chips, in the AMD
line by Athlon-4, Athlon-xp and Athlon-mp chips. The
earlier version of SSE
instruction set supports only single precision
arithmetics, thus the double
and extended precision arithmetics is still done using
387. Later version,
present only in Pentium4 and the future AMD x86-64 chips
supports double pre-
cision arithmetics too.
For i387 you need to use -march=cpu-type, -msse or -msse2
switches to enable
SSE extensions and make this option effective. For
x86-64 compiler, these
extensions are enabled by default.
The resulting code should be considerably faster in
majority of cases and
avoid the numerical instability problems of 387 code, but
may break some
existing code that expects temporaries to be 80bit.
More information about the mythtv-dev