1.2.53 $MMX : Intel MMX support (Intel 80x86 only)

Free Pascal supports optimization for the MMX Intel processor (see also chapter 5).

This optimizes certain code parts for the MMX Intel processor, thus greatly improving speed. The speed is noticed mostly when moving large amounts of data. Things that change are

Remark:MMX support is NOT emulated on non-MMX systems, i.e. if the processor doesn’t have the MMX extensions, the MMX optimizations cannot be used.

When MMX support is on, it is not allowed to do floating point arithmetic. It is allowed to move floating point data, but no arithmetic can be done. If floating point math must be done anyway, first MMX support must be switched off and the FPU must be cleared using the emms function of the cpu unit.

The following example will make this more clear:

Program MMXDemo;  
 
uses mmx;  
 
var  
   d1 : double;  
   a : array[0..10000] of double;  
   i : longint;  
 
begin  
   d1:=1.0;  
{$mmx+}  
   { floating point data is used, but we do _no_ arithmetic }  
   for i:=0 to 10000 do  
     a[i]:=d2;  { this is done with 64 bit moves }  
{$mmx-}  
   emms;   { clear fpu }  
   { now we can do floating point arithmetic }  
   ...  
end.

See the chapter on MMX (5) for more information on this topic.