1# VAX __gmpn_addmul_1 -- Multiply a limb vector with a limb and add
2# the result to a second limb vector.
3
4# Copyright 1992, 1994, 1996, 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# size		(sp + 12)
26# s2_limb	(sp + 16)
27
28.text
29	.align 1
30.globl ___gmpn_addmul_1
31___gmpn_addmul_1:
32	.word	0xfc0
33	movl	12(ap),r4
34	movl	8(ap),r8
35	movl	4(ap),r9
36	movl	16(ap),r6
37	jlss	s2_big
38
39	clrl	r3
40	incl	r4
41	ashl	$-1,r4,r7
42	jlbc	r4,L1
43	clrl	r11
44
45# Loop for S2_LIMB < 0x80000000
46Loop1:	movl	(r8)+,r1
47	jlss	L1n0
48	emul	r1,r6,$0,r2
49	addl2	r11,r2
50	adwc	$0,r3
51	addl2	r2,(r9)+
52	adwc	$0,r3
53L1:	movl	(r8)+,r1
54	jlss	L1n1
55L1p1:	emul	r1,r6,$0,r10
56	addl2	r3,r10
57	adwc	$0,r11
58	addl2	r10,(r9)+
59	adwc	$0,r11
60
61	sobgtr	r7,Loop1
62	movl	r11,r0
63	ret
64
65L1n0:	emul	r1,r6,$0,r2
66	addl2	r11,r2
67	adwc	r6,r3
68	addl2	r2,(r9)+
69	adwc	$0,r3
70	movl	(r8)+,r1
71	jgeq	L1p1
72L1n1:	emul	r1,r6,$0,r10
73	addl2	r3,r10
74	adwc	r6,r11
75	addl2	r10,(r9)+
76	adwc	$0,r11
77
78	sobgtr	r7,Loop1
79	movl	r11,r0
80	ret
81
82
83s2_big:	clrl	r3
84	incl	r4
85	ashl	$-1,r4,r7
86	jlbc	r4,L2
87	clrl	r11
88
89# Loop for S2_LIMB >= 0x80000000
90Loop2:	movl	(r8)+,r1
91	jlss	L2n0
92	emul	r1,r6,$0,r2
93	addl2	r11,r2
94	adwc	r1,r3
95	addl2	r2,(r9)+
96	adwc	$0,r3
97L2:	movl	(r8)+,r1
98	jlss	L2n1
99L2p1:	emul	r1,r6,$0,r10
100	addl2	r3,r10
101	adwc	r1,r11
102	addl2	r10,(r9)+
103	adwc	$0,r11
104
105	sobgtr	r7,Loop2
106	movl	r11,r0
107	ret
108
109L2n0:	emul	r1,r6,$0,r2
110	addl2	r11,r2
111	adwc	r6,r3
112	addl2	r2,(r9)+
113	adwc	r1,r3
114	movl	(r8)+,r1
115	jgeq	L2p1
116L2n1:	emul	r1,r6,$0,r10
117	addl2	r3,r10
118	adwc	r6,r11
119	addl2	r10,(r9)+
120	adwc	r1,r11
121
122	sobgtr	r7,Loop2
123	movl	r11,r0
124	ret
125