1dnl  AMD64 mpn_copyi -- copy limb vector, incrementing.
2
3dnl  Copyright 2003, 2005, 2007 Free Software Foundation, Inc.
4
5dnl  This file is part of the GNU MP Library.
6
7dnl  The GNU MP Library is free software; you can redistribute it and/or modify
8dnl  it under the terms of the GNU Lesser General Public License as published
9dnl  by the Free Software Foundation; either version 3 of the License, or (at
10dnl  your option) any later version.
11
12dnl  The GNU MP Library is distributed in the hope that it will be useful, but
13dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
15dnl  License for more details.
16
17dnl  You should have received a copy of the GNU Lesser General Public License
18dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
19
20include(`../config.m4')
21
22
23C	    cycles/limb
24C K8,K9:	1
25C K10:		1
26C P4:		2.8
27C P6-15:	1.2
28
29
30C INPUT PARAMETERS
31C rp	rdi
32C up	rsi
33C n	rdx
34
35define(`rp',`%rdi')
36define(`up',`%rsi')
37define(`n',`%rdx')
38
39ASM_START()
40	TEXT
41	ALIGN(16)
42PROLOGUE(mpn_copyi)
43	leaq	-8(rp), rp
44	subq	$4, n
45	jc	L(end)
46	ALIGN(16)
47L(oop):	movq	(up), %r8
48	movq	8(up), %r9
49	leaq	32(rp), rp
50	movq	16(up), %r10
51	movq	24(up), %r11
52	leaq	32(up), up
53	movq	%r8, -24(rp)
54	movq	%r9, -16(rp)
55	subq	$4, n
56	movq	%r10, -8(rp)
57	movq	%r11, (rp)
58	jnc	L(oop)
59
60L(end):	shrl	%edx			C edx = lowpart(n)
61	jnc	1f
62	movq	(up), %r8
63	movq	%r8, 8(rp)
64	leaq	8(rp), rp
65	leaq	8(up), up
661:	shrl	%edx			C edx = lowpart(n)
67	jnc	1f
68	movq	(up), %r8
69	movq	8(up), %r9
70	movq	%r8, 8(rp)
71	movq	%r9, 16(rp)
721:	ret
73EPILOGUE()
74