1dnl  MIPS64 mpn_mul_1 -- Multiply a limb vector with a single limb and store
2dnl  the product in a second limb vector.
3
4dnl  Copyright 1992, 1994, 1995, 2000, 2001, 2002 Free Software Foundation,
5dnl  Inc.
6
7dnl  This file is part of the GNU MP Library.
8
9dnl  The GNU MP Library is free software; you can redistribute it and/or modify
10dnl  it under the terms of the GNU Lesser General Public License as published
11dnl  by the Free Software Foundation; either version 3 of the License, or (at
12dnl  your option) any later version.
13
14dnl  The GNU MP Library is distributed in the hope that it will be useful, but
15dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
16dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
17dnl  License for more details.
18
19dnl  You should have received a copy of the GNU Lesser General Public License
20dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
21
22include(`../config.m4')
23
24C INPUT PARAMETERS
25C res_ptr	$4
26C s1_ptr	$5
27C size		$6
28C s2_limb	$7
29
30ASM_START()
31PROLOGUE(mpn_mul_1)
32
33C feed-in phase 0
34	ld	$8,0($5)
35
36C feed-in phase 1
37	daddiu	$5,$5,8
38	dmultu	$8,$7
39
40	daddiu	$6,$6,-1
41	beq	$6,$0,$LC0
42	 move	$2,$0		C zero cy2
43
44	daddiu	$6,$6,-1
45	beq	$6,$0,$LC1
46	ld	$8,0($5)	C load new s1 limb as early as possible
47
48Loop:	nop
49	mflo	$10
50	mfhi	$9
51	daddiu	$5,$5,8
52	daddu	$10,$10,$2	C add old carry limb to low product limb
53	dmultu	$8,$7
54	ld	$8,0($5)	C load new s1 limb as early as possible
55	daddiu	$6,$6,-1	C decrement loop counter
56	sltu	$2,$10,$2	C carry from previous addition -> $2
57	nop
58	nop
59	sd	$10,0($4)
60	daddiu	$4,$4,8
61	bne	$6,$0,Loop
62	 daddu	$2,$9,$2	C add high product limb and carry from addition
63
64C wind-down phase 1
65$LC1:	mflo	$10
66	mfhi	$9
67	daddu	$10,$10,$2
68	sltu	$2,$10,$2
69	dmultu	$8,$7
70	sd	$10,0($4)
71	daddiu	$4,$4,8
72	daddu	$2,$9,$2	C add high product limb and carry from addition
73
74C wind-down phase 0
75$LC0:	mflo	$10
76	mfhi	$9
77	daddu	$10,$10,$2
78	sltu	$2,$10,$2
79	sd	$10,0($4)
80	j	$31
81	daddu	$2,$9,$2	C add high product limb and carry from addition
82EPILOGUE(mpn_mul_1)
83