dnl x86 mpn_sqr_basecase -- square an mpn number, optimised for atom.
dnl Contributed to the GNU project by Torbjorn Granlund and Marco Bodrato.
dnl Copyright 2011 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 TODO
C * Check if'jmp N(%esp)' is well-predicted enough to allow us to combine the
C 4 large loops into one; we could use it for the outer loop branch.
C * Optimise code outside of inner loops.
C * Write combined addmul_1 feed-in a wind-down code, and use when iterating
C outer each loop. ("Overlapping software pipelining")
C * Perhaps use caller-saves regs for inlined mul_1, allowing us to postpone
C all pushes.
C * Perhaps write special codefor n < M, for some small M.
C * Replace inlined addmul_1 with smaller code from aorsmul_1.asm, or perhaps
C with even less pipelined code.
C * We run the outer loop until we have a 2-limb by 1-limb addmul_1 left.
C Consider breaking out earlier, saving high the cost of short loops.
C void mpn_sqr_basecase (mp_ptr wp,
C mp_srcptr xp, mp_size_t xn);
adc un, %edx C un is zero here add %ebx, 12(rp) movd %mm0, %eax
pmuludq %mm7, %mm1 lea 16(rp), rp
psrlq $32, %mm0 adc %edx, %eax movd %mm0, %edx movd %mm1, %ebx adc un, %edx add %eax, (rp)
psrlq $32, %mm1 adc %edx, %ebx movd %mm1, %eax adc un, %eax add %ebx, 4(rp) adc un, %eax mov %eax, 8(rp)
inc n
C ================================================================
L(ol2): lea 8(up,n,4), up movd -4(up), %mm7 C read next U invariant limb lea 12(rp,n,4), rp mov n, un
movd (up), %mm0
pmuludq %mm7, %mm0 xor %edx, %edx
sar $2, un movd 4(up), %mm1
test un, un C clear carry movd %mm0, %eax
pmuludq %mm7, %mm1 inc un jnz L(a2) jmp L(re2)
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.