dnl X64-64 mpn_mullo_basecase optimised for Intel Broadwell.
dnl Contributed to the GNU project by Torbjorn Granlund.
dnl Copyright 2017 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 The inner loops of thiscode are the result of running a code generation and
C optimisation tool suite written by David Harvey and Torbjorn Granlund.
C TODO
C * Suppress more rp[] rewrites in corner.
C * Rearrange feed-in jumps forshort branch forms.
C * Perhaps roll out the heavy artillery and 8-way unroll outer loop. Since
C feed-in code implodes, the blow-up will not be more than perhaps 4x.
C * Micro-optimise critical lead-in code block around L(ent).
C * Write n < 4 code specifically for Broadwell (current code is for Haswell).
ABI_SUPPORT(DOS64)
ABI_SUPPORT(STD64)
ASM_START()
TEXT ALIGN(32)
PROLOGUE(mpn_mullo_basecase)
FUNC_ENTRY(4) cmp $4, R32(n)
jae L(big)
mov vp_param, vp mov (up), %rdx
cmp $2, R32(n)
jae L(gt1)
L(n1): imul (vp), %rdx mov %rdx, (rp)
FUNC_EXIT() ret
L(gt1): ja L(gt2)
L(n2): mov (vp), %r9
mulx( %r9, %rax, %rdx) 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), %r9
mulx( %r9, %rax, %r10) C u0 x v0 mov %rax, (rp) mov 8(up), %rdx
mulx( %r9, %rax, %rdx) C u1 x v0
imul 16(up), %r9 C u2 x v0 add %rax, %r10 adc %rdx, %r9 mov 8(vp), %r8 mov (up), %rdx
mulx( %r8, %rax, %rdx) C u0 x v1 add %rax, %r10 adc %rdx, %r9
imul 8(up), %r8 C u1 x v1 add %r8, %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
ALIGN(16)
L(big): push %r14 push %r12 push %rbx push %rbp mov -8(vp_param,n,8), %r14 C FIXME Put at absolute end
imul (up), %r14 C FIXME Put at absolute end lea -3(n), R32(nn) lea 8(vp_param), vp mov (vp_param), %rdx
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.