Update copyright notices with scripts/update-copyrights.
[glibc.git] / sysdeps / i386 / submul_1.S
blobd4588f9101178defa1d02daaf88dbc24c1a808e8
1 /* i80386 __mpn_submul_1 -- Multiply a limb vector with a limb and subtract
2    the result from a second limb vector.
3    Copyright (C) 1992-2013 Free Software Foundation, Inc.
4    This file is part of the GNU MP Library.
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.
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.
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/>.  */
20 #include "sysdep.h"
21 #include "asm-syntax.h"
22 #include "bp-sym.h"
23 #include "bp-asm.h"
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
31 #define res_ptr edi
32 #define s1_ptr esi
33 #define sizeP ecx
34 #define s2_limb ebx
36         .text
37 ENTRY (BP_SYM (__mpn_submul_1))
38         ENTER
40         pushl   %edi
41         cfi_adjust_cfa_offset (4)
42         pushl   %esi
43         cfi_adjust_cfa_offset (4)
44         pushl   %ebp
45         cfi_adjust_cfa_offset (4)
46         pushl   %ebx
47         cfi_adjust_cfa_offset (4)
48         cfi_rel_offset (edi, 12)
49         cfi_rel_offset (esi, 8)
50         cfi_rel_offset (ebp, 4)
51         cfi_rel_offset (ebx, 0)
53         movl    RES(%esp), %res_ptr
54         movl    S1(%esp), %s1_ptr
55         movl    SIZE(%esp), %sizeP
56         movl    S2LIMB(%esp), %s2_limb
57 #if __BOUNDED_POINTERS__
58         shll    $2, %sizeP      /* convert limbs to bytes */
59         CHECK_BOUNDS_BOTH_WIDE (%res_ptr, RES(%esp), %sizeP)
60         CHECK_BOUNDS_BOTH_WIDE (%s1_ptr, S1(%esp), %sizeP)
61         shrl    $2, %sizeP
62 #endif
63         leal    (%res_ptr,%sizeP,4), %res_ptr
64         leal    (%s1_ptr,%sizeP,4), %s1_ptr
65         negl    %sizeP
66         xorl    %ebp, %ebp
67         ALIGN (3)
68 L(oop):
69         movl    (%s1_ptr,%sizeP,4), %eax
70         mull    %s2_limb
71         addl    %ebp, %eax
72         adcl    $0, %edx
73         subl    %eax, (%res_ptr,%sizeP,4)
74         adcl    $0, %edx
75         movl    %edx, %ebp
77         incl    %sizeP
78         jnz     L(oop)
79         movl    %ebp, %eax
81         popl    %ebx
82         cfi_adjust_cfa_offset (-4)
83         cfi_restore (ebx)
84         popl    %ebp
85         cfi_adjust_cfa_offset (-4)
86         cfi_restore (ebp)
87         popl    %esi
88         cfi_adjust_cfa_offset (-4)
89         cfi_restore (esi)
90         popl    %edi
91         cfi_adjust_cfa_offset (-4)
92         cfi_restore (edi)
94         LEAVE
95         ret
96 END (BP_SYM (__mpn_submul_1))