beta-0.89.2
[luatex.git] / source / libs / gmp / gmp-src / mpn / powerpc32 / sqr_diag_addlsh1.asm
blobf7aba33ee59249731a329ef97d84d2f77ec77ea6
1 dnl PowerPC-32 mpn_sqr_diag_addlsh1.
3 dnl Copyright 2013 Free Software Foundation, Inc.
5 dnl This file is part of the GNU MP Library.
6 dnl
7 dnl The GNU MP Library is free software; you can redistribute it and/or modify
8 dnl it under the terms of either:
9 dnl
10 dnl * the GNU Lesser General Public License as published by the Free
11 dnl Software Foundation; either version 3 of the License, or (at your
12 dnl option) any later version.
13 dnl
14 dnl or
15 dnl
16 dnl * the GNU General Public License as published by the Free Software
17 dnl Foundation; either version 2 of the License, or (at your option) any
18 dnl later version.
19 dnl
20 dnl or both in parallel, as here.
21 dnl
22 dnl The GNU MP Library is distributed in the hope that it will be useful, but
23 dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
24 dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
25 dnl for more details.
26 dnl
27 dnl You should have received copies of the GNU General Public License and the
28 dnl GNU Lesser General Public License along with the GNU MP Library. If not,
29 dnl see https://www.gnu.org/licenses/.
31 include(`../config.m4')
33 C cycles/limb
34 C 603e ?
35 C 604e ?
36 C 75x (G3) ?
37 C 7400,7410 (G4) ?
38 C 744x,745x (G4+) 6
39 C power4/ppc970 ?
40 C power5 ?
42 C This has been feebly optimised for 7447 but not for any other CPU.
44 define(`rp', r3)
45 define(`tp', r4)
46 define(`up', r5)
47 define(`n', r6)
49 ASM_START()
50 PROLOGUE(mpn_sqr_diag_addlsh1)
51 addi n, n, -1
52 addi tp, tp, -4
53 mtctr n
54 lwz r0, 0(up)
55 li r10, 0
56 mullw r7, r0, r0
57 stw r7, 0(rp)
58 mulhwu r6, r0, r0
59 addic r31, r31, 0 C clear CF
61 ALIGN(16)
62 L(top): lwzu r0, 4(up)
63 mullw r7, r0, r0
64 lwz r8, 4(tp)
65 lwzu r9, 8(tp)
66 rlwimi r10, r8, 1,0,30
67 srwi r11, r8, 31
68 rlwimi r11, r9, 1,0,30
69 adde r10, r10, r6
70 adde r11, r11, r7
71 stw r10, 4(rp)
72 srwi r10, r9, 31
73 mulhwu r6, r0, r0
74 stwu r11, 8(rp)
75 bdnz L(top)
77 adde r10, r10, r6
78 stw r10, 4(rp)
79 blr
80 EPILOGUE()