소스 검색

* patch by lag programming to replace bitcnt by popcnt, resolves #40962

florian 9 달 전
부모
커밋
5d4bb6db9b
2개의 변경된 파일2개의 추가작업 그리고 36개의 파일을 삭제
  1. 1 18
      compiler/x86/aasmcpu.pas
  2. 1 18
      tests/utils/avx/asmtestgenerator.pas

+ 1 - 18
compiler/x86/aasmcpu.pas

@@ -5019,23 +5019,6 @@ implementation
 
       hs1,hs2 : String;
 
-      function bitcnt(aValue: int64): integer;
-      var
-        i: integer;
-      begin
-        result := 0;
-
-        for i := 0 to 63 do
-        begin
-          if (aValue mod 2) = 1 then
-          begin
-            inc(result);
-          end;
-
-          aValue := aValue shr 1;
-        end;
-      end;
-
     begin
       new(InsTabMemRefSizeInfoCache);
       FillChar(InsTabMemRefSizeInfoCache^,sizeof(TInsTabMemRefSizeInfoCache),0);
@@ -5322,7 +5305,7 @@ implementation
                          OT_SHORT: ; // ignore
                          else
                            begin
-                             bitcount := bitcnt(actMemSize);
+                             bitcount := popcnt(qword(actMemSize));
 
                              if bitcount > 1 then MRefInfo := msiMultiple
                              else InternalError(777203);

+ 1 - 18
tests/utils/avx/asmtestgenerator.pas

@@ -616,23 +616,6 @@ const
     ExistsCode337     : boolean;
     ExistsSSEAVXReg   : boolean;
 
-    function bitcnt(aValue: int64): integer;
-    var
-      i: integer;
-    begin
-      result := 0;
-
-      for i := 0 to 63 do
-      begin
-        if (aValue mod 2) = 1 then
-        begin
-          inc(result);
-        end;
-
-        aValue := aValue shr 1;
-      end;
-    end;
-
   begin
     new(InsTabMemRefSizeInfoCache);
     FillChar(InsTabMemRefSizeInfoCache^,sizeof(TInsTabMemRefSizeInfoCache),0);
@@ -920,7 +903,7 @@ const
                        OT_SHORT: ; // ignore
                        else
                          begin
-                           bitcount := bitcnt(actMemSize);
+                           bitcount := popcnt(qword(actMemSize));
 
                            if bitcount > 1 then MRefInfo := msiMultiple
                            else;