فهرست منبع

Only perform OpCp2Op optimization when the first Op is ANDI and comparison is against 0.

(cherry picked from commit f83a8f0f8f3b25f461790e8778d6688549427017)
ccrause 2 سال پیش
والد
کامیت
aadb53e72c
1فایلهای تغییر یافته به همراه4 افزوده شده و 4 حذف شده
  1. 4 4
      compiler/avr/aoptcpu.pas

+ 4 - 4
compiler/avr/aoptcpu.pas

@@ -304,10 +304,10 @@ Implementation
           begin
             {
               change
-              <op> reg,x,y
+              <op> reg,x
               cp reg,r1
               into
-              <op>s reg,x,y
+              <op>s reg,x
             }
             { this optimization can applied only to the currently enabled operations because
               the other operations do not update all flags and FPC does not track flag usage }
@@ -327,13 +327,13 @@ Implementation
                 (taicpu(p).opcode = A_ANDI) and
                 (taicpu(p).oper[1]^.typ=top_const) and
                 (taicpu(hp1).oper[1]^.typ=top_const) and
-                (taicpu(p).oper[1]^.val=taicpu(hp1).oper[1]^.val))) and
+                (taicpu(hp1).oper[1]^.val=0))) and
               GetNextInstruction(hp1, hp2) and
               { be careful here, following instructions could use other flags
                 however after a jump fpc never depends on the value of flags }
               { All above instructions set Z and N according to the following
                 Z := result = 0;
-                N := result[31];
+                N := result[7];
                 EQ = Z=1; NE = Z=0;
                 MI = N=1; PL = N=0; }
               MatchInstruction(hp2, A_BRxx) and