|
Packit |
5c3484 |
dnl Intel Pentium mpn_addmul_1 -- mpn by limb multiplication.
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
dnl Copyright 1992, 1994, 1996, 1999, 2000, 2002 Free Software Foundation,
|
|
Packit |
5c3484 |
dnl Inc.
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
dnl This file is part of the GNU MP Library.
|
|
Packit |
5c3484 |
dnl
|
|
Packit |
5c3484 |
dnl The GNU MP Library is free software; you can redistribute it and/or modify
|
|
Packit |
5c3484 |
dnl it under the terms of either:
|
|
Packit |
5c3484 |
dnl
|
|
Packit |
5c3484 |
dnl * the GNU Lesser General Public License as published by the Free
|
|
Packit |
5c3484 |
dnl Software Foundation; either version 3 of the License, or (at your
|
|
Packit |
5c3484 |
dnl option) any later version.
|
|
Packit |
5c3484 |
dnl
|
|
Packit |
5c3484 |
dnl or
|
|
Packit |
5c3484 |
dnl
|
|
Packit |
5c3484 |
dnl * the GNU General Public License as published by the Free Software
|
|
Packit |
5c3484 |
dnl Foundation; either version 2 of the License, or (at your option) any
|
|
Packit |
5c3484 |
dnl later version.
|
|
Packit |
5c3484 |
dnl
|
|
Packit |
5c3484 |
dnl or both in parallel, as here.
|
|
Packit |
5c3484 |
dnl
|
|
Packit |
5c3484 |
dnl The GNU MP Library is distributed in the hope that it will be useful, but
|
|
Packit |
5c3484 |
dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
Packit |
5c3484 |
dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
Packit |
5c3484 |
dnl for more details.
|
|
Packit |
5c3484 |
dnl
|
|
Packit |
5c3484 |
dnl You should have received copies of the GNU General Public License and the
|
|
Packit |
5c3484 |
dnl GNU Lesser General Public License along with the GNU MP Library. If not,
|
|
Packit |
5c3484 |
dnl see https://www.gnu.org/licenses/.
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
include(`../config.m4')
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
C P5: 14.0 cycles/limb
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
ifdef(`OPERATION_addmul_1', `
|
|
Packit |
5c3484 |
define(M4_inst, addl)
|
|
Packit |
5c3484 |
define(M4_function_1, mpn_addmul_1)
|
|
Packit |
5c3484 |
define(M4_function_1c, mpn_addmul_1c)
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
',`ifdef(`OPERATION_submul_1', `
|
|
Packit |
5c3484 |
define(M4_inst, subl)
|
|
Packit |
5c3484 |
define(M4_function_1, mpn_submul_1)
|
|
Packit |
5c3484 |
define(M4_function_1c, mpn_submul_1c)
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
',`m4_error(`Need OPERATION_addmul_1 or OPERATION_submul_1
|
|
Packit |
5c3484 |
')')')
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
MULFUNC_PROLOGUE(mpn_addmul_1 mpn_addmul_1c mpn_submul_1 mpn_submul_1c)
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
C mp_limb_t mpn_addmul_1 (mp_ptr dst, mp_srcptr src, mp_size_t size,
|
|
Packit |
5c3484 |
C mp_limb_t mult);
|
|
Packit |
5c3484 |
C mp_limb_t mpn_addmul_1c (mp_ptr dst, mp_srcptr src, mp_size_t size,
|
|
Packit |
5c3484 |
C mp_limb_t mult, mp_limb_t carry);
|
|
Packit |
5c3484 |
C
|
|
Packit |
5c3484 |
C mp_limb_t mpn_submul_1 (mp_ptr dst, mp_srcptr src, mp_size_t size,
|
|
Packit |
5c3484 |
C mp_limb_t mult);
|
|
Packit |
5c3484 |
C mp_limb_t mpn_submul_1c (mp_ptr dst, mp_srcptr src, mp_size_t size,
|
|
Packit |
5c3484 |
C mp_limb_t mult, mp_limb_t carry);
|
|
Packit |
5c3484 |
C
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
defframe(PARAM_CARRY, 20)
|
|
Packit |
5c3484 |
defframe(PARAM_MULTIPLIER,16)
|
|
Packit |
5c3484 |
defframe(PARAM_SIZE, 12)
|
|
Packit |
5c3484 |
defframe(PARAM_SRC, 8)
|
|
Packit |
5c3484 |
defframe(PARAM_DST, 4)
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
TEXT
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
ALIGN(8)
|
|
Packit |
5c3484 |
PROLOGUE(M4_function_1c)
|
|
Packit |
5c3484 |
deflit(`FRAME',0)
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
movl PARAM_CARRY, %ecx
|
|
Packit |
5c3484 |
pushl %esi FRAME_pushl()
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
jmp L(start_1c)
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
EPILOGUE()
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
ALIGN(8)
|
|
Packit |
5c3484 |
PROLOGUE(M4_function_1)
|
|
Packit |
5c3484 |
deflit(`FRAME',0)
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
xorl %ecx, %ecx
|
|
Packit |
5c3484 |
pushl %esi FRAME_pushl()
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
L(start_1c):
|
|
Packit |
5c3484 |
movl PARAM_SRC, %esi
|
|
Packit |
5c3484 |
movl PARAM_SIZE, %eax
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
pushl %edi FRAME_pushl()
|
|
Packit |
5c3484 |
pushl %ebx FRAME_pushl()
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
movl PARAM_DST, %edi
|
|
Packit |
5c3484 |
leal -1(%eax), %ebx C size-1
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
leal (%esi,%eax,4), %esi
|
|
Packit |
5c3484 |
xorl $-1, %ebx C -size, and clear carry
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
leal (%edi,%eax,4), %edi
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
L(top):
|
|
Packit |
5c3484 |
C eax
|
|
Packit |
5c3484 |
C ebx counter, negative
|
|
Packit |
5c3484 |
C ecx carry
|
|
Packit |
5c3484 |
C edx
|
|
Packit |
5c3484 |
C esi src end
|
|
Packit |
5c3484 |
C edi dst end
|
|
Packit |
5c3484 |
C ebp
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
adcl $0, %ecx
|
|
Packit |
5c3484 |
movl (%esi,%ebx,4), %eax
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
mull PARAM_MULTIPLIER
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
addl %ecx, %eax
|
|
Packit |
5c3484 |
movl (%edi,%ebx,4), %ecx
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
adcl $0, %edx
|
|
Packit |
5c3484 |
M4_inst %eax, %ecx
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
movl %ecx, (%edi,%ebx,4)
|
|
Packit |
5c3484 |
incl %ebx
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
movl %edx, %ecx
|
|
Packit |
5c3484 |
jnz L(top)
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
adcl $0, %ecx
|
|
Packit |
5c3484 |
popl %ebx
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
movl %ecx, %eax
|
|
Packit |
5c3484 |
popl %edi
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
popl %esi
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
ret
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
EPILOGUE()
|