aboutsummaryrefslogtreecommitdiff
path: root/vendor/gmp-6.3.0/mpn/powerpc32/sqr_diag_addlsh1.asm
blob: f7aba33ee59249731a329ef97d84d2f77ec77ea6 (plain) (blame)
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
dnl  PowerPC-32 mpn_sqr_diag_addlsh1.

dnl  Copyright 2013 Free Software Foundation, Inc.

dnl  This file is part of the GNU MP Library.
dnl
dnl  The GNU MP Library is free software; you can redistribute it and/or modify
dnl  it under the terms of either:
dnl
dnl    * the GNU Lesser General Public License as published by the Free
dnl      Software Foundation; either version 3 of the License, or (at your
dnl      option) any later version.
dnl
dnl  or
dnl
dnl    * the GNU General Public License as published by the Free Software
dnl      Foundation; either version 2 of the License, or (at your option) any
dnl      later version.
dnl
dnl  or both in parallel, as here.
dnl
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 General Public License
dnl  for more details.
dnl
dnl  You should have received copies of the GNU General Public License and the
dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
dnl  see https://www.gnu.org/licenses/.

include(`../config.m4')

C                cycles/limb
C 603e			 ?
C 604e			 ?
C 75x (G3)		 ?
C 7400,7410 (G4)	 ?
C 744x,745x (G4+)	 6
C power4/ppc970		 ?
C power5		 ?

C This has been feebly optimised for 7447 but not for any other CPU.

define(`rp',	r3)
define(`tp',	r4)
define(`up',	r5)
define(`n',	r6)

ASM_START()
PROLOGUE(mpn_sqr_diag_addlsh1)
	addi	n, n, -1
	addi	tp, tp, -4
	mtctr	n
	lwz	r0, 0(up)
	li	r10, 0
	mullw	r7, r0, r0
	stw	r7, 0(rp)
	mulhwu	r6, r0, r0
	addic	r31, r31, 0	C clear CF

	ALIGN(16)
L(top):	lwzu	r0, 4(up)
	mullw	r7, r0, r0
	lwz	r8, 4(tp)
	lwzu	r9, 8(tp)
	rlwimi	r10, r8, 1,0,30
	srwi	r11, r8, 31
	rlwimi	r11, r9, 1,0,30
	adde	r10, r10, r6
	adde	r11, r11, r7
	stw	r10, 4(rp)
	srwi	r10, r9, 31
	mulhwu	r6, r0, r0
	stwu	r11, 8(rp)
	bdnz	L(top)

	adde	r10, r10, r6
	stw	r10, 4(rp)
	blr
EPILOGUE()