mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-14 14:09:20 +02:00
+ CPU units: check for SHA support
This commit is contained in:
parent
6c7e6191f6
commit
bff09e8e9e
@ -43,6 +43,7 @@ unit cpu;
|
|||||||
function AVX512CDSupport: boolean;inline;
|
function AVX512CDSupport: boolean;inline;
|
||||||
function AVX512BWSupport: boolean;inline;
|
function AVX512BWSupport: boolean;inline;
|
||||||
function AVX512VLSupport: boolean;inline;
|
function AVX512VLSupport: boolean;inline;
|
||||||
|
function SHASupport: boolean;inline;
|
||||||
function FMASupport: boolean;inline;
|
function FMASupport: boolean;inline;
|
||||||
function POPCNTSupport: boolean;inline;
|
function POPCNTSupport: boolean;inline;
|
||||||
function SSE41Support: boolean;inline;
|
function SSE41Support: boolean;inline;
|
||||||
@ -63,6 +64,7 @@ unit cpu;
|
|||||||
|
|
||||||
{$ASMMODE INTEL}
|
{$ASMMODE INTEL}
|
||||||
var
|
var
|
||||||
|
_AESSupport,
|
||||||
_AVXSupport,
|
_AVXSupport,
|
||||||
_AVX2Support,
|
_AVX2Support,
|
||||||
_AVX512FSupport,
|
_AVX512FSupport,
|
||||||
@ -73,7 +75,7 @@ unit cpu;
|
|||||||
_AVX512CDSupport,
|
_AVX512CDSupport,
|
||||||
_AVX512BWSupport,
|
_AVX512BWSupport,
|
||||||
_AVX512VLSupport,
|
_AVX512VLSupport,
|
||||||
_AESSupport,
|
_SHASupport,
|
||||||
_FMASupport,
|
_FMASupport,
|
||||||
_POPCNTSupport,
|
_POPCNTSupport,
|
||||||
_SSE41Support,
|
_SSE41Support,
|
||||||
@ -240,6 +242,7 @@ unit cpu;
|
|||||||
_AVX512ERSupport:=(_ebx and $8000000)<>0;
|
_AVX512ERSupport:=(_ebx and $8000000)<>0;
|
||||||
_AVX512CDSupport:=(_ebx and $10000000)<>0;
|
_AVX512CDSupport:=(_ebx and $10000000)<>0;
|
||||||
_AVX512BWSupport:=(_ebx and $40000000)<>0;
|
_AVX512BWSupport:=(_ebx and $40000000)<>0;
|
||||||
|
_SHASupport:=(_ebx and $20000000)<>0;
|
||||||
_AVX512VLSupport:=(_ebx and $80000000)<>0;
|
_AVX512VLSupport:=(_ebx and $80000000)<>0;
|
||||||
_BMI1Support:=(_ebx and $8)<>0;
|
_BMI1Support:=(_ebx and $8)<>0;
|
||||||
_BMI2Support:=(_ebx and $100)<>0;
|
_BMI2Support:=(_ebx and $100)<>0;
|
||||||
@ -323,6 +326,12 @@ unit cpu;
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
function SHASupport: boolean;inline;
|
||||||
|
begin
|
||||||
|
result:=_SHASupport;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
function FMASupport: boolean;inline;
|
function FMASupport: boolean;inline;
|
||||||
begin
|
begin
|
||||||
result:=_FMASupport;
|
result:=_FMASupport;
|
||||||
|
@ -40,6 +40,7 @@ unit cpu;
|
|||||||
function AVX512CDSupport: boolean;inline;
|
function AVX512CDSupport: boolean;inline;
|
||||||
function AVX512BWSupport: boolean;inline;
|
function AVX512BWSupport: boolean;inline;
|
||||||
function AVX512VLSupport: boolean;inline;
|
function AVX512VLSupport: boolean;inline;
|
||||||
|
function SHASupport: boolean;inline;
|
||||||
function FMASupport: boolean;inline;
|
function FMASupport: boolean;inline;
|
||||||
function POPCNTSupport: boolean;inline;
|
function POPCNTSupport: boolean;inline;
|
||||||
function SSE41Support: boolean;inline;
|
function SSE41Support: boolean;inline;
|
||||||
@ -73,6 +74,7 @@ unit cpu;
|
|||||||
_AVX512CDSupport,
|
_AVX512CDSupport,
|
||||||
_AVX512BWSupport,
|
_AVX512BWSupport,
|
||||||
_AVX512VLSupport,
|
_AVX512VLSupport,
|
||||||
|
_SHASupport,
|
||||||
_FMASupport,
|
_FMASupport,
|
||||||
_POPCNTSupport,
|
_POPCNTSupport,
|
||||||
_SSE41Support,
|
_SSE41Support,
|
||||||
@ -215,6 +217,7 @@ unit cpu;
|
|||||||
_AVX512PFSupport:=(_ebx and $4000000)<>0;
|
_AVX512PFSupport:=(_ebx and $4000000)<>0;
|
||||||
_AVX512ERSupport:=(_ebx and $8000000)<>0;
|
_AVX512ERSupport:=(_ebx and $8000000)<>0;
|
||||||
_AVX512CDSupport:=(_ebx and $10000000)<>0;
|
_AVX512CDSupport:=(_ebx and $10000000)<>0;
|
||||||
|
_SHASupport:=(_ebx and $20000000)<>0;
|
||||||
_AVX512BWSupport:=(_ebx and $40000000)<>0;
|
_AVX512BWSupport:=(_ebx and $40000000)<>0;
|
||||||
_AVX512VLSupport:=(_ebx and $80000000)<>0;
|
_AVX512VLSupport:=(_ebx and $80000000)<>0;
|
||||||
_BMI1Support:=(_ebx and $8)<>0;
|
_BMI1Support:=(_ebx and $8)<>0;
|
||||||
@ -296,6 +299,12 @@ unit cpu;
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
function SHASupport: boolean;inline;
|
||||||
|
begin
|
||||||
|
result:=_SHASupport;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
function FMASupport: boolean;inline;
|
function FMASupport: boolean;inline;
|
||||||
begin
|
begin
|
||||||
result:=_FMASupport;
|
result:=_FMASupport;
|
||||||
|
@ -35,5 +35,15 @@ begin
|
|||||||
end
|
end
|
||||||
else
|
else
|
||||||
writeln('no');
|
writeln('no');
|
||||||
|
write('SHA support: ');
|
||||||
|
if SHASupport then
|
||||||
|
begin
|
||||||
|
writeln('yes');
|
||||||
|
asm
|
||||||
|
sha256rnds2 %xmm0,%xmm0
|
||||||
|
end;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
writeln('no');
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user