Blame mpn/x86/mul_1.asm

Packit 5c3484
dnl  x86 mpn_mul_1 (for 386, 486, and Pentium Pro) -- Multiply a limb vector
Packit 5c3484
dnl  with a limb and store the result in a second limb vector.
Packit 5c3484
Packit 5c3484
dnl  Copyright 1992, 1994, 1997-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
Packit 5c3484
C			    cycles/limb
Packit 5c3484
C P5				12.5
Packit 5c3484
C P6 model 0-8,10-12		 5.5
Packit 5c3484
C P6 model 9  (Banias)
Packit 5c3484
C P6 model 13 (Dothan)		 5.25
Packit 5c3484
C P4 model 0  (Willamette)	19.0
Packit 5c3484
C P4 model 1  (?)		19.0
Packit 5c3484
C P4 model 2  (Northwood)	19.0
Packit 5c3484
C P4 model 3  (Prescott)
Packit 5c3484
C P4 model 4  (Nocona)
Packit 5c3484
C AMD K6			10.5
Packit 5c3484
C AMD K7			 4.5
Packit 5c3484
C AMD K8
Packit 5c3484
Packit 5c3484
Packit 5c3484
C mp_limb_t mpn_mul_1 (mp_ptr dst, mp_srcptr src, mp_size_t size,
Packit 5c3484
C                      mp_limb_t multiplier);
Packit 5c3484
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
	ALIGN(8)
Packit 5c3484
PROLOGUE(mpn_mul_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
	movl	%eax,(%edi)
Packit 5c3484
	movl	%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
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
	movl	%ebx,(%edi)
Packit 5c3484
	addl	%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
	movl	%ebp,4(%edi)
Packit 5c3484
	addl	%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
	movl	%ebx,8(%edi)
Packit 5c3484
	addl	%eax,%ebp	C new lo + cylimb
Packit 5c3484
	movl	$0,%ebx
Packit 5c3484
	adcl	%edx,%ebx
Packit 5c3484
Packit 5c3484
	movl	%ebp,12(%edi)
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()