summaryrefslogtreecommitdiff
path: root/mpn/powerpc64/sqr_diagonal.asm
blob: 0e9481fc3b4d75ef0f4768c1e07f12db474e142a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
dnl  PowerPC-64 mpn_sqr_diagonal.

dnl  Copyright 2001, 2002, 2003, 2005 Free Software Foundation, Inc.

dnl  This file is part of the GNU MP Library.

dnl  The GNU MP Library is free software; you can redistribute it and/or modify
dnl  it under the terms of the GNU Lesser General Public License as published
dnl  by the Free Software Foundation; either version 2.1 of the License, or (at
dnl  your option) any later version.

dnl  The GNU MP Library is distributed in the hope that it will be useful, but
dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
dnl  License for more details.

dnl  You should have received a copy of the GNU Lesser General Public License
dnl  along with the GNU MP Library; see the file COPYING.LIB.  If not, write to
dnl  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
dnl  MA 02110-1301, USA.

include(`../config.m4')

C		cycles/limb
C POWER3/PPC630:    18
C POWER4/PPC970:     8

C INPUT PARAMETERS
C rp	r3
C up	r4
C n	r5

ASM_START()
PROLOGUE(mpn_sqr_diagonal)
ifdef(`HAVE_ABI_mode32',
`	rldicl	r5, r5, 0, 32')		C zero extend n
	mtctr	r5
	ld	r0, 0(r4)
	bdz	L(end)
	ALIGN(16)

L(top):	mulld	r5, r0, r0
	mulhdu	r6, r0, r0
	ld	r0, 8(r4)
	addi	r4, r4, 8
	std	r5, 0(r3)
	std	r6, 8(r3)
	addi	r3, r3, 16
	bdnz	L(top)

L(end):	mulld	r5, r0, r0
	mulhdu	r6, r0, r0
	std	r5, 0(r3)
	std	r6, 8(r3)

	blr
EPILOGUE()