1dnl  PowerPC-64 mpn_sqr_diagonal.
2
3dnl  Copyright 2001, 2002, 2003, 2005, 2006 Free Software Foundation, Inc.
4
5dnl  This file is part of the GNU MP Library.
6
7dnl  The GNU MP Library is free software; you can redistribute it and/or modify
8dnl  it under the terms of the GNU Lesser General Public License as published
9dnl  by the Free Software Foundation; either version 3 of the License, or (at
10dnl  your option) any later version.
11
12dnl  The GNU MP Library is distributed in the hope that it will be useful, but
13dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
15dnl  License for more details.
16
17dnl  You should have received a copy of the GNU Lesser General Public License
18dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
19
20include(`../config.m4')
21
22C		cycles/limb
23C POWER3/PPC630:    18
24C POWER4/PPC970:     8
25
26C INPUT PARAMETERS
27C rp	r3
28C up	r4
29C n	r5
30
31ASM_START()
32PROLOGUE(mpn_sqr_diagonal)
33ifdef(`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
40L(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
49L(end):	mulld	r5, r0, r0
50	mulhdu	r6, r0, r0
51	std	r5, 0(r3)
52	std	r6, 8(r3)
53
54	blr
55EPILOGUE()
56