Tizen 2.1 base
[external/gmp.git] / mpn / powerpc64 / sqr_diagonal.asm
1 dnl  PowerPC-64 mpn_sqr_diagonal.
2
3 dnl  Copyright 2001, 2002, 2003, 2005, 2006 Free Software Foundation, Inc.
4
5 dnl  This file is part of the GNU MP Library.
6
7 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
8 dnl  it under the terms of the GNU Lesser General Public License as published
9 dnl  by the Free Software Foundation; either version 3 of the License, or (at
10 dnl  your option) any later version.
11
12 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
13 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
15 dnl  License for more details.
16
17 dnl  You should have received a copy of the GNU Lesser General Public License
18 dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
19
20 include(`../config.m4')
21
22 C               cycles/limb
23 C POWER3/PPC630:    18
24 C POWER4/PPC970:     8
25
26 C INPUT PARAMETERS
27 C rp    r3
28 C up    r4
29 C n     r5
30
31 ASM_START()
32 PROLOGUE(mpn_sqr_diagonal)
33 ifdef(`HAVE_ABI_mode32',
34 `       rldicl  r5, r5, 0, 32')         C zero extend n
35         mtctr   r5
36         ld      r0, 0(r4)
37         bdz     L(end)
38         ALIGN(16)
39
40 L(top): mulld   r5, r0, r0
41         mulhdu  r6, r0, r0
42         ld      r0, 8(r4)
43         addi    r4, r4, 8
44         std     r5, 0(r3)
45         std     r6, 8(r3)
46         addi    r3, r3, 16
47         bdnz    L(top)
48
49 L(end): mulld   r5, r0, r0
50         mulhdu  r6, r0, r0
51         std     r5, 0(r3)
52         std     r6, 8(r3)
53
54         blr
55 EPILOGUE()