xref: /netbsd-src/external/lgpl3/gmp/dist/mpn/sparc32/ultrasparct1/addmul_1.asm (revision e89934bbf778a6d6d6894877c4da59d0c7835b0f)
1dnl  SPARC T1 32-bit mpn_addmul_1.
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:       27
24
25C INPUT PARAMETERS
26define(`rp',	`%o0')
27define(`up',	`%o1')
28define(`n',	`%o2')
29define(`v0',	`%o3')
30
31ASM_START()
32PROLOGUE(mpn_addmul_1)
33	mov	0, %g4
34	srl	v0, 0, v0
35	srl	n, 0, n
36	dec	n			C n--
37
38L(top):	lduw	[up+0], %g1
39	add	up, 4, up		C up++
40	mulx	%g1, v0, %g3
41	lduw	[rp+0], %g2
42	add	%g2, %g3, %g3
43	add	%g4, %g3, %g3
44	stw	%g3, [rp+0]
45	add	rp, 4, rp		C rp++
46	srlx	%g3, 32, %g4
47	brnz	n, L(top)
48	dec	n			C n--
49
50	retl
51	mov	%g4, %o0		C return value
52EPILOGUE()
53