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