FIX BUILD (with GHC 6.2.x): System.Directory.Internals is no more
[ghc-hetmet.git] / rts / gmp / mpn / x86 / pentium / aorsmul_1.asm
1 dnl  Intel Pentium mpn_addmul_1 -- mpn by limb multiplication.
2 dnl 
3 dnl  P5: 14.0 cycles/limb
4
5
6 dnl  Copyright (C) 1992, 1994, 1996, 1999, 2000 Free Software Foundation,
7 dnl  Inc.
8 dnl 
9 dnl  This file is part of the GNU MP Library.
10 dnl 
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.
15 dnl 
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.
20 dnl 
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. */
25
26
27 include(`../config.m4')
28
29
30 ifdef(`OPERATION_addmul_1', `
31       define(M4_inst,        addl)
32       define(M4_function_1,  mpn_addmul_1)
33
34 ',`ifdef(`OPERATION_submul_1', `
35       define(M4_inst,        subl)
36       define(M4_function_1,  mpn_submul_1)
37
38 ',`m4_error(`Need OPERATION_addmul_1 or OPERATION_submul_1
39 ')')')
40
41 MULFUNC_PROLOGUE(mpn_addmul_1 mpn_submul_1)
42
43
44 C mp_limb_t M4_function_1 (mp_ptr dst, mp_srcptr src, mp_size_t size,
45 C                          mp_limb_t mult);
46
47 defframe(PARAM_MULTIPLIER,16)
48 defframe(PARAM_SIZE,      12)
49 defframe(PARAM_SRC,       8)
50 defframe(PARAM_DST,       4)
51
52         .text
53         ALIGN(8)
54
55 PROLOGUE(M4_function_1)
56
57         pushl   %edi
58         pushl   %esi
59         pushl   %ebx
60         pushl   %ebp
61 deflit(`FRAME',16)
62
63         movl    PARAM_DST, %edi
64         movl    PARAM_SRC, %esi
65         movl    PARAM_SIZE, %ecx
66         movl    PARAM_MULTIPLIER, %ebp
67
68         leal    (%edi,%ecx,4), %edi
69         leal    (%esi,%ecx,4), %esi
70         negl    %ecx
71         xorl    %ebx, %ebx
72         ALIGN(8)
73
74 L(oop): adcl    $0, %ebx
75         movl    (%esi,%ecx,4), %eax
76
77         mull    %ebp
78
79         addl    %ebx, %eax
80         movl    (%edi,%ecx,4), %ebx
81
82         adcl    $0, %edx
83         M4_inst %eax, %ebx
84
85         movl    %ebx, (%edi,%ecx,4)
86         incl    %ecx
87
88         movl    %edx, %ebx
89         jnz     L(oop)
90
91         adcl    $0, %ebx
92         movl    %ebx, %eax
93         popl    %ebp
94         popl    %ebx
95         popl    %esi
96         popl    %edi
97         ret
98
99 EPILOGUE()