dnl Contributed to the GNU project by Torbjorn Granlund.
dnl Copyright 2008, 2009, 2011, 2012 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 NOTES
C * There is a major stupidity in that we call mpn_mul_1 initially, for a
C large trip count. Instead, we should start with mul_2 for any operand
C size congruence class.
C * Stop iterating addmul_2 earlier, falling into straight-line triangle code
C for the last 2-3 iterations.
C * Perhaps implement n=4 special code.
C * The reload of the outer loop jump address hurts branch prediction.
C * The addmul_2 loop ends with an MUL whose high part is not used upon loop
C exit.
ASM_START()
TEXT ALIGN(16)
PROLOGUE(mpn_mullo_basecase)
FUNC_ENTRY(4) cmp $4, n
jge L(gen) mov (up), %rax C u0 mov (vp_param), %r8 C v0
lea L(tab)(%rip), %r9 ifdef(`PIC',
` movslq (%r9,%rcx,4), %r10 add %r10, %r9 jmp *%r9 ',` jmp *(%r9,n,8) ')
JUMPTABSECT ALIGN(8)
L(tab): JMPENT( L(tab), L(tab)) C not allowed
JMPENT( L(1), L(tab)) C 1
JMPENT( L(2), L(tab)) C 2
JMPENT( L(3), L(tab)) C 3
dnl JMPENT( L(0m4), L(tab)) C 4
dnl JMPENT( L(1m4), L(tab)) C 5
dnl JMPENT( L(2m4), L(tab)) C 6
dnl JMPENT( L(3m4), L(tab)) C 7
dnl JMPENT( L(0m4), L(tab)) C 8
dnl JMPENT( L(1m4), L(tab)) C 9
dnl JMPENT( L(2m4), L(tab)) C 10
dnl JMPENT( L(3m4), L(tab)) C 11
TEXT
L(1): imul %r8, %rax mov %rax, (rp)
FUNC_EXIT() ret
L(2): mov 8(vp_param), %r11
imul %rax, %r11 C u0 x v1 mul %r8 C u0 x v0 mov %rax, (rp)
imul 8(up), %r8 C u1 x v0 lea (%r11, %rdx), %rax add %r8, %rax mov %rax, 8(rp)
FUNC_EXIT() ret
L(3): mov 8(vp_param), %r9 C v1 mov 16(vp_param), %r11 mul %r8 C u0 x v0 -> <r1,r0> mov %rax, (rp) C r0 mov (up), %rax C u0 mov %rdx, %rcx C r1 mul %r9 C u0 x v1 -> <r2,r1>
imul 8(up), %r9 C u1 x v1 -> r2 mov 16(up), %r10
imul %r8, %r10 C u2 x v0 -> r2 add %rax, %rcx adc %rdx, %r9 add %r10, %r9 mov 8(up), %rax C u1 mul %r8 C u1 x v0 -> <r2,r1> add %rax, %rcx adc %rdx, %r9 mov %r11, %rax
imul (up), %rax C u0 x v2 -> r2 add %rax, %r9 mov %rcx, 8(rp) mov %r9, 16(rp)
FUNC_EXIT() ret
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.