J'utilise un code trouvé sur internet pour extraire les infos concernant les instructions (SSE, MMX, etc) supportées par le processeur.
Ce code fonctionne bien mais j'aimerais y intégrer un test pour SSE 3.
Le code pour SSE3, je l'ai trouvé mais sous une forme bien différente que j'aimerais traduire dans la même syntaxe (forme) que ma routine ci-dessous :
Voici le code que j'utilise :
function getCPUInfo: TCPUInfo;
type
TRegChar = array[0..3] of char;
var
lvCPUID : TCPUIDResult;
I : Integer;
begin
lvCPUID := CPUID(0);
Result.Vendor := TRegChar(lvCPUID.EBX) + TRegChar(lvCPUID.EDX) +
TRegChar(lvCPUID.ECX);
lvCPUID := CPUID(1);
// Result.Frequency := GetCPUSpeed;
Result.Family := (lvCPUID.EAX and $F00) shr 8;
Result.Model := (lvCPUID.EAX and $78) shr 4;
Result.Stepping := (lvCPUID.EAX and $F);
Result.EFamily := (lvCPUID.EAX and $7800000) shr 20;
Result.EModel := (lvCPUID.EAX and $78000) shr 16;
Result.EStepping := (lvCPUID.EAX and $F);
Result.APIC := (lvCPUID.EBX and $1FE00000) shr 23;
Result.Brand := lvCPUID.EBX and $7F;
Result.FXSAVE := (lvCPUID.EDX and $01000000) = $01000000;
Result.MMX := (lvCPUID.EDX and $800000) = $800000;
Result.SSE := (lvCPUID.EDX and $2000000) = $2000000;
Result.SSE2 := (lvCPUID.EDX and $4000000) = $4000000;
Result.IA64 := (lvCPUID.EDX and $40000000) = $40000000;
lvCPUID := CPUID($80000001);
Result.MMXPlus := (lvCPUID.EDX and $800000) = $800000;
Result.AMD3DNow := (lvCPUID.EDX and $10000000) = $10000000;
if (Result.Vendor = 'GenuineIntel') and ((Result.Family <> 15) or
(Result.EFamily <> 0)) then
Result.Name := Result.Vendor + ' Processor'
else
begin
Result.Name := '';
for i := 2 to 4 do
begin
lvCPUID := CPUID($80000000 + i);
Result.Name := Result.Name +
TRegChar(lvCPUID.EAX) +
TRegChar(lvCPUID.EBX) +
TRegChar(lvCPUID.ECX) +
TRegChar(lvCPUID.EDX);
end;
Result.Name := Trim(Result.Name);
end;
et voici le code SSE3 a convertir et intégrer dans la syntaxe ci-dessus :
var
CPUInfo,
CPUSSE3: Integer;
begin
asm
MOV EAX, 01H;
CPUID;
MOV CPUInfo, EDX;
MOV CPUSSE3, ECX;
end;
// SSE
if (CPUInfo shr 25) and $1 = 1 then
WriteLn('SSE: Enabled')
else
WriteLn('SSE: Disabled');
// SSE2
if (CPUInfo shr 26) and $1 = 1 then
WriteLn('SSE2: Enabled')
else
WriteLn('SSE2: Disabled');
// SSE3
if CPUSSE3 and $1 = 1 then
WriteLn('SSE3: Enabled')
else
WriteLn('SSE3: Disabled');
Partager