Upload Tizen:Base source
[external/gmp.git] / mpn / x86 / copyd.asm
1 dnl  x86 mpn_copyd -- copy limb vector, decrementing.
2
3 dnl  Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
4 dnl
5 dnl  This file is part of the GNU MP Library.
6 dnl
7 dnl  The GNU MP Library is free software; you can redistribute it and/or
8 dnl  modify it under the terms of the GNU Lesser General Public License as
9 dnl  published by the Free Software Foundation; either version 3 of the
10 dnl  License, or (at your option) any later version.
11 dnl
12 dnl  The GNU MP Library is distributed in the hope that it will be useful,
13 dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
14 dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15 dnl  Lesser General Public License for more details.
16 dnl
17 dnl  You should have received a copy of the GNU Lesser General Public License
18 dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
19
20 include(`../config.m4')
21
22
23 C     cycles/limb  startup (approx)
24 C P5:     1.0         40
25 C P6      2.4         70
26 C K6      1.0         55
27 C K7:     1.3         75
28 C P4:     2.6        175
29 C
30 C (Startup time includes some function call overheads.)
31
32
33 C void mpn_copyd (mp_ptr dst, mp_srcptr src, mp_size_t size);
34 C
35 C Copy src,size to dst,size, working from high to low addresses.
36 C
37 C The code here is very generic and can be expected to be reasonable on all
38 C the x86 family.
39
40 defframe(PARAM_SIZE,12)
41 defframe(PARAM_SRC, 8)
42 defframe(PARAM_DST, 4)
43 deflit(`FRAME',0)
44
45         TEXT
46         ALIGN(32)
47
48 PROLOGUE(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
80 EPILOGUE()