From 6a64fcbb06bfcf38e9ca958279444c7ac30a479f Mon Sep 17 00:00:00 2001 From: florian Date: Thu, 23 Jul 2020 20:57:45 +0000 Subject: [PATCH] + more helper routine to check for CPU features added git-svn-id: trunk@45835 - (cherry picked from commit e26e824700777baed7b121a9f28d4ac8ab9dad58) --- rtl/i386/cpu.pp | 48 ++++++++++++++++++++++++++++++++++++++++++++++- rtl/x86_64/cpu.pp | 47 +++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 93 insertions(+), 2 deletions(-) diff --git a/rtl/i386/cpu.pp b/rtl/i386/cpu.pp index e5cc3e71e8..e65103c7f0 100644 --- a/rtl/i386/cpu.pp +++ b/rtl/i386/cpu.pp @@ -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. diff --git a/rtl/x86_64/cpu.pp b/rtl/x86_64/cpu.pp index ebdb214fa8..ec30046fff 100644 --- a/rtl/x86_64/cpu.pp +++ b/rtl/x86_64/cpu.pp @@ -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.