1dnl  VAX mpn_mul_1 -- Multiply a limb vector with a limb and store the result
2dnl  in 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_mul_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	movl	r2, (r9)+
55L(1):	movl	(r8)+, r1
56	jlss	L(1n1)
57L(1p1):	emul	r1, r6, $0, r10
58	addl2	r3, r10
59	adwc	$0, r11
60	movl	r10, (r9)+
61
62	sobgtr	r7, L(tp1)
63	movl	r11, r0
64	ret
65
66L(1n0):	emul	r1, r6, $0, r2
67	addl2	r11, r2
68	adwc	r6, r3
69	movl	r2, (r9)+
70	movl	(r8)+, r1
71	jgeq	L(1p1)
72L(1n1):	emul	r1, r6, $0, r10
73	addl2	r3, r10
74	adwc	r6, r11
75	movl	r10, (r9)+
76
77	sobgtr	r7, L(tp1)
78	movl	r11, r0
79	ret
80
81L(v0_big):
82	jlbc	r4, L(2)
83
84C Loop for v0 >= 0x80000000
85L(tp2):	movl	(r8)+, r1
86	jlss	L(2n0)
87	emul	r1, r6, $0, r2
88	addl2	r11, r2
89	adwc	r1, r3
90	movl	r2, (r9)+
91L(2):	movl	(r8)+, r1
92	jlss	L(2n1)
93L(2p1):	emul	r1, r6, $0, r10
94	addl2	r3, r10
95	adwc	r1, r11
96	movl	r10, (r9)+
97
98	sobgtr	r7, L(tp2)
99	movl	r11, r0
100	ret
101
102L(2n0):	emul	r1, r6, $0, r2
103	addl2	r1, r3
104	addl2	r11, r2
105	adwc	r6, r3
106	movl	r2, (r9)+
107	movl	(r8)+, r1
108	jgeq	L(2p1)
109L(2n1):	emul	r1, r6, $0, r10
110	addl2	r1, r11
111	addl2	r3, r10
112	adwc	r6, r11
113	movl	r10, (r9)+
114
115	sobgtr	r7, L(tp2)
116	movl	r11, r0
117	ret
118EPILOGUE()
119