1; mc88110 __gmpn_mul_1 -- Multiply a limb vector with a single limb and
2; store the product in a second limb vector.
3
4; Copyright 1992, 1994, 1995, 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	r2
24; s1_ptr	r3
25; size		r4
26; s2_limb	r5
27
28	text
29	align	16
30	global	___gmpn_mul_1
31___gmpn_mul_1:
32	; Make S1_PTR and RES_PTR point at the end of their blocks
33	; and negate SIZE.
34	lda	 r3,r3[r4]
35	lda	 r8,r2[r4]		; RES_PTR in r8 since r2 is retval
36	subu	 r4,r0,r4
37
38	addu.co	 r2,r0,r0		; r2 = cy = 0
39
40	ld	 r6,r3[r4]
41	addu	 r4,r4,1
42	mulu.d	 r10,r6,r5
43	bcnd.n	 eq0,r4,Lend
44	 subu	 r8,r8,8
45
46Loop:	ld	 r6,r3[r4]
47	addu.cio r9,r11,r2
48	or	 r2,r10,r0		; could be avoided if unrolled
49	addu	 r4,r4,1
50	mulu.d	 r10,r6,r5
51	bcnd.n	 ne0,r4,Loop
52	 st	 r9,r8[r4]
53
54Lend:	addu.cio r9,r11,r2
55	st	 r9,r8,4
56	jmp.n	 r1
57	 addu.ci r2,r10,r0
58