mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-18 03:09:11 +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 AVX2Support: boolean;inline;
|
||||||
function FMASupport: boolean;inline;
|
function FMASupport: boolean;inline;
|
||||||
function POPCNTSupport: 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
|
var
|
||||||
is_sse3_cpu : boolean = false;
|
is_sse3_cpu : boolean = false;
|
||||||
@ -50,7 +55,12 @@ unit cpu;
|
|||||||
_AVX2Support,
|
_AVX2Support,
|
||||||
_AESSupport,
|
_AESSupport,
|
||||||
_FMASupport,
|
_FMASupport,
|
||||||
_POPCNTSupport : boolean;
|
_POPCNTSupport,
|
||||||
|
_SSE41Support,
|
||||||
|
_SSE42Support,
|
||||||
|
_MOVBESupport,
|
||||||
|
_F16CSupport,
|
||||||
|
_RDRANDSupport: boolean;
|
||||||
|
|
||||||
|
|
||||||
function InterlockedCompareExchange128(var Target: Int128Rec; NewValue: Int128Rec; Comperand: Int128Rec): Int128Rec;
|
function InterlockedCompareExchange128(var Target: Int128Rec; NewValue: Int128Rec; Comperand: Int128Rec): Int128Rec;
|
||||||
@ -126,6 +136,11 @@ unit cpu;
|
|||||||
end;
|
end;
|
||||||
_AESSupport:=(_ecx and $2000000)<>0;
|
_AESSupport:=(_ecx and $2000000)<>0;
|
||||||
_POPCNTSupport:=(_ecx and $800000)<>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:=
|
_AVXSupport:=
|
||||||
{ XGETBV suspport? }
|
{ XGETBV suspport? }
|
||||||
@ -188,6 +203,37 @@ unit cpu;
|
|||||||
result:=_POPCNTSupport;
|
result:=_POPCNTSupport;
|
||||||
end;
|
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
|
begin
|
||||||
SetupSupport;
|
SetupSupport;
|
||||||
end.
|
end.
|
||||||
|
@ -34,6 +34,11 @@ unit cpu;
|
|||||||
function AVX2Support: boolean;inline;
|
function AVX2Support: boolean;inline;
|
||||||
function FMASupport: boolean;inline;
|
function FMASupport: boolean;inline;
|
||||||
function POPCNTSupport: 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
|
var
|
||||||
is_sse3_cpu : boolean = false;
|
is_sse3_cpu : boolean = false;
|
||||||
@ -50,7 +55,12 @@ unit cpu;
|
|||||||
_InterlockedCompareExchange128Support,
|
_InterlockedCompareExchange128Support,
|
||||||
_AVX2Support,
|
_AVX2Support,
|
||||||
_FMASupport,
|
_FMASupport,
|
||||||
_POPCNTSupport: boolean;
|
_POPCNTSupport,
|
||||||
|
_SSE41Support,
|
||||||
|
_SSE42Support,
|
||||||
|
_MOVBESupport,
|
||||||
|
_F16CSupport,
|
||||||
|
_RDRANDSupport: boolean;
|
||||||
|
|
||||||
function InterlockedCompareExchange128(var Target: Int128Rec; NewValue: Int128Rec; Comperand: Int128Rec): Int128Rec; assembler;
|
function InterlockedCompareExchange128(var Target: Int128Rec; NewValue: Int128Rec; Comperand: Int128Rec): Int128Rec; assembler;
|
||||||
{
|
{
|
||||||
@ -144,6 +154,11 @@ unit cpu;
|
|||||||
_InterlockedCompareExchange128Support:=(_ecx and $2000)<>0;
|
_InterlockedCompareExchange128Support:=(_ecx and $2000)<>0;
|
||||||
_AESSupport:=(_ecx and $2000000)<>0;
|
_AESSupport:=(_ecx and $2000000)<>0;
|
||||||
_POPCNTSupport:=(_ecx and $800000)<>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:=
|
_AVXSupport:=
|
||||||
{ XGETBV suspport? }
|
{ XGETBV suspport? }
|
||||||
@ -202,6 +217,36 @@ unit cpu;
|
|||||||
result:=_POPCNTSupport;
|
result:=_POPCNTSupport;
|
||||||
end;
|
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
|
begin
|
||||||
SetupSupport;
|
SetupSupport;
|
||||||
end.
|
end.
|
||||||
|
Loading…
Reference in New Issue
Block a user