Reorganisation of the source tree
[ghc-hetmet.git] / rts / gmp / mpn / x86 / pentium / mul_1.asm
1 dnl  Intel Pentium mpn_mul_1 -- mpn by limb multiplication.
2 dnl
3 dnl  P5: 13.0 cycles/limb
4
5 dnl  Copyright (C) 1992, 1994, 1996, 1999, 2000 Free Software Foundation,
6 dnl  Inc.
7 dnl 
8 dnl  This file is part of the GNU MP Library.
9 dnl 
10 dnl  The GNU MP Library is free software; you can redistribute it and/or
11 dnl  modify it under the terms of the GNU Lesser General Public License as
12 dnl  published by the Free Software Foundation; either version 2.1 of the
13 dnl  License, or (at your option) any later version.
14 dnl 
15 dnl  The GNU MP Library is distributed in the hope that it will be useful,
16 dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
17 dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18 dnl  Lesser General Public License for more details.
19 dnl 
20 dnl  You should have received a copy of the GNU Lesser General Public
21 dnl  License along with the GNU MP Library; see the file COPYING.LIB.  If
22 dnl  not, write to the Free Software Foundation, Inc., 59 Temple Place -
23 dnl  Suite 330, Boston, MA 02111-1307, USA. */
24
25
26 include(`../config.m4')
27
28
29 C mp_limb_t mpn_mul_1 (mp_ptr dst, mp_srcptr src, mp_size_t size,
30 C                      mp_limb_t multiplier);
31
32 defframe(PARAM_MULTIPLIER,16)
33 defframe(PARAM_SIZE,      12)
34 defframe(PARAM_SRC,       8)
35 defframe(PARAM_DST,       4)
36
37         .text
38         ALIGN(8)
39 PROLOGUE(mpn_mul_1)
40
41         pushl   %edi
42         pushl   %esi
43         pushl   %ebx
44         pushl   %ebp
45 deflit(`FRAME',16)
46
47         movl    PARAM_DST, %edi
48         movl    PARAM_SRC, %esi
49         movl    PARAM_SIZE, %ecx
50         movl    PARAM_MULTIPLIER, %ebp
51
52         leal    (%edi,%ecx,4), %edi
53         leal    (%esi,%ecx,4), %esi
54         negl    %ecx
55         xorl    %ebx, %ebx
56         ALIGN(8)
57
58 L(oop): adcl    $0, %ebx
59         movl    (%esi,%ecx,4), %eax
60
61         mull    %ebp
62
63         addl    %eax, %ebx
64
65         movl    %ebx, (%edi,%ecx,4)
66         incl    %ecx
67
68         movl    %edx, %ebx
69         jnz     L(oop)
70
71         adcl    $0, %ebx
72         movl    %ebx, %eax
73         popl    %ebp
74         popl    %ebx
75         popl    %esi
76         popl    %edi
77         ret
78
79 EPILOGUE()