dnl IA-64 mpn_divexact_1 -- mpn by limb exact division.
dnl Contributed to the GNU project by Torbjorn Granlund and Kevin Ryde.
dnl Copyright 2003-2005, 2010 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/.
C Thiscode is a bit messy, and not as similar to mode1o.asm as desired.
C The critical path during initialization is for computing the inverse of the
C divisor. Since odd divisors are probably common, we conditionally execute
C the initial count_trailing_zeros codeand the downshift.
C Possible improvement: Merge more of the feed-in code into the inverse
C computation.
{.mmi; add r8 = -1, divisor C M0 nop0 C M1
tbit.z p8, p9 = divisor, 0 C I0
} ifdef(`HAVE_ABI_32',
` addp4 rp = 0, rp C M2 rp extend
addp4 up = 0, up C M3 up extend
sxt4 n = n') C I1 size extend ;;
.Lhere:
{.mmi; ld8 r20 = [up], 8 C M0 up[0]
(p8) andcm r8 = r8, divisor C M1 mov r15 = ip C I0 .Lhere ;;
}{.mii
.pred.rel "mutex", p8, p9
(p9) mov rshift = 0 C M0
(p8) popcnt rshift = r8 C I0 r8 = cnt_lo_zeros(divisor) cmp.eq p6, p10 = 1, n C I1 ;;
}{.mii; add r9 = .Ltab-.Lhere, r15 C M0
(p8) shr.u divisor = divisor, rshift C I0 nop0 C I1 ;;
}{.mmi; add n = -4, n C M0 size-1
(p10) ld8 r21 = [up], 8 C M1 up[1] mov r14 = 2 C M1 2
}{.mfi; setf.sig f6 = divisor C M2 divisor mov f9 = f0 C M3 carry FIXME
zxt1 r3 = divisor C I1 divisor low byte ;;
}{.mmi; add r3 = r9, r3 C M0 table offset ip and index sub r16 = 0, divisor C M1 -divisor mov r2 = ar.lc C I0
}{.mmi; sub lshift = 64, rshift C M2
setf.sig f13 = r14 C M3 2 in significand mov r17 = -1 C I1 -1 ;;
}{.mmi; ld1 r3 = [r3] C M0 inverse, 8 bits nop0 C M1 mov ar.lc = n C I0 size-1 loop count
}{.mmi; setf.sig f12 = r16 C M2 -divisor
setf.sig f8 = r17 C M3 -1 cmp.eq p7, p0 = -2, n C I1 ;;
}{.mmi; setf.sig f7 = r3 C M2 inverse, 8 bits cmp.eq p8, p0 = -1, n C M0 shr.u r23 = r20, rshift C I0 ;;
}
C f6 divisor
C f7 inverse, being calculated
C f8 -1, will be -inverse
C f9 carry
C f12 -divisor
C f13 2
C f14 scratch
xmpy.l f14 = f13, f7 C Newton 2*i
xmpy.l f7 = f7, f7 C Newton i*i ;;
xma.l f7 = f7, f12, f14 C Newton i*i*-d + 2*i, 16 bits ;;
setf.sig f10 = r23 C speculative, used iff n = 1
xmpy.l f14 = f13, f7 C Newton 2*i
shl r22 = r21, lshift C speculative, used iff n > 1
xmpy.l f7 = f7, f7 C Newton i*i ;; or r31 = r22, r23 C speculative, used iff n > 1
xma.l f7 = f7, f12, f14 C Newton i*i*-d + 2*i, 32 bits shr.u r23 = r21, rshift C speculative, used iff n > 1 ;;
setf.sig f11 = r31 C speculative, used iff n > 1
xmpy.l f14 = f13, f7 C Newton 2*i
xmpy.l f7 = f7, f7 C Newton i*i ;;
xma.l f7 = f7, f12, f14 C Newton i*i*-d + 2*i, 64 bits
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.