Browse Source

m68k/cgcpu.pas, tcg68k.a_op_const_reg:
* use andi/ori for constant values
* use a scratch register if target is an address register (there seems to exist an omnious
anda/ora instruction though, but GNU as doesn't seem to handle it... maybe I haven't set
the CPU type correctly, so I'll need to investigate this so we can hopefully remove the
need for a scratch register for certain CPU types ;) )

git-svn-id: trunk@22732 -

svenbarth 12 years ago
parent
commit
f501a8fecc
1 changed files with 15 additions and 1 deletions
  1. 15 1
      compiler/m68k/cgcpu.pas

+ 15 - 1
compiler/m68k/cgcpu.pas

@@ -697,7 +697,21 @@ unit cgcpu;
           OP_AND,
           OP_OR:
               begin
-                 list.concat(taicpu.op_const_reg(topcg2tasmop[op],S_L,longint(a), reg));
+                { TODO: on Coldfire ORI/ANDI to CCR is not supported }
+                if op=OP_AND then
+                  opcode:=A_ANDI
+                else
+                  opcode:=A_ORI;
+                if isaddressregister(reg) then
+                  begin
+                    { use scratch register (there is a anda/ora though...) }
+                    scratch_reg:=getintregister(list,OS_INT);
+                    list.concat(taicpu.op_reg_reg(A_MOVE,S_L,reg,scratch_reg));
+                    list.concat(taicpu.op_const_reg(opcode,S_L,longint(a),scratch_reg));
+                    list.concat(taicpu.op_reg_reg(A_MOVE,S_L,scratch_reg,reg));
+                  end
+                else
+                  list.concat(taicpu.op_const_reg(topcg2tasmop[op],S_L,longint(a), reg));
               end;
           OP_DIV :
               begin