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

@ -91,10 +91,14 @@ procedure FillChar(var x;count:longint;value:byte); assembler;
asm
move.l x, a0 { destination }
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
the stack ATM (KB) }
move.l value, d0 { fill data }
tst.l d1 { anything to fill at all? }
beq @LMEMSET5
{$ifdef CPUM68K_HAS_DBRA}
{ FIXME: Any reason why not always just use DBRA mode on
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}
@ -105,16 +109,14 @@ procedure FillChar(var x;count:longint;value:byte); assembler;
subq.l #1,d1
bpl @LMEMSET1
bra @LMEMSET5 { finished slow mode , exit }
{$ifdef CPUM68K_HAS_DBRA}
@LMEMSET4: { fast loop mode section 68010+ }
move.b d0,(a0)+
@LMEMSET3:
dbra d1,@LMEMSET4
{$endif CPUM68K_HAS_DBRA}
@LMEMSET5:
end ['d0','d1','a0'];
end;
{$ifdef dummy}
@ -315,12 +317,13 @@ end;
{$define FPC_SYSTEM_HAS_FILLWORD}
procedure fillword(var x;count : longint;value : word);
begin
procedure FillWord(var x; count : longint; value : word); assembler;
asm
move.l x, a0 { destination }
move.l count, d1 { number of bytes to fill }
move.w value, d0 { fill data }
{ FIXME: this should be move.w, but everything is pushed as long on
the stack ATM (KB) }
move.l value, d0 { fill data }
tst.l d1 { anything to fill at all? }
beq @LMEMSET3
bra @LMEMSET21
@ -328,10 +331,8 @@ procedure fillword(var x;count : longint;value : word);
move.w d0,(a0)+
@LMEMSET21:
subq.l #1,d1
cmp.b #-1,d1
bne @LMEMSET11
bpl @LMEMSET11
@LMEMSET3:
end ['d0','d1','a0'];
end;