]> git.ipfire.org Git - thirdparty/glibc.git/blame - sysdeps/i386/i586/add_n.S
(main): Rewrite initializers to avoid warnings.
[thirdparty/glibc.git] / sysdeps / i386 / i586 / add_n.S
CommitLineData
8f5ca04b
RM
1/* Pentium __mpn_add_n -- Add two limb vectors of the same length > 0 and store
2 sum in a third limb vector.
ae828bc6 3 Copyright (C) 1992, 94, 95, 96, 97, 98 Free Software Foundation, Inc.
5929563f 4 This file is part of the GNU MP Library.
8f5ca04b 5
5929563f
UD
6 The GNU MP Library is free software; you can redistribute it and/or modify
7 it under the terms of the GNU Library General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or (at your
9 option) any later version.
8f5ca04b 10
5929563f
UD
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 Library General Public
14 License for more details.
8f5ca04b 15
5929563f
UD
16 You should have received a copy of the GNU Library General Public License
17 along with the GNU MP Library; see the file COPYING.LIB. If not, write to
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
19 MA 02111-1307, USA. */
8f5ca04b
RM
20
21/*
22 INPUT PARAMETERS
23 res_ptr (sp + 4)
24 s1_ptr (sp + 8)
25 s2_ptr (sp + 12)
26 size (sp + 16)
27*/
28
77a58cad
RM
29#include "sysdep.h"
30#include "asm-syntax.h"
31
ae828bc6
UD
32 .text
33ENTRY(__mpn_add_n)
8f5ca04b
RM
34 pushl %edi
35 pushl %esi
36 pushl %ebx
37 pushl %ebp
38
6b628d36
RM
39 movl 20(%esp),%edi /* res_ptr */
40 movl 24(%esp),%esi /* s1_ptr */
41 movl 28(%esp),%ebp /* s2_ptr */
8f5ca04b
RM
42 movl 32(%esp),%ecx /* size */
43
6b628d36 44 movl (%ebp),%ebx
8f5ca04b
RM
45
46 decl %ecx
6b628d36 47 movl %ecx,%edx
8f5ca04b 48 shrl $3,%ecx
6b628d36 49 andl $7,%edx
8f5ca04b 50 testl %ecx,%ecx /* zero carry flag */
5929563f 51 jz L(end)
6b628d36 52 pushl %edx
8f5ca04b
RM
53
54 ALIGN (3)
5929563f 55L(oop): movl 28(%edi),%eax /* fetch destination cache line */
6b628d36
RM
56 leal 32(%edi),%edi
57
5929563f 58L(1): movl (%esi),%eax
6b628d36
RM
59 movl 4(%esi),%edx
60 adcl %ebx,%eax
61 movl 4(%ebp),%ebx
62 adcl %ebx,%edx
63 movl 8(%ebp),%ebx
64 movl %eax,-32(%edi)
65 movl %edx,-28(%edi)
66
5929563f 67L(2): movl 8(%esi),%eax
6b628d36
RM
68 movl 12(%esi),%edx
69 adcl %ebx,%eax
70 movl 12(%ebp),%ebx
71 adcl %ebx,%edx
72 movl 16(%ebp),%ebx
73 movl %eax,-24(%edi)
74 movl %edx,-20(%edi)
75
5929563f 76L(3): movl 16(%esi),%eax
6b628d36
RM
77 movl 20(%esi),%edx
78 adcl %ebx,%eax
79 movl 20(%ebp),%ebx
80 adcl %ebx,%edx
81 movl 24(%ebp),%ebx
82 movl %eax,-16(%edi)
83 movl %edx,-12(%edi)
84
5929563f 85L(4): movl 24(%esi),%eax
6b628d36
RM
86 movl 28(%esi),%edx
87 adcl %ebx,%eax
88 movl 28(%ebp),%ebx
89 adcl %ebx,%edx
90 movl 32(%ebp),%ebx
91 movl %eax,-8(%edi)
92 movl %edx,-4(%edi)
93
94 leal 32(%esi),%esi
95 leal 32(%ebp),%ebp
8f5ca04b 96 decl %ecx
5929563f 97 jnz L(oop)
8f5ca04b 98
6b628d36 99 popl %edx
5929563f 100L(end):
6b628d36 101 decl %edx /* test %edx w/o clobbering carry */
5929563f 102 js L(end2)
6b628d36 103 incl %edx
5929563f 104L(oop2):
6b628d36
RM
105 leal 4(%edi),%edi
106 movl (%esi),%eax
107 adcl %ebx,%eax
108 movl 4(%ebp),%ebx
109 movl %eax,-4(%edi)
110 leal 4(%esi),%esi
111 leal 4(%ebp),%ebp
112 decl %edx
5929563f
UD
113 jnz L(oop2)
114L(end2):
6b628d36
RM
115 movl (%esi),%eax
116 adcl %ebx,%eax
117 movl %eax,(%edi)
8f5ca04b
RM
118
119 sbbl %eax,%eax
120 negl %eax
121
122 popl %ebp
123 popl %ebx
124 popl %esi
125 popl %edi
126 ret
ae828bc6 127END(__mpn_add_n)