Browse Source

tiny optimization for clearing address regs

git-svn-id: trunk@26569 -
Károly Balogh 11 years ago
parent
commit
667ec17cae
1 changed files with 5 additions and 1 deletions
  1. 5 1
      compiler/m68k/cgcpu.pas

+ 5 - 1
compiler/m68k/cgcpu.pas

@@ -715,7 +715,11 @@ unit cgcpu;
       begin
       begin
         if isaddressregister(register) then
         if isaddressregister(register) then
          begin
          begin
-           list.concat(taicpu.op_const_reg(A_MOVE,S_L,longint(a),register))
+           { an m68k manual I have recommends SUB Ax,Ax to be used instead of CLR for address regs }
+           if a = 0 then
+             list.concat(taicpu.op_reg_reg(A_SUB,S_L,register,register))
+           else
+             list.concat(taicpu.op_const_reg(A_MOVE,S_L,longint(a),register));
          end
          end
         else
         else
         if a = 0 then
         if a = 0 then