Explorar o código

* fix and improve MovImul2Imul: we cannot insert the move target into imul if the imul is 64 bit and the mov 32 bit as
we cannot ensure that the upper 32 bits of the move target are really clear

git-svn-id: trunk@43447 -

florian %!s(int64=5) %!d(string=hai) anos
pai
achega
7464c88003
Modificáronse 1 ficheiros con 4 adicións e 4 borrados
  1. 4 4
      compiler/x86/aoptx86.pas

+ 4 - 4
compiler/x86/aoptx86.pas

@@ -3164,18 +3164,18 @@ unit aoptx86;
            GetLastInstruction(p,hp1) and
            GetLastInstruction(p,hp1) and
            MatchInstruction(hp1,A_MOV,[]) and
            MatchInstruction(hp1,A_MOV,[]) and
            MatchOpType(taicpu(hp1),top_reg,top_reg) and
            MatchOpType(taicpu(hp1),top_reg,top_reg) and
-           ((taicpu(hp1).oper[1]^.reg = taicpu(p).oper[1]^.reg) or
-            ((taicpu(hp1).opsize=S_L) and (taicpu(p).opsize=S_Q) and SuperRegistersEqual(taicpu(hp1).oper[1]^.reg,taicpu(p).oper[1]^.reg))) then
+           (taicpu(hp1).oper[1]^.reg = taicpu(p).oper[1]^.reg) then
           begin
           begin
             TransferUsedRegs(TmpUsedRegs);
             TransferUsedRegs(TmpUsedRegs);
-            if not(RegUsedAfterInstruction(taicpu(p).oper[1]^.reg,p,TmpUsedRegs)) then
+            if not(RegUsedAfterInstruction(taicpu(p).oper[1]^.reg,p,TmpUsedRegs)) or
+              ((taicpu(p).ops = 3) and (taicpu(p).oper[1]^.reg=taicpu(p).oper[2]^.reg)) then
               { change
               { change
                   mov reg1,reg2
                   mov reg1,reg2
                   imul y,reg2 to imul y,reg1,reg2 }
                   imul y,reg2 to imul y,reg1,reg2 }
               begin
               begin
                 taicpu(p).ops := 3;
                 taicpu(p).ops := 3;
+                taicpu(p).loadreg(2,taicpu(p).oper[1]^.reg);
                 taicpu(p).loadreg(1,taicpu(hp1).oper[0]^.reg);
                 taicpu(p).loadreg(1,taicpu(hp1).oper[0]^.reg);
-                taicpu(p).loadreg(2,taicpu(hp1).oper[1]^.reg);
                 DebugMsg(SPeepholeOptimization + 'MovImul2Imul done',p);
                 DebugMsg(SPeepholeOptimization + 'MovImul2Imul done',p);
                 asml.remove(hp1);
                 asml.remove(hp1);
                 hp1.free;
                 hp1.free;