|
@@ -36,10 +36,17 @@ type
|
|
|
function CPUBrandString: shortstring;
|
|
|
|
|
|
function InterlockedCompareExchange128Support : boolean;inline;
|
|
|
+ function TSCSupport: boolean;inline;
|
|
|
+ function MMXSupport: boolean;inline;
|
|
|
function CMOVSupport : boolean;inline;
|
|
|
function AESSupport : boolean;inline;
|
|
|
function AVXSupport : boolean;inline;
|
|
|
function AVX2Support: boolean;inline;
|
|
|
+ function AVX101Support: boolean;inline; { AVX10.1 }
|
|
|
+ function AVX102Support: boolean;inline; { AVX10.2 }
|
|
|
+ function AVX10_256Support: boolean;inline; { AVX10/256 vector length 256 bit supported }
|
|
|
+ function AVX10_512Support: boolean;inline; { AVX10/512 vector length 512 bit supported }
|
|
|
+ function APXFSupport: boolean;inline; { APX_F Advanced Performance Extension Foundation }
|
|
|
function AVX512FSupport: boolean;inline;
|
|
|
function AVX512DQSupport: boolean;inline;
|
|
|
function AVX512IFMASupport: boolean;inline;
|
|
@@ -51,6 +58,13 @@ type
|
|
|
function AVX512VBMISupport: boolean;inline;
|
|
|
function AVX512VBMI2Support: boolean;inline;
|
|
|
function AVX512VNNISupport: boolean;inline;
|
|
|
+ function AVX512VPOPCNTDQSupport: boolean;inline;
|
|
|
+ function AVX512BF16Support: boolean;inline;
|
|
|
+ function AVX512FP16Support: boolean;inline;
|
|
|
+ function AVX512VP2INTERSECTSupport: boolean;inline;
|
|
|
+ function AVX5124VNNIWSupport: boolean;inline;
|
|
|
+ function AVX5124FMAPSSupport: boolean;inline;
|
|
|
+ function GFNISupport: boolean;inline;
|
|
|
function VAESSupport: boolean;inline;
|
|
|
function VCLMULSupport: boolean;inline;
|
|
|
function AVX512BITALGSupport: boolean;inline;
|
|
@@ -58,10 +72,14 @@ type
|
|
|
function ADXSupport: boolean;inline;
|
|
|
function SHASupport: boolean;inline;
|
|
|
function SHA512Support: boolean;inline;
|
|
|
+ function SM3Support: boolean;inline;
|
|
|
+ function SM4Support: boolean;inline;
|
|
|
function FMASupport: boolean;inline;
|
|
|
function CMPXCHG16BSupport: boolean;inline;
|
|
|
function POPCNTSupport: boolean;inline;
|
|
|
function LZCNTSupport: boolean;inline;
|
|
|
+ function SSESupport: boolean;inline;
|
|
|
+ function SSE2Support: boolean;inline;
|
|
|
function SSE3Support: boolean;inline;
|
|
|
function SSSE3Support: boolean;inline;
|
|
|
function SSE41Support: boolean;inline;
|
|
@@ -73,6 +91,7 @@ type
|
|
|
function BMI1Support: boolean;inline;
|
|
|
function BMI2Support: boolean;inline;
|
|
|
|
|
|
+
|
|
|
var
|
|
|
is_sse3_cpu : boolean = false;
|
|
|
|
|
@@ -80,15 +99,17 @@ type
|
|
|
|
|
|
implementation
|
|
|
|
|
|
-{$asmmode att}
|
|
|
-
|
|
|
var
|
|
|
data: record
|
|
|
cpuid1, cpuid7_0, cpuid7_1: TCpuidResult;
|
|
|
AVXSupport,
|
|
|
- LZCNTSupport: boolean;
|
|
|
+ LZCNTSupport,
|
|
|
+ AVX10_256Support,
|
|
|
+ AVX10_512Support: boolean;
|
|
|
+ AVX10Version: byte;
|
|
|
end;
|
|
|
|
|
|
+{$ASMMODE ATT}
|
|
|
|
|
|
procedure CPUID(in_eax: uint32; in_ecx: uint32; out res: TCpuidResult); assembler; nostackframe;
|
|
|
// ^ I don't know how 16-byte result is handled in SysV, if it is returned in RDX:RAX as GCC does things become complex,
|
|
@@ -211,6 +232,7 @@ type
|
|
|
procedure SetupSupport;
|
|
|
var
|
|
|
maxcpuidvalue : longint;
|
|
|
+ cpuid24_0 : TCpuidResult;
|
|
|
begin
|
|
|
maxcpuidvalue:=CPUID(0).eax;
|
|
|
CPUID(1, 0, data.cpuid1);
|
|
@@ -229,6 +251,14 @@ type
|
|
|
{ xmm and ymm state enabled? }
|
|
|
((XGETBV(0) and %110)=%110);
|
|
|
|
|
|
+ if (data.cpuid7_1.edx and (19 shl 0))<>0 then { CPUID.(EAX=24H) leaf is supported }
|
|
|
+ begin
|
|
|
+ CPUID($24, 0, cpuid24_0);
|
|
|
+ data.AVX10_256Support:=(cpuid24_0.ebx and (1 shl 17))<>0;
|
|
|
+ data.AVX10_512Support:=(cpuid24_0.ebx and (1 shl 18))<>0;
|
|
|
+ data.AVX10Version:=cpuid24_0.ebx and $ff;
|
|
|
+ end;
|
|
|
+
|
|
|
data.LZCNTSupport:=(CPUID($80000001).ecx and (1 shl 5))<>0;
|
|
|
end;
|
|
|
|
|
@@ -239,6 +269,18 @@ type
|
|
|
end;
|
|
|
|
|
|
|
|
|
+ function TSCSupport: boolean;
|
|
|
+ begin
|
|
|
+ result:=(data.cpuid1.edx and (1 shl 4))<>0;
|
|
|
+ end;
|
|
|
+
|
|
|
+
|
|
|
+ function MMXSupport: boolean;
|
|
|
+ begin
|
|
|
+ result:=(data.cpuid1.edx and (1 shl 23))<>0;
|
|
|
+ end;
|
|
|
+
|
|
|
+
|
|
|
function CMOVSupport : boolean;
|
|
|
begin
|
|
|
result:=true;
|
|
@@ -263,6 +305,36 @@ type
|
|
|
end;
|
|
|
|
|
|
|
|
|
+ function AVX101Support: boolean;inline; { AVX10.1 }
|
|
|
+ begin
|
|
|
+ result:=(data.AVX10Version>=1);
|
|
|
+ end;
|
|
|
+
|
|
|
+
|
|
|
+ function AVX102Support: boolean;inline; { AVX10.2 }
|
|
|
+ begin
|
|
|
+ result:=(data.AVX10Version>=2);
|
|
|
+ end;
|
|
|
+
|
|
|
+
|
|
|
+ function AVX10_256Support: boolean;inline; { AVX10/256 }
|
|
|
+ begin
|
|
|
+ result:=data.AVX10_256Support;
|
|
|
+ end;
|
|
|
+
|
|
|
+
|
|
|
+ function AVX10_512Support: boolean;inline; { AVX10/512 }
|
|
|
+ begin
|
|
|
+ result:=data.AVX10_256Support;
|
|
|
+ end;
|
|
|
+
|
|
|
+
|
|
|
+ function APXFSupport: boolean;inline; { APX_F Advanced Performance Extension Foundation }
|
|
|
+ begin
|
|
|
+ result:=(data.cpuid7_1.ebx and (1 shl 21))<>0;
|
|
|
+ end;
|
|
|
+
|
|
|
+
|
|
|
function AVX512FSupport: boolean;inline;
|
|
|
begin
|
|
|
result:=(data.cpuid7_0.ebx and (1 shl 16))<>0;
|
|
@@ -323,6 +395,12 @@ type
|
|
|
end;
|
|
|
|
|
|
|
|
|
+ function GFNISupport: boolean;inline;
|
|
|
+ begin
|
|
|
+ result:=(data.cpuid7_0.ecx and (1 shl 8))<>0;
|
|
|
+ end;
|
|
|
+
|
|
|
+
|
|
|
function VAESSupport: boolean;inline;
|
|
|
begin
|
|
|
result:=(data.cpuid7_0.ecx and (1 shl 9))<>0;
|
|
@@ -347,6 +425,42 @@ type
|
|
|
end;
|
|
|
|
|
|
|
|
|
+ function AVX512VPOPCNTDQSupport: boolean;inline;
|
|
|
+ begin
|
|
|
+ result:=(data.cpuid7_0.ecx and (1 shl 14))<>0;
|
|
|
+ end;
|
|
|
+
|
|
|
+
|
|
|
+ function AVX512BF16Support: boolean;inline;
|
|
|
+ begin
|
|
|
+ result:=(data.cpuid7_1.eax and (1 shl 5))<>0;
|
|
|
+ end;
|
|
|
+
|
|
|
+
|
|
|
+ function AVX512FP16Support: boolean;inline;
|
|
|
+ begin
|
|
|
+ result:=(data.cpuid7_0.edx and (1 shl 23))<>0;
|
|
|
+ end;
|
|
|
+
|
|
|
+
|
|
|
+ function AVX512VP2INTERSECTSupport: boolean;inline;
|
|
|
+ begin
|
|
|
+ result:=(data.cpuid7_0.edx and (1 shl 8))<>0;
|
|
|
+ end;
|
|
|
+
|
|
|
+
|
|
|
+ function AVX5124VNNIWSupport: boolean;inline;
|
|
|
+ begin
|
|
|
+ result:=(data.cpuid7_0.edx and (1 shl 2))<>0;
|
|
|
+ end;
|
|
|
+
|
|
|
+
|
|
|
+ function AVX5124FMAPSSupport: boolean;inline;
|
|
|
+ begin
|
|
|
+ result:=(data.cpuid7_0.edx and (1 shl 3))<>0;
|
|
|
+ end;
|
|
|
+
|
|
|
+
|
|
|
function RDSEEDSupport: boolean;inline;
|
|
|
begin
|
|
|
result:=(data.cpuid7_0.ebx and (1 shl 18))<>0;
|
|
@@ -371,6 +485,18 @@ type
|
|
|
end;
|
|
|
|
|
|
|
|
|
+ function SM3Support: boolean;inline;
|
|
|
+ begin
|
|
|
+ result:=(data.cpuid7_1.eax and (1 shl 1))<>0;
|
|
|
+ end;
|
|
|
+
|
|
|
+
|
|
|
+ function SM4Support: boolean;inline;
|
|
|
+ begin
|
|
|
+ result:=(data.cpuid7_1.eax and (1 shl 2))<>0;
|
|
|
+ end;
|
|
|
+
|
|
|
+
|
|
|
function FMASupport: boolean;inline;
|
|
|
begin
|
|
|
result:=data.AVXSupport and ((data.cpuid1.ecx and (1 shl 12))<>0);
|
|
@@ -395,6 +521,18 @@ type
|
|
|
end;
|
|
|
|
|
|
|
|
|
+ function SSESupport: boolean;inline;
|
|
|
+ begin
|
|
|
+ result:=(data.cpuid1.edx and (1 shl 25))<>0;
|
|
|
+ end;
|
|
|
+
|
|
|
+
|
|
|
+ function SSE2Support: boolean;inline;
|
|
|
+ begin
|
|
|
+ result:=(data.cpuid1.edx and (1 shl 26))<>0;
|
|
|
+ end;
|
|
|
+
|
|
|
+
|
|
|
function SSE3Support: boolean;inline;
|
|
|
begin
|
|
|
result:=(data.cpuid1.ecx and (1 shl 0))<>0;
|