dnl AMD64 mpn_mullo_basecase optimised for Conroe/Wolfdale/Nehalem/Westmere.
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
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 4.0 4.18-4.25
C Intel NHM 3.75 4.06-4.2
C Intel SBR
C Intel IBR
C Intel HWL
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.
C TODO
C * Implement proper cor2, replacing current cor0.
C * Offset n by 2 in order to avoid the outer loop cmp. (And sqr_basecase?)
C * Micro-optimise.
C When playing with pointers, set this to $2 to fall back to conservative
C indexing in wind-down code.
define(`I',`$1')
ASM_START()
TEXT ALIGN(32)
PROLOGUE(mpn_mullo_basecase)
FUNC_ENTRY(4)
mov (up), %rax mov vp_param, vp
cmp $4, n_param
jb L(small)
mov (vp_param), v0 push %rbx lea (rp,n_param,8), rp C point rp at R[un] push %rbp lea (up,n_param,8), up C point up right after U's end push %r12 mov $0, R32(n) C FIXME sub n_param, n push %r13 mul v0 mov 8(vp), v1
add $2, n lea 16(vp), vp lea -16(up), up cmp $-2, n jl L(outer)
pop %r15 pop %r14
jnz L(cor0)
L(cor1):mov (vp), v0 mov 8(vp), v1 mov -16(up), %rax mul v0 C u0 x v2 add -16(rp), %rax C FIXME: rp[0] still available in reg? adc -8(rp), %rdx C FIXME: rp[1] still available in reg? mov -8(up), %rbx
imul v0, %rbx mov -16(up), %rcx
imul v1, %rcx mov %rax, -16(rp) add %rbx, %rcx add %rdx, %rcx mov %rcx, -8(rp) pop %r13 pop %r12 pop %rbp pop %rbx
FUNC_EXIT() ret
L(cor0):mov (vp), %r11
imul -8(up), %r11 add %rax, %r11 mov %r11, -8(rp) pop %r13 pop %r12 pop %rbp pop %rbx
FUNC_EXIT() ret
ALIGN(16)
L(small): cmp $2, n_param
jae L(gt1)
L(n1): imul (vp_param), %rax mov %rax, (rp)
FUNC_EXIT() ret
L(gt1): ja L(gt2)
L(n2): mov (vp_param), %r9 mul %r9 mov %rax, (rp) mov 8(up), %rax
imul %r9, %rax add %rax, %rdx mov 8(vp), %r9 mov (up), %rcx
imul %r9, %rcx add %rcx, %rdx mov %rdx, 8(rp)
FUNC_EXIT() ret
L(gt2):
L(n3): mov (vp_param), %r9 mul %r9 C u0 x v0 mov %rax, (rp) mov %rdx, %r10 mov 8(up), %rax mul %r9 C u1 x v0
imul 16(up), %r9 C u2 x v0 add %rax, %r10 adc %rdx, %r9 mov 8(vp), %r11 mov (up), %rax mul %r11 C u0 x v1 add %rax, %r10 adc %rdx, %r9
imul 8(up), %r11 C u1 x v1 add %r11, %r9 mov %r10, 8(rp) mov 16(vp), %r10 mov (up), %rax
imul %rax, %r10 C u0 x v2 add %r10, %r9 mov %r9, 16(rp)
FUNC_EXIT() ret
EPILOGUE()
Messung V0.5
¤ Dauer der Verarbeitung: 0.11 Sekunden
(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.