* basic work to make Move() and FillChar() internal under ifdef INTERNALMOVEFILLCHAR

git-svn-id: trunk@3021 -
This commit is contained in:
peter 2006-03-24 17:32:39 +00:00
parent 4e5319a581
commit 2d3c01d83a
6 changed files with 105 additions and 1 deletions

View File

@ -796,6 +796,7 @@ const
fastmoveproc_forward : pointer = @Forwards_IA32_3;
fastmoveproc_backward : pointer = @Backwards_IA32_3;
{$ifndef INTERNALMOVEFILLCHAR}
procedure Move(const source;var dest;count:SizeInt);[public, alias: 'FPC_MOVE'];assembler;nostackframe;
asm
cmp ecx,SMALLMOVESIZE
@ -826,6 +827,7 @@ asm
jmp dword ptr fastmoveproc_backward {Source/Dest Overlap}
@Done:
end;
{$endif INTERNALMOVEFILLCHAR}
{$asmmode att}

View File

@ -88,8 +88,10 @@ function mmx_support : boolean;
mmx_support:=false;
end;
{$ifndef INTERNALMOVEFILLCHAR}
{$define USE_FASTMOVE}
{$i fastmove.inc}
{$endif INTERNALMOVEFILLCHAR}
procedure fpc_cpuinit;
begin
@ -105,6 +107,81 @@ procedure fpc_cpuinit;
{$ifndef FPC_SYSTEM_HAS_MOVE}
{$define FPC_SYSTEM_HAS_MOVE}
{$ifdef INTERNALMOVEFILLCHAR}
procedure SysMoveForward(const source;var dest;count:SizeInt);assembler;
var
saveesi,saveedi : longint;
asm
movl %edi,saveedi
movl %esi,saveesi
movl %eax,%esi
movl %edx,%edi
movl %ecx,%edx
cld
cmpl $15,%edx
jl .LFMove1
movl %edi,%ecx { Align on 32bits }
negl %ecx
andl $3,%ecx
subl %ecx,%edx
rep
movsb
movl %edx,%ecx
andl $3,%edx
shrl $2,%ecx
rep
movsl
.LFMove1:
movl %edx,%ecx
rep
movsb
movl saveedi,%edi
movl saveesi,%esi
end;
procedure SysMoveBackward(const source;var dest;count:SizeInt);assembler;
var
saveesi,saveedi : longint;
asm
movl %edi,saveedi
movl %esi,saveesi
movl %eax,%esi
movl %edx,%edi
movl %ecx,%edx
std
addl %edx,%esi
addl %edx,%edi
movl %edi,%ecx
decl %esi
decl %edi
cmpl $15,%edx
jl .LBMove1
negl %ecx { Align on 32bits }
andl $3,%ecx
subl %ecx,%edx
rep
movsb
movl %edx,%ecx
andl $3,%edx
shrl $2,%ecx
subl $3,%esi
subl $3,%edi
rep
movsl
addl $3,%esi
addl $3,%edi
.LBMove1:
movl %edx,%ecx
rep
movsb
cld
movl saveedi,%edi
movl saveesi,%esi
end;
{$else INTERNALMOVEFILLCHAR}
procedure Move(const source;var dest;count:SizeInt);[public, alias: 'FPC_MOVE'];assembler;
var
saveesi,saveedi : longint;
@ -184,13 +261,18 @@ asm
movl saveedi,%edi
movl saveesi,%esi
end;
{$endif INTERNALMOVEFILLCHAR}
{$endif FPC_SYSTEM_HAS_MOVE}
{$ifndef FPC_SYSTEM_HAS_FILLCHAR}
{$define FPC_SYSTEM_HAS_FILLCHAR}
{$ifdef INTERNALMOVEFILLCHAR}
Procedure SysFillChar(var x;count:SizeInt;value:byte);assembler;
{$else INTERNALMOVEFILLCHAR}
Procedure FillChar(var x;count:SizeInt;value:byte);assembler;
{$endif INTERNALMOVEFILLCHAR}
asm
{A push is prefered over a local variable because a local
variable causes the compiler to generate a stackframe.}

View File

