xref: /netbsd-src/external/lgpl3/gmp/dist/mpn/sparc64/ultrasparct1/add_n.asm (revision 19ef5b5b0bcb90f63509df6e78769de1b57c2758)
1dnl  SPARC v9 mpn_add_n for T1/T2.
2
3dnl  Copyright 2010 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 T1:	 ?
24C UltraSPARC T2:	 ?
25
26C INPUT PARAMETERS
27define(`rp', `%o0')
28define(`up', `%o1')
29define(`vp', `%o2')
30define(`n',  `%o3')
31define(`cy', `%o4')
32
33ASM_START()
34	REGISTER(%g2,#scratch)
35	REGISTER(%g3,#scratch)
36PROLOGUE(mpn_add_nc)
37	b,a	L(ent)
38EPILOGUE()
39PROLOGUE(mpn_add_n)
40	mov	0, cy
41L(ent):	cmp	%g0, cy
42L(top):	ldx	[up+0], %o4
43	add	up, 8, up
44	ldx	[vp+0], %o5
45	add	vp, 8, vp
46	add	rp, 8, rp
47	add	n, -1, n
48	srlx	%o4, 32, %g1
49	srlx	%o5, 32, %g2
50	addccc	%o4, %o5, %g3
51	addccc	%g1, %g2, %g0
52	brgz	n, L(top)
53	 stx	%g3, [rp-8]
54
55	retl
56	addc	%g0, %g0, %o0
57EPILOGUE()
58