Re: MMX bogomips fun

Olaf Titz (olaf@bigred.inka.de)
03 Feb 1997 10:48:29 +0100


Illuminati Primus <vermont@gate.net> wrote:
> I wonder.. how fast would linux be if it was optimized for MMX? Will GCC
> support MMX optimizations sometime? I have been thinking it could
> probably speed up checksumming and other repetitive calculations.. Or

It _could_ speed up this kind of calculations, if carefully
hand-optimized, yes. But I think MMX is over-rated.

MMX is a set of basic arithmetic instructions (add, multiply...) on
64-bit registers that do four 16-bit ops or eight 8-bit ops in
parallel, i.e. SIMD processing. That can help if you operate on really
independent data (as with some graphics calculations, you can do
several pixels in parallel) or with things like checksumming if the
algorithm requires no overflow handling (e.g. IP header checksum),
etc.

Now the big gotcha: The 64-bit registers used for MMX are the FPU
registers. If you have floating point and MMX ops in the same task,
you have to FSAVE/FRSTOR them. This is a _very_ expensive operation
(124+70 cycles in the best case). It's only justified if a block of
MMX operations saves more cycles, compared to regular operations.
So it won't help for the simple calculations described above.

olaf

-- 
___        Olaf.Titz@inka.de or @{stud,informatik}.uni-karlsruhe.de       ____
__ o           <URL:http://www.inka.de/~bigred/>     <IRC:praetorius>
__/<_              >> Just as long as the wheels keep on turning round
_)>(_)______________ I will live for the groove 'til the sun goes down << ____