FIX BUILD (with GHC 6.2.x): System.Directory.Internals is no more
[ghc-hetmet.git] / rts / gmp / mpn / x86 / copyd.asm
1 dnl  x86 mpn_copyd -- copy limb vector, decrementing.
2 dnl 
3 dnl  Future: On P6 an MMX loop should be able to go faster than this code.
4
5
6 dnl  Copyright (C) 1999, 2000 Free Software Foundation, Inc.
7 dnl 
8 dnl  This file is part of the GNU MP Library.
9 dnl 
10 dnl  The GNU MP Library is free software; you can redistribute it and/or
11 dnl  modify it under the terms of the GNU Lesser General Public License as
12 dnl  published by the Free Software Foundation; either version 2.1 of the
13 dnl  License, or (at your option) any later version.
14 dnl 
15 dnl  The GNU MP Library is distributed in the hope that it will be useful,
16 dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
17 dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18 dnl  Lesser General Public License for more details.
19 dnl 
20 dnl  You should have received a copy of the GNU Lesser General Public
21 dnl  License along with the GNU MP Library; see the file COPYING.LIB.  If
22 dnl  not, write to the Free Software Foundation, Inc., 59 Temple Place -
23 dnl  Suite 330, Boston, MA 02111-1307, USA.
24
25
26 include(`../config.m4')
27
28
29 C void mpn_copyd (mp_ptr dst, mp_srcptr src, mp_size_t size);
30 C
31 C Copy src,size to dst,size, working from high to low addresses.
32 C
33 C The code here is very generic and can be expected to be reasonable on all
34 C the x86 family.
35 C
36 C P5 - 1.0 cycles/limb.
37 C
38 C P6 - 2.4 cycles/limb, approx 40 cycles startup.
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()