diff --git a/rtl/i386/cpu.pp b/rtl/i386/cpu.pp index c16a837cfb..590c651234 100644 --- a/rtl/i386/cpu.pp +++ b/rtl/i386/cpu.pp @@ -43,6 +43,8 @@ unit cpu; function AVX512CDSupport: boolean;inline; function AVX512BWSupport: boolean;inline; function AVX512VLSupport: boolean;inline; + function RDSEEDSupport: boolean;inline; + function ADXSupport: boolean;inline; function SHASupport: boolean;inline; function FMASupport: boolean;inline; function POPCNTSupport: boolean;inline; @@ -76,6 +78,8 @@ unit cpu; _AVX512CDSupport, _AVX512BWSupport, _AVX512VLSupport, + _RDSEEDSupport, + _ADXSupport, _SHASupport, _FMASupport, _POPCNTSupport, @@ -250,6 +254,8 @@ unit cpu; _AVX2Support:=_AVXSupport and ((_ebx and $20)<>0); _AVX512FSupport:=(_ebx and $10000)<>0; _AVX512DQSupport:=(_ebx and $20000)<>0; + _RDSEEDSupport:=(_ebx and $40000)<>0; + _ADXSupport:=(_ebx and $80000)<>0; _AVX512IFMASupport:=(_ebx and $200000)<>0; _AVX512PFSupport:=(_ebx and $4000000)<>0; _AVX512ERSupport:=(_ebx and $8000000)<>0; @@ -339,6 +345,18 @@ unit cpu; end; + function RDSEEDSupport: boolean;inline; + begin + result:=_RDSEEDSupport; + end; + + + function ADXSupport: boolean;inline; + begin + result:=_ADXSupport; + end; + + function SHASupport: boolean;inline; begin result:=_SHASupport; diff --git a/rtl/x86_64/cpu.pp b/rtl/x86_64/cpu.pp index bbcb2295ba..a4446c2ef1 100644 --- a/rtl/x86_64/cpu.pp +++ b/rtl/x86_64/cpu.pp @@ -39,7 +39,9 @@ unit cpu; function AVX512ERSupport: boolean;inline; function AVX512CDSupport: boolean;inline; function AVX512BWSupport: boolean;inline; - function AVX512VLSupport: boolean;inline; + function AVX512VLSupport: boolean;inline; + function RDSEEDSupport: boolean;inline; + function ADXSupport: boolean;inline; function SHASupport: boolean;inline; function FMASupport: boolean;inline; function POPCNTSupport: boolean;inline; @@ -75,6 +77,8 @@ unit cpu; _AVX512CDSupport, _AVX512BWSupport, _AVX512VLSupport, + _RDSEEDSupport, + _ADXSupport, _SHASupport, _FMASupport, _POPCNTSupport, @@ -224,6 +228,8 @@ unit cpu; _AVX2Support:=_AVXSupport and ((_ebx and $20)<>0); _AVX512FSupport:=(_ebx and $10000)<>0; _AVX512DQSupport:=(_ebx and $20000)<>0; + _RDSEEDSupport:=(_ebx and $40000)<>0; + _ADXSupport:=(_ebx and $80000)<>0; _AVX512IFMASupport:=(_ebx and $200000)<>0; _AVX512PFSupport:=(_ebx and $4000000)<>0; _AVX512ERSupport:=(_ebx and $8000000)<>0; @@ -310,6 +316,18 @@ unit cpu; end; + function RDSEEDSupport: boolean;inline; + begin + result:=_RDSEEDSupport; + end; + + + function ADXSupport: boolean;inline; + begin + result:=_ADXSupport; + end; + + function SHASupport: boolean;inline; begin result:=_SHASupport; diff --git a/tests/test/units/cpu/tcpu1.pp b/tests/test/units/cpu/tcpu1.pp index 30d81680db..600e37a852 100644 --- a/tests/test/units/cpu/tcpu1.pp +++ b/tests/test/units/cpu/tcpu1.pp @@ -66,5 +66,25 @@ begin end else writeln('no'); + write('ADX support: '); + if ADXSupport then + begin + writeln('yes'); + asm + adcx %eax,%eax + end; + end + else + writeln('no'); + write('RDSEED support: '); + if RDSEEDSupport then + begin + writeln('yes'); + asm + rdseed %eax + end; + end + else + writeln('no'); end.