dnl This file is part of the GNU MP Library.
dnl
dnl The GNU MP Library is free software; you can redistribute it and/or modify
dnl it under the terms of either:
dnl
dnl * the GNU Lesser General Public License as published by the Free
dnl Software Foundation; either version 3 of the License, or (at your
dnl option) any later version.
dnl
dnl or
dnl
dnl * the GNU General Public License as published by the Free Software
dnl Foundation; either version 2 of the License, or (at your option) any
dnl later version.
dnl
dnl or both in parallel, as here.
dnl
dnl The GNU MP Library is distributed in the hope that it will be useful, but
dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
dnl for more details.
dnl
dnl You should have received copies of the GNU General Public License and the
dnl GNU Lesser General Public License along with the GNU MP Library. If not,
dnl see https://www.gnu.org/licenses/.
include(`../config.m4')
C cycles/limb
C P5,P54: 6.0
C P55: 5.375
C mp_limb_t mpn_lshift (mp_ptr dst, mp_srcptr src, mp_size_t size,
C unsigned shift);
C
C The main shift-by-N loop should run at 5.375 c/l and that's what P55 does,
C but P5 and P54 run only at 6.0 c/l, which is 4 cycles lost somewhere.
C We can use faster codefor shift-by-1 under certain conditions. cmp $1,%ecx jne L(normal)
leal 4(%esi),%eax
cmpl %edi,%eax
jnc L(special) C jump if s_ptr + 1 >= res_ptr
leal (%esi,%ebp,4),%eax
cmpl %eax,%edi
jnc L(special) C jump if res_ptr >= s_ptr + size
L(end2):
shll %cl,%edx C compute least significant limb
movl %edx,(%edi) C store it
popl %eax C popcarry limb
popl %ebp
popl %ebx
popl %esi
popl %edi ret
C We loop from least significant end of the arrays, which is only
C permissable if the source and destination don't overlap, since the
C function is documented to work for overlapping source and destination.
L(special):
movl (%esi),%edx
addl $4,%esi
decl %ebp
pushl %ebp
shrl $3,%ebp
addl %edx,%edx
incl %ebp
decl %ebp jz L(Lend)
movl (%edi),%eax C fetch destination cache line
ALIGN(4)
L(Loop):
movl 28(%edi),%eax C fetch destination cache line
movl %edx,%ebx
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.