1 /* i80386 __mpn_sub_n -- Add two limb vectors of the same length > 0 and store
2 sum in a third limb vector.
4 Copyright (C) 1992, 1994, 1995 Free Software Foundation, Inc.
6 This file is part of the GNU MP Library.
8 The GNU MP Library is free software; you can redistribute it and/or modify
9 it under the terms of the GNU Library General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or (at your
11 option) any later version.
13 The GNU MP Library is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
16 License for more details.
18 You should have received a copy of the GNU Library General Public License
19 along with the GNU MP Library; see the file COPYING.LIB. If not, write to
20 the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
31 #include "asm-syntax.h"
35 .globl C_SYMBOL_NAME(__mpn_sub_n)
36 C_SYMBOL_NAME(__mpn_sub_n:)
40 movl 12(%esp),%edi /* res_ptr */
41 movl 16(%esp),%esi /* s1_ptr */
42 movl 20(%esp),%edx /* s2_ptr */
43 movl 24(%esp),%ecx /* size */
46 shrl $3,%ecx /* compute count for unrolled loop */
48 andl $7,%eax /* get index where to start loop */
49 jz Loop /* necessary special case for 0 */
50 incl %ecx /* adjust loop count */
51 shll $2,%eax /* adjustment for pointers... */
52 subl %eax,%edi /* ... since they are offset ... */
53 subl %eax,%esi /* ... by a constant when we ... */
54 subl %eax,%edx /* ... enter the loop */
55 shrl $2,%eax /* restore previous value */
57 /* Calculate start address in loop for PIC. Due to limitations in some
58 assemblers, Loop-L0-3 cannot be put into the leal */
60 L0: leal (%eax,%eax,8),%eax
62 addl $(Loop-L0-3),%eax
65 /* Calculate start address in loop for non-PIC. */
66 leal (Loop - 3)(%eax,%eax,8),%eax
68 jmp *%eax /* jump into loop */
70 Loop: movl (%esi),%eax