xref: /netbsd-src/external/lgpl3/gmp/dist/mpn/vax/mul_1.asm (revision fa28c6faa16e0b00edee7acdcaf4899797043def)
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.
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_mul_1)
25	.word	0xfc0
26	movl	12(ap), r4
27	movl	8(ap), r8
28	movl	4(ap), r9
29	clrl	r3
30	incl	r4
31	ashl	$-1, r4, r7
32	clrl	r11
33	movl	16(ap), r6
34	jlss	L(v0_big)
35	jlbc	r4, L(1)
36
37C Loop for v0 < 0x80000000
38L(tp1):	movl	(r8)+, r1
39	jlss	L(1n0)
40	emul	r1, r6, $0, r2
41	addl2	r11, r2
42	adwc	$0, r3
43	movl	r2, (r9)+
44L(1):	movl	(r8)+, r1
45	jlss	L(1n1)
46L(1p1):	emul	r1, r6, $0, r10
47	addl2	r3, r10
48	adwc	$0, r11
49	movl	r10, (r9)+
50
51	sobgtr	r7, L(tp1)
52	movl	r11, r0
53	ret
54
55L(1n0):	emul	r1, r6, $0, r2
56	addl2	r11, r2
57	adwc	r6, r3
58	movl	r2, (r9)+
59	movl	(r8)+, r1
60	jgeq	L(1p1)
61L(1n1):	emul	r1, r6, $0, r10
62	addl2	r3, r10
63	adwc	r6, r11
64	movl	r10, (r9)+
65
66	sobgtr	r7, L(tp1)
67	movl	r11, r0
68	ret
69
70L(v0_big):
71	jlbc	r4, L(2)
72
73C Loop for v0 >= 0x80000000
74L(tp2):	movl	(r8)+, r1
75	jlss	L(2n0)
76	emul	r1, r6, $0, r2
77	addl2	r11, r2
78	adwc	r1, r3
79	movl	r2, (r9)+
80L(2):	movl	(r8)+, r1
81	jlss	L(2n1)
82L(2p1):	emul	r1, r6, $0, r10
83	addl2	r3, r10
84	adwc	r1, r11
85	movl	r10, (r9)+
86
87	sobgtr	r7, L(tp2)
88	movl	r11, r0
89	ret
90
91L(2n0):	emul	r1, r6, $0, r2
92	addl2	r1, r3
93	addl2	r11, r2
94	adwc	r6, r3
95	movl	r2, (r9)+
96	movl	(r8)+, r1
97	jgeq	L(2p1)
98L(2n1):	emul	r1, r6, $0, r10
99	addl2	r1, r11
100	addl2	r3, r10
101	adwc	r6, r11
102	movl	r10, (r9)+
103
104	sobgtr	r7, L(tp2)
105	movl	r11, r0
106	ret
107EPILOGUE()
108