]> git.ipfire.org Git - thirdparty/glibc.git/blame - sysdeps/i386/i586/addmul_1.S
Use <> for include of kernel-features.h.
[thirdparty/glibc.git] / sysdeps / i386 / i586 / addmul_1.S
CommitLineData
8f5ca04b
RM
1/* Pentium __mpn_addmul_1 -- Multiply a limb vector with a limb and add
2 the result to a second limb vector.
1ad9da69 3 Copyright (C) 1992, 94, 96, 97, 98, 00, 2005 Free Software Foundation, Inc.
5929563f 4 This file is part of the GNU MP Library.
8f5ca04b 5
5929563f 6 The GNU MP Library is free software; you can redistribute it and/or modify
6d84f89a
AJ
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
5929563f 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
6d84f89a 13 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
5929563f 14 License for more details.
8f5ca04b 15
6d84f89a 16 You should have received a copy of the GNU Lesser General Public License
5929563f
UD
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 20
8f5ca04b
RM
21#include "sysdep.h"
22#include "asm-syntax.h"
2fc08826 23#include "bp-sym.h"
43c81906
GM
24#include "bp-asm.h"
25
26#define PARMS LINKAGE+16 /* space for 4 saved regs */
27#define RES PARMS
28#define S1 RES+PTR_SIZE
29#define SIZE S1+PTR_SIZE
30#define S2LIMB SIZE+4
8f5ca04b
RM
31
32#define res_ptr edi
33#define s1_ptr esi
6b628d36 34#define size ecx
f9e7bbce 35#define s2_limb ebx
8f5ca04b 36
ae828bc6 37 .text
2fc08826 38ENTRY (BP_SYM (__mpn_addmul_1))
43c81906
GM
39 ENTER
40
fee732e5 41 pushl %res_ptr
1ad9da69 42 cfi_adjust_cfa_offset (4)
fee732e5 43 pushl %s1_ptr
1ad9da69 44 cfi_adjust_cfa_offset (4)
43c81906 45 pushl %ebp
1ad9da69 46 cfi_adjust_cfa_offset (4)
fee732e5 47 pushl %s2_limb
1ad9da69 48 cfi_adjust_cfa_offset (4)
43c81906
GM
49
50 movl RES(%esp), %res_ptr
1ad9da69 51 cfi_rel_offset (res_ptr, 12)
43c81906 52 movl S1(%esp), %s1_ptr
1ad9da69 53 cfi_rel_offset (s1_ptr, 8)
43c81906
GM
54 movl SIZE(%esp), %size
55 movl S2LIMB(%esp), %s2_limb
1ad9da69 56 cfi_rel_offset (s2_limb, 0)
2fc08826
GM
57#if __BOUNDED_POINTERS__
58 shll $2, %size /* convert limbs to bytes */
59 CHECK_BOUNDS_BOTH_WIDE (%res_ptr, RES(%esp), %size)
60 CHECK_BOUNDS_BOTH_WIDE (%s1_ptr, S1(%esp), %size)
2fc08826
GM
61 shrl $2, %size
62#endif
43c81906
GM
63 leal (%res_ptr,%size,4), %res_ptr
64 leal (%s1_ptr,%size,4), %s1_ptr
65 negl %size
f9e7bbce 66 xorl %ebp, %ebp
1ad9da69 67 cfi_rel_offset (ebp, 4)
8f5ca04b 68 ALIGN (3)
6b628d36 69
f9e7bbce 70L(oop): adcl $0, %ebp
43c81906
GM
71 movl (%s1_ptr,%size,4), %eax
72
73 mull %s2_limb
8f5ca04b 74
f9e7bbce
GM
75 addl %ebp, %eax
76 movl (%res_ptr,%size,4), %ebp
8f5ca04b 77
43c81906 78 adcl $0, %edx
f9e7bbce 79 addl %eax, %ebp
8f5ca04b 80
f9e7bbce 81 movl %ebp, (%res_ptr,%size,4)
43c81906 82 incl %size
8f5ca04b 83
f9e7bbce 84 movl %edx, %ebp
43c81906 85 jnz L(oop)
8f5ca04b 86
f9e7bbce
GM
87 adcl $0, %ebp
88 movl %ebp, %eax
fee732e5 89 popl %s2_limb
1ad9da69 90 cfi_adjust_cfa_offset (-4)
fee732e5 91 cfi_restore (s2_limb)
f9e7bbce 92 popl %ebp
1ad9da69
UD
93 cfi_adjust_cfa_offset (-4)
94 cfi_restore (ebp)
fee732e5 95 popl %s1_ptr
1ad9da69 96 cfi_adjust_cfa_offset (-4)
fee732e5
UD
97 cfi_restore (s1_ptr)
98 popl %res_ptr
1ad9da69 99 cfi_adjust_cfa_offset (-4)
fee732e5 100 cfi_restore (res_ptr)
8f5ca04b 101
43c81906 102 LEAVE
8f5ca04b 103 ret
ae828bc6 104#undef size
2fc08826 105END (BP_SYM (__mpn_addmul_1))