beta-0.89.2
[luatex.git] / source / libs / gmp / gmp-src / mpn / powerpc32 / mul_1.asm
blobe42087cfa8b2bcb9bdd9bea706d741575357c9ad
1 dnl PowerPC-32 mpn_mul_1 -- Multiply a limb vector with a limb and store the
2 dnl result in a second limb vector.
4 dnl Copyright 1995, 1997, 2000, 2002, 2003, 2005 Free Software Foundation,
5 dnl Inc.
7 dnl This file is part of the GNU MP Library.
8 dnl
9 dnl The GNU MP Library is free software; you can redistribute it and/or modify
10 dnl it under the terms of either:
11 dnl
12 dnl * the GNU Lesser General Public License as published by the Free
13 dnl Software Foundation; either version 3 of the License, or (at your
14 dnl option) any later version.
15 dnl
16 dnl or
17 dnl
18 dnl * the GNU General Public License as published by the Free Software
19 dnl Foundation; either version 2 of the License, or (at your option) any
20 dnl later version.
21 dnl
22 dnl or both in parallel, as here.
23 dnl
24 dnl The GNU MP Library is distributed in the hope that it will be useful, but
25 dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
26 dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
27 dnl for more details.
28 dnl
29 dnl You should have received copies of the GNU General Public License and the
30 dnl GNU Lesser General Public License along with the GNU MP Library. If not,
31 dnl see https://www.gnu.org/licenses/.
33 include(`../config.m4')
35 C cycles/limb
36 C 603e: ?
37 C 604e: 4.0
38 C 75x (G3): 4.5-11
39 C 7400,7410 (G4): 4.5-11
40 C 744x,745x (G4+): 6.0
41 C power4/ppc970: 6.0
42 C power5: 5.63
44 C INPUT PARAMETERS
45 C rp r3
46 C up r4
47 C n r5
48 C vl r6
50 ASM_START()
51 PROLOGUE(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
56 C 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)
63 C Software pipelined main loop
64 L(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)
77 C Finish software pipeline
78 L(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
87 L(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
96 L(end3):
97 mullw r11,r8,r6
98 stw r11,4(r3)
99 mulhwu r3,r8,r6
101 EPILOGUE(mpn_mul_1)