Ver código fonte

* do not use an extra register, if CPC does a comparison with 0,
this was previously "fixed" by the peephole optimizer, but this increased
register pressure

git-svn-id: trunk@31239 -

florian 10 anos atrás
pai
commit
d014572b8e
1 arquivos alterados com 9 adições e 3 exclusões
  1. 9 3
      compiler/avr/navradd.pas

+ 9 - 3
compiler/avr/navradd.pas

@@ -237,9 +237,15 @@ interface
               end;
             if right.location.loc=LOC_CONSTANT then
               begin
-                tmpreg2:=cg.getintregister(current_asmdata.CurrAsmList,OS_8);
-                cg.a_load_const_reg(current_asmdata.CurrAsmList,OS_8,(right.location.value64 shr ((i-1)*8)) and $ff,tmpreg2);
-                current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_CPC,tmpreg1,tmpreg2));
+                { just use R1? }
+                if ((right.location.value64 shr ((i-1)*8)) and $ff)=0 then
+                  current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_CPC,tmpreg1,NR_R1))
+                else
+                  begin
+                    tmpreg2:=cg.getintregister(current_asmdata.CurrAsmList,OS_8);
+                    cg.a_load_const_reg(current_asmdata.CurrAsmList,OS_8,(right.location.value64 shr ((i-1)*8)) and $ff,tmpreg2);
+                    current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_CPC,tmpreg1,tmpreg2));
+                  end;
               end
             { above it is checked, if left=0, then a constant is allowed }
             else if (left.location.loc=LOC_CONSTANT) and (left.location.value=0) then