1 /* i80386 __mpn_sub_n -- Add two limb vectors of the same length > 0 and store
2 sum in a third limb vector.
3 Copyright (C) 1992-2022 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 <https://www.gnu.org/licenses/>. */
21 #include "asm-syntax.h"
23 #define PARMS 4+8 /* space for 2 saved regs */
33 cfi_adjust_cfa_offset (4)
35 cfi_adjust_cfa_offset (4)
38 cfi_rel_offset (edi, 4)
40 cfi_rel_offset (esi, 0)
46 cfi_adjust_cfa_offset (4)
47 cfi_rel_offset (ebx, 0)
51 shrl $3,%ecx /* compute count for unrolled loop */
53 andl $7,%eax /* get index where to start loop */
54 jz L(oop) /* necessary special case for 0 */
55 incl %ecx /* adjust loop count */
56 shll $2,%eax /* adjustment for pointers... */
57 subl %eax,%edi /* ... since they are offset ... */
58 subl %eax,%esi /* ... by a constant when we ... */
59 subl %eax,%edx /* ... enter the loop */
60 shrl $2,%eax /* restore previous value */
61 #if defined __CET__ && (__CET__ & 1) != 0
62 leal -4(,%eax,4),%ebx /* Count for 4-byte endbr32 */
65 /* Calculate start address in loop for PIC. Due to limitations in some
66 assemblers, Loop-L0-3 cannot be put into the leal */
68 cfi_adjust_cfa_offset (4)
69 L(0): leal (%eax,%eax,8),%eax
71 addl $(L(oop)-L(0)-3),%eax
73 cfi_adjust_cfa_offset (-4)
75 /* Calculate start address in loop for non-PIC. */
76 leal (L(oop) - 3)(%eax,%eax,8),%eax
78 #if defined __CET__ && (__CET__ & 1) != 0
79 addl %ebx,%eax /* Adjust for endbr32 */
81 jmp *%eax /* jump into loop */
83 L(oop): movl (%esi),%eax
123 #if defined __CET__ && (__CET__ & 1) != 0
125 cfi_adjust_cfa_offset (-4)
129 cfi_adjust_cfa_offset (-4)
132 cfi_adjust_cfa_offset (-4)