1dnl  SPARC v9 mpn_copyd -- Copy a limb vector, decrementing.
2
3dnl  Copyright 1999-2003 Free Software Foundation, Inc.
4
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 modify
8dnl  it under the terms of either:
9dnl
10dnl    * the GNU Lesser General Public License as published by the Free
11dnl      Software Foundation; either version 3 of the License, or (at your
12dnl      option) any later version.
13dnl
14dnl  or
15dnl
16dnl    * the GNU General Public License as published by the Free Software
17dnl      Foundation; either version 2 of the License, or (at your option) any
18dnl      later version.
19dnl
20dnl  or both in parallel, as here.
21dnl
22dnl  The GNU MP Library is distributed in the hope that it will be useful, but
23dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
24dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
25dnl  for more details.
26dnl
27dnl  You should have received copies of the GNU General Public License and the
28dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
29dnl  see https://www.gnu.org/licenses/.
30
31include(`../config.m4')
32
33C		   cycles/limb
34C UltraSPARC 1&2:	 2
35C UltraSPARC 3:		 2.5
36C UltraSPARC T1:	17
37C UltraSPARC T3:	 6
38C UltraSPARC T4/T5:	 2
39
40C INPUT PARAMETERS
41C rptr	%o0
42C sptr	%o1
43C n	%o2
44
45ASM_START()
46	REGISTER(%g2,#scratch)
47	REGISTER(%g3,#scratch)
48PROLOGUE(mpn_copyd)
49	sllx	%o2,3,%g1
50	add	%g1,%o0,%o0
51	add	%g1,%o1,%o1
52	addcc	%o2,-8,%o2
53	bl,pt	%xcc,L(end01234567)
54	nop
55L(loop1):
56	ldx	[%o1-8],%g1
57	ldx	[%o1-16],%g2
58	ldx	[%o1-24],%g3
59	ldx	[%o1-32],%g4
60	ldx	[%o1-40],%g5
61	ldx	[%o1-48],%o3
62	ldx	[%o1-56],%o4
63	ldx	[%o1-64],%o5
64	add	%o1,-64,%o1
65	stx	%g1,[%o0-8]
66	stx	%g2,[%o0-16]
67	stx	%g3,[%o0-24]
68	stx	%g4,[%o0-32]
69	stx	%g5,[%o0-40]
70	stx	%o3,[%o0-48]
71	stx	%o4,[%o0-56]
72	stx	%o5,[%o0-64]
73	addcc	%o2,-8,%o2
74	bge,pt	%xcc,L(loop1)
75	add	%o0,-64,%o0
76L(end01234567):
77	addcc	%o2,8,%o2
78	bz,pn	%xcc,L(end)
79	nop
80L(loop2):
81	ldx	[%o1-8],%g1
82	add	%o1,-8,%o1
83	addcc	%o2,-1,%o2
84	stx	%g1,[%o0-8]
85	bg,pt	%xcc,L(loop2)
86	add	%o0,-8,%o0
87L(end):	retl
88	nop
89EPILOGUE(mpn_copyd)
90