dnl Copyright 2012, 2013, 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 TODO
C * Do overlapped software pipelining. This should close the remaining gap to
C mul_basecase.
C
C * Update un just once in the outer loop.
C
C * Perhaps keep un and n pre-multiplied by 8, thus suppressing ",8" from
C loads and stores. At least in some cases, the non-scaled form is faster.
C
C * Optimise xit3 code, e.g., using shrx and sarx like in the main loop.
C
C * The mul_1 feed-in code has gotten little attention and could probably be
C improved. Perhaps even expand it to 4 separate loops to allow straight
C fall-through into the 4 addmul_1 loops.
C
C * Clean up ad-hoc scratch register usage in the addmul_1 feed-in code blocks.
mov (up), %rdx mov8(up), %rcx
mulx( %rcx, %r9, %r10) C v0 * v1 W 12
mulx( %rdx, %rax, %r8) C v0 * v0 W 01 mov %rcx, %rdx
mulx( %rdx, %r11, %rdx) C v1 * v1 W 23 add %r9, %r9 C W 1 adc %r10, %r10 C W 2 adc $0, %rdx C W 3 add %r9, %r8 C W 1 adc %r11, %r10 C W 2 adc $0, %rdx C W 3 mov %rax, (rp) mov %r8, 8(rp) mov %r10, 16(rp) mov %rdx, 24(rp)
FUNC_EXIT() ret
mov $63, R32(%r15) C keep at 63for shrx/sarx.
test $1, R8(un) jz L(x0)
L(x1): test $2, R8(un) jz L(f3) jmp L(f1)
L(x0): test $2, R8(un) jz L(f0)
C jmp L(f2)
L(f2): mov -8(up,un,8), %rdx C up[0] lea2(un), n lea8(rp), rp
.byte0xc4,0x62,0x82,0xf7,0x5c,0xee,0xf0 C sarx %r15, -16(up,un,8), %r11
.byte0xc4,0x62,0x83,0xf7,0x6c,0xee,0xf0 C shrx %r15, -16(up,un,8), %r13 and %rdx, %r11 C "ci" in C code
mulx( %rdx, %rax, %r10) C up[0]^2 lea (%r13,%rdx,2), %rdx C "u0" arg in C code add %rax, %r11
L(f1): mov -8(up,un,8), %rdx C up[0] lea1(un), n lea8(rp), rp
.byte0xc4,0x62,0x82,0xf7,0x6c,0xee,0xf0 C sarx %r15, -16(up,un,8), %r13
.byte0xc4,0xe2,0x83,0xf7,0x5c,0xee,0xf0 C shrx %r15, -16(up,un,8), %rbx and %rdx, %r13 C "ci" in C code
mulx( %rdx, %rax, %r12) C up[0]^2 lea (%rbx,%rdx,2), %rdx C "u0" arg in C code add %rax, %r13
.byte0xc4,0xe2,0xe3,0xf6,0x04,0xee C mulx (up,un,8), %rbx, %rax adc %r12, %rbx adc $0, %rax
.byte0xc4,0x62,0xb3,0xf6,0x44,0xee,0x08 C mulx 8(up,un,8), %r9, %r8 jmp L(b1)
L(f0): mov -8(up,un,8), %rdx C up[0] lea (un), n lea8(rp), rp
.byte0xc4,0xe2,0x82,0xf7,0x5c,0xee,0xf0 C sarx %r15, -16(up,un,8), %rbx
.byte0xc4,0x62,0x83,0xf7,0x4c,0xee,0xf0 C shrx %r15, -16(up,un,8), %r9 and %rdx, %rbx C "ci" in C code
mulx( %rdx, %r10, %rax) C up[0]^2 lea (%r9,%rdx,2), %rdx C "u0" arg in C code add %r10, %rbx adc $0, %rax C "cin" in C code
.byte0xc4,0x62,0xb3,0xf6,0x04,0xce C mulx (up,un,8), %r9, %r8
.byte0xc4,0x62,0xa3,0xf6,0x54,0xee,0x08 C mulx 8(up,un,8), %r11, %r10 jmp L(b0)
L(f3): mov -8(up,un,8), %rdx C up[0] lea3(un), n lea8(rp), rp
.byte0xc4,0x62,0x82,0xf7,0x4c,0xee,0xf0 C sarx %r15, -16(up,un,8), %r9
.byte0xc4,0x62,0x83,0xf7,0x5c,0xee,0xf0 C shrx %r15, -16(up,un,8), %r11 and %rdx, %r9 C "ci" in C code
mulx( %rdx, %rax, %r8) C up[0]^2 lea (%r11,%rdx,2), %rdx C "u0" arg in C code add %rax, %r9
.byte0xc4,0x62,0xa3,0xf6,0x14,0xee C mulx (%rsi,%rbp,8),%r11,%r10
.byte0xc4,0x62,0x93,0xf6,0x64,0xee,0x08 C mulx 0x8(%rsi,%rbp,8),%r13,%r12
.byte0xc4,0xe2,0xe3,0xf6,0x44,0xee,0x10 C mulx 0x10(%rsi,%rbp,8),%rbx,%rax adc %r8, %r11 adc %r10, %r13 adc %r12, %rbx adc $0, %rax
jrcxz L(xit3) jmp L(top3) C FIXME perhaps fall through
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.