Преглед изворни кода

Don't emit useless AND/BICs in ARM CG

In certain cases the CG would emit something like
bic r1, r0, #0
As BIC is clearing the specified bits this is equivalent to
mov r1, r0
This patch changes the CG to emit the mov instead which the register
allocator will hopefully remove most of the time.

git-svn-id: trunk@22024 -
masta пре 13 година
родитељ
комит
6529307d9e
1 измењених фајлова са 2 додато и 0 уклоњено
  1. 2 0
      compiler/arm/cgcpu.pas

+ 2 - 0
compiler/arm/cgcpu.pas

@@ -765,6 +765,8 @@ unit cgcpu;
               end
               end
             { BIC clears the specified bits, while AND keeps them, using BIC allows to use a
             { BIC clears the specified bits, while AND keeps them, using BIC allows to use a
               broader range of shifterconstants.}
               broader range of shifterconstants.}
+            else if (op = OP_AND) and (not(dword(a))=0) then
+              list.concat(taicpu.op_reg_reg(A_MOV,dst,src))
             else if (op = OP_AND) and is_shifter_const(not(dword(a)),shift) then
             else if (op = OP_AND) and is_shifter_const(not(dword(a)),shift) then
               list.concat(taicpu.op_reg_reg_const(A_BIC,dst,src,not(dword(a))))
               list.concat(taicpu.op_reg_reg_const(A_BIC,dst,src,not(dword(a))))
             else if (op = OP_AND) and split_into_shifter_const(not(dword(a)), imm1, imm2) then
             else if (op = OP_AND) and split_into_shifter_const(not(dword(a)), imm1, imm2) then