1dnl  x86 mpn_copyd -- copy limb vector, decrementing.
2
3dnl  Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
4dnl
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
8dnl  modify it under the terms of the GNU Lesser General Public License as
9dnl  published by the Free Software Foundation; either version 3 of the
10dnl  License, or (at your option) any later version.
11dnl
12dnl  The GNU MP Library is distributed in the hope that it will be useful,
13dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
14dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15dnl  Lesser General Public License for more details.
16dnl
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  startup (approx)
24C P5:     1.0         40
25C P6      2.4         70
26C K6      1.0         55
27C K7:     1.3         75
28C P4:     2.6        175
29C
30C (Startup time includes some function call overheads.)
31
32
33C void mpn_copyd (mp_ptr dst, mp_srcptr src, mp_size_t size);
34C
35C Copy src,size to dst,size, working from high to low addresses.
36C
37C The code here is very generic and can be expected to be reasonable on all
38C the x86 family.
39
40defframe(PARAM_SIZE,12)
41defframe(PARAM_SRC, 8)
42defframe(PARAM_DST, 4)
43deflit(`FRAME',0)
44
45	TEXT
46	ALIGN(32)
47
48PROLOGUE(mpn_copyd)
49	C eax	saved esi
50	C ebx
51	C ecx	counter
52	C edx	saved edi
53	C esi	src
54	C edi	dst
55	C ebp
56
57	movl	PARAM_SIZE, %ecx
58	movl	%esi, %eax
59
60	movl	PARAM_SRC, %esi
61	movl	%edi, %edx
62
63	movl	PARAM_DST, %edi
64	leal	-4(%esi,%ecx,4), %esi
65
66	leal	-4(%edi,%ecx,4), %edi
67
68	std
69
70	rep
71	movsl
72
73	cld
74
75	movl	%eax, %esi
76	movl	%edx, %edi
77
78	ret
79
80EPILOGUE()
81