]> git.ipfire.org Git - thirdparty/glibc.git/blob - sysdeps/i386/i586/addmul_1.S
Replace FSF snail mail address with URLs.
[thirdparty/glibc.git] / sysdeps / i386 / i586 / addmul_1.S
1 /* Pentium __mpn_addmul_1 -- Multiply a limb vector with a limb and add
2 the result to a second limb vector.
3 Copyright (C) 1992, 94, 96, 97, 98, 00, 2005 Free Software Foundation, Inc.
4 This file is part of the GNU MP Library.
5
6 The GNU MP Library is free software; you can redistribute it and/or modify
7 it under the terms of the GNU Lesser General Public License as published by
8 the Free Software Foundation; either version 2.1 of the License, or (at your
9 option) any later version.
10
11 The GNU MP Library is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
14 License for more details.
15
16 You should have received a copy of the GNU Lesser General Public License
17 along with the GNU MP Library; see the file COPYING.LIB. If not,
18 see <http://www.gnu.org/licenses/>. */
19
20 #include "sysdep.h"
21 #include "asm-syntax.h"
22 #include "bp-sym.h"
23 #include "bp-asm.h"
24
25 #define PARMS LINKAGE+16 /* space for 4 saved regs */
26 #define RES PARMS
27 #define S1 RES+PTR_SIZE
28 #define SIZE S1+PTR_SIZE
29 #define S2LIMB SIZE+4
30
31 #define res_ptr edi
32 #define s1_ptr esi
33 #define size ecx
34 #define s2_limb ebx
35
36 .text
37 ENTRY (BP_SYM (__mpn_addmul_1))
38 ENTER
39
40 pushl %res_ptr
41 cfi_adjust_cfa_offset (4)
42 pushl %s1_ptr
43 cfi_adjust_cfa_offset (4)
44 pushl %ebp
45 cfi_adjust_cfa_offset (4)
46 pushl %s2_limb
47 cfi_adjust_cfa_offset (4)
48
49 movl RES(%esp), %res_ptr
50 cfi_rel_offset (res_ptr, 12)
51 movl S1(%esp), %s1_ptr
52 cfi_rel_offset (s1_ptr, 8)
53 movl SIZE(%esp), %size
54 movl S2LIMB(%esp), %s2_limb
55 cfi_rel_offset (s2_limb, 0)
56 #if __BOUNDED_POINTERS__
57 shll $2, %size /* convert limbs to bytes */
58 CHECK_BOUNDS_BOTH_WIDE (%res_ptr, RES(%esp), %size)
59 CHECK_BOUNDS_BOTH_WIDE (%s1_ptr, S1(%esp), %size)
60 shrl $2, %size
61 #endif
62 leal (%res_ptr,%size,4), %res_ptr
63 leal (%s1_ptr,%size,4), %s1_ptr
64 negl %size
65 xorl %ebp, %ebp
66 cfi_rel_offset (ebp, 4)
67 ALIGN (3)
68
69 L(oop): adcl $0, %ebp
70 movl (%s1_ptr,%size,4), %eax
71
72 mull %s2_limb
73
74 addl %ebp, %eax
75 movl (%res_ptr,%size,4), %ebp
76
77 adcl $0, %edx
78 addl %eax, %ebp
79
80 movl %ebp, (%res_ptr,%size,4)
81 incl %size
82
83 movl %edx, %ebp
84 jnz L(oop)
85
86 adcl $0, %ebp
87 movl %ebp, %eax
88 popl %s2_limb
89 cfi_adjust_cfa_offset (-4)
90 cfi_restore (s2_limb)
91 popl %ebp
92 cfi_adjust_cfa_offset (-4)
93 cfi_restore (ebp)
94 popl %s1_ptr
95 cfi_adjust_cfa_offset (-4)
96 cfi_restore (s1_ptr)
97 popl %res_ptr
98 cfi_adjust_cfa_offset (-4)
99 cfi_restore (res_ptr)
100
101 LEAVE
102 ret
103 #undef size
104 END (BP_SYM (__mpn_addmul_1))