~ubuntu-branches/ubuntu/quantal/gclcvs/quantal

« back to all changes in this revision

Viewing changes to gmp3/mpn/x86/aorsmul_1.asm

  • Committer: Bazaar Package Importer
  • Author(s): Camm Maguire
  • Date: 2004-06-24 15:13:46 UTC
  • Revision ID: james.westby@ubuntu.com-20040624151346-xh0xaaktyyp7aorc
Tags: 2.7.0-26
C_GC_OFFSET is 2 on m68k-linux

Show diffs side-by-side

added added

removed removed

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