mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-07 14:27:59 +02:00
* improved CompareByte for x86-64 based on a patch by Markus Beth
git-svn-id: trunk@37528 -
This commit is contained in:
parent
13957d32b8
commit
0c7306e1cd
@ -640,27 +640,30 @@ asm
|
||||
mov %rsi, %rdx
|
||||
mov %rdi, %rcx
|
||||
{$endif win64}
|
||||
testq %r8,%r8
|
||||
je .LCmpbyteZero
|
||||
negq %r8
|
||||
jz .LCmpbyteZero
|
||||
|
||||
.balign 8
|
||||
subq %r8, %rcx
|
||||
subq %r8, %rdx
|
||||
|
||||
.balign 16
|
||||
.LCmpbyteLoop:
|
||||
movb (%rcx),%r9b
|
||||
cmpb (%rdx),%r9b
|
||||
leaq 1(%rcx),%rcx
|
||||
leaq 1(%rdx),%rdx
|
||||
movb (%rcx,%r8), %al
|
||||
cmpb (%rdx,%r8), %al
|
||||
jne .LCmpbyteExitFast
|
||||
decq %r8
|
||||
incq %r8
|
||||
jne .LCmpbyteLoop
|
||||
.LCmpbyteExitFast:
|
||||
movzbq -1(%rdx),%r8 { Compare last position }
|
||||
movzbq %r9b,%rax
|
||||
subq %r8,%rax
|
||||
ret
|
||||
|
||||
.LCmpbyteZero:
|
||||
movq $0,%rax
|
||||
ret
|
||||
xorl %eax, %eax
|
||||
retq
|
||||
|
||||
.LCmpbyteExitFast:
|
||||
{$ifdef oldbinutils}
|
||||
.byte 0x42,0x0F,0xB6,0x0C,0x02
|
||||
{$else}
|
||||
movzbl (%rdx,%r8), %ecx { Compare last position }
|
||||
{$endif}
|
||||
subq %rcx, %rax
|
||||
end;
|
||||
{$endif FPC_SYSTEM_HAS_COMPAREBYTE}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user