1/* hppa add_n -- Add two limb vectors of the same length > 0 and store
2 *		 sum in a third limb vector.
3 *
4 *      Copyright (C) 1992, 1994, 1998,
5 *                    2001, 2002 Fee Software Foundation, Inc.
6 *
7 * This file is part of Libgcrypt.
8 *
9 * Libgcrypt is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU Lesser General Public License as
11 * published by the Free Software Foundation; either version 2.1 of
12 * the License, or (at your option) any later version.
13 *
14 * Libgcrypt is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 * GNU Lesser General Public License for more details.
18 *
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
22 *
23 * Note: This code is heavily based on the GNU MP Library.
24 *	 Actually it's the same code with only minor changes in the
25 *	 way the data is stored; this is to support the abstraction
26 *	 of an optional secure memory allocation which may be used
27 *	 to avoid revealing of sensitive data due to paging etc.
28 */
29
30
31
32/*******************
33 *  mpi_limb_t
34 *  _gcry_mpih_add_n( mpi_ptr_t res_ptr,	(gr26)
35 *		   mpi_ptr_t s1_ptr,	(gr25)
36 *		   mpi_ptr_t s2_ptr,	(gr24)
37 *		   mpi_size_t size)	(gr23)
38 *
39 * One might want to unroll this as for other processors, but it turns
40 * out that the data cache contention after a store makes such
41 * unrolling useless.  We can't come under 5 cycles/limb anyway.
42 */
43
44	.code
45	.export 	_gcry_mpih_add_n
46	.label		_gcry_mpih_add_n
47	.proc
48	.callinfo	frame=0,no_calls
49	.entry
50
51	ldws,ma 	4(0,%r25),%r20
52	ldws,ma 	4(0,%r24),%r19
53
54	addib,= 	-1,%r23,L$end	; check for (SIZE == 1)
55	 add		%r20,%r19,%r28	; add first limbs ignoring cy
56
57	.label L$loop
58	ldws,ma 	4(0,%r25),%r20
59	ldws,ma 	4(0,%r24),%r19
60	stws,ma 	%r28,4(0,%r26)
61	addib,<>	-1,%r23,L$loop
62	 addc		%r20,%r19,%r28
63
64	.label L$end
65	stws		%r28,0(0,%r26)
66	bv		0(%r2)
67	 addc		%r0,%r0,%r28
68
69	.exit
70	.procend
71