1
dnl Intel Pentium-4 mpn_addmul_1 -- Multiply a limb vector with a limb and add
2
dnl the result to a second limb vector.
4
dnl Pentium4: 6 cycles/limb, unstable timing, at least on early Pentium4
5
dnl silicon (stepping 10).
7
dnl Copyright 2001 Free Software Foundation, Inc.
9
dnl This file is part of the GNU MP Library.
11
dnl The GNU MP Library is free software; you can redistribute it and/or
12
dnl modify it under the terms of the GNU Lesser General Public License as
13
dnl published by the Free Software Foundation; either version 2.1 of the
14
dnl License, or (at your option) any later version.
16
dnl The GNU MP Library is distributed in the hope that it will be useful,
17
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
18
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19
dnl Lesser General Public License for more details.
21
dnl You should have received a copy of the GNU Lesser General Public
22
dnl License along with the GNU MP Library; see the file COPYING.LIB. If
23
dnl not, write to the Free Software Foundation, Inc., 59 Temple Place -
24
dnl Suite 330, Boston, MA 02111-1307, USA.
27
include(`../config.m4')
30
C mp_limb_t mpn_addmul_1 (mp_ptr dst, mp_srcptr src, mp_size_t size,
31
C mp_limb_t multiplier);
32
C mp_limb_t mpn_addmul_1c (mp_ptr dst, mp_srcptr src, mp_size_t size,
33
C mp_limb_t multiplier, mp_limb_t carry);
35
C Only the carry limb propagation is on the dependent chain, but some other
36
C Pentium4 pipeline magic brings down performance to 6 cycles/l from the
39
defframe(PARAM_CARRY, 20)
40
defframe(PARAM_MULTIPLIER,16)
41
defframe(PARAM_SIZE, 12)
42
defframe(PARAM_SRC, 8)
43
defframe(PARAM_DST, 4)
47
PROLOGUE(mpn_addmul_1c)
49
movd PARAM_CARRY, %mm0
50
jmp LF(mpn_addmul_1,start_1c)
53
PROLOGUE(mpn_addmul_1)
60
movd PARAM_MULTIPLIER, %mm7
62
C eax src, incrementing
64
C ecx loop counter, decrementing
65
C edx dst, incrementing
67
C mm0 carry, low 32-bits
71
movd (%eax), %mm1 C src
73
movd (%edx),%mm2 C dst
75
paddq %mm1, %mm2 C prod
76
paddq %mm2, %mm0 C carry
78
movd %mm0, (%edx) C result