(CFLAGS-tst-align.c): Add -mpreferred-stack-boundary=4.
[glibc.git] / sysdeps / i386 / i586 / addmul_1.S
blob9329637fe2a00dc0b9affe3d9acca49604d0ac6f
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 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, write to
18    the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
19    MA 02111-1307, USA. */
21 #include "sysdep.h"
22 #include "asm-syntax.h"
23 #include "bp-sym.h"
24 #include "bp-asm.h"
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
32 #define res_ptr edi
33 #define s1_ptr esi
34 #define size ecx
35 #define s2_limb ebx
37         .text
38 ENTRY (BP_SYM (__mpn_addmul_1))
39         ENTER
41         pushl   %edi
42         pushl   %esi
43         pushl   %ebp
44         pushl   %ebx
46         movl    RES(%esp), %res_ptr
47         movl    S1(%esp), %s1_ptr
48         movl    SIZE(%esp), %size
49         movl    S2LIMB(%esp), %s2_limb
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)
54         shrl    $2, %size
55 #endif
56         leal    (%res_ptr,%size,4), %res_ptr
57         leal    (%s1_ptr,%size,4), %s1_ptr
58         negl    %size
59         xorl    %ebp, %ebp
60         ALIGN (3)
62 L(oop): adcl    $0, %ebp
63         movl    (%s1_ptr,%size,4), %eax
65         mull    %s2_limb
67         addl    %ebp, %eax
68         movl    (%res_ptr,%size,4), %ebp
70         adcl    $0, %edx
71         addl    %eax, %ebp
73         movl    %ebp, (%res_ptr,%size,4)
74         incl    %size
76         movl    %edx, %ebp
77         jnz     L(oop)
79         adcl    $0, %ebp
80         movl    %ebp, %eax
81         popl    %ebx
82         popl    %ebp
83         popl    %esi
84         popl    %edi
86         LEAVE
87         ret
88 #undef size
89 END (BP_SYM (__mpn_addmul_1))