瀏覽代碼

* x86: Fixed optimisation where OptPass2Movx didn't search ahead properly for shift/rotate instructions

J. Gareth "Curious Kit" Moreton 3 月之前
父節點
當前提交
075985568b
共有 1 個文件被更改,包括 3 次插入5 次删除
  1. 3 5
      compiler/x86/aoptx86.pas

+ 3 - 5
compiler/x86/aoptx86.pas

@@ -12001,13 +12001,11 @@ unit aoptx86;
             )
             )
           ) and
           ) and
           MatchInstruction(hp1, [A_SHL, A_SHR, A_SAR, A_ROR, A_ROL, A_RCR, A_RCL], []) and
           MatchInstruction(hp1, [A_SHL, A_SHR, A_SAR, A_ROR, A_ROL, A_RCR, A_RCL], []) and
-          (taicpu(hp1).oper[0]^.typ = top_reg) { This is enough to determine that it's %cl } then
+          (taicpu(hp1).oper[0]^.typ = top_reg) { This is enough to determine that it's %cl } and
+          not RegInOp(NR_ECX, taicpu(hp1).oper[1]^) then
           begin
           begin
             TransferUsedRegs(TmpUsedRegs);
             TransferUsedRegs(TmpUsedRegs);
-            hp2 := p;
-            repeat
-              UpdateUsedRegs(TmpUsedRegs, tai(hp2.Next));
-            until not GetNextInstruction(hp2, hp2) or (hp2 = hp1);
+            UpdateUsedRegsBetween(TmpUsedRegs, p, hp1);
 
 
             if not RegUsedAfterInstruction(NR_CL, hp1, TmpUsedRegs) then
             if not RegUsedAfterInstruction(NR_CL, hp1, TmpUsedRegs) then
               begin
               begin