Tizen 2.1 base
[external/gmp.git] / mpn / x86_64 / copyd.asm
1 dnl  AMD64 mpn_copyd -- copy limb vector, decrementing.
2
3 dnl  Copyright 2003, 2005, 2007 Free Software Foundation, Inc.
4
5 dnl  This file is part of the GNU MP Library.
6
7 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
8 dnl  it under the terms of the GNU Lesser General Public License as published
9 dnl  by the Free Software Foundation; either version 3 of the License, or (at
10 dnl  your option) any later version.
11
12 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
13 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
15 dnl  License for more details.
16
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
24 C K8,K9:        1
25 C K10:          1
26 C P4:           2.8
27 C P6 core2:     1.2
28 C P6 corei7:    1
29
30
31 C INPUT PARAMETERS
32 C rp    rdi
33 C up    rsi
34 C n     rdx
35
36 define(`rp',`%rdi')
37 define(`up',`%rsi')
38 define(`n',`%rdx')
39
40 ASM_START()
41         TEXT
42         ALIGN(16)
43 PROLOGUE(mpn_copyd)
44         leaq    -8(up,n,8), up
45         leaq    (rp,n,8), rp
46         subq    $4, n
47         jc      L(end)
48         ALIGN(16)
49 L(oop): movq    (up), %r8
50         movq    -8(up), %r9
51         leaq    -32(rp), rp
52         movq    -16(up), %r10
53         movq    -24(up), %r11
54         leaq    -32(up), up
55         movq    %r8, 24(rp)
56         movq    %r9, 16(rp)
57         subq    $4, n
58         movq    %r10, 8(rp)
59         movq    %r11, (rp)
60         jnc     L(oop)
61
62 L(end): shrl    %edx                    C edx = lowpart(n)
63         jnc     1f
64         movq    (up), %r8
65         movq    %r8, -8(rp)
66         leaq    -8(rp), rp
67         leaq    -8(up), up
68 1:      shrl    %edx                    C edx = lowpart(n)
69         jnc     1f
70         movq    (up), %r8
71         movq    -8(up), %r9
72         movq    %r8, -8(rp)
73         movq    %r9, -16(rp)
74 1:      ret
75 EPILOGUE()