瀏覽代碼

* arm/a64: Fixed bug where shifter operand was not preserved in AND/CMP -> TST optimisation

J. Gareth "Curious Kit" Moreton 1 年之前
父節點
當前提交
f77b9fa4ef
共有 1 個文件被更改,包括 9 次插入1 次删除
  1. 9 1
      compiler/armgen/aoptarm.pas

+ 9 - 1
compiler/armgen/aoptarm.pas

@@ -1676,7 +1676,15 @@ Implementation
                   taicpu(p).oppostfix := PF_None;
                   taicpu(p).oppostfix := PF_None;
                   taicpu(p).loadreg(0, taicpu(p).oper[1]^.reg);
                   taicpu(p).loadreg(0, taicpu(p).oper[1]^.reg);
                   taicpu(p).loadoper(1, taicpu(p).oper[2]^);
                   taicpu(p).loadoper(1, taicpu(p).oper[2]^);
-                  taicpu(p).ops := 2;
+                  if (taicpu(p).ops = 4) then
+                    begin
+                      { Make sure any shifter operator is also transferred }
+                      taicpu(p).loadshifterop(2, taicpu(p).oper[3]^.shifterop^);
+                      taicpu(p).ops := 3;
+                    end
+                  else
+                    taicpu(p).ops := 2;
+
                   DebugMsg(SPeepholeOptimization + 'AND; CMP -> TST', p);
                   DebugMsg(SPeepholeOptimization + 'AND; CMP -> TST', p);
                 end
                 end
               else
               else