1# VAX __gmpn_add_n -- Add two limb vectors of the same length > 0 and store
2# sum in a third limb vector.
3
4# Copyright 1999, 2000 Free Software Foundation, Inc.
5
6# This file is part of the GNU MP Library.
7
8# The GNU MP Library is free software; you can redistribute it and/or modify
9# it under the terms of the GNU Lesser General Public License as published by
10# the Free Software Foundation; either version 3 of the License, or (at your
11# option) any later version.
12
13# The GNU MP Library is distributed in the hope that it will be useful, but
14# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15# or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
16# License for more details.
17
18# You should have received a copy of the GNU Lesser General Public License
19# along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
20
21
22# INPUT PARAMETERS
23# res_ptr	(sp + 4)
24# s1_ptr	(sp + 8)
25# s2_ptr	(sp + 12)
26# size		(sp + 16)
27
28.text
29	.align 1
30.globl ___gmpn_add_n
31___gmpn_add_n:
32	.word	0x0
33	movl	16(ap),r0
34	movl	12(ap),r1
35	movl	8(ap),r2
36	movl	4(ap),r3
37	mnegl	r0,r5
38	addl2	$3,r0
39	ashl	$-2,r0,r0	# unroll loop count
40	bicl2	$-4,r5		# mask out low 2 bits
41	movaq	(r5)[r5],r5	# 9x
42	jmp	Loop(r5)
43
44Loop:	movl	(r2)+,r4
45	adwc	(r1)+,r4
46	movl	r4,(r3)+
47	movl	(r2)+,r4
48	adwc	(r1)+,r4
49	movl	r4,(r3)+
50	movl	(r2)+,r4
51	adwc	(r1)+,r4
52	movl	r4,(r3)+
53	movl	(r2)+,r4
54	adwc	(r1)+,r4
55	movl	r4,(r3)+
56	sobgtr	r0,Loop
57
58	adwc	r0,r0
59	ret
60