b41b5366cc5e79c2ca02468e6504c80c316029ae
[platform/upstream/gmp.git] / mpn / alpha / copyd.asm
1 dnl  Alpha mpn_copyd -- copy, decrementing.
2
3 dnl  Copyright 2002, 2003 Free Software Foundation, Inc.
4
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 modify
8 dnl  it under the terms of either:
9 dnl
10 dnl    * the GNU Lesser General Public License as published by the Free
11 dnl      Software Foundation; either version 3 of the License, or (at your
12 dnl      option) any later version.
13 dnl
14 dnl  or
15 dnl
16 dnl    * the GNU General Public License as published by the Free Software
17 dnl      Foundation; either version 2 of the License, or (at your option) any
18 dnl      later version.
19 dnl
20 dnl  or both in parallel, as here.
21 dnl
22 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
23 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
24 dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
25 dnl  for more details.
26 dnl
27 dnl  You should have received copies of the GNU General Public License and the
28 dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
29 dnl  see https://www.gnu.org/licenses/.
30
31 include(`../config.m4')
32
33 C      cycles/limb
34 C EV4:     4
35 C EV5:     1.75
36 C EV6:     1
37
38 C INPUT PARAMETERS
39 C rp    r16
40 C up    r17
41 C n     r18
42
43
44 ASM_START()
45 PROLOGUE(mpn_copyd)
46         s8addq  r18,r16,r16             C E0
47         s8addq  r18,r17,r17             C E1
48         lda     r18,-8(r18)             C E0
49         blt     r18,$Lend               C E1
50 $Loop:  ldq     r0,-8(r17)              C E0
51         ldq     r1,-16(r17)             C E1
52         ldq     r2,-24(r17)             C E0
53         ldq     r3,-32(r17)             C E1
54         ldq     r4,-40(r17)             C E0
55         ldq     r5,-48(r17)             C E1
56         ldq     r6,-56(r17)             C E0
57         ldq     r7,-64(r17)             C E1
58         stq     r0,-8(r16)              C E0
59         lda     r17,-64(r17)            C E1
60         stq     r1,-16(r16)             C E0
61         bis     r31, r31, r31           C E1
62         stq     r2,-24(r16)             C E0
63         lda     r18,-8(r18)             C E1
64         stq     r3,-32(r16)             C E0
65         bis     r31, r31, r31           C E1
66         stq     r4,-40(r16)             C E0
67         bis     r31, r31, r31           C E1
68         stq     r5,-48(r16)             C E0
69         bis     r31, r31, r31           C E1
70         stq     r6,-56(r16)             C E0
71         bis     r31, r31, r31           C E1
72         stq     r7,-64(r16)             C E0
73         lda     r16,-64(r16)            C E1
74         bge     r18,$Loop               C E1
75 $Lend:  lda     r18,7(r18)              C E0
76         blt     r18,$Lret               C E1
77         ldq     r0,-8(r17)              C E0
78         beq     r18,$Lend0              C E1
79 $Loop0: stq     r0,-8(r16)              C E0
80         lda     r16,-8(r16)             C E1
81         ldq     r0,-16(r17)             C E0
82         lda     r18,-1(r18)             C E1
83         lda     r17,-8(r17)             C E0
84         bgt     r18,$Loop0              C E1
85 $Lend0: stq     r0,-8(r16)              C E0
86 $Lret:  ret     r31,(r26),1             C E1
87 EPILOGUE(mpn_copyd)
88 ASM_END()