Sfoglia il codice sorgente

+ use TX86AsmOptimizer.OptPass1SHLSAL on x86-64

git-svn-id: trunk@38499 -
florian 7 anni fa
parent
commit
5fbecc5501
2 ha cambiato i file con 14 aggiunte e 5 eliminazioni
  1. 12 5
      compiler/x86/aoptx86.pas
  2. 2 0
      compiler/x86_64/aoptcpu.pas

+ 12 - 5
compiler/x86/aoptx86.pas

@@ -2082,7 +2082,7 @@ unit aoptx86;
       begin
       begin
         Result:=false;
         Result:=false;
         if MatchOpType(taicpu(p),top_const,top_reg) and
         if MatchOpType(taicpu(p),top_const,top_reg) and
-           (taicpu(p).opsize = S_L) and
+           (taicpu(p).opsize in [S_L{$ifdef x86_64},S_Q{$endif x86_64}]) and
            (taicpu(p).oper[0]^.val <= 3) then
            (taicpu(p).oper[0]^.val <= 3) then
           { Changes "shl const, %reg32; add const/reg, %reg32" to one lea statement }
           { Changes "shl const, %reg32; add const/reg, %reg32" to one lea statement }
           begin
           begin
@@ -2143,10 +2143,14 @@ unit aoptx86;
                       hp1.free;
                       hp1.free;
                     end;
                     end;
               end;
               end;
-            if TmpBool2 or
+            if TmpBool2
+{$ifndef x86_64}
+               or
                ((current_settings.optimizecputype < cpu_Pentium2) and
                ((current_settings.optimizecputype < cpu_Pentium2) and
                (taicpu(p).oper[0]^.val <= 3) and
                (taicpu(p).oper[0]^.val <= 3) and
-               not(cs_opt_size in current_settings.optimizerswitches)) then
+               not(cs_opt_size in current_settings.optimizerswitches))
+{$endif x86_64}
+              then
               begin
               begin
                 if not(TmpBool2) and
                 if not(TmpBool2) and
                     (taicpu(p).oper[0]^.val = 1) then
                     (taicpu(p).oper[0]^.val = 1) then
@@ -2155,13 +2159,14 @@ unit aoptx86;
                       taicpu(p).oper[1]^.reg, taicpu(p).oper[1]^.reg)
                       taicpu(p).oper[1]^.reg, taicpu(p).oper[1]^.reg)
                   end
                   end
                 else
                 else
-                  hp1 := taicpu.op_ref_reg(A_LEA, S_L, TmpRef,
+                  hp1 := taicpu.op_ref_reg(A_LEA, taicpu(p).opsize, TmpRef,
                               taicpu(p).oper[1]^.reg);
                               taicpu(p).oper[1]^.reg);
                 InsertLLItem(p.previous, p.next, hp1);
                 InsertLLItem(p.previous, p.next, hp1);
                 p.free;
                 p.free;
                 p := hp1;
                 p := hp1;
               end;
               end;
           end
           end
+{$ifndef x86_64}
         else if (current_settings.optimizecputype < cpu_Pentium2) and
         else if (current_settings.optimizecputype < cpu_Pentium2) and
           MatchOpType(taicpu(p),top_const,top_reg) then
           MatchOpType(taicpu(p),top_const,top_reg) then
           begin
           begin
@@ -2189,7 +2194,9 @@ unit aoptx86;
                p.free;
                p.free;
                p := hp1;
                p := hp1;
              end;
              end;
-          end;
+          end
+{$endif x86_64}
+          ;
       end;
       end;
 
 
 
 

+ 2 - 0
compiler/x86_64/aoptcpu.pas

@@ -112,6 +112,8 @@ uses
                 result:=OptPass1LEA(p);
                 result:=OptPass1LEA(p);
               A_SUB:
               A_SUB:
                 result:=OptPass1Sub(p);
                 result:=OptPass1Sub(p);
+              A_SHL,A_SAL:
+                result:=OptPass1SHLSAL(p);
             end;
             end;
           end;
           end;
         end;
         end;