xref: /netbsd-src/external/lgpl3/gmp/dist/mpn/pa32/add_n.asm (revision ce54336801cf28877c3414aa2fcb251dddd543a2)
1dnl  HP-PA mpn_add_n -- Add two limb vectors of the same length > 0 and store
2dnl  sum in a third limb vector.
3
4dnl  Copyright 1992, 1994, 2000-2002 Free Software Foundation, Inc.
5
6dnl  This file is part of the GNU MP Library.
7dnl
8dnl  The GNU MP Library is free software; you can redistribute it and/or modify
9dnl  it under the terms of either:
10dnl
11dnl    * the GNU Lesser General Public License as published by the Free
12dnl      Software Foundation; either version 3 of the License, or (at your
13dnl      option) any later version.
14dnl
15dnl  or
16dnl
17dnl    * the GNU General Public License as published by the Free Software
18dnl      Foundation; either version 2 of the License, or (at your option) any
19dnl      later version.
20dnl
21dnl  or both in parallel, as here.
22dnl
23dnl  The GNU MP Library is distributed in the hope that it will be useful, but
24dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
25dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
26dnl  for more details.
27dnl
28dnl  You should have received copies of the GNU General Public License and the
29dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
30dnl  see https://www.gnu.org/licenses/.
31
32include(`../config.m4')
33
34C INPUT PARAMETERS
35C res_ptr	gr26
36C s1_ptr	gr25
37C s2_ptr	gr24
38C size		gr23
39
40C One might want to unroll this as for other processors, but it turns out that
41C the data cache contention after a store makes such unrolling useless.  We
42C can't come under 5 cycles/limb anyway.
43
44ASM_START()
45PROLOGUE(mpn_add_n)
46	ldws,ma		4(0,%r25),%r20
47	ldws,ma		4(0,%r24),%r19
48
49	addib,=		-1,%r23,L(end)	C check for (SIZE == 1)
50	 add		%r20,%r19,%r28	C add first limbs ignoring cy
51
52LDEF(loop)
53	ldws,ma		4(0,%r25),%r20
54	ldws,ma		4(0,%r24),%r19
55	stws,ma		%r28,4(0,%r26)
56	addib,<>	-1,%r23,L(loop)
57	 addc		%r20,%r19,%r28
58
59LDEF(end)
60	stws		%r28,0(0,%r26)
61	bv		0(%r2)
62	 addc		%r0,%r0,%r28
63EPILOGUE()
64