1dnl  VAX mpn_addmul_1 -- Multiply a limb vector with a limb and add the result
2dnl  to a second limb vector.
3
4dnl  Copyright 1992, 1994, 1996, 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_addmul_1)
36	.word	0xfc0
37	movl	12(ap), r4
38	movl	8(ap), r8
39	movl	4(ap), r9
40	clrl	r3
41	incl	r4
42	ashl	$-1, r4, r7
43	clrl	r11
44	movl	16(ap), r6
45	jlss	L(v0_big)
46	jlbc	r4, L(1)
47
48C Loop for v0 < 0x80000000
49L(tp1):	movl	(r8)+, r1
50	jlss	L(1n0)
51	emul	r1, r6, $0, r2
52	addl2	r11, r2
53	adwc	$0, r3
54	addl2	r2, (r9)+
55	adwc	$0, r3
56L(1):	movl	(r8)+, r1
57	jlss	L(1n1)
58L(1p1):	emul	r1, r6, $0, r10
59	addl2	r3, r10
60	adwc	$0, r11
61	addl2	r10, (r9)+
62	adwc	$0, r11
63
64	sobgtr	r7, L(tp1)
65	movl	r11, r0
66	ret
67
68L(1n0):	emul	r1, r6, $0, r2
69	addl2	r11, r2
70	adwc	r6, r3
71	addl2	r2, (r9)+
72	adwc	$0, r3
73	movl	(r8)+, r1
74	jgeq	L(1p1)
75L(1n1):	emul	r1, r6, $0, r10
76	addl2	r3, r10
77	adwc	r6, r11
78	addl2	r10, (r9)+
79	adwc	$0, r11
80
81	sobgtr	r7, L(tp1)
82	movl	r11, r0
83	ret
84
85L(v0_big):
86	jlbc	r4, L(2)
87
88C Loop for v0 >= 0x80000000
89L(tp2):	movl	(r8)+, r1
90	jlss	L(2n0)
91	emul	r1, r6, $0, r2
92	addl2	r11, r2
93	adwc	r1, r3
94	addl2	r2, (r9)+
95	adwc	$0, r3
96L(2):	movl	(r8)+, r1
97	jlss	L(2n1)
98L(2p1):	emul	r1, r6, $0, r10
99	addl2	r3, r10
100	adwc	r1, r11
101	addl2	r10, (r9)+
102	adwc	$0, r11
103
104	sobgtr	r7, L(tp2)
105	movl	r11, r0
106	ret
107
108L(2n0):	emul	r1, r6, $0, r2
109	addl2	r11, r2
110	adwc	r6, r3
111	addl2	r2, (r9)+
112	adwc	r1, r3
113	movl	(r8)+, r1
114	jgeq	L(2p1)
115L(2n1):	emul	r1, r6, $0, r10
116	addl2	r3, r10
117	adwc	r6, r11
118	addl2	r10, (r9)+
119	adwc	r1, r11
120
121	sobgtr	r7, L(tp2)
122	movl	r11, r0
123	ret
124EPILOGUE()
125