Blame mpn/x86/aorsmul_1.asm

Packit 5c3484
dnl  x86 __gmpn_addmul_1 (for 386 and 486) -- Multiply a limb vector with a
Packit 5c3484
dnl  limb and add the result to a second limb vector.
Packit 5c3484
Packit 5c3484
dnl  Copyright 1992, 1994, 1997, 1999-2002, 2005 Free Software Foundation, 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
C			    cycles/limb
Packit 5c3484
C P5				14.75
Packit 5c3484
C P6 model 0-8,10-12		 7.5
Packit 5c3484
C P6 model 9  (Banias)		 6.7
Packit 5c3484
C P6 model 13 (Dothan)		 6.75
Packit 5c3484
C P4 model 0  (Willamette)	24.0
Packit 5c3484
C P4 model 1  (?)		24.0
Packit 5c3484
C P4 model 2  (Northwood)	24.0
Packit 5c3484
C P4 model 3  (Prescott)
Packit 5c3484
C P4 model 4  (Nocona)
Packit 5c3484
C Intel Atom
Packit 5c3484
C AMD K6			12.5
Packit 5c3484
C AMD K7			 5.25
Packit 5c3484
C AMD K8
Packit 5c3484
C AMD K10
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
Packit 5c3484
',`ifdef(`OPERATION_submul_1',`
Packit 5c3484
      define(M4_inst,        subl)
Packit 5c3484
      define(M4_function_1,  mpn_submul_1)
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_submul_1)
Packit 5c3484
Packit 5c3484
Packit 5c3484
C mp_limb_t M4_function_1 (mp_ptr dst, mp_srcptr src, mp_size_t size,
Packit 5c3484
C                          mp_limb_t mult);
Packit 5c3484
Packit 5c3484
define(PARAM_MULTIPLIER, `FRAME+16(%esp)')
Packit 5c3484
define(PARAM_SIZE,       `FRAME+12(%esp)')
Packit 5c3484
define(PARAM_SRC,        `FRAME+8(%esp)')
Packit 5c3484
define(PARAM_DST,        `FRAME+4(%esp)')
Packit 5c3484
Packit 5c3484
	TEXT
Packit 5c3484
	ALIGN(8)
Packit 5c3484
Packit 5c3484
PROLOGUE(M4_function_1)
Packit 5c3484
deflit(`FRAME',0)
Packit 5c3484
Packit 5c3484
	pushl	%edi
Packit 5c3484
	pushl	%esi
Packit 5c3484
	pushl	%ebx
Packit 5c3484
	pushl	%ebp
Packit 5c3484
deflit(`FRAME',16)
Packit 5c3484
Packit 5c3484
	movl	PARAM_DST,%edi
Packit 5c3484
	movl	PARAM_SRC,%esi
Packit 5c3484
	movl	PARAM_SIZE,%ecx
Packit 5c3484
Packit 5c3484
	xorl	%ebx,%ebx
Packit 5c3484
	andl	$3,%ecx
Packit 5c3484
	jz	L(end0)
Packit 5c3484
Packit 5c3484
L(oop0):
Packit 5c3484
	movl	(%esi),%eax
Packit 5c3484
	mull	PARAM_MULTIPLIER
Packit 5c3484
	leal	4(%esi),%esi
Packit 5c3484
	addl	%ebx,%eax
Packit 5c3484
	movl	$0,%ebx
Packit 5c3484
	adcl	%ebx,%edx
Packit 5c3484
	M4_inst	%eax,(%edi)
Packit 5c3484
	adcl	%edx,%ebx	C propagate carry into cylimb
Packit 5c3484
Packit 5c3484
	leal	4(%edi),%edi
Packit 5c3484
	decl	%ecx
Packit 5c3484
	jnz	L(oop0)
Packit 5c3484
Packit 5c3484
L(end0):
Packit 5c3484
	movl	PARAM_SIZE,%ecx
Packit 5c3484
	shrl	$2,%ecx
Packit 5c3484
	jz	L(end)
Packit 5c3484
Packit 5c3484
	ALIGN(8)
Packit 5c3484
L(oop):	movl	(%esi),%eax
Packit 5c3484
	mull	PARAM_MULTIPLIER
Packit 5c3484
	addl	%eax,%ebx
Packit 5c3484
	movl	$0,%ebp
Packit 5c3484
	adcl	%edx,%ebp
Packit 5c3484
Packit 5c3484
	movl	4(%esi),%eax
Packit 5c3484
	mull	PARAM_MULTIPLIER
Packit 5c3484
	M4_inst	%ebx,(%edi)
Packit 5c3484
	adcl	%eax,%ebp	C new lo + cylimb
Packit 5c3484
	movl	$0,%ebx
Packit 5c3484
	adcl	%edx,%ebx
Packit 5c3484
Packit 5c3484
	movl	8(%esi),%eax
Packit 5c3484
	mull	PARAM_MULTIPLIER
Packit 5c3484
	M4_inst	%ebp,4(%edi)
Packit 5c3484
	adcl	%eax,%ebx	C new lo + cylimb
Packit 5c3484
	movl	$0,%ebp
Packit 5c3484
	adcl	%edx,%ebp
Packit 5c3484
Packit 5c3484
	movl	12(%esi),%eax
Packit 5c3484
	mull	PARAM_MULTIPLIER
Packit 5c3484
	M4_inst	%ebx,8(%edi)
Packit 5c3484
	adcl	%eax,%ebp	C new lo + cylimb
Packit 5c3484
	movl	$0,%ebx
Packit 5c3484
	adcl	%edx,%ebx
Packit 5c3484
Packit 5c3484
	M4_inst	%ebp,12(%edi)
Packit 5c3484
	adcl	$0,%ebx		C propagate carry into cylimb
Packit 5c3484
Packit 5c3484
	leal	16(%esi),%esi
Packit 5c3484
	leal	16(%edi),%edi
Packit 5c3484
	decl	%ecx
Packit 5c3484
	jnz	L(oop)
Packit 5c3484
Packit 5c3484
L(end):	movl	%ebx,%eax
Packit 5c3484
Packit 5c3484
	popl	%ebp
Packit 5c3484
	popl	%ebx
Packit 5c3484
	popl	%esi
Packit 5c3484
	popl	%edi
Packit 5c3484
	ret
Packit 5c3484
Packit 5c3484
EPILOGUE()