Browse Source

* x86: JccMovJmpMov2CMovCMov will no longer move
MOV instructions (fixes i40122)

J. Gareth "Curious Kit" Moreton 2 years ago
parent
commit
4d676cd6fa
1 changed files with 2 additions and 14 deletions
  1. 2 14
      compiler/x86/aoptx86.pas

+ 2 - 14
compiler/x86/aoptx86.pas

@@ -12407,25 +12407,13 @@ unit aoptx86;
                                       if there are any opposing CMOV pairs that
                                       if there are any opposing CMOV pairs that
                                       write to the same register }
                                       write to the same register }
                                     for x := 0 to w - 1 do
                                     for x := 0 to w - 1 do
-                                      if RegWrites[x] = taicpu(hp1).oper[1]^.reg then
+                                      if (RegWrites[x] = taicpu(hp1).oper[1]^.reg) then
                                         begin
                                         begin
-                                          { We have a match.  Move this instruction
-                                            right to the top }
+                                          { We have a match.  Keep this as a MOV }
 
 
-                                          hp2 := hp1;
                                           { Move ahead in preparation }
                                           { Move ahead in preparation }
                                           GetNextInstruction(hp1, hp1);
                                           GetNextInstruction(hp1, hp1);
 
 
-                                          asml.Remove(hp2);
-                                          asml.InsertAfter(hp2, hp_prev);
-
-                                          { Note we can't use the trick of inserting before hp_prev
-                                            and then calling TrySwapMovOp with hp_prev2, like with
-                                            the MOV imm,reg optimisations, because hp2 may share a
-                                            register with the comparison }
-                                          if (hp_prev <> p) then
-                                            TrySwapMovCmp(hp_prev, hp2);
-
                                           RegMatch := True;
                                           RegMatch := True;
                                           Break;
                                           Break;
                                         end;
                                         end;