Browse Source

Replace DBRA instruction for Coldfire with a SUB/BRA combination in the for-loop-code-
generation and the assembly helpers in the RTL as DBRA is not supported by Coldfire.

git-svn-id: trunk@22740 -

svenbarth 12 years ago
parent
commit
43d8da7aa3
2 changed files with 33 additions and 1 deletions
  1. 8 1
      compiler/m68k/cgcpu.pas
  2. 25 0
      rtl/m68k/m68k.inc

+ 8 - 1
compiler/m68k/cgcpu.pas

@@ -1440,7 +1440,14 @@ unit cgcpu;
                    a_label(list,hl);
                    list.concat(taicpu.op_ref_ref(A_MOVE,S_B,hp1,hp2));
                    a_label(list,hl2);
-                   list.concat(taicpu.op_reg_sym(A_DBRA,S_L,hregister,hl));
+                   if current_settings.cputype=cpu_coldfire then
+                     begin
+                       { Coldfire does not support DBRA }
+                       list.concat(taicpu.op_const_reg(A_SUB,S_L,1,hregister));
+                       list.concat(taicpu.op_sym(A_BMI,S_L,hl));
+                     end
+                   else
+                     list.concat(taicpu.op_reg_sym(A_DBRA,S_L,hregister,hl));
                 end;
 
               { restore the registers that we have just used olny if they are used! }

+ 25 - 0
rtl/m68k/m68k.inc

@@ -95,7 +95,12 @@ procedure FillChar(var x;count:longint;value:byte); assembler;
    @LMEMSET4:             { fast loop mode section 68010+ }
      move.b d0,(a0)+
    @LMEMSET3:
+{$ifdef CPUCOLDFIRE}
+     sub.l #1,d1
+     bmi @LMEMSET4
+{$else}
      dbra d1,@LMEMSET4
+{$endif}
 
    @LMEMSET5:
     end ['d0','d1','a0'];
@@ -137,7 +142,12 @@ asm
 @LMSTRCOPY56:         { 68010 Fast loop mode }
    move.b (a0)+,(a1)+
 @LMSTRCOPY55:
+{$ifdef CPUCOLDFIRE}
+   sub.l #1,d1
+   bmi @LMSTRCOPY56
+{$else}
    dbra  d1,@LMSTRCOPY56
+{$endif}
 @Lend:
 end;
 
@@ -172,7 +182,12 @@ procedure strconcat(s1,s2 : pointer);[public,alias: 'STRCONCAT'];
 @Loop:
       move.b  (a1)+,(a0)+          { s1[i] := s2[i];             }
 @ALoop:
+{$ifdef CPUCOLDFIRE}
+      sub.l   #1,d6
+      bmi     @Loop
+{$else}
       dbra    d6,@Loop
+{$endif}
       move.l  s1,a0
       add.b   d0,(a0)              { change to new string length }
 @Lend:
@@ -270,12 +285,22 @@ begin
   @LMOVE01:
     move.b   -(a0),-(a1)   {  (s < d) copy loop }
   @LMOVE02:
+{$ifdef CPUCOLDFIRE}
+    sub.l     #1,d0
+    bmi       @LMOVE01
+{$else}
     dbra      d0,@LMOVE01
+{$endif}
     bra       @LMOVE5
   @LMOVE03:
     move.b  (a0)+,(a1)+  { (s >= d) copy loop }
   @LMOVE04:
+{$ifdef CPUCOLDFIRE}
+    sub.l     #1,d0
+    bmi       @LMOVE03
+{$else}
     dbra      d0,@LMOVE03
+{$endif}
   { end fast loop mode }
   @LMOVE5:
   end ['d0','a0','a1'];