瀏覽代碼

+ functions to check for Popcnt support

git-svn-id: trunk@45827 -
florian 5 年之前
父節點
當前提交
c01db96df4
共有 2 個文件被更改,包括 19 次插入2 次删除
  1. 10 1
      rtl/i386/cpu.pp
  2. 9 1
      rtl/x86_64/cpu.pp

+ 10 - 1
rtl/i386/cpu.pp

@@ -35,6 +35,7 @@ unit cpu;
     function AVXSupport: boolean;inline;
     function AVX2Support: boolean;inline;
     function FMASupport: boolean;inline;
+    function POPCNTSupport: boolean;inline;
 
     var
       is_sse3_cpu : boolean = false;
@@ -48,7 +49,8 @@ unit cpu;
       _AVXSupport,
       _AVX2Support,
       _AESSupport,
-      _FMASupport : boolean;
+      _FMASupport,
+      _POPCNTSupport : boolean;
 
 
     function InterlockedCompareExchange128(var Target: Int128Rec; NewValue: Int128Rec; Comperand: Int128Rec): Int128Rec;
@@ -123,6 +125,7 @@ unit cpu;
                  popl %ebx
               end;
               _AESSupport:=(_ecx and $2000000)<>0;
+              _POPCNTSupport:=(_ecx and $800000)<>0;
 
               _AVXSupport:=
                 { XGETBV suspport? }
@@ -179,6 +182,12 @@ unit cpu;
         result:=_FMASupport;
       end;
 
+
+    function POPCNTSupport: boolean;inline;
+      begin
+        result:=_POPCNTSupport;
+      end;
+
 begin
   SetupSupport;
 end.

+ 9 - 1
rtl/x86_64/cpu.pp

@@ -33,6 +33,7 @@ unit cpu;
     function AVXSupport : boolean;inline;
     function AVX2Support: boolean;inline;
     function FMASupport: boolean;inline;
+    function POPCNTSupport: boolean;inline;
 
     var
       is_sse3_cpu : boolean = false;
@@ -48,7 +49,8 @@ unit cpu;
       _AVXSupport,
       _InterlockedCompareExchange128Support,
       _AVX2Support,
-      _FMASupport : boolean;
+      _FMASupport,
+      _POPCNTSupport: boolean;
 
     function InterlockedCompareExchange128(var Target: Int128Rec; NewValue: Int128Rec; Comperand: Int128Rec): Int128Rec; assembler;
      {
@@ -141,6 +143,7 @@ unit cpu;
         end ['rax','rbx','rcx','rdx'];
         _InterlockedCompareExchange128Support:=(_ecx and $2000)<>0;
         _AESSupport:=(_ecx and $2000000)<>0;
+        _POPCNTSupport:=(_ecx and $800000)<>0;
 
         _AVXSupport:=
           { XGETBV suspport? }
@@ -194,6 +197,11 @@ unit cpu;
       end;
 
 
+    function POPCNTSupport: boolean;inline;
+      begin
+        result:=_POPCNTSupport;
+      end;
+
 begin
   SetupSupport;
 end.