1 dnl Intel Pentium mpn_mul_basecase -- mpn by mpn multiplication.
3 dnl Copyright 1996, 1998, 1999, 2000, 2002 Free Software Foundation, Inc.
5 dnl This file is part of the GNU MP Library.
7 dnl The GNU MP Library is free software; you can redistribute it and/or
8 dnl modify it under the terms of the GNU Lesser General Public License as
9 dnl published by the Free Software Foundation; either version 3 of the
10 dnl License, or (at your option) any later version.
12 dnl The GNU MP Library is distributed in the hope that it will be useful,
13 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
14 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 dnl Lesser General Public License for more details.
17 dnl You should have received a copy of the GNU Lesser General Public License
18 dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
20 include(`../config.m4')
23 C P5: 14.2 cycles/crossproduct (approx)
26 C void mpn_mul_basecase (mp_ptr wp,
27 C mp_srcptr xp, mp_size_t xsize,
28 C mp_srcptr yp, mp_size_t ysize);
30 defframe(PARAM_YSIZE, 20)
31 defframe(PARAM_YP, 16)
32 defframe(PARAM_XSIZE, 12)
36 defframe(VAR_COUNTER, -4)
40 PROLOGUE(mpn_mul_basecase)
42 pushl %eax C dummy push for allocating stack slot
52 movl (%esi),%eax C load xp[0]
53 mull (%ebp) C multiply by yp[0]
54 movl %eax,(%edi) C store to wp[0]
55 movl PARAM_XSIZE,%ecx C xsize
56 decl %ecx C If xsize = 1, ysize = 1 too
63 leal (%esi,%eax,4),%esi C make xp point at end
64 leal (%edi,%eax,4),%edi C offset wp by xsize
65 negl %ecx C negate j size/index for inner loop
66 xorl %eax,%eax C clear carry
70 movl (%esi,%ecx,4),%eax C load next limb at xp[j]
73 movl %eax,(%edi,%ecx,4)
80 movl %ebx,(%edi) C most significant limb of product
81 addl $4,%edi C increment wp
84 movl %eax,VAR_COUNTER C set index i to ysize
87 addl $4,%ebp C make ebp point to next y limb
92 C code at 0x61 here, close enough to aligned
95 movl (%esi,%ecx,4),%eax
98 movl (%edi,%ecx,4),%ebx
101 movl %ebx,(%edi,%ecx,4)
110 movl VAR_COUNTER,%eax
112 movl %eax,VAR_COUNTER
124 movl %edx,4(%edi) C store to wp[1]
128 popl %eax C dummy pop for deallocating stack slot