xref: /netbsd-src/external/lgpl3/gmp/dist/mpn/sparc64/ultrasparct1/addlshC_n.asm (revision 212397c69a103ae7e5eafa8731ddfae671d2dee7)
1dnl  SPARC v9 mpn_addlshC_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
20C		   cycles/limb
21C UltraSPARC T1:	21
22C UltraSPARC T2:	 ?
23
24C INPUT PARAMETERS
25define(`rp', `%o0')
26define(`up', `%o1')
27define(`vp', `%o2')
28define(`n',  `%o3')
29define(`cy', `%o4')
30
31ASM_START()
32	REGISTER(%g2,#scratch)
33	REGISTER(%g3,#scratch)
34PROLOGUE(func)
35	mov	0, cy
36	mov	0, %g5
37	cmp	%g0, cy
38L(top):	ldx	[up+0], %o4
39	add	up, 8, up
40	ldx	[vp+0], %o5
41	add	vp, 8, vp
42	add	rp, 8, rp
43
44	sllx	%o5, LSH, %g4
45	add	n, -1, n
46	or	%g5, %g4, %g4
47	srlx	%o5, RSH, %g5
48
49	srlx	%o4, 32, %g1
50	srlx	%g4, 32, %g2
51	addccc	%o4, %g4, %g3
52	addccc	%g1, %g2, %g0
53	brgz	n, L(top)
54	 stx	%g3, [rp-8]
55
56	retl
57	addc	%g5, %g0, %o0
58EPILOGUE()
59