From 5ca73c61f4d95f688a592a93cea607417a734c9c Mon Sep 17 00:00:00 2001 From: florian Date: Wed, 7 Jul 2021 20:26:59 +0000 Subject: [PATCH] + CPU.BMI1Support and CPU.BMI2Support git-svn-id: trunk@49582 - --- rtl/i386/cpu.pp | 19 ++++++++++++++++++- rtl/x86_64/cpu.pp | 23 +++++++++++++++++++++-- 2 files changed, 39 insertions(+), 3 deletions(-) diff --git a/rtl/i386/cpu.pp b/rtl/i386/cpu.pp index 0ba4844035..e05c70550a 100644 --- a/rtl/i386/cpu.pp +++ b/rtl/i386/cpu.pp @@ -43,6 +43,8 @@ unit cpu; function F16CSupport: boolean;inline; function RDRANDSupport: boolean;inline; function RTMSupport: boolean;inline; + function BMI1Support: boolean;inline; + function BMI2Support: boolean;inline; var is_sse3_cpu : boolean = false; @@ -63,7 +65,9 @@ unit cpu; _MOVBESupport, _F16CSupport, _RDRANDSupport, - _RTMSupport: boolean; + _RTMSupport, + _BMI1Support, + _BMI2Support: boolean; {$ASMMODE ATT} @@ -204,6 +208,8 @@ unit cpu; popl %ebx end; _AVX2Support:=_AVXSupport and ((_ebx and $20)<>0); + _BMI1Support:=(_ebx and $8)<>0; + _BMI2Support:=(_ebx and $100)<>0; _RTMSupport:=((_ebx and $800)<>0); end; end; @@ -283,6 +289,17 @@ unit cpu; end; + function BMI1Support: boolean;inline; + begin + result:=_BMI1Support; + end; + + + function BMI2Support: boolean;inline; + begin + result:=_BMI2Support; + end; + begin SetupSupport; end. diff --git a/rtl/x86_64/cpu.pp b/rtl/x86_64/cpu.pp index 990eec5feb..05197dee5c 100644 --- a/rtl/x86_64/cpu.pp +++ b/rtl/x86_64/cpu.pp @@ -40,6 +40,8 @@ unit cpu; function F16CSupport: boolean;inline; function RDRANDSupport: boolean;inline; function RTMSupport: boolean;inline; + function BMI1Support: boolean;inline; + function BMI2Support: boolean;inline; var is_sse3_cpu : boolean = false; @@ -62,7 +64,9 @@ unit cpu; _MOVBESupport, _F16CSupport, _RDRANDSupport, - _RTMSupport: boolean; + _RTMSupport, + _BMI1Support, + _BMI2Support: boolean; function InterlockedCompareExchange128(var Target: Int128Rec; NewValue: Int128Rec; Comperand: Int128Rec): Int128Rec; assembler; { @@ -181,7 +185,9 @@ unit cpu; movl %ebx,_ebx end ['rax','rbx','rcx','rdx']; _AVX2Support:=_AVXSupport and ((_ebx and $20)<>0); - _RTMSupport:=((_ebx and $800)<>0); + _BMI1Support:=(_ebx and $8)<>0; + _BMI2Support:=(_ebx and $100)<>0; + _RTMSupport:=(_ebx and $800)<>0; end; @@ -255,6 +261,19 @@ unit cpu; result:=_RTMSupport; end; + + function BMI1Support: boolean;inline; + begin + result:=_BMI1Support; + end; + + + function BMI2Support: boolean;inline; + begin + result:=_BMI2Support; + end; + + begin SetupSupport; end.