Browse Source

* do not emit TST.L #ofs(dX) instructions for the Coldfire

fixes an assembler error while compiling packages/fpgtk/src/fpgtk.pp for the Coldfire

git-svn-id: trunk@25637 -
Károly Balogh 12 years ago
parent
commit
6c0581da49
1 changed files with 13 additions and 2 deletions
  1. 13 2
      compiler/m68k/n68kcnv.pas

+ 13 - 2
compiler/m68k/n68kcnv.pas

@@ -165,6 +165,7 @@ implementation
         hlabel,
         oldTrueLabel,
         oldFalseLabel : tasmlabel;
+        tmpreference : treference;
       begin
          oldTrueLabel:=current_procinfo.CurrTrueLabel;
          oldFalseLabel:=current_procinfo.CurrFalseLabel;
@@ -209,8 +210,18 @@ implementation
                     { can we optimize it, or do we need to fix the ref. ? }
                     if isvalidrefoffset(left.location.reference) then
                       begin
-                        current_asmdata.CurrAsmList.concat(taicpu.op_ref(A_TST,TCGSize2OpSize[opsize],
-                           left.location.reference));
+                        { Coldfire cannot handle tst.l 123(dX) }
+                        if (current_settings.cputype in cpu_coldfire) and
+                           not (isaddressregister(left.location.reference.base)) then
+                          begin
+                            tmpreference:=left.location.reference;
+                            hreg2:=cg.getaddressregister(current_asmdata.CurrAsmList);
+                            tmpreference.base:=hreg2;
+                            current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_MOVE,S_L,left.location.reference.base,hreg2));
+                            current_asmdata.CurrAsmList.concat(taicpu.op_ref(A_TST,TCGSize2OpSize[opsize],tmpreference));
+                          end
+                        else
+                          current_asmdata.CurrAsmList.concat(taicpu.op_ref(A_TST,TCGSize2OpSize[opsize],left.location.reference));
                       end
                     else
                       begin