dnl SPARC v9 64-bit mpn_mul_1 -- Multiply a limb vector with a limb and store
dnl the result in a second limb vector.
dnl Copyright 1998, 2000-2003 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
C UltraSPARC 1&2: 14
C UltraSPARC 3: 18.5
C Algorithm: We use eight floating-point multiplies per limb product, with the
C invariant v operand split into four 16-bit pieces, and the s1 operand split
C into 32-bit pieces. We sum pairs of 48-bit partial products using
C floating-point add, then convert the four 49-bit product-sums and transfer
C them to the integer unit.
C Possible optimizations:
C 1. Align the stack area where we transfer the four 49-bit product-sums
C to a 32-byte boundary. That would minimize the cache collision.
C (UltraSPARC-1/2 use a direct-mapped cache.) (Perhaps even better would
C be to align the area to map to the area immediately before s1?)
C 2. Sum the 449-bit quantities using 32-bit operations, as in the
C develop mpn_addmul_2. This would save many integer instructions.
C 3. Unrolling. Questionable if it is worth the code expansion, given that
C it could only save 1 cycle/limb.
C 4. Specialize for particular v values. If its upper 32 bits are zero, we
C could save many operations, in the FPU (fmuld), but more so in the IEU
C since we'll be summing 48-bit quantities, which might be simpler.
C 5. Ideally, we should schedule the f2/f3 and f4/f5 RAW further apart, and
C the i00,i16,i32,i48 RAW less apart. The latter apart-scheduling should
C not be greater than needed for L2 cache latency, and also not so great
C that i16 needs to be copied.
C 6. Avoid performing mem+fa+fm in the same cycle, at least not when we want
C to get high IEU bandwidth. (12 of the 14 cycles will be free for2 IEU
C ops.)
C Instruction classification (as per UltraSPARC-1/2 functional units):
C 8 FM
C 10 FA
C 11 MEM
C 9 ISHIFT + 10? IADDLOG
C 1 BRANCH
C 49 insns totally (plus three mov insns that should be optimized out)
C The loop executes 53 instructions in 14 cycles on UltraSPARC-1/2, i.e we
C sustain 3.79 instructions/cycle.
C Initialization. (1) Split v operand into four 16-bit chunks and store them
C as IEEE double in fp registers. (2) Clear upper 32 bits of fp register pairs
C f2 and f4. (3) Store masks in registers aliased to `xffff' and `xffffffff'.
save %sp, -256, %sp mov -1, %g4
srlx %g4, 48, xffff C store mask in register `xffff' and %i3, xffff, %g2
stx %g2, [%sp+2223+0]
srlx %i3, 16, %g3 and %g3, xffff, %g3
stx %g3, [%sp+2223+8]
srlx %i3, 32, %g2 and %g2, xffff, %g2
stx %g2, [%sp+2223+16]
srlx %i3, 48, %g3
stx %g3, [%sp+2223+24]
srlx %g4, 32, xffffffff C store mask in register `xffffffff'
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.