Browse Source

+ recognize xor reg,reg (same register twice) and sub reg,reg as writing a new
value to reg in TX86AsmOptimizer.RegLoadedWithNewValue

git-svn-id: trunk@36112 -

nickysn 8 years ago
parent
commit
85fbbec319
1 changed files with 5 additions and 1 deletions
  1. 5 1
      compiler/x86/aoptx86.pas

+ 5 - 1
compiler/x86/aoptx86.pas

@@ -486,7 +486,11 @@ unit aoptx86;
           (((p.opcode = A_FSTSW) or
             (p.opcode = A_FNSTSW)) and
            (p.oper[0]^.typ=top_reg) and
-           Reg1WriteOverwritesReg2Entirely(p.oper[0]^.reg,reg));
+           Reg1WriteOverwritesReg2Entirely(p.oper[0]^.reg,reg)) or
+          (((p.opcode = A_XOR) or (p.opcode = A_SUB)) and
+           (p.oper[0]^.typ=top_reg) and (p.oper[1]^.typ=top_reg) and
+           (p.oper[0]^.reg=p.oper[1]^.reg) and
+           Reg1WriteOverwritesReg2Entirely(p.oper[1]^.reg,reg));
       end;