beta-0.89.2
[luatex.git] / source / libs / gmp / gmp-src / mpn / x86 / pentium / aorsmul_1.asm
blobd83cc4513b60b07815a778e8671c5e2c575522a2
1 dnl Intel Pentium mpn_addmul_1 -- mpn by limb multiplication.
3 dnl Copyright 1992, 1994, 1996, 1999, 2000, 2002 Free Software Foundation,
4 dnl Inc.
6 dnl This file is part of the GNU MP Library.
7 dnl
8 dnl The GNU MP Library is free software; you can redistribute it and/or modify
9 dnl it under the terms of either:
10 dnl
11 dnl * the GNU Lesser General Public License as published by the Free
12 dnl Software Foundation; either version 3 of the License, or (at your
13 dnl option) any later version.
14 dnl
15 dnl or
16 dnl
17 dnl * the GNU General Public License as published by the Free Software
18 dnl Foundation; either version 2 of the License, or (at your option) any
19 dnl later version.
20 dnl
21 dnl or both in parallel, as here.
22 dnl
23 dnl The GNU MP Library is distributed in the hope that it will be useful, but
24 dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
25 dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
26 dnl for more details.
27 dnl
28 dnl You should have received copies of the GNU General Public License and the
29 dnl GNU Lesser General Public License along with the GNU MP Library. If not,
30 dnl see https://www.gnu.org/licenses/.
32 include(`../config.m4')
35 C P5: 14.0 cycles/limb
38 ifdef(`OPERATION_addmul_1', `
39 define(M4_inst, addl)
40 define(M4_function_1, mpn_addmul_1)
41 define(M4_function_1c, mpn_addmul_1c)
43 ',`ifdef(`OPERATION_submul_1', `
44 define(M4_inst, subl)
45 define(M4_function_1, mpn_submul_1)
46 define(M4_function_1c, mpn_submul_1c)
48 ',`m4_error(`Need OPERATION_addmul_1 or OPERATION_submul_1
49 ')')')
51 MULFUNC_PROLOGUE(mpn_addmul_1 mpn_addmul_1c mpn_submul_1 mpn_submul_1c)
54 C mp_limb_t mpn_addmul_1 (mp_ptr dst, mp_srcptr src, mp_size_t size,
55 C mp_limb_t mult);
56 C mp_limb_t mpn_addmul_1c (mp_ptr dst, mp_srcptr src, mp_size_t size,
57 C mp_limb_t mult, mp_limb_t carry);
59 C mp_limb_t mpn_submul_1 (mp_ptr dst, mp_srcptr src, mp_size_t size,
60 C mp_limb_t mult);
61 C mp_limb_t mpn_submul_1c (mp_ptr dst, mp_srcptr src, mp_size_t size,
62 C mp_limb_t mult, mp_limb_t carry);
65 defframe(PARAM_CARRY, 20)
66 defframe(PARAM_MULTIPLIER,16)
67 defframe(PARAM_SIZE, 12)
68 defframe(PARAM_SRC, 8)
69 defframe(PARAM_DST, 4)
71 TEXT
73 ALIGN(8)
74 PROLOGUE(M4_function_1c)
75 deflit(`FRAME',0)
77 movl PARAM_CARRY, %ecx
78 pushl %esi FRAME_pushl()
80 jmp L(start_1c)
82 EPILOGUE()
85 ALIGN(8)
86 PROLOGUE(M4_function_1)
87 deflit(`FRAME',0)
89 xorl %ecx, %ecx
90 pushl %esi FRAME_pushl()
92 L(start_1c):
93 movl PARAM_SRC, %esi
94 movl PARAM_SIZE, %eax
96 pushl %edi FRAME_pushl()
97 pushl %ebx FRAME_pushl()
99 movl PARAM_DST, %edi
100 leal -1(%eax), %ebx C size-1
102 leal (%esi,%eax,4), %esi
103 xorl $-1, %ebx C -size, and clear carry
105 leal (%edi,%eax,4), %edi
107 L(top):
108 C eax
109 C ebx counter, negative
110 C ecx carry
111 C edx
112 C esi src end
113 C edi dst end
114 C ebp
116 adcl $0, %ecx
117 movl (%esi,%ebx,4), %eax
119 mull PARAM_MULTIPLIER
121 addl %ecx, %eax
122 movl (%edi,%ebx,4), %ecx
124 adcl $0, %edx
125 M4_inst %eax, %ecx
127 movl %ecx, (%edi,%ebx,4)
128 incl %ebx
130 movl %edx, %ecx
131 jnz L(top)
134 adcl $0, %ecx
135 popl %ebx
137 movl %ecx, %eax
138 popl %edi
140 popl %esi
144 EPILOGUE()