2 {* MMX support unit. By Vladimir Kladov, 2003. }
12 TCpuId
= ( cpuOld486
, cpuNew486
, cpuMMX
, cpuSSE
, cpuSSE2
);
13 {* Enumeration type to represent CPU type.
14 cpuOld486: Old 486 Processor and earlier
15 cpuNew486: New 486 Processor to Pentium1 without MMX
16 cpuMMX : MMX supported (but not SSE or SSE2)
17 cpuSSE : MMX and SSE supported (but not SSE2)
18 cpuSSE2 : MMX, SSE and SSE2 supported
21 function GetCPUType
: TCpuId
;
22 {* Checks CPU (Intel PC x86 Architecture) for MMX support.
25 Use following constants in shuffle commands (like "pshufw") as third operand
26 to instruct to which locations (0,1,2,3) source parts should be placed: }
287 function GetCPUType
: TCpuId
;
290 Result
:= cpuOld486
; // old 486 and earlier
292 asm // check if bit
21 of EFLAGS can be set
and reset
302 AND EAX, not( 1 shl 21 )
312 if I
= 0 then Exit
; // CPUID not supported
313 Inc( Result
); // cpuNew486
314 asm // get CPU features flags using CPUID command
319 DB $0F, $A2 //CPUID
: EAX, EBX, EDX and ECX are changed
!!!
320 MOV [ I
], EDX // I
:= features information
325 if (I
and (1 shl 23)) = 0 then Exit
; // MMX not supported at all
326 Inc( Result
); // MMX supported.
327 if (I
and (1 shl 25)) = 0 then Exit
;
328 Inc( Result
); // SSE supported.
329 if (I
and (1 shl 26)) = 0 then Exit
;
330 Inc( Result
); // SSE2 supported.