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}
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 }
tst.l d1 { anything to fill at all? }
beq @LMEMSET5
procedure FillChar(var x; count : longint; value : byte); assembler;
asm
move.l x, a0 { destination }
move.l count, d1 { number of bytes to fill }
{ 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}
cmpi.l #65535, d1 { check, if this is a word move }
ble @LMEMSET3 { use fast dbra mode }
{ 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}
bra @LMEMSET2
@LMEMSET1:
move.b d0,(a0)+
@LMEMSET2:
subq.l #1,d1
bpl @LMEMSET1
bra @LMEMSET5 { finished slow mode , exit }
bra @LMEMSET2
@LMEMSET1:
move.b d0,(a0)+
@LMEMSET2:
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
@LMEMSET4: { fast loop mode section 68010+ }
move.b d0,(a0)+
@LMEMSET3:
dbra d1,@LMEMSET4
{$endif CPUM68K_HAS_DBRA}
@LMEMSET5:
end ['d0','d1','a0'];
@LMEMSET5:
end;
{$ifdef dummy}
@ -315,24 +317,23 @@ end;
{$define FPC_SYSTEM_HAS_FILLWORD}
procedure fillword(var x;count : longint;value : word);
begin
asm
move.l x, a0 { destination }
move.l count, d1 { number of bytes to fill }
move.w value, d0 { fill data }
tst.l d1 { anything to fill at all? }
beq @LMEMSET3
bra @LMEMSET21
@LMEMSET11:
move.w d0,(a0)+
@LMEMSET21:
subq.l #1,d1
cmp.b #-1,d1
bne @LMEMSET11
@LMEMSET3:
end ['d0','d1','a0'];
end;
procedure FillWord(var x; count : longint; value : word); assembler;
asm
move.l x, a0 { destination }
move.l count, d1 { number of bytes to fill }
{ 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
@LMEMSET11:
move.w d0,(a0)+
@LMEMSET21:
subq.l #1,d1
bpl @LMEMSET11
@LMEMSET3:
end;
{$define FPC_SYSTEM_HAS_ABS_LONGINT}