~ubuntu-branches/ubuntu/intrepid/ecl/intrepid

« back to all changes in this revision

Viewing changes to src/gmp/mpn/x86/mul_1.asm

  • Committer: Bazaar Package Importer
  • Author(s): Peter Van Eynde
  • Date: 2006-05-17 02:46:26 UTC
  • Revision ID: james.westby@ubuntu.com-20060517024626-lljr08ftv9g9vefl
Tags: upstream-0.9h-20060510
ImportĀ upstreamĀ versionĀ 0.9h-20060510

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
dnl  x86 mpn_mul_1 (for 386, 486, and Pentium Pro) -- Multiply a limb vector
 
2
dnl  with a limb and store the result in a second limb vector.
 
3
 
 
4
dnl  Copyright 1992, 1994, 1997, 1998, 1999, 2000, 2001, 2002 Free Software
 
5
dnl  Foundation, Inc.
 
6
dnl 
 
7
dnl  This file is part of the GNU MP Library.
 
8
dnl 
 
9
dnl  The GNU MP Library is free software; you can redistribute it and/or
 
10
dnl  modify it under the terms of the GNU Lesser General Public License as
 
11
dnl  published by the Free Software Foundation; either version 2.1 of the
 
12
dnl  License, or (at your option) any later version.
 
13
dnl 
 
14
dnl  The GNU MP Library is distributed in the hope that it will be useful,
 
15
dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
16
dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
17
dnl  Lesser General Public License for more details.
 
18
dnl 
 
19
dnl  You should have received a copy of the GNU Lesser General Public
 
20
dnl  License along with the GNU MP Library; see the file COPYING.LIB.  If
 
21
dnl  not, write to the Free Software Foundation, Inc., 59 Temple Place -
 
22
dnl  Suite 330, Boston, MA 02111-1307, USA.
 
23
 
 
24
include(`../config.m4')
 
25
 
 
26
 
 
27
C     cycles/limb
 
28
C P5:    12.5
 
29
C P6:     5.5
 
30
C K6:    10.5
 
31
C K7:     4.5
 
32
C P4:    19
 
33
 
 
34
 
 
35
C mp_limb_t mpn_mul_1 (mp_ptr dst, mp_srcptr src, mp_size_t size,
 
36
C                      mp_limb_t multiplier);
 
37
 
 
38
defframe(PARAM_MULTIPLIER,16)
 
39
defframe(PARAM_SIZE,      12)
 
40
defframe(PARAM_SRC,       8)
 
41
defframe(PARAM_DST,       4)
 
42
 
 
43
        TEXT
 
44
        ALIGN(8)
 
45
PROLOGUE(mpn_mul_1)
 
46
deflit(`FRAME',0)
 
47
 
 
48
        pushl   %edi
 
49
        pushl   %esi
 
50
        pushl   %ebx
 
51
        pushl   %ebp
 
52
deflit(`FRAME',16)
 
53
 
 
54
        movl    PARAM_DST,%edi
 
55
        movl    PARAM_SRC,%esi
 
56
        movl    PARAM_SIZE,%ecx
 
57
 
 
58
        xorl    %ebx,%ebx
 
59
        andl    $3,%ecx
 
60
        jz      L(end0)
 
61
 
 
62
L(oop0):
 
63
        movl    (%esi),%eax
 
64
        mull    PARAM_MULTIPLIER
 
65
        leal    4(%esi),%esi
 
66
        addl    %ebx,%eax
 
67
        movl    $0,%ebx
 
68
        adcl    %ebx,%edx
 
69
        movl    %eax,(%edi)
 
70
        movl    %edx,%ebx       C propagate carry into cylimb
 
71
 
 
72
        leal    4(%edi),%edi
 
73
        decl    %ecx
 
74
        jnz     L(oop0)
 
75
 
 
76
L(end0):
 
77
        movl    PARAM_SIZE,%ecx
 
78
        shrl    $2,%ecx
 
79
        jz      L(end)
 
80
 
 
81
 
 
82
        ALIGN(8)
 
83
L(oop): movl    (%esi),%eax
 
84
        mull    PARAM_MULTIPLIER
 
85
        addl    %eax,%ebx
 
86
        movl    $0,%ebp
 
87
        adcl    %edx,%ebp
 
88
 
 
89
        movl    4(%esi),%eax
 
90
        mull    PARAM_MULTIPLIER
 
91
        movl    %ebx,(%edi)
 
92
        addl    %eax,%ebp       C new lo + cylimb
 
93
        movl    $0,%ebx
 
94
        adcl    %edx,%ebx
 
95
 
 
96
        movl    8(%esi),%eax
 
97
        mull    PARAM_MULTIPLIER
 
98
        movl    %ebp,4(%edi)
 
99
        addl    %eax,%ebx       C new lo + cylimb
 
100
        movl    $0,%ebp
 
101
        adcl    %edx,%ebp
 
102
 
 
103
        movl    12(%esi),%eax
 
104
        mull    PARAM_MULTIPLIER
 
105
        movl    %ebx,8(%edi)
 
106
        addl    %eax,%ebp       C new lo + cylimb
 
107
        movl    $0,%ebx
 
108
        adcl    %edx,%ebx
 
109
 
 
110
        movl    %ebp,12(%edi)
 
111
 
 
112
        leal    16(%esi),%esi
 
113
        leal    16(%edi),%edi
 
114
        decl    %ecx
 
115
        jnz     L(oop)
 
116
 
 
117
L(end): movl    %ebx,%eax
 
118
 
 
119
        popl    %ebp
 
120
        popl    %ebx
 
121
        popl    %esi
 
122
        popl    %edi
 
123
        ret
 
124
 
 
125
EPILOGUE()