]>
Commit | Line | Data |
---|---|---|
28f540f4 RM |
1 | /* i80386 __mpn_mul_1 -- Multiply a limb vector with a limb and store |
2 | the result in a second limb vector. | |
a334319f | 3 | Copyright (C) 1992, 1994, 1997, 1998, 2000 Free Software Foundation, Inc. |
5929563f | 4 | This file is part of the GNU MP Library. |
28f540f4 | 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. |
28f540f4 | 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. |
28f540f4 | 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. */ | |
28f540f4 | 20 | |
ae828bc6 | 21 | #include <sysdep.h> |
28f540f4 | 22 | #include "asm-syntax.h" |
2fc08826 | 23 | #include "bp-sym.h" |
3f02f778 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 | |
28f540f4 RM |
31 | |
32 | #define res_ptr edi | |
33 | #define s1_ptr esi | |
34 | #define size ecx | |
f9e7bbce | 35 | #define s2_limb ebx |
28f540f4 | 36 | |
ae828bc6 | 37 | .text |
2fc08826 | 38 | ENTRY (BP_SYM (__mpn_mul_1)) |
3f02f778 | 39 | ENTER |
28f540f4 | 40 | |
a334319f UD |
41 | pushl %edi |
42 | pushl %esi | |
43c81906 | 43 | pushl %ebp |
a334319f | 44 | pushl %ebx |
28f540f4 | 45 | |
43c81906 GM |
46 | movl RES(%esp), %res_ptr |
47 | movl S1(%esp), %s1_ptr | |
48 | movl SIZE(%esp), %size | |
49 | movl S2LIMB(%esp), %s2_limb | |
2fc08826 GM |
50 | #if __BOUNDED_POINTERS__ |
51 | shll $2, %size /* convert limbs to bytes */ | |
52 | CHECK_BOUNDS_BOTH_WIDE (%res_ptr, RES(%esp), %size) | |
53 | CHECK_BOUNDS_BOTH_WIDE (%s1_ptr, S1(%esp), %size) | |
2fc08826 GM |
54 | shrl $2, %size |
55 | #endif | |
43c81906 GM |
56 | leal (%res_ptr,%size,4), %res_ptr |
57 | leal (%s1_ptr,%size,4), %s1_ptr | |
58 | negl %size | |
f9e7bbce | 59 | xorl %ebp, %ebp |
28f540f4 | 60 | ALIGN (3) |
5929563f | 61 | L(oop): |
43c81906 GM |
62 | movl (%s1_ptr,%size,4), %eax |
63 | mull %s2_limb | |
f9e7bbce | 64 | addl %ebp, %eax |
43c81906 GM |
65 | movl %eax, (%res_ptr,%size,4) |
66 | adcl $0, %edx | |
f9e7bbce | 67 | movl %edx, %ebp |
28f540f4 | 68 | |
43c81906 GM |
69 | incl %size |
70 | jnz L(oop) | |
f9e7bbce | 71 | movl %ebp, %eax |
28f540f4 | 72 | |
a334319f | 73 | popl %ebx |
f9e7bbce | 74 | popl %ebp |
a334319f UD |
75 | popl %esi |
76 | popl %edi | |
3f02f778 GM |
77 | |
78 | LEAVE | |
28f540f4 | 79 | ret |
ae828bc6 | 80 | #undef size |
2fc08826 | 81 | END (BP_SYM (__mpn_mul_1)) |