really fixed FillChar and fixed FillWord. fixes 8 tests.

git-svn-id: trunk@25621 -
This commit is contained in:
Károly Balogh 2013-10-02 12:33:52 +00:00
parent 2a9916baba
commit e27db65085

View File

@ -87,34 +87,36 @@ end;
{$define FPC_SYSTEM_HAS_FILLCHAR} {$define FPC_SYSTEM_HAS_FILLCHAR}
procedure FillChar(var x;count:longint;value:byte); assembler; procedure FillChar(var x; count : longint; value : byte); assembler;
asm asm
move.l x, a0 { destination } move.l x, a0 { destination }
move.l count, d1 { number of bytes to fill } move.l count, d1 { number of bytes to fill }
move.b value, d0 { fill data } { FIXME: this should be move.b, but everything is pushed as long on
tst.l d1 { anything to fill at all? } the stack ATM (KB) }
beq @LMEMSET5 move.l value, d0 { fill data }
tst.l d1 { anything to fill at all? }
beq @LMEMSET5
{$ifdef CPUM68K_HAS_DBRA} {$ifdef CPUM68K_HAS_DBRA}
cmpi.l #65535, d1 { check, if this is a word move } { FIXME: Any reason why not always just use DBRA mode on
ble @LMEMSET3 { use fast dbra mode } CPUs which support it? (KB) }
cmpi.l #65535, d1 { check, if this is a word move }
ble @LMEMSET3 { use fast dbra mode }
{$endif CPUM68K_HAS_DBRA} {$endif CPUM68K_HAS_DBRA}
bra @LMEMSET2 bra @LMEMSET2
@LMEMSET1: @LMEMSET1:
move.b d0,(a0)+ move.b d0,(a0)+
@LMEMSET2: @LMEMSET2:
subq.l #1,d1 subq.l #1,d1
bpl @LMEMSET1 bpl @LMEMSET1
bra @LMEMSET5 { finished slow mode , exit } bra @LMEMSET5 { finished slow mode , exit }
{$ifdef CPUM68K_HAS_DBRA} {$ifdef CPUM68K_HAS_DBRA}
@LMEMSET4: { fast loop mode section 68010+ } @LMEMSET4: { fast loop mode section 68010+ }
move.b d0,(a0)+ move.b d0,(a0)+
@LMEMSET3: @LMEMSET3:
dbra d1,@LMEMSET4 dbra d1,@LMEMSET4
{$endif CPUM68K_HAS_DBRA} {$endif CPUM68K_HAS_DBRA}
@LMEMSET5:
@LMEMSET5: end;
end ['d0','d1','a0'];
{$ifdef dummy} {$ifdef dummy}
@ -315,24 +317,23 @@ end;
{$define FPC_SYSTEM_HAS_FILLWORD} {$define FPC_SYSTEM_HAS_FILLWORD}
procedure fillword(var x;count : longint;value : word); procedure FillWord(var x; count : longint; value : word); assembler;
begin asm
asm move.l x, a0 { destination }
move.l x, a0 { destination } move.l count, d1 { number of bytes to fill }
move.l count, d1 { number of bytes to fill } { FIXME: this should be move.w, but everything is pushed as long on
move.w value, d0 { fill data } the stack ATM (KB) }
tst.l d1 { anything to fill at all? } move.l value, d0 { fill data }
beq @LMEMSET3 tst.l d1 { anything to fill at all? }
bra @LMEMSET21 beq @LMEMSET3
@LMEMSET11: bra @LMEMSET21
move.w d0,(a0)+ @LMEMSET11:
@LMEMSET21: move.w d0,(a0)+
subq.l #1,d1 @LMEMSET21:
cmp.b #-1,d1 subq.l #1,d1
bne @LMEMSET11 bpl @LMEMSET11
@LMEMSET3: @LMEMSET3:
end ['d0','d1','a0']; end;
end;
{$define FPC_SYSTEM_HAS_ABS_LONGINT} {$define FPC_SYSTEM_HAS_ABS_LONGINT}