dnl Copyright 2004, 2005, 2007-2012, 2014 Free Software Foundation, Inc.
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 norm unorm frac
C AMD K8,K9 131312
C AMD K10 131312
C Intel P4 434443
C Intel core2 24.524.519.5
C Intel corei 20.519.518
C Intel atom 434636
C VIA nano 25.525.524
C mp_limb_t
C mpn_divrem_1 (mp_ptr qp, mp_size_t fn,
C mp_srcptr np, mp_size_t nn, mp_limb_t d)
C mp_limb_t
C mpn_preinv_divrem_1 (mp_ptr qp, mp_size_t fn,
C mp_srcptr np, mp_size_t nn, mp_limb_t d,
C mp_limb_t dinv, int cnt)
C INPUT PARAMETERS
define(`qp', `%rdi')
define(`fn_param', `%rsi')
define(`up_param', `%rdx')
define(`un_param', `%rcx')
define(`d', `%r8')
define(`dinv', `%r9') C only for mpn_preinv_divrem_1
C shift passed on stack C only for mpn_preinv_divrem_1
L(normalized):
test un, un je L(8) C un == 0 mov -8(up,un,8), %rbp dec un mov %rbp, %rax sub d, %rbp
cmovc %rax, %rbp
sbb R32(%rax), R32(%rax) inc R32(%rax) mov %rax, (qp) lea -8(qp), qp
L(8):
IFSTD(` push %rdi ')
IFSTD(` push %rsi ') push %r8
IFSTD(` mov d, %rdi ')
IFDOS(` sub $32, %rsp ')
IFDOS(` mov d, %rcx ')
ASSERT(nz, `test $15, %rsp') CALL( mpn_invert_limb)
IFDOS(` add $32, %rsp ') pop %r8
IFSTD(` pop %rsi ')
IFSTD(` pop %rdi ')
mov %rax, dinv mov %rbp, %rax jmp L(nent)
ALIGN(16)
L(ntop):mov (up,un,8), %r10 C K8-K10 P6-CNR P6-NHM P4 mul dinv C 0,130,200,180,45 add %r10, %rax C 48312 adc %rbp, %rdx C 591013 mov %rax, %rbp C 59413 mov %rdx, %r13 C 6111223
imul d, %rdx C 6111123 sub %rdx, %r10 C 10161433 mov d, %rax C add %r10, %rax C 11171534 cmp %rbp, %r10 C 11171534
cmovc %r10, %rax C 12181635 adc $-1, %r13 C cmp d, %rax C
jae L(nfx) C
L(nok): mov %r13, (qp) C sub $8, qp C
L(nent):lea1(%rax), %rbp C dec un C
jns L(ntop) C
xor R32(%rcx), R32(%rcx) jmp L(frac)
L(nfx): sub d, %rax inc %r13 jmp L(nok)
L(unnormalized):
test un, un je L(44) mov -8(up,un,8), %rax cmp d, %rax
jae L(44) mov %rbp, (qp) mov %rax, %rbp lea -8(qp), qp je L(ret) dec un
L(44):
bsr d, %rcx
not R32(%rcx)
shl R8(%rcx), d
shl R8(%rcx), %rbp
push %rcx
IFSTD(` push %rdi ')
IFSTD(` push %rsi ') push %r8
IFSTD(` sub $8, %rsp ')
IFSTD(` mov d, %rdi ')
IFDOS(` sub $40, %rsp ')
IFDOS(` mov d, %rcx ')
ASSERT(nz, `test $15, %rsp') CALL( mpn_invert_limb)
IFSTD(` add $8, %rsp ')
IFDOS(` add $40, %rsp ') pop %r8
IFSTD(` pop %rsi ')
IFSTD(` pop %rdi ') pop %rcx
mov %rax, dinv mov %rbp, %rax
test un, un je L(frac)
L(uent):dec un mov (up,un,8), %rbp neg R32(%rcx) shr R8(%rcx), %rbp neg R32(%rcx) or %rbp, %rax jmp L(ent)
L(ufx): sub d, %rax inc %r13 jmp L(uok)
L(efx): sub d, %rax inc %r13 jmp L(eok)
L(frac):mov d, %rbp neg %rbp jmp L(fent)
ALIGN(16) C K8-K10 P6-CNR P6-NHM P4
L(ftop):mul dinv C 0,120,170,17 add %r11, %rdx C 5810 mov %rax, %r11 C 483 mov %rdx, %r13 C 6911
imul %rbp, %rdx C 6911 mov d, %rax C add %rdx, %rax C 101414 cmp %r11, %rdx C 101414
cmovc %rdx, %rax C 111515 adc $-1, %r13 C mov %r13, (qp) C sub $8, qp C
L(fent):lea1(%rax), %r11 C dec fn C
jns L(ftop) C
shr R8(%rcx), %rax
L(ret): pop %rbx pop %rbp pop %r12 pop %r13
FUNC_EXIT() ret
EPILOGUE()
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.