1dnl  HP-PA 2.0 32-bit mpn_add_n -- Add two limb vectors of the same length > 0
2dnl  and store sum in a third limb vector.
3
4dnl  Copyright 1997, 1998, 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 This runs at 2 cycles/limb on PA8000.
41
42ASM_START()
43PROLOGUE(mpn_add_n)
44	sub		%r0,%r23,%r22
45	zdep		%r22,30,3,%r28		C r28 = 2 * (-n & 7)
46	zdep		%r22,29,3,%r22		C r22 = 4 * (-n & 7)
47	sub		%r25,%r22,%r25		C offset s1_ptr
48	sub		%r24,%r22,%r24		C offset s2_ptr
49	sub		%r26,%r22,%r26		C offset res_ptr
50	blr		%r28,%r0		C branch into loop
51	add		%r0,%r0,%r0		C reset carry
52
53LDEF(loop)
54	ldw		0(%r25),%r20
55	ldw		0(%r24),%r31
56	addc		%r20,%r31,%r20
57	stw		%r20,0(%r26)
58
59LDEF(7)
60	ldw		4(%r25),%r21
61	ldw		4(%r24),%r19
62	addc		%r21,%r19,%r21
63	stw		%r21,4(%r26)
64
65LDEF(6)
66	ldw		8(%r25),%r20
67	ldw		8(%r24),%r31
68	addc		%r20,%r31,%r20
69	stw		%r20,8(%r26)
70
71LDEF(5)
72	ldw		12(%r25),%r21
73	ldw		12(%r24),%r19
74	addc		%r21,%r19,%r21
75	stw		%r21,12(%r26)
76
77LDEF(4)
78	ldw		16(%r25),%r20
79	ldw		16(%r24),%r31
80	addc		%r20,%r31,%r20
81	stw		%r20,16(%r26)
82
83LDEF(3)
84	ldw		20(%r25),%r21
85	ldw		20(%r24),%r19
86	addc		%r21,%r19,%r21
87	stw		%r21,20(%r26)
88
89LDEF(2)
90	ldw		24(%r25),%r20
91	ldw		24(%r24),%r31
92	addc		%r20,%r31,%r20
93	stw		%r20,24(%r26)
94
95LDEF(1)
96	ldw		28(%r25),%r21
97	ldo		32(%r25),%r25
98	ldw		28(%r24),%r19
99	addc		%r21,%r19,%r21
100	stw		%r21,28(%r26)
101	ldo		32(%r24),%r24
102	addib,>		-8,%r23,L(loop)
103	ldo		32(%r26),%r26
104
105	bv		(%r2)
106	addc		%r0,%r0,%r28
107EPILOGUE()
108