1dnl  PowerPC-64 mpn_mul_1 -- Multiply a limb vector with a limb and add
2dnl  the result to a second limb vector.
3
4dnl  Copyright 1999, 2000, 2001, 2003, 2005 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
23C		cycles/limb
24C POWER3/PPC630:     ?
25C POWER4/PPC970:     10
26
27C INPUT PARAMETERS
28C rp	r3
29C up	r4
30C n	r5
31C v	r6,r7  or  r7,r8
32
33ASM_START()
34PROLOGUE(mpn_mul_1)
35
36ifdef(`BROKEN_LONGLONG_PARAM',
37`	rldimi	r8, r7, 32,0	C assemble vlimb from separate 32-bit arguments
38	mr	r6, r8
39',`
40	rldimi	r7, r6, 32,0	C assemble vlimb from separate 32-bit arguments
41	mr	r6, r7
42')
43	li	r7, 0		C cy_limb = 0
44	mtctr	r5
45	addic	r0, r0, 0
46	addi	r3, r3, -8
47	addi	r4, r4, -8
48
49L(oop):	ldu	r0, 8(r4)
50	mulld	r9, r0, r6
51	adde	r12, r9, r7	C add old high limb and new low limb
52	srdi	r5, r9, 32
53	srdi	r11, r7, 32
54	adde	r5, r5, r11	C add high limb parts, set cy
55	mulhdu	r7, r0, r6
56	stdu	r12, 8(r3)
57	bdnz	L(oop)
58
59	addze	r4, r7
60	srdi	r3, r4, 32
61	blr
62EPILOGUE()
63