mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-07 08:48:08 +02:00
+ more helper routine to check for CPU features added
git-svn-id: trunk@45835 -
(cherry picked from commit e26e824700
)
This commit is contained in:
parent
8d6a8e5492
commit
6a64fcbb06
@ -36,6 +36,11 @@ unit cpu;
|
||||
function AVX2Support: boolean;inline;
|
||||
function FMASupport: boolean;inline;
|
||||
function POPCNTSupport: boolean;inline;
|
||||
function SSE41Support: boolean;inline;
|
||||
function SSE42Support: boolean;inline;
|
||||
function MOVBESupport: boolean;inline;
|
||||
function F16CSupport: boolean;inline;
|
||||
function RDRANDSupport: boolean;inline;
|
||||
|
||||
var
|
||||
is_sse3_cpu : boolean = false;
|
||||
@ -50,7 +55,12 @@ unit cpu;
|
||||
_AVX2Support,
|
||||
_AESSupport,
|
||||
_FMASupport,
|
||||
_POPCNTSupport : boolean;
|
||||
_POPCNTSupport,
|
||||
_SSE41Support,
|
||||
_SSE42Support,
|
||||
_MOVBESupport,
|
||||
_F16CSupport,
|
||||
_RDRANDSupport: boolean;
|
||||
|
||||
|
||||
function InterlockedCompareExchange128(var Target: Int128Rec; NewValue: Int128Rec; Comperand: Int128Rec): Int128Rec;
|
||||
@ -126,6 +136,11 @@ unit cpu;
|
||||
end;
|
||||
_AESSupport:=(_ecx and $2000000)<>0;
|
||||
_POPCNTSupport:=(_ecx and $800000)<>0;
|
||||
_SSE41Support:=(_ecx and $80000)<>0;
|
||||
_SSE42Support:=(_ecx and $100000)<>0;
|
||||
_MOVBESupport:=(_ecx and $400000)<>0;
|
||||
_F16CSupport:=(_ecx and $20000000)<>0;
|
||||
_RDRANDSupport:=(_ecx and $40000000)<>0;
|
||||
|
||||
_AVXSupport:=
|
||||
{ XGETBV suspport? }
|
||||
@ -188,6 +203,37 @@ unit cpu;
|
||||
result:=_POPCNTSupport;
|
||||
end;
|
||||
|
||||
|
||||
function SSE41Support: boolean;inline;
|
||||
begin
|
||||
result:=_SSE41Support;
|
||||
end;
|
||||
|
||||
|
||||
function SSE42Support: boolean;inline;
|
||||
begin
|
||||
result:=_SSE42Support;
|
||||
end;
|
||||
|
||||
|
||||
function MOVBESupport: boolean;inline;
|
||||
begin
|
||||
result:=_MOVBESupport;
|
||||
end;
|
||||
|
||||
|
||||
function F16CSupport: boolean;inline;
|
||||
begin
|
||||
result:=_F16CSupport;
|
||||
end;
|
||||
|
||||
|
||||
function RDRANDSupport: boolean;inline;
|
||||
begin
|
||||
result:=_RDRANDSupport;
|
||||
end;
|
||||
|
||||
|
||||
begin
|
||||
SetupSupport;
|
||||
end.
|
||||
|
@ -34,6 +34,11 @@ unit cpu;
|
||||
function AVX2Support: boolean;inline;
|
||||
function FMASupport: boolean;inline;
|
||||
function POPCNTSupport: boolean;inline;
|
||||
function SSE41Support: boolean;inline;
|
||||
function SSE42Support: boolean;inline;
|
||||
function MOVBESupport: boolean;inline;
|
||||
function F16CSupport: boolean;inline;
|
||||
function RDRANDSupport: boolean;inline;
|
||||
|
||||
var
|
||||
is_sse3_cpu : boolean = false;
|
||||
@ -50,7 +55,12 @@ unit cpu;
|
||||
_InterlockedCompareExchange128Support,
|
||||
_AVX2Support,
|
||||
_FMASupport,
|
||||
_POPCNTSupport: boolean;
|
||||
_POPCNTSupport,
|
||||
_SSE41Support,
|
||||
_SSE42Support,
|
||||
_MOVBESupport,
|
||||
_F16CSupport,
|
||||
_RDRANDSupport: boolean;
|
||||
|
||||
function InterlockedCompareExchange128(var Target: Int128Rec; NewValue: Int128Rec; Comperand: Int128Rec): Int128Rec; assembler;
|
||||
{
|
||||
@ -144,6 +154,11 @@ unit cpu;
|
||||
_InterlockedCompareExchange128Support:=(_ecx and $2000)<>0;
|
||||
_AESSupport:=(_ecx and $2000000)<>0;
|
||||
_POPCNTSupport:=(_ecx and $800000)<>0;
|
||||
_SSE41Support:=(_ecx and $80000)<>0;
|
||||
_SSE42Support:=(_ecx and $100000)<>0;
|
||||
_MOVBESupport:=(_ecx and $400000)<>0;
|
||||
_F16CSupport:=(_ecx and $20000000)<>0;
|
||||
_RDRANDSupport:=(_ecx and $40000000)<>0;
|
||||
|
||||
_AVXSupport:=
|
||||
{ XGETBV suspport? }
|
||||
@ -202,6 +217,36 @@ unit cpu;
|
||||
result:=_POPCNTSupport;
|
||||
end;
|
||||
|
||||
function SSE41Support: boolean;inline;
|
||||
begin
|
||||
result:=_SSE41Support;
|
||||
end;
|
||||
|
||||
|
||||
function SSE42Support: boolean;inline;
|
||||
begin
|
||||
result:=_SSE42Support;
|
||||
end;
|
||||
|
||||
|
||||
function MOVBESupport: boolean;inline;
|
||||
begin
|
||||
result:=_MOVBESupport;
|
||||
end;
|
||||
|
||||
|
||||
function F16CSupport: boolean;inline;
|
||||
begin
|
||||
result:=_F16CSupport;
|
||||
end;
|
||||
|
||||
|
||||
function RDRANDSupport: boolean;inline;
|
||||
begin
|
||||
result:=_RDRANDSupport;
|
||||
end;
|
||||
|
||||
|
||||
begin
|
||||
SetupSupport;
|
||||
end.
|
||||
|
Loading…
Reference in New Issue
Block a user