xref: /netbsd-src/external/lgpl3/gmp/dist/mpn/x86_64/bt1/copyi.asm (revision 8e33eff89e26cf71871ead62f0d5063e1313c33a)
1dnl  AMD64 mpn_copyi optimised for AMD bobcat.
2
3dnl  Copyright 2003, 2005, 2007, 2011, 2012 Free Software Foundation, Inc.
4
5dnl  This file is part of the GNU MP Library.
6dnl
7dnl  The GNU MP Library is free software; you can redistribute it and/or modify
8dnl  it under the terms of either:
9dnl
10dnl    * the GNU Lesser General Public License as published by the Free
11dnl      Software Foundation; either version 3 of the License, or (at your
12dnl      option) any later version.
13dnl
14dnl  or
15dnl
16dnl    * the GNU General Public License as published by the Free Software
17dnl      Foundation; either version 2 of the License, or (at your option) any
18dnl      later version.
19dnl
20dnl  or both in parallel, as here.
21dnl
22dnl  The GNU MP Library is distributed in the hope that it will be useful, but
23dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
24dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
25dnl  for more details.
26dnl
27dnl  You should have received copies of the GNU General Public License and the
28dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
29dnl  see https://www.gnu.org/licenses/.
30
31include(`../config.m4')
32
33C	     cycles/limb
34C AMD K8,K9	 1
35C AMD K10	 1-2  (alignment fluctuations)
36C AMD bd1	 ?
37C AMD bobcat	 1.5
38C Intel P4	 2.8
39C Intel core2	 1
40C Intel NHM	 1-1.25
41C Intel SBR	 1
42C Intel atom	 2.87
43C VIA nano	 2
44
45C INPUT PARAMETERS
46C rp	rdi
47C up	rsi
48C n	rdx
49
50define(`rp',`%rdi')
51define(`up',`%rsi')
52define(`n',`%rdx')
53
54ABI_SUPPORT(DOS64)
55ABI_SUPPORT(STD64)
56
57ASM_START()
58	TEXT
59	ALIGN(16)
60PROLOGUE(mpn_copyi)
61	FUNC_ENTRY(3)
62	lea	-32(up,n,8), up
63	lea	-32(rp,n,8), rp
64	neg	n
65	add	$4, n
66	jg	L(end)
67	ALIGN(16)
68L(top):	mov	(up,n,8), %r8
69	mov	%r8, (rp,n,8)
70	mov	8(up,n,8), %r8
71	mov	%r8, 8(rp,n,8)
72	mov	16(up,n,8), %r8
73	mov	%r8, 16(rp,n,8)
74	mov	24(up,n,8), %r8
75	mov	%r8, 24(rp,n,8)
76L(ent):	add	$4, n
77	jle	L(top)
78
79L(end):	cmp	$4, R32(n)
80	jz	L(ret)
81	mov	(up,n,8), %r8
82	mov	%r8, (rp,n,8)
83	cmp	$3, R32(n)
84	jz	L(ret)
85	mov	8(up,n,8), %r8
86	mov	%r8, 8(rp,n,8)
87	cmp	$2, R32(n)
88	jz	L(ret)
89	mov	16(up,n,8), %r8
90	mov	%r8, 16(rp,n,8)
91
92L(ret):	FUNC_EXIT()
93	ret
94EPILOGUE()
95