xref: /netbsd-src/external/lgpl3/gmp/dist/mpn/sparc64/copyd.asm (revision 4391d5e9d4f291db41e3b3ba26a01b5e51364aae)
1dnl  SPARC v9 mpn_copyd -- Copy a limb vector, decrementing.
2
3dnl  Copyright 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
4
5dnl  This file is part of the GNU MP Library.
6
7dnl  The GNU MP Library is free software; you can redistribute it and/or modify
8dnl  it under the terms of the GNU Lesser General Public License as published
9dnl  by the Free Software Foundation; either version 3 of the License, or (at
10dnl  your option) any later version.
11
12dnl  The GNU MP Library is distributed in the hope that it will be useful, but
13dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
15dnl  License for more details.
16
17dnl  You should have received a copy of the GNU Lesser General Public License
18dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
19
20include(`../config.m4')
21
22C		   cycles/limb
23C UltraSPARC 1&2:     2
24C UltraSPARC 3:	      2.5
25
26C INPUT PARAMETERS
27C rptr	%o0
28C sptr	%o1
29C n	%o2
30
31ASM_START()
32	REGISTER(%g2,#scratch)
33	REGISTER(%g3,#scratch)
34PROLOGUE(mpn_copyd)
35	sllx	%o2,3,%g1
36	add	%g1,%o0,%o0
37	add	%g1,%o1,%o1
38	addcc	%o2,-8,%o2
39	bl,pt	%icc,L(end01234567)
40	nop
41L(loop1):
42	ldx	[%o1-8],%g1
43	ldx	[%o1-16],%g2
44	ldx	[%o1-24],%g3
45	ldx	[%o1-32],%g4
46	ldx	[%o1-40],%g5
47	ldx	[%o1-48],%o3
48	ldx	[%o1-56],%o4
49	ldx	[%o1-64],%o5
50	add	%o1,-64,%o1
51	stx	%g1,[%o0-8]
52	stx	%g2,[%o0-16]
53	stx	%g3,[%o0-24]
54	stx	%g4,[%o0-32]
55	stx	%g5,[%o0-40]
56	stx	%o3,[%o0-48]
57	stx	%o4,[%o0-56]
58	stx	%o5,[%o0-64]
59	addcc	%o2,-8,%o2
60	bge,pt	%icc,L(loop1)
61	add	%o0,-64,%o0
62L(end01234567):
63	addcc	%o2,8,%o2
64	bz,pn	%icc,L(end)
65	nop
66L(loop2):
67	ldx	[%o1-8],%g1
68	add	%o1,-8,%o1
69	addcc	%o2,-1,%o2
70	stx	%g1,[%o0-8]
71	bg,pt	%icc,L(loop2)
72	add	%o0,-8,%o0
73L(end):	retl
74	nop
75EPILOGUE(mpn_copyd)
76