+ CMOVSupport function

This commit is contained in:
florian 2022-11-08 21:14:56 +01:00
parent a2789d611f
commit 12aa48602b
3 changed files with 32 additions and 0 deletions

View File

@ -31,6 +31,7 @@ unit cpu;
{ returns the contents of the cr0 register }
function cr0 : longint;
function CMOVSupport : boolean;inline;
function InterlockedCompareExchange128Support : boolean;
function AESSupport : boolean;inline;
function AVXSupport: boolean;inline;
@ -73,6 +74,7 @@ unit cpu;
{$ASMMODE INTEL}
var
_CMOVSupport,
_AESSupport,
_AVXSupport,
_AVX2Support,
@ -219,9 +221,11 @@ unit cpu;
pushl %ebx
movl $1,%eax
cpuid
movl %edx,_edx
movl %ecx,_ecx
popl %ebx
end;
_CMOVSupport:=(_edx and $8000)<>0;
_AESSupport:=(_ecx and $2000000)<>0;
_POPCNTSupport:=(_ecx and $800000)<>0;
_SSE41Support:=(_ecx and $80000)<>0;
@ -299,6 +303,12 @@ unit cpu;
end;
function CMOVSupport : boolean;
begin
result:=_CMOVSupport;
end;
function AESSupport : boolean;
begin
result:=_AESSupport;

View File

@ -29,6 +29,7 @@ unit cpu;
sysutils;
function InterlockedCompareExchange128Support : boolean;inline;
function CMOVSupport : boolean;inline;
function AESSupport : boolean;inline;
function AVXSupport : boolean;inline;
function AVX2Support: boolean;inline;
@ -270,6 +271,12 @@ unit cpu;
end;
function CMOVSupport : boolean;
begin
result:=true;
end;
function AESSupport : boolean;inline;
begin
result:=_AESSupport;

View File

@ -4,6 +4,21 @@ uses
cpu;
begin
write('CMOV support: ');
if CMOVSupport then
begin
writeln('yes');
asm
cmov %eax,%eax
fldz
fldz
fcmovb %st(1)
fstpl %st(0)
fstpl %st(0)
end;
end
else
writeln('no');
write('AES support: ');
if AESSupport then
begin