mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-23 12:19:25 +02:00
* fpc_shortstr_append_shortstr has to use high(s1) instead of 255 as
maxlen + ppc version of fpc_shortstr_append_shortstr
This commit is contained in:
parent
a101c4f2ec
commit
f0227e6a17
@ -895,10 +895,11 @@ begin
|
|||||||
movl s2,%esi
|
movl s2,%esi
|
||||||
movl %edi,%ebx
|
movl %edi,%ebx
|
||||||
movzbl (%edi),%ecx
|
movzbl (%edi),%ecx
|
||||||
xor %eax,%eax
|
movl s1+4,%eax
|
||||||
lea 1(%edi,%ecx),%edi
|
lea 1(%edi,%ecx),%edi
|
||||||
negl %ecx
|
negl %ecx
|
||||||
addl $0x0ff,%ecx
|
addl %eax,%ecx
|
||||||
|
// no need to zero eax, high(s1) <= 255
|
||||||
lodsb
|
lodsb
|
||||||
cmpl %ecx,%eax
|
cmpl %ecx,%eax
|
||||||
jbe .LStrConcat1
|
jbe .LStrConcat1
|
||||||
@ -1256,7 +1257,12 @@ end;
|
|||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.44 2003-05-26 21:18:13 peter
|
Revision 1.45 2003-06-01 14:50:17 jonas
|
||||||
|
* fpc_shortstr_append_shortstr has to use high(s1) instead of 255 as
|
||||||
|
maxlen
|
||||||
|
+ ppc version of fpc_shortstr_append_shortstr
|
||||||
|
|
||||||
|
Revision 1.44 2003/05/26 21:18:13 peter
|
||||||
* FPC_SHORTSTR_APPEND_SHORTSTR public added
|
* FPC_SHORTSTR_APPEND_SHORTSTR public added
|
||||||
|
|
||||||
Revision 1.43 2003/05/26 19:36:46 peter
|
Revision 1.43 2003/05/26 19:36:46 peter
|
||||||
|
@ -580,8 +580,8 @@ var
|
|||||||
begin
|
begin
|
||||||
s1l:=length(s1);
|
s1l:=length(s1);
|
||||||
s2l:=length(s2);
|
s2l:=length(s2);
|
||||||
if s1l+s2l>255 then
|
if s1l+s2l>high(s1) then
|
||||||
s2l:=255-s1l;
|
s2l:=high(s1)-s1l;
|
||||||
move(s2[1],s1[s1l+1],s2l);
|
move(s2[1],s1[s1l+1],s2l);
|
||||||
s1[0]:=chr(s1l+s2l);
|
s1[0]:=chr(s1l+s2l);
|
||||||
end;
|
end;
|
||||||
@ -975,7 +975,12 @@ end;
|
|||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.59 2003-05-26 21:18:13 peter
|
Revision 1.60 2003-06-01 14:50:17 jonas
|
||||||
|
* fpc_shortstr_append_shortstr has to use high(s1) instead of 255 as
|
||||||
|
maxlen
|
||||||
|
+ ppc version of fpc_shortstr_append_shortstr
|
||||||
|
|
||||||
|
Revision 1.59 2003/05/26 21:18:13 peter
|
||||||
* FPC_SHORTSTR_APPEND_SHORTSTR public added
|
* FPC_SHORTSTR_APPEND_SHORTSTR public added
|
||||||
|
|
||||||
Revision 1.58 2003/05/26 19:36:46 peter
|
Revision 1.58 2003/05/26 19:36:46 peter
|
||||||
|
@ -747,42 +747,45 @@ LShortStrCopyDone2:
|
|||||||
end ['R0','R3','R4','R5','R10','CR0','CTR'];
|
end ['R0','R3','R4','R5','R10','CR0','CTR'];
|
||||||
|
|
||||||
|
|
||||||
(*
|
{$define FPC_SYSTEM_HAS_FPC_SHORTSTR_APPEND_SHORTSTR}
|
||||||
!!! fast version like for the i386, but not called this way currently (JM)
|
|
||||||
|
|
||||||
{$define FPC_SYSTEM_HAS_FPC_SHORTSTR_CONCAT}
|
procedure fpc_shortstr_append_shortstr(var s1: shortstring; const s2: shortstring); compilerproc;
|
||||||
|
{ expects that results (r3) contains a pointer to the current string s1, r4 }
|
||||||
function fpc_shortstr_concat(const s1,s2: shortstring): shortstring; compilerproc;
|
{ high(s1) and (r5) a pointer to the one that has to be concatenated }
|
||||||
{ expects that results (r3) contains a pointer to the current string and s1 }
|
|
||||||
{ (r4) a pointer to the one that has to be concatenated }
|
|
||||||
assembler;
|
assembler;
|
||||||
asm
|
asm
|
||||||
{ load length s1 }
|
{ load length s1 }
|
||||||
lbz r9, 0(r4)
|
lbz r6, 0(r3)
|
||||||
{ load length result }
|
{ load length s2 }
|
||||||
lbz r10, 0(r3)
|
lbz r10, 0(r5)
|
||||||
{ length 0? }
|
{ length 0? }
|
||||||
cmplwi r10,0
|
cmplwi r10,0
|
||||||
{ go to last current character of result }
|
|
||||||
add r4,r9,r4
|
|
||||||
|
|
||||||
{ calculate min(length(s1),255-length(result)) }
|
{ calculate min(length(s2),high(result)-length(result)) }
|
||||||
subfic r9,r9,255
|
sub r9,r4,r6
|
||||||
subc r8,r9,r10 { r8 := r9 - r10 }
|
subc r8,r9,r10 { r8 := r9 - r10 }
|
||||||
subfe r9,r9,r9 { if r9 >= r10 then r9' := 0 else r9' := -1 }
|
subfe r9,r9,r9 { if r9 >= r10 then r9' := 0 else r9' := -1 }
|
||||||
and r9,r8,r9 { if r9 >= r10 then r9' := 0 else r9' := r9-r8 }
|
and r9,r8,r9 { if r9 >= r10 then r9' := 0 else r9' := r9-r10 }
|
||||||
add r9,r9,r10 { if r9 >= r10 then r9' := r10 else r9' := r9 }
|
add r9,r9,r10 { if r9 >= r10 then r9' := r10 else r9' := r9 }
|
||||||
|
|
||||||
{ and concatenate }
|
{ calculate new length }
|
||||||
|
add r10,r6,r9
|
||||||
|
{ load value to copy in ctr }
|
||||||
mtctr r9
|
mtctr r9
|
||||||
beq LShortStrConcatDone
|
{ store new length }
|
||||||
LShortStrConcatLoop:
|
stb r10,0(r3)
|
||||||
lbzu r10,1(r4)
|
{ go to last current character of result }
|
||||||
|
add r3,r6,r3
|
||||||
|
|
||||||
|
{ if nothing to do, exit }
|
||||||
|
beq LShortStrAppendDone
|
||||||
|
{ and concatenate }
|
||||||
|
LShortStrAppendLoop:
|
||||||
|
lbzu r10,1(r5)
|
||||||
stbu r10,1(r3)
|
stbu r10,1(r3)
|
||||||
bdnz LShortStrConcatLoop
|
bdnz LShortStrAppendLoop
|
||||||
LShortStrConcatDone:
|
LShortStrAppendDone:
|
||||||
end ['R3','R4','R8','R9','R10','CTR'];
|
end ['R3','R4','R8','R9','R10','CTR'];
|
||||||
*)
|
|
||||||
|
|
||||||
(*
|
(*
|
||||||
{$define FPC_SYSTEM_HAS_FPC_SHORTSTR_COMPARE}
|
{$define FPC_SYSTEM_HAS_FPC_SHORTSTR_COMPARE}
|
||||||
@ -960,7 +963,12 @@ end ['R3','R10'];
|
|||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.49 2003-05-29 21:17:27 jonas
|
Revision 1.50 2003-06-01 14:50:17 jonas
|
||||||
|
* fpc_shortstr_append_shortstr has to use high(s1) instead of 255 as
|
||||||
|
maxlen
|
||||||
|
+ ppc version of fpc_shortstr_append_shortstr
|
||||||
|
|
||||||
|
Revision 1.49 2003/05/29 21:17:27 jonas
|
||||||
* compile with -dppc603 to not use unaligned float loads in move() and
|
* compile with -dppc603 to not use unaligned float loads in move() and
|
||||||
g_concatcopy, because the 603 and 604 take an exception for those
|
g_concatcopy, because the 603 and 604 take an exception for those
|
||||||
(and netbsd doesn't even handle those in the kernel). There are
|
(and netbsd doesn't even handle those in the kernel). There are
|
||||||
|
Loading…
Reference in New Issue
Block a user