mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-12 07:46:00 +02:00
* save edi,esi,ebx
This commit is contained in:
parent
79c80b2741
commit
cba9b5206d
@ -23,7 +23,11 @@
|
|||||||
|
|
||||||
{$define FPC_SYSTEM_HAS_MOVE}
|
{$define FPC_SYSTEM_HAS_MOVE}
|
||||||
procedure Move(const source;var dest;count:longint);assembler;
|
procedure Move(const source;var dest;count:longint);assembler;
|
||||||
|
var
|
||||||
|
saveesi,saveedi : longint;
|
||||||
asm
|
asm
|
||||||
|
movl %edi,saveedi
|
||||||
|
movl %esi,saveesi
|
||||||
movl dest,%edi
|
movl dest,%edi
|
||||||
movl source,%esi
|
movl source,%esi
|
||||||
movl %edi,%eax
|
movl %edi,%eax
|
||||||
@ -88,15 +92,17 @@ asm
|
|||||||
movsb
|
movsb
|
||||||
cld
|
cld
|
||||||
.LMoveEnd:
|
.LMoveEnd:
|
||||||
end ['EAX','EBX','ECX','ESI','EDI'];
|
movl saveedi,%edi
|
||||||
|
movl saveesi,%esi
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
{$define FPC_SYSTEM_HAS_FILLCHAR}
|
{$define FPC_SYSTEM_HAS_FILLCHAR}
|
||||||
Procedure FillChar(var x;count:longint;value:byte);
|
Procedure FillChar(var x;count:longint;value:byte);assembler;
|
||||||
{ alias seems to be nowhere used? (JM)
|
var
|
||||||
[public,alias: 'FPC_FILLCHAR']; }
|
saveedi : longint;
|
||||||
assembler;
|
|
||||||
asm
|
asm
|
||||||
|
movl %edi,saveedi
|
||||||
cld
|
cld
|
||||||
movl x,%edi
|
movl x,%edi
|
||||||
movb value,%al
|
movb value,%al
|
||||||
@ -127,12 +133,16 @@ asm
|
|||||||
rep
|
rep
|
||||||
stosb
|
stosb
|
||||||
.LFillEnd:
|
.LFillEnd:
|
||||||
|
movl saveedi,%edi
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
{$define FPC_SYSTEM_HAS_FILLWORD}
|
{$define FPC_SYSTEM_HAS_FILLWORD}
|
||||||
procedure fillword(var x;count : longint;value : word);assembler;
|
procedure fillword(var x;count : longint;value : word);assembler;
|
||||||
|
var
|
||||||
|
saveedi : longint;
|
||||||
asm
|
asm
|
||||||
|
movl %edi,saveedi
|
||||||
movl x,%edi
|
movl x,%edi
|
||||||
movl count,%ecx
|
movl count,%ecx
|
||||||
{ check for zero or negative count }
|
{ check for zero or negative count }
|
||||||
@ -152,12 +162,16 @@ asm
|
|||||||
rep
|
rep
|
||||||
stosw
|
stosw
|
||||||
.LFillWordEnd:
|
.LFillWordEnd:
|
||||||
end ['EAX','ECX','EDX','EDI'];
|
movl saveedi,%edi
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
{$define FPC_SYSTEM_HAS_FILLDWORD}
|
{$define FPC_SYSTEM_HAS_FILLDWORD}
|
||||||
procedure filldword(var x;count : longint;value : dword);assembler;
|
procedure filldword(var x;count : longint;value : dword);assembler;
|
||||||
|
var
|
||||||
|
saveedi : longint;
|
||||||
asm
|
asm
|
||||||
|
movl %edi,saveedi
|
||||||
movl x,%edi
|
movl x,%edi
|
||||||
movl count,%ecx
|
movl count,%ecx
|
||||||
{ check for zero or negative count }
|
{ check for zero or negative count }
|
||||||
@ -168,84 +182,101 @@ asm
|
|||||||
rep
|
rep
|
||||||
stosl
|
stosl
|
||||||
.LFillDWordEnd:
|
.LFillDWordEnd:
|
||||||
end ['EAX','ECX','EDX','EDI'];
|
movl saveedi,%edi
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
{$define FPC_SYSTEM_HAS_INDEXBYTE}
|
{$define FPC_SYSTEM_HAS_INDEXBYTE}
|
||||||
function IndexByte(Const buf;len:longint;b:byte):longint; assembler;
|
function IndexByte(Const buf;len:longint;b:byte):longint; assembler;
|
||||||
|
var
|
||||||
|
saveedi : longint;
|
||||||
asm
|
asm
|
||||||
|
movl %edi,saveedi
|
||||||
xorl %eax,%eax
|
xorl %eax,%eax
|
||||||
movl Len,%ecx // Load len
|
movl Len,%ecx // Load len
|
||||||
movl Buf,%edi // Load String
|
movl Buf,%edi // Load String
|
||||||
testl %ecx,%ecx
|
testl %ecx,%ecx
|
||||||
jz .Lready
|
jz .Lready
|
||||||
cld
|
cld
|
||||||
movl %ecx,%ebx // Copy for easy manipulation
|
movl %ecx,%edx // Copy for easy manipulation
|
||||||
movb b,%al
|
movb b,%al
|
||||||
repne
|
repne
|
||||||
scasb
|
scasb
|
||||||
jne .Lcharposnotfound
|
jne .Lcharposnotfound
|
||||||
incl %ecx
|
incl %ecx
|
||||||
subl %ecx,%ebx
|
subl %ecx,%edx
|
||||||
movl %ebx,%eax
|
movl %edx,%eax
|
||||||
jmp .Lready
|
jmp .Lready
|
||||||
.Lcharposnotfound:
|
.Lcharposnotfound:
|
||||||
movl $-1,%eax
|
movl $-1,%eax
|
||||||
.Lready:
|
.Lready:
|
||||||
end ['EAX','EBX','ECX','EDI'];
|
movl saveedi,%edi
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
{$define FPC_SYSTEM_HAS_INDEXWORD}
|
{$define FPC_SYSTEM_HAS_INDEXWORD}
|
||||||
function Indexword(Const buf;len:longint;b:word):longint; assembler;
|
function Indexword(Const buf;len:longint;b:word):longint; assembler;
|
||||||
|
var
|
||||||
|
saveedi : longint;
|
||||||
asm
|
asm
|
||||||
|
movl %edi,saveedi
|
||||||
xorl %eax,%eax
|
xorl %eax,%eax
|
||||||
movl Len,%ecx // Load len
|
movl Len,%ecx // Load len
|
||||||
movl Buf,%edi // Load String
|
movl Buf,%edi // Load String
|
||||||
testl %ecx,%ecx
|
testl %ecx,%ecx
|
||||||
jz .Lready
|
jz .Lready
|
||||||
cld
|
cld
|
||||||
movl %ecx,%ebx // Copy for easy manipulation
|
movl %ecx,%edx // Copy for easy manipulation
|
||||||
movw b,%ax
|
movw b,%ax
|
||||||
repne
|
repne
|
||||||
scasw
|
scasw
|
||||||
jne .Lcharposnotfound
|
jne .Lcharposnotfound
|
||||||
incl %ecx
|
incl %ecx
|
||||||
subl %ecx,%ebx
|
subl %ecx,%edx
|
||||||
movl %ebx,%eax
|
movl %edx,%eax
|
||||||
jmp .Lready
|
jmp .Lready
|
||||||
.Lcharposnotfound:
|
.Lcharposnotfound:
|
||||||
movl $-1,%eax
|
movl $-1,%eax
|
||||||
.Lready:
|
.Lready:
|
||||||
end ['EAX','EBX','ECX','EDI'];
|
movl saveedi,%edi
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
{$define FPC_SYSTEM_HAS_INDEXDWORD}
|
{$define FPC_SYSTEM_HAS_INDEXDWORD}
|
||||||
function IndexDWord(Const buf;len:longint;b:DWord):longint; assembler;
|
function IndexDWord(Const buf;len:longint;b:DWord):longint; assembler;
|
||||||
|
var
|
||||||
|
saveedi : longint;
|
||||||
asm
|
asm
|
||||||
|
movl %edi,saveedi
|
||||||
xorl %eax,%eax
|
xorl %eax,%eax
|
||||||
movl Len,%ecx // Load len
|
movl Len,%ecx // Load len
|
||||||
movl Buf,%edi // Load String
|
movl Buf,%edi // Load String
|
||||||
testl %ecx,%ecx
|
testl %ecx,%ecx
|
||||||
jz .Lready
|
jz .Lready
|
||||||
cld
|
cld
|
||||||
movl %ecx,%ebx // Copy for easy manipulation
|
movl %ecx,%edx // Copy for easy manipulation
|
||||||
movl b,%eax
|
movl b,%eax
|
||||||
repne
|
repne
|
||||||
scasl
|
scasl
|
||||||
jne .Lcharposnotfound
|
jne .Lcharposnotfound
|
||||||
incl %ecx
|
incl %ecx
|
||||||
subl %ecx,%ebx
|
subl %ecx,%edx
|
||||||
movl %ebx,%eax
|
movl %edx,%eax
|
||||||
jmp .Lready
|
jmp .Lready
|
||||||
.Lcharposnotfound:
|
.Lcharposnotfound:
|
||||||
movl $-1,%eax
|
movl $-1,%eax
|
||||||
.Lready:
|
.Lready:
|
||||||
end ['EAX','EBX','ECX','EDI'];
|
movl saveedi,%edi
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
{$define FPC_SYSTEM_HAS_COMPAREBYTE}
|
{$define FPC_SYSTEM_HAS_COMPAREBYTE}
|
||||||
function CompareByte(Const buf1,buf2;len:longint):longint; assembler;
|
function CompareByte(Const buf1,buf2;len:longint):longint; assembler;
|
||||||
|
var
|
||||||
|
saveesi,saveedi : longint;
|
||||||
asm
|
asm
|
||||||
|
movl %edi,saveedi
|
||||||
|
movl %esi,saveesi
|
||||||
cld
|
cld
|
||||||
movl len,%eax
|
movl len,%eax
|
||||||
movl buf2,%esi { Load params}
|
movl buf2,%esi { Load params}
|
||||||
@ -282,13 +313,20 @@ asm
|
|||||||
movzbl -1(%edi),%eax // Compare failing (or equal) position
|
movzbl -1(%edi),%eax // Compare failing (or equal) position
|
||||||
subl %ecx,%eax
|
subl %ecx,%eax
|
||||||
.LCmpbyteExit:
|
.LCmpbyteExit:
|
||||||
end ['ECX','EAX','ESI','EDI'];
|
movl saveedi,%edi
|
||||||
|
movl saveesi,%esi
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{$define FPC_SYSTEM_HAS_COMPAREWORD}
|
{$define FPC_SYSTEM_HAS_COMPAREWORD}
|
||||||
function CompareWord(Const buf1,buf2;len:longint):longint; assembler;
|
function CompareWord(Const buf1,buf2;len:longint):longint; assembler;
|
||||||
|
var
|
||||||
|
saveesi,saveedi,saveebx : longint;
|
||||||
asm
|
asm
|
||||||
|
movl %edi,saveedi
|
||||||
|
movl %esi,saveesi
|
||||||
|
movl %ebx,saveebx
|
||||||
cld
|
cld
|
||||||
movl len,%eax
|
movl len,%eax
|
||||||
movl buf2,%esi { Load params}
|
movl buf2,%esi { Load params}
|
||||||
@ -335,12 +373,20 @@ asm
|
|||||||
movzwl -2(%edi),%eax // Compare failing (or equal) position
|
movzwl -2(%edi),%eax // Compare failing (or equal) position
|
||||||
subl %ecx,%eax // calculate end result.
|
subl %ecx,%eax // calculate end result.
|
||||||
.LCmpwordExit:
|
.LCmpwordExit:
|
||||||
end ['EBX','EDX','ECX','EAX','ESI','EDI'];
|
movl saveedi,%edi
|
||||||
|
movl saveesi,%esi
|
||||||
|
movl saveebx,%ebx
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
{$define FPC_SYSTEM_HAS_COMPAREDWORD}
|
{$define FPC_SYSTEM_HAS_COMPAREDWORD}
|
||||||
function CompareDWord(Const buf1,buf2;len:longint):longint; assembler;
|
function CompareDWord(Const buf1,buf2;len:longint):longint; assembler;
|
||||||
|
var
|
||||||
|
saveesi,saveedi,saveebx : longint;
|
||||||
asm
|
asm
|
||||||
|
movl %edi,saveedi
|
||||||
|
movl %esi,saveesi
|
||||||
|
movl %ebx,saveebx
|
||||||
cld
|
cld
|
||||||
movl len,%eax
|
movl len,%eax
|
||||||
movl buf2,%esi { Load params}
|
movl buf2,%esi { Load params}
|
||||||
@ -385,12 +431,19 @@ asm
|
|||||||
movzwl -4(%edi),%eax // Compare failing (or equal) position
|
movzwl -4(%edi),%eax // Compare failing (or equal) position
|
||||||
subl %ecx,%eax // calculate end result.
|
subl %ecx,%eax // calculate end result.
|
||||||
.LCmpDwordExit:
|
.LCmpDwordExit:
|
||||||
end ['EBX','EDX','ECX','EAX','ESI','EDI'];
|
movl saveedi,%edi
|
||||||
|
movl saveesi,%esi
|
||||||
|
movl saveebx,%ebx
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
{$define FPC_SYSTEM_HAS_INDEXCHAR0}
|
{$define FPC_SYSTEM_HAS_INDEXCHAR0}
|
||||||
function IndexChar0(Const buf;len:longint;b:Char):longint; assembler;
|
function IndexChar0(Const buf;len:longint;b:Char):longint; assembler;
|
||||||
|
var
|
||||||
|
saveesi,saveebx : longint;
|
||||||
asm
|
asm
|
||||||
|
movl %esi,saveesi
|
||||||
|
movl %ebx,saveebx
|
||||||
// Can't use scasb, or will have to do it twice, think this
|
// Can't use scasb, or will have to do it twice, think this
|
||||||
// is faster for small "len"
|
// is faster for small "len"
|
||||||
movl Buf,%esi // Load address
|
movl Buf,%esi // Load address
|
||||||
@ -414,7 +467,9 @@ asm
|
|||||||
movl $-1,%ecx // Not found return -1
|
movl $-1,%ecx // Not found return -1
|
||||||
.LFound:
|
.LFound:
|
||||||
movl %ecx,%eax
|
movl %ecx,%eax
|
||||||
end['EAX','EBX','ECX','EDX','ESI'];
|
movl saveesi,%esi
|
||||||
|
movl saveebx,%ebx
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
{****************************************************************************
|
{****************************************************************************
|
||||||
@ -1200,35 +1255,36 @@ end;
|
|||||||
function declocked(var l : longint) : boolean;assembler;
|
function declocked(var l : longint) : boolean;assembler;
|
||||||
|
|
||||||
asm
|
asm
|
||||||
movl l,%edi
|
movl l,%eax
|
||||||
{ this check should be done because a lock takes a lot }
|
{ this check should be done because a lock takes a lot }
|
||||||
{ of time! }
|
{ of time! }
|
||||||
cmpb $0,IsMultithread
|
cmpb $0,IsMultithread
|
||||||
jz .Ldeclockednolock
|
jz .Ldeclockednolock
|
||||||
lock
|
lock
|
||||||
decl (%edi)
|
decl (%eax)
|
||||||
jmp .Ldeclockedend
|
jmp .Ldeclockedend
|
||||||
.Ldeclockednolock:
|
.Ldeclockednolock:
|
||||||
decl (%edi);
|
decl (%eax);
|
||||||
.Ldeclockedend:
|
.Ldeclockedend:
|
||||||
setzb %al
|
setzb %al
|
||||||
end ['EDI','EAX'];
|
end;
|
||||||
|
|
||||||
{$define FPC_SYSTEM_HAS_INCLOCKED}
|
{$define FPC_SYSTEM_HAS_INCLOCKED}
|
||||||
procedure inclocked(var l : longint);assembler;
|
procedure inclocked(var l : longint);assembler;
|
||||||
|
|
||||||
asm
|
asm
|
||||||
movl l,%edi
|
movl l,%eax
|
||||||
{ this check should be done because a lock takes a lot }
|
{ this check should be done because a lock takes a lot }
|
||||||
{ of time! }
|
{ of time! }
|
||||||
cmpb $0,IsMultithread
|
cmpb $0,IsMultithread
|
||||||
jz .Linclockednolock
|
jz .Linclockednolock
|
||||||
lock
|
lock
|
||||||
incl (%edi)
|
incl (%eax)
|
||||||
jmp .Linclockedend
|
jmp .Linclockedend
|
||||||
.Linclockednolock:
|
.Linclockednolock:
|
||||||
incl (%edi)
|
incl (%eax)
|
||||||
.Linclockedend:
|
.Linclockedend:
|
||||||
end ['EDI'];
|
end;
|
||||||
|
|
||||||
{****************************************************************************
|
{****************************************************************************
|
||||||
FPU
|
FPU
|
||||||
@ -1257,7 +1313,10 @@ end;
|
|||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.45 2003-06-01 14:50:17 jonas
|
Revision 1.46 2003-09-08 18:21:37 peter
|
||||||
|
* save edi,esi,ebx
|
||||||
|
|
||||||
|
Revision 1.45 2003/06/01 14:50:17 jonas
|
||||||
* fpc_shortstr_append_shortstr has to use high(s1) instead of 255 as
|
* fpc_shortstr_append_shortstr has to use high(s1) instead of 255 as
|
||||||
maxlen
|
maxlen
|
||||||
+ ppc version of fpc_shortstr_append_shortstr
|
+ ppc version of fpc_shortstr_append_shortstr
|
||||||
|
@ -106,7 +106,7 @@
|
|||||||
fstp %st(1)
|
fstp %st(1)
|
||||||
fclex
|
fclex
|
||||||
fldcw -4(%ebp)
|
fldcw -4(%ebp)
|
||||||
end ['ECX'];
|
end;
|
||||||
|
|
||||||
|
|
||||||
{$define FPC_SYSTEM_HAS_INT}
|
{$define FPC_SYSTEM_HAS_INT}
|
||||||
@ -124,7 +124,7 @@
|
|||||||
frndint
|
frndint
|
||||||
fclex
|
fclex
|
||||||
fldcw -4(%ebp)
|
fldcw -4(%ebp)
|
||||||
end ['ECX'];
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -147,13 +147,13 @@
|
|||||||
movl res,%eax
|
movl res,%eax
|
||||||
movl res+4,%edx
|
movl res+4,%edx
|
||||||
fldcw oldcw
|
fldcw oldcw
|
||||||
end ['EAX','ECX','EDX'];
|
end;
|
||||||
|
|
||||||
|
|
||||||
{$define FPC_SYSTEM_HAS_ROUND}
|
{$define FPC_SYSTEM_HAS_ROUND}
|
||||||
{$ifdef hascompilerproc}
|
{$ifdef hascompilerproc}
|
||||||
function round(d : extended) : int64;[internconst:in_const_round, external name 'FPC_ROUND'];
|
function round(d : extended) : int64;[internconst:in_const_round, external name 'FPC_ROUND'];
|
||||||
|
|
||||||
function fpc_round(d : extended) : int64;assembler;[public, alias:'FPC_ROUND'];{$ifdef hascompilerproc}compilerproc;{$endif hascompilerproc}
|
function fpc_round(d : extended) : int64;assembler;[public, alias:'FPC_ROUND'];{$ifdef hascompilerproc}compilerproc;{$endif hascompilerproc}
|
||||||
{$else}
|
{$else}
|
||||||
function round(d : extended) : int64;assembler;[internconst:in_const_round];
|
function round(d : extended) : int64;assembler;[internconst:in_const_round];
|
||||||
@ -173,7 +173,7 @@
|
|||||||
movl res,%eax
|
movl res,%eax
|
||||||
movl res+4,%edx
|
movl res+4,%edx
|
||||||
fldcw oldcw
|
fldcw oldcw
|
||||||
end ['EAX','EDX'];
|
end;
|
||||||
|
|
||||||
|
|
||||||
{$define FPC_SYSTEM_HAS_POWER}
|
{$define FPC_SYSTEM_HAS_POWER}
|
||||||
@ -198,7 +198,10 @@
|
|||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.14 2003-04-23 21:28:21 peter
|
Revision 1.15 2003-09-08 18:21:37 peter
|
||||||
|
* save edi,esi,ebx
|
||||||
|
|
||||||
|
Revision 1.14 2003/04/23 21:28:21 peter
|
||||||
* fpc_round added, needed for int64 currency
|
* fpc_round added, needed for int64 currency
|
||||||
|
|
||||||
Revision 1.13 2003/02/05 19:53:17 carl
|
Revision 1.13 2003/02/05 19:53:17 carl
|
||||||
|
136
rtl/i386/set.inc
136
rtl/i386/set.inc
@ -20,7 +20,10 @@ function fpc_set_load_small(l: fpc_small_set): fpc_normal_set;assembler;[public,
|
|||||||
{
|
{
|
||||||
load a normal set p from a smallset l
|
load a normal set p from a smallset l
|
||||||
}
|
}
|
||||||
|
var
|
||||||
|
saveedi : longint;
|
||||||
asm
|
asm
|
||||||
|
movl %edi,saveedi
|
||||||
movl __RESULT,%edi
|
movl __RESULT,%edi
|
||||||
movl l,%eax
|
movl l,%eax
|
||||||
stosl
|
stosl
|
||||||
@ -28,7 +31,8 @@ asm
|
|||||||
movl $7,%ecx
|
movl $7,%ecx
|
||||||
rep
|
rep
|
||||||
stosl
|
stosl
|
||||||
end ['EAX','ECX','EDI'];
|
movl saveedi,%edi
|
||||||
|
end;
|
||||||
|
|
||||||
{$define FPC_SYSTEM_HAS_FPC_SET_CREATE_ELEMENT}
|
{$define FPC_SYSTEM_HAS_FPC_SET_CREATE_ELEMENT}
|
||||||
|
|
||||||
@ -36,11 +40,14 @@ function fpc_set_create_element(b : byte): fpc_normal_set;assembler;[public,alia
|
|||||||
{
|
{
|
||||||
create a new set in p from an element b
|
create a new set in p from an element b
|
||||||
}
|
}
|
||||||
|
var
|
||||||
|
saveedi : longint;
|
||||||
asm
|
asm
|
||||||
{$ifndef hascompilerproc}
|
{$ifndef hascompilerproc}
|
||||||
pushl %eax
|
pushl %eax
|
||||||
pushl %ecx
|
pushl %ecx
|
||||||
{$endif not hascompilerproc}
|
{$endif not hascompilerproc}
|
||||||
|
movl %edi,saveedi
|
||||||
movl __RESULT,%edi
|
movl __RESULT,%edi
|
||||||
xorl %eax,%eax
|
xorl %eax,%eax
|
||||||
movl $8,%ecx
|
movl $8,%ecx
|
||||||
@ -49,11 +56,12 @@ asm
|
|||||||
leal -32(%edi),%eax
|
leal -32(%edi),%eax
|
||||||
movzbl b,%edi
|
movzbl b,%edi
|
||||||
btsl %edi,(%eax)
|
btsl %edi,(%eax)
|
||||||
|
movl saveedi,%edi
|
||||||
{$ifndef hascompilerproc}
|
{$ifndef hascompilerproc}
|
||||||
popl %ecx
|
popl %ecx
|
||||||
popl %eax
|
popl %eax
|
||||||
{$endif hascompilerproc}
|
{$endif hascompilerproc}
|
||||||
end ['EAX','ECX','EDI'];
|
end;
|
||||||
|
|
||||||
|
|
||||||
{$define FPC_SYSTEM_HAS_FPC_SET_SET_BYTE}
|
{$define FPC_SYSTEM_HAS_FPC_SET_SET_BYTE}
|
||||||
@ -62,16 +70,22 @@ function fpc_set_set_byte(const source: fpc_normal_set; b : byte): fpc_normal_se
|
|||||||
{
|
{
|
||||||
add the element b to the set pointed by source
|
add the element b to the set pointed by source
|
||||||
}
|
}
|
||||||
|
var
|
||||||
|
saveesi,saveedi : longint;
|
||||||
asm
|
asm
|
||||||
movl $8,%ecx
|
movl %edi,saveedi
|
||||||
movl source,%esi
|
movl %esi,saveesi
|
||||||
movl __RESULT,%edi
|
movl $8,%ecx
|
||||||
rep
|
movl source,%esi
|
||||||
movsl
|
movl __RESULT,%edi
|
||||||
leal -32(%edi),%eax
|
rep
|
||||||
movzbl b,%edi
|
movsl
|
||||||
btsl %edi,(%eax)
|
leal -32(%edi),%eax
|
||||||
end ['EAX','ECX','ESI','EDI'];
|
movzbl b,%edi
|
||||||
|
btsl %edi,(%eax)
|
||||||
|
movl saveedi,%edi
|
||||||
|
movl saveesi,%esi
|
||||||
|
end;
|
||||||
{$else hascompilerproc}
|
{$else hascompilerproc}
|
||||||
function fpc_set_set_byte(b : byte): fpc_normal_set;assembler;[public,alias:'FPC_SET_SET_BYTE'];
|
function fpc_set_set_byte(b : byte): fpc_normal_set;assembler;[public,alias:'FPC_SET_SET_BYTE'];
|
||||||
{
|
{
|
||||||
@ -98,16 +112,22 @@ function fpc_set_unset_byte(const source: fpc_normal_set; b : byte): fpc_normal_
|
|||||||
{
|
{
|
||||||
add the element b to the set pointed by source
|
add the element b to the set pointed by source
|
||||||
}
|
}
|
||||||
|
var
|
||||||
|
saveesi,saveedi : longint;
|
||||||
asm
|
asm
|
||||||
movl $8,%ecx
|
movl %edi,saveedi
|
||||||
movl source,%esi
|
movl %esi,saveesi
|
||||||
movl __RESULT,%edi
|
movl $8,%ecx
|
||||||
rep
|
movl source,%esi
|
||||||
movsl
|
movl __RESULT,%edi
|
||||||
leal -32(%edi),%eax
|
rep
|
||||||
movzbl b,%edi
|
movsl
|
||||||
btrl %edi,(%eax)
|
leal -32(%edi),%eax
|
||||||
end ['EAX','ECX','ESI','EDI'];
|
movzbl b,%edi
|
||||||
|
btrl %edi,(%eax)
|
||||||
|
movl saveedi,%edi
|
||||||
|
movl saveesi,%esi
|
||||||
|
end;
|
||||||
{$else hascompilerproc}
|
{$else hascompilerproc}
|
||||||
function fpc_set_unset_byte(b : byte): fpc_normal_set;assembler;[public,alias:'FPC_SET_UNSET_BYTE']; {$ifdef hascompilerproc} compilerproc; {$endif}
|
function fpc_set_unset_byte(b : byte): fpc_normal_set;assembler;[public,alias:'FPC_SET_UNSET_BYTE']; {$ifdef hascompilerproc} compilerproc; {$endif}
|
||||||
{
|
{
|
||||||
@ -136,7 +156,12 @@ function fpc_set_set_range(const orgset: fpc_normal_set; l,h : byte): fpc_normal
|
|||||||
{
|
{
|
||||||
adds the range [l..h] to the set pointed to by p
|
adds the range [l..h] to the set pointed to by p
|
||||||
}
|
}
|
||||||
|
var
|
||||||
|
saveesi,saveedi,saveebx : longint;
|
||||||
asm
|
asm
|
||||||
|
movl %edi,saveedi
|
||||||
|
movl %esi,saveesi
|
||||||
|
movl %ebx,saveebx
|
||||||
movzbl l,%eax // lowest bit to be set in eax
|
movzbl l,%eax // lowest bit to be set in eax
|
||||||
movzbl h,%ebx // highest in ebx
|
movzbl h,%ebx // highest in ebx
|
||||||
movl $8,%ecx // we have to copy 32 bytes
|
movl $8,%ecx // we have to copy 32 bytes
|
||||||
@ -179,6 +204,9 @@ asm
|
|||||||
andl %edx,%ebx // combine both bitmasks
|
andl %edx,%ebx // combine both bitmasks
|
||||||
orl %ebx,(%edi) // store to set
|
orl %ebx,(%edi) // store to set
|
||||||
.Lset_range_done:
|
.Lset_range_done:
|
||||||
|
movl saveedi,%edi
|
||||||
|
movl saveesi,%esi
|
||||||
|
movl saveebx,%ebx
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{$else hascompilerproc}
|
{$else hascompilerproc}
|
||||||
@ -235,11 +263,17 @@ function fpc_set_in_byte(const p: fpc_normal_set; b: byte): boolean; assembler;
|
|||||||
tests if the element b is in the set p the carryflag is set if it present
|
tests if the element b is in the set p the carryflag is set if it present
|
||||||
}
|
}
|
||||||
asm
|
asm
|
||||||
|
{$ifdef hascompilerproc}
|
||||||
|
movl p,%edx
|
||||||
|
movzbl b,%eax
|
||||||
|
btl %eax,(%edx)
|
||||||
|
{$else hascompilerproc}
|
||||||
pushl %eax
|
pushl %eax
|
||||||
movl p,%edi
|
movl p,%edi
|
||||||
movzbl b,%eax
|
movzbl b,%eax
|
||||||
btl %eax,(%edi)
|
btl %eax,(%edi)
|
||||||
popl %eax
|
popl %eax
|
||||||
|
{$endif hascompilerproc}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -253,9 +287,13 @@ procedure fpc_set_add_sets(set1,set2,dest : pointer);assembler;[public,alias:'FP
|
|||||||
{
|
{
|
||||||
adds set1 and set2 into set dest
|
adds set1 and set2 into set dest
|
||||||
}
|
}
|
||||||
|
var
|
||||||
|
saveesi,saveedi : longint;
|
||||||
asm
|
asm
|
||||||
|
movl %edi,saveedi
|
||||||
|
movl %esi,saveesi
|
||||||
movl set1,%esi
|
movl set1,%esi
|
||||||
movl set2,%ebx
|
movl set2,%edx
|
||||||
{$ifdef hascompilerproc}
|
{$ifdef hascompilerproc}
|
||||||
movl __RESULT,%edi
|
movl __RESULT,%edi
|
||||||
{$else hascompilerproc}
|
{$else hascompilerproc}
|
||||||
@ -264,11 +302,13 @@ asm
|
|||||||
movl $8,%ecx
|
movl $8,%ecx
|
||||||
.LMADDSETS1:
|
.LMADDSETS1:
|
||||||
lodsl
|
lodsl
|
||||||
orl (%ebx),%eax
|
orl (%edx),%eax
|
||||||
stosl
|
stosl
|
||||||
addl $4,%ebx
|
addl $4,%edx
|
||||||
decl %ecx
|
decl %ecx
|
||||||
jnz .LMADDSETS1
|
jnz .LMADDSETS1
|
||||||
|
movl saveedi,%edi
|
||||||
|
movl saveesi,%esi
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -282,9 +322,13 @@ procedure fpc_set_mul_sets(set1,set2,dest:pointer);assembler;[public,alias:'FPC_
|
|||||||
{
|
{
|
||||||
multiplies (takes common elements of) set1 and set2 result put in dest
|
multiplies (takes common elements of) set1 and set2 result put in dest
|
||||||
}
|
}
|
||||||
|
var
|
||||||
|
saveesi,saveedi : longint;
|
||||||
asm
|
asm
|
||||||
|
movl %edi,saveedi
|
||||||
|
movl %esi,saveesi
|
||||||
movl set1,%esi
|
movl set1,%esi
|
||||||
movl set2,%ebx
|
movl set2,%edx
|
||||||
{$ifdef hascompilerproc}
|
{$ifdef hascompilerproc}
|
||||||
movl __RESULT,%edi
|
movl __RESULT,%edi
|
||||||
{$else hascompilerproc}
|
{$else hascompilerproc}
|
||||||
@ -293,11 +337,13 @@ asm
|
|||||||
movl $8,%ecx
|
movl $8,%ecx
|
||||||
.LMMULSETS1:
|
.LMMULSETS1:
|
||||||
lodsl
|
lodsl
|
||||||
andl (%ebx),%eax
|
andl (%edx),%eax
|
||||||
stosl
|
stosl
|
||||||
addl $4,%ebx
|
addl $4,%edx
|
||||||
decl %ecx
|
decl %ecx
|
||||||
jnz .LMMULSETS1
|
jnz .LMMULSETS1
|
||||||
|
movl saveedi,%edi
|
||||||
|
movl saveesi,%esi
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -311,7 +357,12 @@ procedure fpc_set_sub_sets(set1,set2,dest:pointer);assembler;[public,alias:'FPC_
|
|||||||
{
|
{
|
||||||
computes the diff from set1 to set2 result in dest
|
computes the diff from set1 to set2 result in dest
|
||||||
}
|
}
|
||||||
|
var
|
||||||
|
saveesi,saveedi,saveebx : longint;
|
||||||
asm
|
asm
|
||||||
|
movl %edi,saveedi
|
||||||
|
movl %esi,saveesi
|
||||||
|
movl %ebx,saveebx
|
||||||
movl set1,%esi
|
movl set1,%esi
|
||||||
movl set2,%ebx
|
movl set2,%ebx
|
||||||
{$ifdef hascompilerproc}
|
{$ifdef hascompilerproc}
|
||||||
@ -329,6 +380,9 @@ asm
|
|||||||
addl $4,%ebx
|
addl $4,%ebx
|
||||||
decl %ecx
|
decl %ecx
|
||||||
jnz .LMSUBSETS1
|
jnz .LMSUBSETS1
|
||||||
|
movl saveedi,%edi
|
||||||
|
movl saveesi,%esi
|
||||||
|
movl saveebx,%ebx
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -342,9 +396,13 @@ procedure fpc_set_symdif_sets(set1,set2,dest:pointer);assembler;[public,alias:'F
|
|||||||
{
|
{
|
||||||
computes the symetric diff from set1 to set2 result in dest
|
computes the symetric diff from set1 to set2 result in dest
|
||||||
}
|
}
|
||||||
|
var
|
||||||
|
saveesi,saveedi : longint;
|
||||||
asm
|
asm
|
||||||
|
movl %edi,saveedi
|
||||||
|
movl %esi,saveesi
|
||||||
movl set1,%esi
|
movl set1,%esi
|
||||||
movl set2,%ebx
|
movl set2,%edx
|
||||||
{$ifdef hascompilerproc}
|
{$ifdef hascompilerproc}
|
||||||
movl __RESULT,%edi
|
movl __RESULT,%edi
|
||||||
{$else hascompilerproc}
|
{$else hascompilerproc}
|
||||||
@ -353,12 +411,13 @@ asm
|
|||||||
movl $8,%ecx
|
movl $8,%ecx
|
||||||
.LMSYMDIFSETS1:
|
.LMSYMDIFSETS1:
|
||||||
lodsl
|
lodsl
|
||||||
movl (%ebx),%edx
|
xorl (%edx),%eax
|
||||||
xorl %edx,%eax
|
|
||||||
stosl
|
stosl
|
||||||
addl $4,%ebx
|
addl $4,%edx
|
||||||
decl %ecx
|
decl %ecx
|
||||||
jnz .LMSYMDIFSETS1
|
jnz .LMSYMDIFSETS1
|
||||||
|
movl saveedi,%edi
|
||||||
|
movl saveesi,%esi
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -368,7 +427,11 @@ function fpc_set_comp_sets(const set1,set2: fpc_normal_set): boolean;assembler;[
|
|||||||
{
|
{
|
||||||
compares set1 and set2 zeroflag is set if they are equal
|
compares set1 and set2 zeroflag is set if they are equal
|
||||||
}
|
}
|
||||||
|
var
|
||||||
|
saveesi,saveedi : longint;
|
||||||
asm
|
asm
|
||||||
|
movl %edi,saveedi
|
||||||
|
movl %esi,saveesi
|
||||||
movl set1,%esi
|
movl set1,%esi
|
||||||
movl set2,%edi
|
movl set2,%edi
|
||||||
movl $8,%ecx
|
movl $8,%ecx
|
||||||
@ -387,6 +450,8 @@ asm
|
|||||||
{$ifdef hascompilerproc}
|
{$ifdef hascompilerproc}
|
||||||
seteb %al
|
seteb %al
|
||||||
{$endif hascompilerproc}
|
{$endif hascompilerproc}
|
||||||
|
movl saveedi,%edi
|
||||||
|
movl saveesi,%esi
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -396,7 +461,11 @@ function fpc_set_contains_sets(const set1,set2: fpc_normal_set): boolean;assembl
|
|||||||
{
|
{
|
||||||
on exit, zero flag is set if set1 <= set2 (set2 contains set1)
|
on exit, zero flag is set if set1 <= set2 (set2 contains set1)
|
||||||
}
|
}
|
||||||
|
var
|
||||||
|
saveesi,saveedi : longint;
|
||||||
asm
|
asm
|
||||||
|
movl %edi,saveedi
|
||||||
|
movl %esi,saveesi
|
||||||
movl set1,%esi
|
movl set1,%esi
|
||||||
movl set2,%edi
|
movl set2,%edi
|
||||||
movl $8,%ecx
|
movl $8,%ecx
|
||||||
@ -416,6 +485,8 @@ asm
|
|||||||
{$ifdef hascompilerproc}
|
{$ifdef hascompilerproc}
|
||||||
seteb %al
|
seteb %al
|
||||||
{$endif hascompilerproc}
|
{$endif hascompilerproc}
|
||||||
|
movl saveedi,%edi
|
||||||
|
movl saveesi,%esi
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -582,7 +653,10 @@ end;
|
|||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.10 2003-05-26 19:36:46 peter
|
Revision 1.11 2003-09-08 18:21:37 peter
|
||||||
|
* save edi,esi,ebx
|
||||||
|
|
||||||
|
Revision 1.10 2003/05/26 19:36:46 peter
|
||||||
* fpc_shortstr_concat is now the same for all targets
|
* fpc_shortstr_concat is now the same for all targets
|
||||||
* fpc_shortstr_append_shortstr added for optimized code generation
|
* fpc_shortstr_append_shortstr added for optimized code generation
|
||||||
|
|
||||||
|
@ -19,7 +19,11 @@
|
|||||||
|
|
||||||
{$define FPC_UNIT_HAS_STRCOPY}
|
{$define FPC_UNIT_HAS_STRCOPY}
|
||||||
function strcopy(dest,source : pchar) : pchar;assembler;
|
function strcopy(dest,source : pchar) : pchar;assembler;
|
||||||
|
var
|
||||||
|
saveesi,saveedi : longint;
|
||||||
asm
|
asm
|
||||||
|
movl %edi,saveedi
|
||||||
|
movl %esi,saveesi
|
||||||
movl source,%edi
|
movl source,%edi
|
||||||
testl %edi,%edi
|
testl %edi,%edi
|
||||||
jz .LStrCopyDone
|
jz .LStrCopyDone
|
||||||
@ -72,12 +76,18 @@ asm
|
|||||||
movb %al,(%edi)
|
movb %al,(%edi)
|
||||||
.LStrCopyDone:
|
.LStrCopyDone:
|
||||||
movl dest,%eax
|
movl dest,%eax
|
||||||
end ['EAX','EDX','ECX','ESI','EDI'];
|
movl saveedi,%edi
|
||||||
|
movl saveesi,%esi
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
{$define FPC_UNIT_HAS_STRECOPY}
|
{$define FPC_UNIT_HAS_STRECOPY}
|
||||||
function strecopy(dest,source : pchar) : pchar;assembler;
|
function strecopy(dest,source : pchar) : pchar;assembler;
|
||||||
|
var
|
||||||
|
saveesi,saveedi : longint;
|
||||||
asm
|
asm
|
||||||
|
movl %edi,saveedi
|
||||||
|
movl %esi,saveesi
|
||||||
cld
|
cld
|
||||||
movl source,%edi
|
movl source,%edi
|
||||||
movl $0xffffffff,%ecx
|
movl $0xffffffff,%ecx
|
||||||
@ -98,12 +108,18 @@ asm
|
|||||||
movl dest,%eax
|
movl dest,%eax
|
||||||
decl %edi
|
decl %edi
|
||||||
movl %edi,%eax
|
movl %edi,%eax
|
||||||
end ['EAX','ECX','ESI','EDI'];
|
movl %edi,saveedi
|
||||||
|
movl %esi,saveesi
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
{$define FPC_UNIT_HAS_STRLCOPY}
|
{$define FPC_UNIT_HAS_STRLCOPY}
|
||||||
function strlcopy(dest,source : pchar;maxlen : longint) : pchar;assembler;
|
function strlcopy(dest,source : pchar;maxlen : longint) : pchar;assembler;
|
||||||
|
var
|
||||||
|
saveesi,saveedi : longint;
|
||||||
asm
|
asm
|
||||||
|
movl %edi,saveedi
|
||||||
|
movl %esi,saveesi
|
||||||
movl source,%esi
|
movl source,%esi
|
||||||
movl maxlen,%ecx
|
movl maxlen,%ecx
|
||||||
movl dest,%edi
|
movl dest,%edi
|
||||||
@ -123,7 +139,9 @@ asm
|
|||||||
stosb // add a #0
|
stosb // add a #0
|
||||||
.LSTRLCOPY3:
|
.LSTRLCOPY3:
|
||||||
movl dest,%eax
|
movl dest,%eax
|
||||||
end ['EAX','ECX','ESI','EDI'];
|
movl saveedi,%edi
|
||||||
|
movl saveesi,%esi
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
{$define FPC_UNIT_HAS_STRLEN}
|
{$define FPC_UNIT_HAS_STRLEN}
|
||||||
@ -133,7 +151,10 @@ function strlen(p : pchar) : longint;assembler;
|
|||||||
|
|
||||||
{$define FPC_UNIT_HAS_STREND}
|
{$define FPC_UNIT_HAS_STREND}
|
||||||
function strend(p : pchar) : pchar;assembler;
|
function strend(p : pchar) : pchar;assembler;
|
||||||
|
var
|
||||||
|
saveedi : longint;
|
||||||
asm
|
asm
|
||||||
|
movl %edi,saveedi
|
||||||
cld
|
cld
|
||||||
xorl %eax,%eax
|
xorl %eax,%eax
|
||||||
movl p,%edi
|
movl p,%edi
|
||||||
@ -146,13 +167,18 @@ asm
|
|||||||
movl %edi,%eax
|
movl %edi,%eax
|
||||||
decl %eax
|
decl %eax
|
||||||
.LStrEndNil:
|
.LStrEndNil:
|
||||||
end ['EDI','ECX','EAX'];
|
movl saveedi,%edi
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{$define FPC_UNIT_HAS_STRCOMP}
|
{$define FPC_UNIT_HAS_STRCOMP}
|
||||||
function strcomp(str1,str2 : pchar) : longint;assembler;
|
function strcomp(str1,str2 : pchar) : longint;assembler;
|
||||||
|
var
|
||||||
|
saveesi,saveedi : longint;
|
||||||
asm
|
asm
|
||||||
|
movl %edi,saveedi
|
||||||
|
movl %esi,saveesi
|
||||||
movl str2,%edi
|
movl str2,%edi
|
||||||
movl $0xffffffff,%ecx
|
movl $0xffffffff,%ecx
|
||||||
cld
|
cld
|
||||||
@ -167,13 +193,19 @@ asm
|
|||||||
movb -1(%esi),%al
|
movb -1(%esi),%al
|
||||||
movzbl -1(%edi),%ecx
|
movzbl -1(%edi),%ecx
|
||||||
subl %ecx,%eax
|
subl %ecx,%eax
|
||||||
end ['EAX','ECX','ESI','EDI'];
|
movl saveedi,%edi
|
||||||
|
movl saveesi,%esi
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{$define FPC_UNIT_HAS_STRLCOMP}
|
{$define FPC_UNIT_HAS_STRLCOMP}
|
||||||
function strlcomp(str1,str2 : pchar;l : longint) : longint;assembler;
|
function strlcomp(str1,str2 : pchar;l : longint) : longint;assembler;
|
||||||
|
var
|
||||||
|
saveesi,saveedi : longint;
|
||||||
asm
|
asm
|
||||||
|
movl %edi,saveedi
|
||||||
|
movl %esi,saveesi
|
||||||
movl str2,%edi
|
movl str2,%edi
|
||||||
movl $0xffffffff,%ecx
|
movl $0xffffffff,%ecx
|
||||||
cld
|
cld
|
||||||
@ -192,13 +224,19 @@ asm
|
|||||||
movb -1(%esi),%al
|
movb -1(%esi),%al
|
||||||
movzbl -1(%edi),%ecx
|
movzbl -1(%edi),%ecx
|
||||||
subl %ecx,%eax
|
subl %ecx,%eax
|
||||||
end ['EAX','ECX','ESI','EDI'];
|
movl saveedi,%edi
|
||||||
|
movl saveesi,%esi
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{$define FPC_UNIT_HAS_STRICOMP}
|
{$define FPC_UNIT_HAS_STRICOMP}
|
||||||
function stricomp(str1,str2 : pchar) : longint;assembler;
|
function stricomp(str1,str2 : pchar) : longint;assembler;
|
||||||
|
var
|
||||||
|
saveesi,saveedi : longint;
|
||||||
asm
|
asm
|
||||||
|
movl %edi,saveedi
|
||||||
|
movl %esi,saveesi
|
||||||
movl str2,%edi
|
movl str2,%edi
|
||||||
movl $0xffffffff,%ecx
|
movl $0xffffffff,%ecx
|
||||||
cld
|
cld
|
||||||
@ -213,29 +251,35 @@ asm
|
|||||||
cmpsb
|
cmpsb
|
||||||
jz .LSTRICOMP3 // If last reached then exit
|
jz .LSTRICOMP3 // If last reached then exit
|
||||||
movzbl -1(%esi),%eax
|
movzbl -1(%esi),%eax
|
||||||
movzbl -1(%edi),%ebx
|
movzbl -1(%edi),%edx
|
||||||
cmpb $97,%al
|
cmpb $97,%al
|
||||||
jb .LSTRICOMP1
|
jb .LSTRICOMP1
|
||||||
cmpb $122,%al
|
cmpb $122,%al
|
||||||
ja .LSTRICOMP1
|
ja .LSTRICOMP1
|
||||||
subb $0x20,%al
|
subb $0x20,%al
|
||||||
.LSTRICOMP1:
|
.LSTRICOMP1:
|
||||||
cmpb $97,%bl
|
cmpb $97,%dl
|
||||||
jb .LSTRICOMP4
|
jb .LSTRICOMP4
|
||||||
cmpb $122,%bl
|
cmpb $122,%dl
|
||||||
ja .LSTRICOMP4
|
ja .LSTRICOMP4
|
||||||
subb $0x20,%bl
|
subb $0x20,%dl
|
||||||
.LSTRICOMP4:
|
.LSTRICOMP4:
|
||||||
subl %ebx,%eax
|
subl %edx,%eax
|
||||||
jz .LSTRICOMP2 // If still equal, compare again
|
jz .LSTRICOMP2 // If still equal, compare again
|
||||||
.LSTRICOMP3:
|
.LSTRICOMP3:
|
||||||
end ['EAX','EBX','ECX','ESI','EDI'];
|
movl saveedi,%edi
|
||||||
|
movl saveesi,%esi
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{$define FPC_UNIT_HAS_STRLICOMP}
|
{$define FPC_UNIT_HAS_STRLICOMP}
|
||||||
function strlicomp(str1,str2 : pchar;l : longint) : longint;assembler;
|
function strlicomp(str1,str2 : pchar;l : longint) : longint;assembler;
|
||||||
|
var
|
||||||
|
saveesi,saveedi : longint;
|
||||||
asm
|
asm
|
||||||
|
movl %edi,saveedi
|
||||||
|
movl %esi,saveesi
|
||||||
movl str2,%edi
|
movl str2,%edi
|
||||||
movl $0xffffffff,%ecx
|
movl $0xffffffff,%ecx
|
||||||
cld
|
cld
|
||||||
@ -254,29 +298,35 @@ asm
|
|||||||
cmpsb
|
cmpsb
|
||||||
jz .LSTRLICOMP3 // If last reached, exit
|
jz .LSTRLICOMP3 // If last reached, exit
|
||||||
movzbl -1(%esi),%eax
|
movzbl -1(%esi),%eax
|
||||||
movzbl -1(%edi),%ebx
|
movzbl -1(%edi),%edx
|
||||||
cmpb $97,%al
|
cmpb $97,%al
|
||||||
jb .LSTRLICOMP1
|
jb .LSTRLICOMP1
|
||||||
cmpb $122,%al
|
cmpb $122,%al
|
||||||
ja .LSTRLICOMP1
|
ja .LSTRLICOMP1
|
||||||
subb $0x20,%al
|
subb $0x20,%al
|
||||||
.LSTRLICOMP1:
|
.LSTRLICOMP1:
|
||||||
cmpb $97,%bl
|
cmpb $97,%dl
|
||||||
jb .LSTRLICOMP4
|
jb .LSTRLICOMP4
|
||||||
cmpb $122,%bl
|
cmpb $122,%dl
|
||||||
ja .LSTRLICOMP4
|
ja .LSTRLICOMP4
|
||||||
subb $0x20,%bl
|
subb $0x20,%dl
|
||||||
.LSTRLICOMP4:
|
.LSTRLICOMP4:
|
||||||
subl %ebx,%eax
|
subl %edx,%eax
|
||||||
jz .LSTRLICOMP2
|
jz .LSTRLICOMP2
|
||||||
.LSTRLICOMP3:
|
.LSTRLICOMP3:
|
||||||
end ['EAX','EBX','ECX','ESI','EDI'];
|
movl saveedi,%edi
|
||||||
|
movl saveesi,%esi
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{$define FPC_UNIT_HAS_STRSCAN}
|
{$define FPC_UNIT_HAS_STRSCAN}
|
||||||
function strscan(p : pchar;c : char) : pchar;assembler;
|
function strscan(p : pchar;c : char) : pchar;assembler;
|
||||||
|
var
|
||||||
|
saveesi,saveedi : longint;
|
||||||
asm
|
asm
|
||||||
|
movl %edi,saveedi
|
||||||
|
movl %esi,saveesi
|
||||||
movl p,%eax
|
movl p,%eax
|
||||||
xorl %ecx,%ecx
|
xorl %ecx,%ecx
|
||||||
testl %eax,%eax
|
testl %eax,%eax
|
||||||
@ -390,12 +440,17 @@ asm
|
|||||||
.LSTRSCANNOTFOUND:
|
.LSTRSCANNOTFOUND:
|
||||||
xorl %eax,%eax
|
xorl %eax,%eax
|
||||||
.LSTRSCAN:
|
.LSTRSCAN:
|
||||||
end ['EAX','ECX','ESI','EDI','EDX'];
|
movl saveedi,%edi
|
||||||
|
movl saveesi,%esi
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
{$define FPC_UNIT_HAS_STRRSCAN}
|
{$define FPC_UNIT_HAS_STRRSCAN}
|
||||||
function strrscan(p : pchar;c : char) : pchar;assembler;
|
function strrscan(p : pchar;c : char) : pchar;assembler;
|
||||||
|
var
|
||||||
|
saveedi : longint;
|
||||||
asm
|
asm
|
||||||
|
movl %edi,saveedi
|
||||||
xorl %eax,%eax
|
xorl %eax,%eax
|
||||||
movl p,%edi
|
movl p,%edi
|
||||||
orl %edi,%edi
|
orl %edi,%edi
|
||||||
@ -419,12 +474,17 @@ asm
|
|||||||
movl %edi,%eax
|
movl %edi,%eax
|
||||||
incl %eax
|
incl %eax
|
||||||
.LSTRRSCAN:
|
.LSTRRSCAN:
|
||||||
end ['EAX','ECX','EDI'];
|
movl saveedi,%edi
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
{$define FPC_UNIT_HAS_STRUPPER}
|
{$define FPC_UNIT_HAS_STRUPPER}
|
||||||
function strupper(p : pchar) : pchar;assembler;
|
function strupper(p : pchar) : pchar;assembler;
|
||||||
|
var
|
||||||
|
saveesi,saveedi : longint;
|
||||||
asm
|
asm
|
||||||
|
movl %edi,saveedi
|
||||||
|
movl %esi,saveesi
|
||||||
movl p,%esi
|
movl p,%esi
|
||||||
orl %esi,%esi
|
orl %esi,%esi
|
||||||
jz .LStrUpperNil
|
jz .LStrUpperNil
|
||||||
@ -442,12 +502,18 @@ asm
|
|||||||
jnz .LSTRUPPER1
|
jnz .LSTRUPPER1
|
||||||
.LStrUpperNil:
|
.LStrUpperNil:
|
||||||
movl p,%eax
|
movl p,%eax
|
||||||
end ['EAX','ESI','EDI'];
|
movl saveedi,%edi
|
||||||
|
movl saveesi,%esi
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
{$define FPC_UNIT_HAS_STRLOWER}
|
{$define FPC_UNIT_HAS_STRLOWER}
|
||||||
function strlower(p : pchar) : pchar;assembler;
|
function strlower(p : pchar) : pchar;assembler;
|
||||||
|
var
|
||||||
|
saveesi,saveedi : longint;
|
||||||
asm
|
asm
|
||||||
|
movl %esi,saveesi
|
||||||
|
movl %edi,saveedi
|
||||||
movl p,%esi
|
movl p,%esi
|
||||||
orl %esi,%esi
|
orl %esi,%esi
|
||||||
jz .LStrLowerNil
|
jz .LStrLowerNil
|
||||||
@ -465,11 +531,16 @@ asm
|
|||||||
jnz .LSTRLOWER1
|
jnz .LSTRLOWER1
|
||||||
.LStrLowerNil:
|
.LStrLowerNil:
|
||||||
movl p,%eax
|
movl p,%eax
|
||||||
end ['EAX','ESI','EDI'];
|
movl saveedi,%edi
|
||||||
|
movl saveesi,%esi
|
||||||
|
end;
|
||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.8 2003-04-30 16:36:39 florian
|
Revision 1.9 2003-09-08 18:21:37 peter
|
||||||
|
* save edi,esi,ebx
|
||||||
|
|
||||||
|
Revision 1.8 2003/04/30 16:36:39 florian
|
||||||
+ support for generic pchar routines added
|
+ support for generic pchar routines added
|
||||||
+ some basic rtl stuff for x86-64 added
|
+ some basic rtl stuff for x86-64 added
|
||||||
|
|
||||||
|
@ -22,8 +22,11 @@ function strpas(p : pchar) : string;
|
|||||||
|
|
||||||
{$define FPC_UNIT_HAS_STRPCOPY}
|
{$define FPC_UNIT_HAS_STRPCOPY}
|
||||||
function strpcopy(d : pchar;const s : string) : pchar;assembler;
|
function strpcopy(d : pchar;const s : string) : pchar;assembler;
|
||||||
|
var
|
||||||
|
saveesi,saveedi : longint;
|
||||||
asm
|
asm
|
||||||
pushl %esi // Save ESI
|
movl %edi,saveedi
|
||||||
|
movl %esi,saveesi
|
||||||
cld
|
cld
|
||||||
movl s,%esi // Load Source adress
|
movl s,%esi // Load Source adress
|
||||||
movl d,%edi // load destination address
|
movl d,%edi // load destination address
|
||||||
@ -33,12 +36,16 @@ asm
|
|||||||
movsb
|
movsb
|
||||||
movb $0,(%edi)
|
movb $0,(%edi)
|
||||||
movl d,%eax // return value to EAX
|
movl d,%eax // return value to EAX
|
||||||
popl %esi
|
movl saveedi,%edi
|
||||||
end ['EDI','EAX','ECX'];
|
movl saveesi,%esi
|
||||||
|
end;
|
||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.8 2003-07-07 20:22:05 peter
|
Revision 1.9 2003-09-08 18:21:37 peter
|
||||||
|
* save edi,esi,ebx
|
||||||
|
|
||||||
|
Revision 1.8 2003/07/07 20:22:05 peter
|
||||||
* generic string routines added
|
* generic string routines added
|
||||||
|
|
||||||
Revision 1.7 2002/09/07 16:01:19 peter
|
Revision 1.7 2002/09/07 16:01:19 peter
|
||||||
|
@ -14,7 +14,10 @@
|
|||||||
|
|
||||||
**********************************************************************}
|
**********************************************************************}
|
||||||
|
|
||||||
|
var
|
||||||
|
saveedi : longint;
|
||||||
asm
|
asm
|
||||||
|
movl %edi,saveedi
|
||||||
movl p,%edi
|
movl p,%edi
|
||||||
movl $0xffffffff,%ecx
|
movl $0xffffffff,%ecx
|
||||||
xorl %eax,%eax
|
xorl %eax,%eax
|
||||||
@ -23,12 +26,16 @@ asm
|
|||||||
scasb
|
scasb
|
||||||
movl $0xfffffffe,%eax
|
movl $0xfffffffe,%eax
|
||||||
subl %ecx,%eax
|
subl %ecx,%eax
|
||||||
end ['EDI','ECX','EAX'];
|
movl saveedi,%edi
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.3 2002-09-07 16:01:19 peter
|
Revision 1.4 2003-09-08 18:21:37 peter
|
||||||
|
* save edi,esi,ebx
|
||||||
|
|
||||||
|
Revision 1.3 2002/09/07 16:01:19 peter
|
||||||
* old logs removed and tabs fixed
|
* old logs removed and tabs fixed
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -24,8 +24,6 @@
|
|||||||
|
|
||||||
Function CallIntegerFunc(s: Pointer; Address: Pointer; Index, IValue: LongInt): Int64; assembler;
|
Function CallIntegerFunc(s: Pointer; Address: Pointer; Index, IValue: LongInt): Int64; assembler;
|
||||||
asm
|
asm
|
||||||
movl S,%esi
|
|
||||||
movl Address,%edi
|
|
||||||
// ? Indexed Function
|
// ? Indexed Function
|
||||||
movl Index,%eax
|
movl Index,%eax
|
||||||
testl %eax,%eax
|
testl %eax,%eax
|
||||||
@ -33,17 +31,15 @@ Function CallIntegerFunc(s: Pointer; Address: Pointer; Index, IValue: LongInt):
|
|||||||
movl IValue,%eax
|
movl IValue,%eax
|
||||||
pushl %eax
|
pushl %eax
|
||||||
.LINoPush:
|
.LINoPush:
|
||||||
push %esi
|
push s
|
||||||
// reset EDX for routines that return only EAX
|
// reset EDX for routines that return only EAX
|
||||||
xorl %edx,%edx
|
xorl %edx,%edx
|
||||||
call %edi
|
call Address
|
||||||
// now the result is in EDX:EAX
|
// now the result is in EDX:EAX
|
||||||
end;
|
end;
|
||||||
|
|
||||||
Function CallIntegerProc(s : Pointer;Address : Pointer;Value : Integer; INdex,IValue : Longint) : Integer;assembler;
|
Function CallIntegerProc(s : Pointer;Address : Pointer;Value : Integer; INdex,IValue : Longint) : Integer;assembler;
|
||||||
asm
|
asm
|
||||||
movl S,%esi
|
|
||||||
movl Address,%edi
|
|
||||||
// Push value to set
|
// Push value to set
|
||||||
movl Value,%eax
|
movl Value,%eax
|
||||||
pushl %eax
|
pushl %eax
|
||||||
@ -54,15 +50,13 @@ Function CallIntegerProc(s : Pointer;Address : Pointer;Value : Integer; INdex,IV
|
|||||||
movl IValue,%eax
|
movl IValue,%eax
|
||||||
pushl %eax
|
pushl %eax
|
||||||
.LIPNoPush:
|
.LIPNoPush:
|
||||||
pushl %esi
|
pushl s
|
||||||
call %edi
|
call Address
|
||||||
end;
|
end;
|
||||||
|
|
||||||
Function CallSingleFunc(s : Pointer; Address : Pointer;
|
Function CallSingleFunc(s : Pointer; Address : Pointer;
|
||||||
Index, IValue : Longint) : Single; assembler;
|
Index, IValue : Longint) : Single; assembler;
|
||||||
asm
|
asm
|
||||||
movl S,%esi
|
|
||||||
movl Address,%edi
|
|
||||||
// ? Indexed Function
|
// ? Indexed Function
|
||||||
movl Index,%eax
|
movl Index,%eax
|
||||||
testl %eax,%eax
|
testl %eax,%eax
|
||||||
@ -70,16 +64,14 @@ Function CallSingleFunc(s : Pointer; Address : Pointer;
|
|||||||
movl IValue,%eax
|
movl IValue,%eax
|
||||||
pushl %eax
|
pushl %eax
|
||||||
.LINoPush:
|
.LINoPush:
|
||||||
push %esi
|
pushl s
|
||||||
call %edi
|
call Address
|
||||||
//
|
//
|
||||||
end;
|
end;
|
||||||
|
|
||||||
Function CallDoubleFunc(s : Pointer; Address : Pointer;
|
Function CallDoubleFunc(s : Pointer; Address : Pointer;
|
||||||
Index, IValue : Longint) : Double; assembler;
|
Index, IValue : Longint) : Double; assembler;
|
||||||
asm
|
asm
|
||||||
movl S,%esi
|
|
||||||
movl Address,%edi
|
|
||||||
// ? Indexed Function
|
// ? Indexed Function
|
||||||
movl Index,%eax
|
movl Index,%eax
|
||||||
testl %eax,%eax
|
testl %eax,%eax
|
||||||
@ -87,15 +79,13 @@ Function CallDoubleFunc(s : Pointer; Address : Pointer;
|
|||||||
movl IValue,%eax
|
movl IValue,%eax
|
||||||
pushl %eax
|
pushl %eax
|
||||||
.LINoPush:
|
.LINoPush:
|
||||||
push %esi
|
pushl s
|
||||||
call %edi
|
call Address
|
||||||
//
|
//
|
||||||
end;
|
end;
|
||||||
|
|
||||||
Function CallExtendedFunc(s : Pointer;Address : Pointer; INdex,IValue : Longint) : Extended;assembler;
|
Function CallExtendedFunc(s : Pointer;Address : Pointer; INdex,IValue : Longint) : Extended;assembler;
|
||||||
asm
|
asm
|
||||||
movl S,%esi
|
|
||||||
movl Address,%edi
|
|
||||||
// ? Indexed Function
|
// ? Indexed Function
|
||||||
movl Index,%eax
|
movl Index,%eax
|
||||||
testl %eax,%eax
|
testl %eax,%eax
|
||||||
@ -103,15 +93,13 @@ Function CallExtendedFunc(s : Pointer;Address : Pointer; INdex,IValue : Longint)
|
|||||||
movl IValue,%eax
|
movl IValue,%eax
|
||||||
pushl %eax
|
pushl %eax
|
||||||
.LINoPush:
|
.LINoPush:
|
||||||
push %esi
|
pushl s
|
||||||
call %edi
|
call Address
|
||||||
//
|
//
|
||||||
end;
|
end;
|
||||||
|
|
||||||
Function CallBooleanFunc(s : Pointer;Address : Pointer; Index,IValue : Longint) : Boolean;assembler;
|
Function CallBooleanFunc(s : Pointer;Address : Pointer; Index,IValue : Longint) : Boolean;assembler;
|
||||||
asm
|
asm
|
||||||
movl S,%esi
|
|
||||||
movl Address,%edi
|
|
||||||
// ? Indexed Function
|
// ? Indexed Function
|
||||||
movl Index,%eax
|
movl Index,%eax
|
||||||
testl %eax,%eax
|
testl %eax,%eax
|
||||||
@ -119,8 +107,8 @@ Function CallBooleanFunc(s : Pointer;Address : Pointer; Index,IValue : Longint)
|
|||||||
movl IValue,%eax
|
movl IValue,%eax
|
||||||
pushl %eax
|
pushl %eax
|
||||||
.LBNoPush:
|
.LBNoPush:
|
||||||
push %esi
|
pushl s
|
||||||
call %edi
|
call Address
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// Assembler Functions can't have short stringreturn values.
|
// Assembler Functions can't have short stringreturn values.
|
||||||
@ -130,8 +118,6 @@ Function CallBooleanFunc(s : Pointer;Address : Pointer; Index,IValue : Longint)
|
|||||||
Procedure CallSStringFunc(s : Pointer;Address : Pointer; INdex,IValue : Longint;
|
Procedure CallSStringFunc(s : Pointer;Address : Pointer; INdex,IValue : Longint;
|
||||||
Var Res: Shortstring);assembler;
|
Var Res: Shortstring);assembler;
|
||||||
asm
|
asm
|
||||||
movl S,%esi
|
|
||||||
movl Address,%edi
|
|
||||||
// ? Indexed Function
|
// ? Indexed Function
|
||||||
movl Index,%eax
|
movl Index,%eax
|
||||||
testl %eax,%eax
|
testl %eax,%eax
|
||||||
@ -141,14 +127,12 @@ Procedure CallSStringFunc(s : Pointer;Address : Pointer; INdex,IValue : Longint;
|
|||||||
// the result is stored in an invisible parameter
|
// the result is stored in an invisible parameter
|
||||||
pushl Res
|
pushl Res
|
||||||
.LSSNoPush:
|
.LSSNoPush:
|
||||||
push %esi
|
pushl s
|
||||||
call %edi
|
call Address
|
||||||
end;
|
end;
|
||||||
|
|
||||||
Procedure CallSStringProc(s : Pointer;Address : Pointer;Const Value : ShortString; INdex,IVAlue : Longint);assembler;
|
Procedure CallSStringProc(s : Pointer;Address : Pointer;Const Value : ShortString; INdex,IVAlue : Longint);assembler;
|
||||||
asm
|
asm
|
||||||
movl S,%esi
|
|
||||||
movl Address,%edi
|
|
||||||
// Push value to set
|
// Push value to set
|
||||||
movl Value,%eax
|
movl Value,%eax
|
||||||
pushl %eax
|
pushl %eax
|
||||||
@ -161,13 +145,16 @@ Procedure CallSStringProc(s : Pointer;Address : Pointer;Const Value : ShortStrin
|
|||||||
pushl %eax
|
pushl %eax
|
||||||
.LSSPNoPush:
|
.LSSPNoPush:
|
||||||
// BUG 2 (push)
|
// BUG 2 (push)
|
||||||
pushl %esi
|
pushl s
|
||||||
call %edi
|
call Address
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.5 2003-03-29 16:55:56 michael
|
Revision 1.6 2003-09-08 18:21:37 peter
|
||||||
|
* save edi,esi,ebx
|
||||||
|
|
||||||
|
Revision 1.5 2003/03/29 16:55:56 michael
|
||||||
+ Patch from Mattias Gaertner for single typeinfo
|
+ Patch from Mattias Gaertner for single typeinfo
|
||||||
|
|
||||||
Revision 1.4 2002/09/07 16:01:19 peter
|
Revision 1.4 2002/09/07 16:01:19 peter
|
||||||
|
Loading…
Reference in New Issue
Block a user