xref: /netbsd-src/external/lgpl3/gmp/dist/mpn/vax/add_n.asm (revision ce54336801cf28877c3414aa2fcb251dddd543a2)
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.
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
34ASM_START()
35PROLOGUE(mpn_add_n)
36	.word	0x0
37	movl	16(ap), r0
38	movl	12(ap), r1
39	movl	8(ap), r2
40	movl	4(ap), r3
41	mnegl	r0, r5
42	addl2	$3, r0
43	ashl	$-2, r0, r0	C unroll loop count
44	bicl2	$-4, r5		C mask out low 2 bits
45	movaq	(r5)[r5], r5	C 9x
46	jmp	L(top)[r5]
47
48L(top):	movl	(r2)+, r4
49	adwc	(r1)+, r4
50	movl	r4, (r3)+
51	movl	(r2)+, r4
52	adwc	(r1)+, r4
53	movl	r4, (r3)+
54	movl	(r2)+, r4
55	adwc	(r1)+, r4
56	movl	r4, (r3)+
57	movl	(r2)+, r4
58	adwc	(r1)+, r4
59	movl	r4, (r3)+
60	sobgtr	r0, L(top)
61
62	adwc	r0, r0
63	ret
64EPILOGUE()
65