1dnl  PowerPC-32 mpn_mul_1 -- Multiply a limb vector with a limb and store the
2dnl  result in a second limb vector.
3
4dnl  Copyright 1995, 1997, 2000, 2002, 2003, 2005 Free Software Foundation,
5dnl  Inc.
6
7dnl  This file is part of the GNU MP Library.
8dnl
9dnl  The GNU MP Library is free software; you can redistribute it and/or modify
10dnl  it under the terms of either:
11dnl
12dnl    * the GNU Lesser General Public License as published by the Free
13dnl      Software Foundation; either version 3 of the License, or (at your
14dnl      option) any later version.
15dnl
16dnl  or
17dnl
18dnl    * the GNU General Public License as published by the Free Software
19dnl      Foundation; either version 2 of the License, or (at your option) any
20dnl      later version.
21dnl
22dnl  or both in parallel, as here.
23dnl
24dnl  The GNU MP Library is distributed in the hope that it will be useful, but
25dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
26dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
27dnl  for more details.
28dnl
29dnl  You should have received copies of the GNU General Public License and the
30dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
31dnl  see https://www.gnu.org/licenses/.
32
33include(`../config.m4')
34
35C                cycles/limb
36C 603e:            ?
37C 604e:            4.0
38C 75x (G3):        4.5-11
39C 7400,7410 (G4):  4.5-11
40C 744x,745x (G4+): 6.0
41C power4/ppc970:   6.0
42C power5:          5.63
43
44C INPUT PARAMETERS
45C rp	r3
46C up	r4
47C n	r5
48C vl	r6
49
50ASM_START()
51PROLOGUE(mpn_mul_1)
52	mtctr	r5
53	addi	r3,r3,-4	C adjust res_ptr, it's offset before it's used
54	li	r12,0		C clear upper product reg
55	addic	r0,r0,0		C clear cy
56C Start software pipeline
57	lwz	r8,0(r4)
58	bdz	L(end3)
59	lwzu	r9,4(r4)
60	mullw	r11,r8,r6
61	mulhwu	r0,r8,r6
62	bdz	L(end1)
63C Software pipelined main loop
64L(loop):
65	lwz	r8,4(r4)
66	mullw	r10,r9,r6
67	adde	r5,r11,r12
68	mulhwu	r12,r9,r6
69	stw	r5,4(r3)
70	bdz	L(end2)
71	lwzu	r9,8(r4)
72	mullw	r11,r8,r6
73	adde	r7,r10,r0
74	mulhwu	r0,r8,r6
75	stwu	r7,8(r3)
76	bdnz	L(loop)
77C Finish software pipeline
78L(end1):
79	mullw	r10,r9,r6
80	adde	r5,r11,r12
81	mulhwu	r12,r9,r6
82	stw	r5,4(r3)
83	adde	r7,r10,r0
84	stwu	r7,8(r3)
85	addze	r3,r12
86	blr
87L(end2):
88	mullw	r11,r8,r6
89	adde	r7,r10,r0
90	mulhwu	r0,r8,r6
91	stwu	r7,8(r3)
92	adde	r5,r11,r12
93	stw	r5,4(r3)
94	addze	r3,r0
95	blr
96L(end3):
97	mullw	r11,r8,r6
98	stw	r11,4(r3)
99	mulhwu	r3,r8,r6
100	blr
101EPILOGUE(mpn_mul_1)
102