@ -73,12 +73,14 @@ end;
{$endif FPC_SYSTEM_HAS_FILLCHAR}
{$ifndef INTERNALMOVEFILLCHAR}
{$ifndef FPC_SYSTEM_HAS_FILLBYTE}
procedure FillByte (var x;count : SizeInt;value : byte );
begin
FillChar (X,Count,CHR(VALUE));
end;
{$endif not FPC_SYSTEM_HAS_FILLBYTE}
{$endif INTERNALMOVEFILLCHAR}
{$ifndef FPC_SYSTEM_HAS_FILLWORD}

View File

@ -62,6 +62,8 @@ const
fpc_in_leave = 51; {macpas}
fpc_in_cycle = 52; {macpas}
fpc_in_slice = 53;
fpc_in_move_x = 54;
fpc_in_fillchar_x = 55;
{ Internal constant functions }
fpc_in_const_sqr = 100;

View File

@ -139,6 +139,7 @@ function CheckInitialStkLen(stklen : SizeUInt) : SizeUInt; forward;
{$define SYSPROCDEFINED}
{$endif cpuarm}
{$ifndef INTERNALMOVEFILLCHAR}
procedure fillchar(var x;count : SizeInt;value : boolean);{$ifdef SYSTEMINLINE}inline;{$endif}
begin
fillchar(x,count,byte(value));
@ -148,6 +149,7 @@ procedure fillchar(var x;count : SizeInt;value : char);{$ifdef SYSTEMINLINE}inli
begin
fillchar(x,count,byte(value));
end;
{$endif INTERNALMOVEFILLCHAR}
{ Include generic pascal only routines which are not defined in the processor
specific include file }

View File

@ -339,6 +339,7 @@ var
{ Threading support }
fpc_threadvar_relocate_proc : pointer; public name 'FPC_THREADVAR_RELOCATE';
ThreadVar
ThreadID : TThreadID;
{ Standard In- and Output }
@ -368,11 +369,18 @@ ThreadVar
{$endif}
{$endif}
{$ifdef INTERNALMOVEFILLCHAR}
Procedure SysMoveForward(const source;var dest;count:SizeInt);
Procedure SysMoveBackward(const source;var dest;count:SizeInt);
Procedure SysFillChar(var x;count:SizeInt;Value:Byte);
procedure FillByte(var x;count:SizeInt;value:byte);[INTERNPROC: fpc_in_fillchar_x];
{$else INTERNALMOVEFILLCHAR}
Procedure Move(const source;var dest;count:SizeInt);{$ifdef INLINEGENERICS}inline;{$endif}
Procedure FillChar(var x;count:SizeInt;Value:Boolean);{$ifdef SYSTEMINLINE}inline;{$endif}
Procedure FillChar(var x;count:SizeInt;Value:Char);{$ifdef SYSTEMINLINE}inline;{$endif}
Procedure FillChar(var x;count:SizeInt;Value:Byte);{$ifdef INLINEGENERICS}inline;{$endif}
procedure FillByte(var x;count:SizeInt;value:byte);{$ifdef INLINEGENERICS}inline;{$endif}
{$endif INTERNALMOVEFILLCHAR}
Procedure FillWord(var x;count:SizeInt;Value:Word);
procedure FillDWord(var x;count:SizeInt;value:DWord);
function IndexChar(const buf;len:SizeInt;b:char):SizeInt;
@ -388,6 +396,12 @@ function IndexChar0(const buf;len:SizeInt;b:char):SizeInt;
function CompareChar0(const buf1,buf2;len:SizeInt):SizeInt;{$ifdef INLINEGENERICS}inline;{$endif}
procedure prefetch(const mem);[internproc:fpc_in_prefetch_var];
{$ifdef INTERNALMOVEFILLCHAR}
var
fpc_moveforward_proc : pointer = @SysMoveForward public name 'FPC_MOVEFORWARD_PROC';
fpc_movebackward_proc : pointer = @SysMoveBackward public name 'FPC_MOVEBACKWARD_PROC';
fpc_fillchar_proc : pointer = @SysFillChar public name 'FPC_FILLCHAR_PROC';
{$endif INTERNALMOVEFILLCHAR}
{****************************************************************************
Math Routines