+ functions to check for Popcnt support

git-svn-id: trunk@45827 -
This commit is contained in:
florian 2020-07-22 20:47:11 +00:00
parent 6478a727d7
commit c01db96df4
2 changed files with 19 additions and 2 deletions

View File

@ -35,6 +35,7 @@ unit cpu;
function AVXSupport: boolean;inline;
function AVX2Support: boolean;inline;
function FMASupport: boolean;inline;
function POPCNTSupport: boolean;inline;
var
is_sse3_cpu : boolean = false;
@ -48,7 +49,8 @@ unit cpu;
_AVXSupport,
_AVX2Support,
_AESSupport,
_FMASupport : boolean;
_FMASupport,
_POPCNTSupport : boolean;
function InterlockedCompareExchange128(var Target: Int128Rec; NewValue: Int128Rec; Comperand: Int128Rec): Int128Rec;
@ -123,6 +125,7 @@ unit cpu;
popl %ebx
end;
_AESSupport:=(_ecx and $2000000)<>0;
_POPCNTSupport:=(_ecx and $800000)<>0;
_AVXSupport:=
{ XGETBV suspport? }
@ -179,6 +182,12 @@ unit cpu;
result:=_FMASupport;
end;
function POPCNTSupport: boolean;inline;
begin
result:=_POPCNTSupport;
end;
begin
SetupSupport;
end.

View File

@ -33,6 +33,7 @@ unit cpu;
function AVXSupport : boolean;inline;
function AVX2Support: boolean;inline;
function FMASupport: boolean;inline;
function POPCNTSupport: boolean;inline;
var
is_sse3_cpu : boolean = false;
@ -48,7 +49,8 @@ unit cpu;
_AVXSupport,
_InterlockedCompareExchange128Support,
_AVX2Support,
_FMASupport : boolean;
_FMASupport,
_POPCNTSupport: boolean;
function InterlockedCompareExchange128(var Target: Int128Rec; NewValue: Int128Rec; Comperand: Int128Rec): Int128Rec; assembler;
{
@ -141,6 +143,7 @@ unit cpu;
end ['rax','rbx','rcx','rdx'];
_InterlockedCompareExchange128Support:=(_ecx and $2000)<>0;
_AESSupport:=(_ecx and $2000000)<>0;
_POPCNTSupport:=(_ecx and $800000)<>0;
_AVXSupport:=
{ XGETBV suspport? }
@ -194,6 +197,11 @@ unit cpu;
end;
function POPCNTSupport: boolean;inline;
begin
result:=_POPCNTSupport;
end;
begin
SetupSupport;
end.