Browse Source

* Ensure the number of operands is 2 for MOVXX instructions in OptPass1MOVXX. Otherwise the classic MOVSD/W/B no-operand instructions (REP MOVSX) cause AV during checks of operands. The AV is thrown when trying to compile ucomplex.pp with -Cfsse3.
* Also fixed generation of debug comments in OptPass1MOVXX.

git-svn-id: trunk@36295 -

yury 8 years ago
parent
commit
884cb758e7
1 changed files with 4 additions and 1 deletions
  1. 4 1
      compiler/x86/aoptx86.pas

+ 4 - 1
compiler/x86/aoptx86.pas

@@ -1622,7 +1622,10 @@ unit aoptx86;
         hp1 : tai;
       begin
         Result:=false;
+        if taicpu(p).opercnt <> 2 then
+          exit;
         if GetNextInstruction(p,hp1) and
+          (taicpu(hp1).opercnt = 2) and
           MatchInstruction(hp1,taicpu(p).opcode,[taicpu(p).opsize]) then
           begin
             if (taicpu(hp1).oper[0]^.typ = taicpu(p).oper[1]^.typ) and
@@ -1651,8 +1654,8 @@ unit aoptx86;
                           begin
                             asml.remove(p);
                             p.free;
-                            DebugMsg('PeepHole Optimization MovXXMovXX2Nop 1 done',p);
                             GetNextInstruction(hp1,p);
+                            DebugMsg('PeepHole Optimization MovXXMovXX2Nop 1 done',p);
                           end
                         else
                           DebugMsg('PeepHole Optimization MovXXMovXX2MoVXX 1 done',p);