|
@@ -34,10 +34,16 @@ var
|
|
asm
|
|
asm
|
|
movl %edi,saveedi
|
|
movl %edi,saveedi
|
|
movl %esi,saveesi
|
|
movl %esi,saveesi
|
|
|
|
+{$ifdef REGCALL}
|
|
|
|
+ movl %eax,%esi
|
|
|
|
+ movl %edx,%edi
|
|
|
|
+ movl %ecx,%edx
|
|
|
|
+{$else}
|
|
movl dest,%edi
|
|
movl dest,%edi
|
|
movl source,%esi
|
|
movl source,%esi
|
|
- movl %edi,%eax
|
|
|
|
movl count,%edx
|
|
movl count,%edx
|
|
|
|
+{$endif}
|
|
|
|
+ movl %edi,%eax
|
|
{ check for zero or negative count }
|
|
{ check for zero or negative count }
|
|
cmpl $0,%edx
|
|
cmpl $0,%edx
|
|
jle .LMoveEnd
|
|
jle .LMoveEnd
|
|
@@ -110,9 +116,15 @@ var
|
|
asm
|
|
asm
|
|
movl %edi,saveedi
|
|
movl %edi,saveedi
|
|
cld
|
|
cld
|
|
|
|
+{$ifdef REGCALL}
|
|
|
|
+ movl %eax,%edi
|
|
|
|
+ movb %cl,%al
|
|
|
|
+ movl %edx,%ecx
|
|
|
|
+{$else}
|
|
movl x,%edi
|
|
movl x,%edi
|
|
movb value,%al
|
|
movb value,%al
|
|
movl count,%ecx
|
|
movl count,%ecx
|
|
|
|
+{$endif}
|
|
{ check for zero or negative count }
|
|
{ check for zero or negative count }
|
|
cmpl $0,%ecx
|
|
cmpl $0,%ecx
|
|
jle .LFillEnd
|
|
jle .LFillEnd
|
|
@@ -149,12 +161,18 @@ var
|
|
saveedi : longint;
|
|
saveedi : longint;
|
|
asm
|
|
asm
|
|
movl %edi,saveedi
|
|
movl %edi,saveedi
|
|
|
|
+{$ifdef REGCALL}
|
|
|
|
+ movl %eax,%edi
|
|
|
|
+ movzwl %cx,%eax
|
|
|
|
+ movl %edx,%ecx
|
|
|
|
+{$else}
|
|
movl x,%edi
|
|
movl x,%edi
|
|
movl count,%ecx
|
|
movl count,%ecx
|
|
|
|
+ movzwl value,%eax
|
|
|
|
+{$endif}
|
|
{ check for zero or negative count }
|
|
{ check for zero or negative count }
|
|
cmpl $0,%ecx
|
|
cmpl $0,%ecx
|
|
jle .LFillWordEnd
|
|
jle .LFillWordEnd
|
|
- movzwl value,%eax
|
|
|
|
movl %eax,%edx
|
|
movl %eax,%edx
|
|
shll $16,%eax
|
|
shll $16,%eax
|
|
orl %edx,%eax
|
|
orl %edx,%eax
|
|
@@ -178,12 +196,18 @@ var
|
|
saveedi : longint;
|
|
saveedi : longint;
|
|
asm
|
|
asm
|
|
movl %edi,saveedi
|
|
movl %edi,saveedi
|
|
|
|
+{$ifdef REGCALL}
|
|
|
|
+ movl %eax,%edi
|
|
|
|
+ movl %ecx,%eax
|
|
|
|
+ movl %edx,%ecx
|
|
|
|
+{$else}
|
|
movl x,%edi
|
|
movl x,%edi
|
|
movl count,%ecx
|
|
movl count,%ecx
|
|
|
|
+ movl value,%eax
|
|
|
|
+{$endif}
|
|
{ check for zero or negative count }
|
|
{ check for zero or negative count }
|
|
cmpl $0,%ecx
|
|
cmpl $0,%ecx
|
|
jle .LFillDWordEnd
|
|
jle .LFillDWordEnd
|
|
- movl value,%eax
|
|
|
|
cld
|
|
cld
|
|
rep
|
|
rep
|
|
stosl
|
|
stosl
|
|
@@ -195,17 +219,25 @@ 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
|
|
var
|
|
- saveedi : longint;
|
|
|
|
|
|
+ saveedi,saveebx : longint;
|
|
asm
|
|
asm
|
|
movl %edi,saveedi
|
|
movl %edi,saveedi
|
|
- xorl %eax,%eax
|
|
|
|
|
|
+ movl %ebx,saveebx
|
|
|
|
+{$ifdef REGCALL}
|
|
|
|
+ movl %edx,%ecx // Load len
|
|
|
|
+ movb %cl,%bl
|
|
|
|
+ movl %eax,%edi // Load String
|
|
|
|
+{$else}
|
|
movl Len,%ecx // Load len
|
|
movl Len,%ecx // Load len
|
|
movl Buf,%edi // Load String
|
|
movl Buf,%edi // Load String
|
|
|
|
+ movb b,%bl
|
|
|
|
+{$endif}
|
|
|
|
+ xorl %eax,%eax
|
|
testl %ecx,%ecx
|
|
testl %ecx,%ecx
|
|
jz .Lready
|
|
jz .Lready
|
|
cld
|
|
cld
|
|
movl %ecx,%edx // Copy for easy manipulation
|
|
movl %ecx,%edx // Copy for easy manipulation
|
|
- movb b,%al
|
|
|
|
|
|
+ movb %bl,%al
|
|
repne
|
|
repne
|
|
scasb
|
|
scasb
|
|
jne .Lcharposnotfound
|
|
jne .Lcharposnotfound
|
|
@@ -217,23 +249,32 @@ asm
|
|
movl $-1,%eax
|
|
movl $-1,%eax
|
|
.Lready:
|
|
.Lready:
|
|
movl saveedi,%edi
|
|
movl saveedi,%edi
|
|
|
|
+ movl saveebx,%ebx
|
|
end;
|
|
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
|
|
var
|
|
- saveedi : longint;
|
|
|
|
|
|
+ saveedi,saveebx : longint;
|
|
asm
|
|
asm
|
|
movl %edi,saveedi
|
|
movl %edi,saveedi
|
|
- xorl %eax,%eax
|
|
|
|
|
|
+ movl %ebx,saveebx
|
|
|
|
+{$ifdef REGCALL}
|
|
|
|
+ movl %eax,%edi
|
|
|
|
+ movl %cx,%bx
|
|
|
|
+ movl %edx,%ecx
|
|
|
|
+{$else}
|
|
movl Len,%ecx // Load len
|
|
movl Len,%ecx // Load len
|
|
movl Buf,%edi // Load String
|
|
movl Buf,%edi // Load String
|
|
|
|
+ movw b,%bx
|
|
|
|
+{$endif}
|
|
|
|
+ xorl %eax,%eax
|
|
testl %ecx,%ecx
|
|
testl %ecx,%ecx
|
|
jz .Lready
|
|
jz .Lready
|
|
cld
|
|
cld
|
|
movl %ecx,%edx // Copy for easy manipulation
|
|
movl %ecx,%edx // Copy for easy manipulation
|
|
- movw b,%ax
|
|
|
|
|
|
+ movw %bx,%ax
|
|
repne
|
|
repne
|
|
scasw
|
|
scasw
|
|
jne .Lcharposnotfound
|
|
jne .Lcharposnotfound
|
|
@@ -245,23 +286,32 @@ asm
|
|
movl $-1,%eax
|
|
movl $-1,%eax
|
|
.Lready:
|
|
.Lready:
|
|
movl saveedi,%edi
|
|
movl saveedi,%edi
|
|
|
|
+ movl saveebx,%ebx
|
|
end;
|
|
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
|
|
var
|
|
- saveedi : longint;
|
|
|
|
|
|
+ saveedi,saveebx : longint;
|
|
asm
|
|
asm
|
|
movl %edi,saveedi
|
|
movl %edi,saveedi
|
|
- xorl %eax,%eax
|
|
|
|
|
|
+ movl %ebx,saveebx
|
|
|
|
+{$ifdef REGCALL}
|
|
|
|
+ movl %eax,%edi
|
|
|
|
+ movl %ecx,%ebx
|
|
|
|
+ movl %edx,%ecx
|
|
|
|
+{$else}
|
|
movl Len,%ecx // Load len
|
|
movl Len,%ecx // Load len
|
|
movl Buf,%edi // Load String
|
|
movl Buf,%edi // Load String
|
|
|
|
+ movl b,%ebx
|
|
|
|
+{$endif}
|
|
|
|
+ xorl %eax,%eax
|
|
testl %ecx,%ecx
|
|
testl %ecx,%ecx
|
|
jz .Lready
|
|
jz .Lready
|
|
cld
|
|
cld
|
|
movl %ecx,%edx // Copy for easy manipulation
|
|
movl %ecx,%edx // Copy for easy manipulation
|
|
- movl b,%eax
|
|
|
|
|
|
+ movl %ebx,%eax
|
|
repne
|
|
repne
|
|
scasl
|
|
scasl
|
|
jne .Lcharposnotfound
|
|
jne .Lcharposnotfound
|
|
@@ -273,6 +323,7 @@ asm
|
|
movl $-1,%eax
|
|
movl $-1,%eax
|
|
.Lready:
|
|
.Lready:
|
|
movl saveedi,%edi
|
|
movl saveedi,%edi
|
|
|
|
+ movl saveebx,%ebx
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
|
|
@@ -284,9 +335,15 @@ asm
|
|
movl %edi,saveedi
|
|
movl %edi,saveedi
|
|
movl %esi,saveesi
|
|
movl %esi,saveesi
|
|
cld
|
|
cld
|
|
|
|
+{$ifdef REGCALL}
|
|
|
|
+ movl %eax,%edi
|
|
|
|
+ movl %edx,%esi
|
|
|
|
+ movl %ecx,%eax
|
|
|
|
+{$else}
|
|
movl len,%eax
|
|
movl len,%eax
|
|
movl buf2,%esi { Load params}
|
|
movl buf2,%esi { Load params}
|
|
movl buf1,%edi
|
|
movl buf1,%edi
|
|
|
|
+{$endif}
|
|
testl %eax,%eax {We address -1(%esi), so we have to deal with len=0}
|
|
testl %eax,%eax {We address -1(%esi), so we have to deal with len=0}
|
|
je .LCmpbyteExit
|
|
je .LCmpbyteExit
|
|
cmpl $7,%eax {<7 not worth aligning and go through all trouble}
|
|
cmpl $7,%eax {<7 not worth aligning and go through all trouble}
|
|
@@ -334,9 +391,15 @@ asm
|
|
movl %esi,saveesi
|
|
movl %esi,saveesi
|
|
movl %ebx,saveebx
|
|
movl %ebx,saveebx
|
|
cld
|
|
cld
|
|
|
|
+{$ifdef REGCALL}
|
|
|
|
+ movl %eax,%edi
|
|
|
|
+ movl %edx,%esi
|
|
|
|
+ movl %ecx,%eax
|
|
|
|
+{$else}
|
|
movl len,%eax
|
|
movl len,%eax
|
|
movl buf2,%esi { Load params}
|
|
movl buf2,%esi { Load params}
|
|
movl buf1,%edi
|
|
movl buf1,%edi
|
|
|
|
+{$endif}
|
|
testl %eax,%eax {We address -2(%esi), so we have to deal with len=0}
|
|
testl %eax,%eax {We address -2(%esi), so we have to deal with len=0}
|
|
je .LCmpwordExit
|
|
je .LCmpwordExit
|
|
cmpl $5,%eax {<5 (3 bytes align + 4 bytes cmpsl = 4 words}
|
|
cmpl $5,%eax {<5 (3 bytes align + 4 bytes cmpsl = 4 words}
|
|
@@ -394,9 +457,15 @@ asm
|
|
movl %esi,saveesi
|
|
movl %esi,saveesi
|
|
movl %ebx,saveebx
|
|
movl %ebx,saveebx
|
|
cld
|
|
cld
|
|
|
|
+{$ifdef REGCALL}
|
|
|
|
+ movl %eax,%edi
|
|
|
|
+ movl %edx,%esi
|
|
|
|
+ movl %ecx,%eax
|
|
|
|
+{$else}
|
|
movl len,%eax
|
|
movl len,%eax
|
|
movl buf2,%esi { Load params}
|
|
movl buf2,%esi { Load params}
|
|
movl buf1,%edi
|
|
movl buf1,%edi
|
|
|
|
+{$endif}
|
|
testl %eax,%eax {We address -2(%esi), so we have to deal with len=0}
|
|
testl %eax,%eax {We address -2(%esi), so we have to deal with len=0}
|
|
je .LCmpDwordExit
|
|
je .LCmpDwordExit
|
|
cmpl $3,%eax {<3 (3 bytes align + 4 bytes cmpsl) = 2 DWords}
|
|
cmpl $3,%eax {<3 (3 bytes align + 4 bytes cmpsl) = 2 DWords}
|
|
@@ -452,9 +521,14 @@ asm
|
|
movl %ebx,saveebx
|
|
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"
|
|
|
|
+{$ifdef REGCALL}
|
|
|
|
+ movl %eax,%esi // Load address
|
|
|
|
+ movzbl %cl,%ebx // Load searchpattern
|
|
|
|
+{$else}
|
|
movl Buf,%esi // Load address
|
|
movl Buf,%esi // Load address
|
|
movl len,%edx // load maximal searchdistance
|
|
movl len,%edx // load maximal searchdistance
|
|
movzbl b,%ebx // Load searchpattern
|
|
movzbl b,%ebx // Load searchpattern
|
|
|
|
+{$endif}
|
|
testl %edx,%edx
|
|
testl %edx,%edx
|
|
je .LFound
|
|
je .LFound
|
|
xorl %ecx,%ecx // zero index in Buf
|
|
xorl %ecx,%ecx // zero index in Buf
|
|
@@ -1095,7 +1169,9 @@ end ['EAX'];
|
|
{$define FPC_SYSTEM_HAS_GET_CALLER_ADDR}
|
|
{$define FPC_SYSTEM_HAS_GET_CALLER_ADDR}
|
|
function get_caller_addr(framebp:pointer):pointer;assembler;{$ifdef SYSTEMINLINE}inline;{$endif}
|
|
function get_caller_addr(framebp:pointer):pointer;assembler;{$ifdef SYSTEMINLINE}inline;{$endif}
|
|
asm
|
|
asm
|
|
|
|
+{$ifndef REGCALL}
|
|
movl framebp,%eax
|
|
movl framebp,%eax
|
|
|
|
+{$endif}
|
|
orl %eax,%eax
|
|
orl %eax,%eax
|
|
jz .Lg_a_null
|
|
jz .Lg_a_null
|
|
movl 4(%eax),%eax
|
|
movl 4(%eax),%eax
|
|
@@ -1106,7 +1182,9 @@ end ['EAX'];
|
|
{$define FPC_SYSTEM_HAS_GET_CALLER_FRAME}
|
|
{$define FPC_SYSTEM_HAS_GET_CALLER_FRAME}
|
|
function get_caller_frame(framebp:pointer):pointer;assembler;{$ifdef SYSTEMINLINE}inline;{$endif}
|
|
function get_caller_frame(framebp:pointer):pointer;assembler;{$ifdef SYSTEMINLINE}inline;{$endif}
|
|
asm
|
|
asm
|
|
|
|
+{$ifndef REGCALL}
|
|
movl framebp,%eax
|
|
movl framebp,%eax
|
|
|
|
+{$endif}
|
|
orl %eax,%eax
|
|
orl %eax,%eax
|
|
jz .Lgnf_null
|
|
jz .Lgnf_null
|
|
movl (%eax),%eax
|
|
movl (%eax),%eax
|
|
@@ -1121,7 +1199,9 @@ end ['EAX'];
|
|
{$define FPC_SYSTEM_HAS_ABS_LONGINT}
|
|
{$define FPC_SYSTEM_HAS_ABS_LONGINT}
|
|
function abs(l:longint):longint; assembler;{$ifdef SYSTEMINLINE}inline;{$endif}[internconst:in_const_abs];
|
|
function abs(l:longint):longint; assembler;{$ifdef SYSTEMINLINE}inline;{$endif}[internconst:in_const_abs];
|
|
asm
|
|
asm
|
|
|
|
+{$ifndef REGCALL}
|
|
movl l,%eax
|
|
movl l,%eax
|
|
|
|
+{$endif}
|
|
cltd
|
|
cltd
|
|
xorl %edx,%eax
|
|
xorl %edx,%eax
|
|
subl %edx,%eax
|
|
subl %edx,%eax
|
|
@@ -1131,7 +1211,13 @@ end ['EAX','EDX'];
|
|
{$define FPC_SYSTEM_HAS_ODD_LONGINT}
|
|
{$define FPC_SYSTEM_HAS_ODD_LONGINT}
|
|
function odd(l:longint):boolean;assembler;{$ifdef SYSTEMINLINE}inline;{$endif}[internconst:in_const_odd];
|
|
function odd(l:longint):boolean;assembler;{$ifdef SYSTEMINLINE}inline;{$endif}[internconst:in_const_odd];
|
|
asm
|
|
asm
|
|
|
|
+{$ifdef SYSTEMINLINE}
|
|
movl l,%eax
|
|
movl l,%eax
|
|
|
|
+{$else}
|
|
|
|
+{$ifndef REGCALL}
|
|
|
|
+ movl l,%eax
|
|
|
|
+{$endif}
|
|
|
|
+{$endif}
|
|
andl $1,%eax
|
|
andl $1,%eax
|
|
setnz %al
|
|
setnz %al
|
|
end ['EAX'];
|
|
end ['EAX'];
|
|
@@ -1140,7 +1226,13 @@ end ['EAX'];
|
|
{$define FPC_SYSTEM_HAS_SQR_LONGINT}
|
|
{$define FPC_SYSTEM_HAS_SQR_LONGINT}
|
|
function sqr(l:longint):longint;assembler;{$ifdef SYSTEMINLINE}inline;{$endif}[internconst:in_const_sqr];
|
|
function sqr(l:longint):longint;assembler;{$ifdef SYSTEMINLINE}inline;{$endif}[internconst:in_const_sqr];
|
|
asm
|
|
asm
|
|
- mov l,%eax
|
|
|
|
|
|
+{$ifdef SYSTEMINLINE}
|
|
|
|
+ movl l,%eax
|
|
|
|
+{$else}
|
|
|
|
+{$ifndef REGCALL}
|
|
|
|
+ movl l,%eax
|
|
|
|
+{$endif}
|
|
|
|
+{$endif}
|
|
imull %eax,%eax
|
|
imull %eax,%eax
|
|
end ['EAX'];
|
|
end ['EAX'];
|
|
|
|
|
|
@@ -1272,7 +1364,9 @@ end;
|
|
function declocked(var l : longint) : boolean;assembler;
|
|
function declocked(var l : longint) : boolean;assembler;
|
|
|
|
|
|
asm
|
|
asm
|
|
|
|
+{$ifndef REGCALL}
|
|
movl l,%eax
|
|
movl l,%eax
|
|
|
|
+{$endif}
|
|
{ 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
|
|
@@ -1290,7 +1384,9 @@ function declocked(var l : longint) : boolean;assembler;
|
|
procedure inclocked(var l : longint);assembler;
|
|
procedure inclocked(var l : longint);assembler;
|
|
|
|
|
|
asm
|
|
asm
|
|
|
|
+{$ifndef REGCALL}
|
|
movl l,%eax
|
|
movl l,%eax
|
|
|
|
+{$endif}
|
|
{ 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
|
|
@@ -1330,7 +1426,10 @@ end;
|
|
|
|
|
|
{
|
|
{
|
|
$Log$
|
|
$Log$
|
|
- Revision 1.52 2003-11-03 09:42:27 marco
|
|
|
|
|
|
+ Revision 1.53 2003-11-11 21:08:17 peter
|
|
|
|
+ * REGCALL define added
|
|
|
|
+
|
|
|
|
+ Revision 1.52 2003/11/03 09:42:27 marco
|
|
* Peter's Cardinal<->Longint fixes patch
|
|
* Peter's Cardinal<->Longint fixes patch
|
|
|
|
|
|
Revision 1.51 2003/10/27 09:16:57 marco
|
|
Revision 1.51 2003/10/27 09:16:57 marco
|