|
Packit |
6c4009 |
/* Pentium __mpn_sub_n -- Subtract two limb vectors of the same length > 0
|
|
Packit |
6c4009 |
and store difference in a third limb vector.
|
|
Packit |
6c4009 |
Copyright (C) 1992-2018 Free Software Foundation, Inc.
|
|
Packit |
6c4009 |
This file is part of the GNU MP Library.
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
The GNU MP Library is free software; you can redistribute it and/or modify
|
|
Packit |
6c4009 |
it under the terms of the GNU Lesser General Public License as published by
|
|
Packit |
6c4009 |
the Free Software Foundation; either version 2.1 of the License, or (at your
|
|
Packit |
6c4009 |
option) any later version.
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
The GNU MP Library is distributed in the hope that it will be useful, but
|
|
Packit |
6c4009 |
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
Packit |
6c4009 |
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
|
Packit |
6c4009 |
License for more details.
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
You should have received a copy of the GNU Lesser General Public License
|
|
Packit |
6c4009 |
along with the GNU MP Library; see the file COPYING.LIB. If not,
|
|
Packit |
6c4009 |
see <http://www.gnu.org/licenses/>. */
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#include "sysdep.h"
|
|
Packit |
6c4009 |
#include "asm-syntax.h"
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#define PARMS 4+16 /* space for 4 saved regs */
|
|
Packit |
6c4009 |
#define RES PARMS
|
|
Packit |
6c4009 |
#define S1 RES+4
|
|
Packit |
6c4009 |
#define S2 S1+4
|
|
Packit |
6c4009 |
#define SIZE S2+4
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
.text
|
|
Packit |
6c4009 |
ENTRY (__mpn_sub_n)
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
pushl %edi
|
|
Packit |
6c4009 |
cfi_adjust_cfa_offset (4)
|
|
Packit |
6c4009 |
pushl %esi
|
|
Packit |
6c4009 |
cfi_adjust_cfa_offset (4)
|
|
Packit |
6c4009 |
pushl %ebp
|
|
Packit |
6c4009 |
cfi_adjust_cfa_offset (4)
|
|
Packit |
6c4009 |
pushl %ebx
|
|
Packit |
6c4009 |
cfi_adjust_cfa_offset (4)
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
movl RES(%esp),%edi
|
|
Packit |
6c4009 |
cfi_rel_offset (edi, 12)
|
|
Packit |
6c4009 |
movl S1(%esp),%esi
|
|
Packit |
6c4009 |
cfi_rel_offset (esi, 8)
|
|
Packit |
6c4009 |
movl S2(%esp),%ebx
|
|
Packit |
6c4009 |
cfi_rel_offset (ebx, 0)
|
|
Packit |
6c4009 |
movl SIZE(%esp),%ecx
|
|
Packit |
6c4009 |
movl (%ebx),%ebp
|
|
Packit |
6c4009 |
cfi_rel_offset (ebp, 4)
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
decl %ecx
|
|
Packit |
6c4009 |
movl %ecx,%edx
|
|
Packit |
6c4009 |
shrl $3,%ecx
|
|
Packit |
6c4009 |
andl $7,%edx
|
|
Packit |
6c4009 |
testl %ecx,%ecx /* zero carry flag */
|
|
Packit |
6c4009 |
jz L(end)
|
|
Packit |
6c4009 |
pushl %edx
|
|
Packit |
6c4009 |
cfi_adjust_cfa_offset (4)
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
ALIGN (3)
|
|
Packit |
6c4009 |
L(oop): movl 28(%edi),%eax /* fetch destination cache line */
|
|
Packit |
6c4009 |
leal 32(%edi),%edi
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
L(1): movl (%esi),%eax
|
|
Packit |
6c4009 |
movl 4(%esi),%edx
|
|
Packit |
6c4009 |
sbbl %ebp,%eax
|
|
Packit |
6c4009 |
movl 4(%ebx),%ebp
|
|
Packit |
6c4009 |
sbbl %ebp,%edx
|
|
Packit |
6c4009 |
movl 8(%ebx),%ebp
|
|
Packit |
6c4009 |
movl %eax,-32(%edi)
|
|
Packit |
6c4009 |
movl %edx,-28(%edi)
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
L(2): movl 8(%esi),%eax
|
|
Packit |
6c4009 |
movl 12(%esi),%edx
|
|
Packit |
6c4009 |
sbbl %ebp,%eax
|
|
Packit |
6c4009 |
movl 12(%ebx),%ebp
|
|
Packit |
6c4009 |
sbbl %ebp,%edx
|
|
Packit |
6c4009 |
movl 16(%ebx),%ebp
|
|
Packit |
6c4009 |
movl %eax,-24(%edi)
|
|
Packit |
6c4009 |
movl %edx,-20(%edi)
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
L(3): movl 16(%esi),%eax
|
|
Packit |
6c4009 |
movl 20(%esi),%edx
|
|
Packit |
6c4009 |
sbbl %ebp,%eax
|
|
Packit |
6c4009 |
movl 20(%ebx),%ebp
|
|
Packit |
6c4009 |
sbbl %ebp,%edx
|
|
Packit |
6c4009 |
movl 24(%ebx),%ebp
|
|
Packit |
6c4009 |
movl %eax,-16(%edi)
|
|
Packit |
6c4009 |
movl %edx,-12(%edi)
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
L(4): movl 24(%esi),%eax
|
|
Packit |
6c4009 |
movl 28(%esi),%edx
|
|
Packit |
6c4009 |
sbbl %ebp,%eax
|
|
Packit |
6c4009 |
movl 28(%ebx),%ebp
|
|
Packit |
6c4009 |
sbbl %ebp,%edx
|
|
Packit |
6c4009 |
movl 32(%ebx),%ebp
|
|
Packit |
6c4009 |
movl %eax,-8(%edi)
|
|
Packit |
6c4009 |
movl %edx,-4(%edi)
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
leal 32(%esi),%esi
|
|
Packit |
6c4009 |
leal 32(%ebx),%ebx
|
|
Packit |
6c4009 |
decl %ecx
|
|
Packit |
6c4009 |
jnz L(oop)
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
popl %edx
|
|
Packit |
6c4009 |
cfi_adjust_cfa_offset (-4)
|
|
Packit |
6c4009 |
L(end):
|
|
Packit |
6c4009 |
decl %edx /* test %edx w/o clobbering carry */
|
|
Packit |
6c4009 |
js L(end2)
|
|
Packit |
6c4009 |
incl %edx
|
|
Packit |
6c4009 |
L(oop2):
|
|
Packit |
6c4009 |
leal 4(%edi),%edi
|
|
Packit |
6c4009 |
movl (%esi),%eax
|
|
Packit |
6c4009 |
sbbl %ebp,%eax
|
|
Packit |
6c4009 |
movl 4(%ebx),%ebp
|
|
Packit |
6c4009 |
movl %eax,-4(%edi)
|
|
Packit |
6c4009 |
leal 4(%esi),%esi
|
|
Packit |
6c4009 |
leal 4(%ebx),%ebx
|
|
Packit |
6c4009 |
decl %edx
|
|
Packit |
6c4009 |
jnz L(oop2)
|
|
Packit |
6c4009 |
L(end2):
|
|
Packit |
6c4009 |
movl (%esi),%eax
|
|
Packit |
6c4009 |
sbbl %ebp,%eax
|
|
Packit |
6c4009 |
movl %eax,(%edi)
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
sbbl %eax,%eax
|
|
Packit |
6c4009 |
negl %eax
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
popl %ebx
|
|
Packit |
6c4009 |
cfi_adjust_cfa_offset (-4)
|
|
Packit |
6c4009 |
cfi_restore (ebx)
|
|
Packit |
6c4009 |
popl %ebp
|
|
Packit |
6c4009 |
cfi_adjust_cfa_offset (-4)
|
|
Packit |
6c4009 |
cfi_restore (ebp)
|
|
Packit |
6c4009 |
popl %esi
|
|
Packit |
6c4009 |
cfi_adjust_cfa_offset (-4)
|
|
Packit |
6c4009 |
cfi_restore (esi)
|
|
Packit |
6c4009 |
popl %edi
|
|
Packit |
6c4009 |
cfi_adjust_cfa_offset (-4)
|
|
Packit |
6c4009 |
cfi_restore (edi)
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
ret
|
|
Packit |
6c4009 |
END (__mpn_sub_n)
|