mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-20 10:45:08 +02:00
+ LZCNTSupport
+ test extended
This commit is contained in:
parent
a18e75eaff
commit
dde8f54ee7
@ -46,6 +46,7 @@ unit cpu;
|
||||
function SHASupport: boolean;inline;
|
||||
function FMASupport: boolean;inline;
|
||||
function POPCNTSupport: boolean;inline;
|
||||
function LZCNTSupport: boolean;inline;
|
||||
function SSE41Support: boolean;inline;
|
||||
function SSE42Support: boolean;inline;
|
||||
function MOVBESupport: boolean;inline;
|
||||
@ -78,6 +79,7 @@ unit cpu;
|
||||
_SHASupport,
|
||||
_FMASupport,
|
||||
_POPCNTSupport,
|
||||
_LZCNTSupport,
|
||||
_SSE41Support,
|
||||
_SSE42Support,
|
||||
_MOVBESupport,
|
||||
@ -185,7 +187,7 @@ unit cpu;
|
||||
|
||||
procedure SetupSupport;
|
||||
var
|
||||
_ecx,_ebx,maxcpuidvalue : longint;
|
||||
_edx,_ecx,_ebx,maxcpuidvalue : longint;
|
||||
begin
|
||||
is_sse3_cpu:=false;
|
||||
if cpuid_support then
|
||||
@ -224,6 +226,17 @@ unit cpu;
|
||||
|
||||
_FMASupport:=_AVXSupport and ((_ecx and $1000)<>0);
|
||||
|
||||
asm
|
||||
pushl %ebx
|
||||
movl $0x80000001,%eax
|
||||
cpuid
|
||||
movl %ecx,_ecx
|
||||
movl %edx,_edx
|
||||
popl %ebx
|
||||
end;
|
||||
_LZCNTSupport:=(_ecx and $20)<>0;
|
||||
|
||||
|
||||
if maxcpuidvalue>=7 then
|
||||
begin
|
||||
asm
|
||||
@ -344,6 +357,12 @@ unit cpu;
|
||||
end;
|
||||
|
||||
|
||||
function LZCNTSupport: boolean;inline;
|
||||
begin
|
||||
result:=_LZCNTSupport;
|
||||
end;
|
||||
|
||||
|
||||
function SSE41Support: boolean;inline;
|
||||
begin
|
||||
result:=_SSE41Support;
|
||||
|
@ -43,6 +43,7 @@ unit cpu;
|
||||
function SHASupport: boolean;inline;
|
||||
function FMASupport: boolean;inline;
|
||||
function POPCNTSupport: boolean;inline;
|
||||
function LZCNTSupport: boolean;inline;
|
||||
function SSE41Support: boolean;inline;
|
||||
function SSE42Support: boolean;inline;
|
||||
function MOVBESupport: boolean;inline;
|
||||
@ -77,6 +78,7 @@ unit cpu;
|
||||
_SHASupport,
|
||||
_FMASupport,
|
||||
_POPCNTSupport,
|
||||
_LZCNTSupport,
|
||||
_SSE41Support,
|
||||
_SSE42Support,
|
||||
_MOVBESupport,
|
||||
@ -167,6 +169,7 @@ unit cpu;
|
||||
|
||||
procedure SetupSupport;
|
||||
var
|
||||
_edx,
|
||||
_ecx,
|
||||
_ebx,maxcpuidvalue : longint;
|
||||
begin
|
||||
@ -201,6 +204,14 @@ unit cpu;
|
||||
|
||||
_FMASupport:=_AVXSupport and ((_ecx and $1000)<>0);
|
||||
|
||||
asm
|
||||
movl $0x80000001,%eax
|
||||
cpuid
|
||||
movl %ecx,_ecx
|
||||
movl %edx,_edx
|
||||
end;
|
||||
_LZCNTSupport:=(_ecx and $20)<>0;
|
||||
|
||||
{ very early x86-64 CPUs might not support eax=7 }
|
||||
if maxcpuidvalue>=7 then
|
||||
begin
|
||||
@ -316,6 +327,13 @@ unit cpu;
|
||||
result:=_POPCNTSupport;
|
||||
end;
|
||||
|
||||
|
||||
function LZCNTSupport: boolean;inline;
|
||||
begin
|
||||
result:=_LZCNTSupport;
|
||||
end;
|
||||
|
||||
|
||||
function SSE41Support: boolean;inline;
|
||||
begin
|
||||
result:=_SSE41Support;
|
||||
|
@ -24,6 +24,17 @@ begin
|
||||
end
|
||||
else
|
||||
writeln('no');
|
||||
write('AVXF512 support: ');
|
||||
if AVX512FSupport then
|
||||
begin
|
||||
writeln('yes');
|
||||
asm
|
||||
vpxor %ymm0,%ymm0,%ymm0
|
||||
vaddpd %zmm0,%zmm0,%zmm0
|
||||
end;
|
||||
end
|
||||
else
|
||||
writeln('no');
|
||||
write('FMA support: ');
|
||||
if FMASupport then
|
||||
begin
|
||||
@ -45,5 +56,15 @@ begin
|
||||
end
|
||||
else
|
||||
writeln('no');
|
||||
write('LZCNT support: ');
|
||||
if LZCNTSupport then
|
||||
begin
|
||||
writeln('yes');
|
||||
asm
|
||||
lzcnt %eax,%eax
|
||||
end;
|
||||
end
|
||||
else
|
||||
writeln('no');
|
||||
end.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user