* make strpas assembler function

This commit is contained in:
peter 2003-11-19 16:58:44 +00:00
parent ff7b561fc9
commit 5e5462edd1
3 changed files with 40 additions and 17 deletions

View File

@ -1151,7 +1151,7 @@ end;
{$define FPC_SYSTEM_HAS_FPC_PCHAR_TO_SHORTSTR} {$define FPC_SYSTEM_HAS_FPC_PCHAR_TO_SHORTSTR}
function fpc_pchar_to_shortstr(p:pchar):shortstring;[public,alias:'FPC_PCHAR_TO_SHORTSTR']; {$ifdef hascompilerproc} compilerproc; {$endif} function fpc_pchar_to_shortstr(p:pchar):shortstring;assembler;[public,alias:'FPC_PCHAR_TO_SHORTSTR']; {$ifdef hascompilerproc} compilerproc; {$endif}
{$include strpas.inc} {$include strpas.inc}
{$define FPC_SYSTEM_HAS_FPC_PCHAR_LENGTH} {$define FPC_SYSTEM_HAS_FPC_PCHAR_LENGTH}
@ -1426,7 +1426,10 @@ end;
{ {
$Log$ $Log$
Revision 1.53 2003-11-11 21:08:17 peter Revision 1.54 2003-11-19 16:58:44 peter
* make strpas assembler function
Revision 1.53 2003/11/11 21:08:17 peter
* REGCALL define added * REGCALL define added
Revision 1.52 2003/11/03 09:42:27 marco Revision 1.52 2003/11/03 09:42:27 marco

View File

@ -17,7 +17,7 @@
{$define FPC_UNIT_HAS_STRPAS} {$define FPC_UNIT_HAS_STRPAS}
function strpas(p : pchar) : string; function strpas(p : pchar) : string; assembler;
{$i strpas.inc} {$i strpas.inc}
{$define FPC_UNIT_HAS_STRPCOPY} {$define FPC_UNIT_HAS_STRPCOPY}
@ -25,31 +25,34 @@ function strpcopy(d : pchar;const s : string) : pchar;assembler;
var var
saveesi,saveedi : longint; saveesi,saveedi : longint;
asm asm
movl %edi,saveedi movl %edi,saveedi
movl %esi,saveesi movl %esi,saveesi
cld cld
{$ifdef REGCALL} {$ifdef REGCALL}
movl %eax,%edi // load destination address movl %eax,%edi // load destination address
movl %edx,%esi // Load Source adress movl %edx,%esi // Load Source adress
{$else} {$else}
movl s,%esi // Load Source adress movl s,%esi // Load Source adress
movl d,%edi // load destination address movl d,%edi // load destination address
{$endif} {$endif}
movzbl (%esi),%ecx // load length in ECX movzbl (%esi),%ecx // load length in ECX
incl %esi incl %esi
rep rep
movsb movsb
movb $0,(%edi) movb $0,(%edi)
{$ifndef REGCALL} {$ifndef REGCALL}
movl d,%eax // return value to EAX movl d,%eax // return value to EAX
{$endif} {$endif}
movl saveedi,%edi movl saveedi,%edi
movl saveesi,%esi movl saveesi,%esi
end; end;
{ {
$Log$ $Log$
Revision 1.10 2003-11-11 21:08:17 peter Revision 1.11 2003-11-19 16:58:44 peter
* make strpas assembler function
Revision 1.10 2003/11/11 21:08:17 peter
* REGCALL define added * REGCALL define added
Revision 1.9 2003/09/08 18:21:37 peter Revision 1.9 2003/09/08 18:21:37 peter

View File

@ -13,10 +13,16 @@
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
**********************************************************************} **********************************************************************}
begin var
saveres,saveebx,saveesi,saveedi : longint;
asm asm
movl %ebx,saveebx
movl %esi,saveesi
movl %edi,saveedi
{$ifdef regcall} {$ifdef regcall}
movl %eax,%esi movl p,%esi
movl __RESULT,%edi
movl __RESULT,saveres
{$else} {$else}
movl p,%esi movl p,%esi
{$endif} {$endif}
@ -24,7 +30,9 @@ asm
testl %esi,%esi testl %esi,%esi
movl %esi,%eax movl %esi,%eax
jz .LStrPasDone jz .LStrPasDone
{$ifndef REGCALL}
movl __RESULT,%edi movl __RESULT,%edi
{$endif}
leal 3(%esi),%edx leal 3(%esi),%edx
andl $-4,%edx andl $-4,%edx
// skip length byte // skip length byte
@ -87,16 +95,25 @@ asm
incb %cl incb %cl
jnz .LStrPasEndLoop jnz .LStrPasEndLoop
.LStrPasDone: .LStrPasDone:
{$ifdef REGCALL}
movl saveres,%edi
{$else}
movl __RESULT,%edi movl __RESULT,%edi
{$endif}
addb $255,%cl addb $255,%cl
movb %cl,(%edi) movb %cl,(%edi)
end ['EAX','EBX','ECX','EDX','ESI','EDI']; movl %esi,saveesi
movl %edi,saveedi
movl %ebx,saveebx
end; end;
{ {
$Log$ $Log$
Revision 1.3 2003-11-11 21:08:17 peter Revision 1.4 2003-11-19 16:58:44 peter
* make strpas assembler function
Revision 1.3 2003/11/11 21:08:17 peter
* REGCALL define added * REGCALL define added
Revision 1.2 2002/09/07 16:01:19 peter Revision 1.2 2002/09/07 16:01:19 peter