dnl Intel Pentium MMX mpn_mul_1 -- mpn by limb multiplication. dnl Copyright 2000-2002 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 P5: 12.0 for 32-bit multiplier C 7.0 for 16-bit multiplier C mp_limb_t mpn_mul_1 (mp_ptr dst, mp_srcptr src, mp_size_t size, C mp_limb_t multiplier); C C When the multiplier is 16 bits some special case MMX code is used. Small C multipliers might arise reasonably often from mpz_mul_ui etc. If the size C is odd there's roughly a 5 cycle penalty, so times for say size==7 and C size==8 end up being quite close. If src isn't aligned to an 8 byte C boundary then one limb is processed separately with roughly a 5 cycle C penalty, so in that case it's say size==8 and size==9 which are close. C C Alternatives: C C MMX is not believed to be of any use for 32-bit multipliers, since for C instance the current method would just have to be more or less duplicated C for the high and low halves of the multiplier, and would probably C therefore run at about 14 cycles, which is slower than the plain integer C at 12. C C Adding the high and low MMX products using integer code seems best. An C attempt at using paddd and carry bit propagation with pcmpgtd didn't give C any joy. Perhaps something could be done keeping the values signed and C thereby avoiding adjustments to make pcmpgtd into an unsigned compare, or C perhaps not. C C Future: C C An mpn_mul_1c entrypoint would need a double carry out of the low result C limb in the 16-bit code, unless it could be assumed the carry fits in 16 C bits, possibly as carry