dnl AMD64 mpn_sqr_basecase optimised for Intel Sandy bridge and Ivy bridge.
dnl Contributed to the GNU project by Torbjörn Granlund.
dnl Copyright 2008, 2009, 2011-2013 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 cycles/limb mul_2 addmul_2 sqr_diag_addlsh1
C AMD K8,K9 ? ? ?
C AMD K10 ? ? ?
C AMD bull ? ? ?
C AMD pile ? ? ?
C AMD steam ? ? ?
C AMD bobcat ? ? ?
C AMD jaguar ? ? ?
C Intel P4 ? ? ?
C Intel core ? ? ?
C Intel NHM ? ? ?
C Intel SBR 2.57 2.93 3.0
C Intel IBR 2.35 2.66 3.0
C Intel HWL 2.02 2.5 2.5
C Intel BWL ? ? ?
C Intel atom ? ? ?
C VIA nano ? ? ?
C The inner loops of thiscode are the result of running a code generation and
C optimisation tool suite written by David Harvey and Torbjörn Granlund, except
C that the sqr_diag_addlsh1 loop was manually written.
C TODO
C * Replace current unoptimised sqr_diag_addlsh1 loop, 2.5 c/l should be easy.
C * Streamline pointer updates.
C * Perhaps suppress a few more xor insns in feed-in code.
C * Make sure we write no dead registers in feed-in code.
C * We might use 32-bit size ops, since n >= 2^32 is non-terminating. Watch
C out for negative sizes being zero-extended, though.
C * The straight-line codefor n <= 3 comes from the K8 code, and might be
C quite sub-optimal here. Write specific code, andaddcodefor n = 4.
C * The mul_2 loop has a 10 insn common sequence in the loop start and the
C wind-down code. Try re-rolling it.
C * This file has been the subject to just basic micro-optimisation.
C When playing with pointers, set this to $2 to fall back to conservative
C indexing in wind-down code.
define(`I',`$1')
L(do_mul_2): mov (up), v0 push %rbx lea (rp,un_param,8), rp C point rp at R[un] mov 8(up), %rax push %rbp lea (up,un_param,8), up C point up right after U's end mov %rax, v1 push %r12 mov $1, R32(un) C free up rdx push %r13 sub un_param, un push %r14 push un mul v0 mov %rax, (rp,un,8) mov 8(up,un,8), %rax
test $1, R8(un) jnz L(m2b1)
L(m2b0):lea 2(un), n xor R32(w1), R32(w1) C FIXME xor R32(w2), R32(w2) C FIXME mov %rdx, w0 jmp L(m2l0)
L(m2b1):lea 1(un), n xor R32(w3), R32(w3) C FIXME xor R32(w0), R32(w0) C FIXME mov %rdx, w2 jmp L(m2l1)
L(do_addmul_2):
L(outer): lea 16(rp), rp cmp $-2, R32(un) C jump if un C {-1,0} FIXME jump if un C {-2,1}
jge L(corner) C FIXME: move to before the lea above
mov -8(up,un,8), v0 mov (up,un,8), %rax mov %rax, v1 mul v0
test $1, R8(un) jnz L(a1x1)
pop %r14 pop %r13 pop %r12 pop %rbp pop %rbx
FUNC_EXIT() ret
EPILOGUE()
Messung V0.5
¤ 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.0.13Bemerkung:
(vorverarbeitet)
¤
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.