summaryrefslogtreecommitdiff
path: root/mpn/alpha/ev6/sqr_diagonal.asm
blob: 58d086e624c61f16e66d21b9a187ddb7653182dc (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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
dnl  Alpha mpn_sqr_diagonal.

dnl  Copyright 2001, 2002, 2006 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 3 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.  If not, see http://www.gnu.org/licenses/.

include(`../config.m4')

C      cycles/limb
C EV4:      ?
C EV5:      ?
C EV6:      2.3

C  INPUT PARAMETERS
C  rp	r16
C  up	r17
C  n	r18


ASM_START()
PROLOGUE(mpn_sqr_diagonal)
	lda	r18, -2(r18)	C n -= 2
	ldq	r0,   0(r17)
	mulq	r0, r0, r4
	umulh	r0, r0, r20
	blt	r18, L(ex1)
	ldq	r1,   8(r17)
	mulq	r1, r1, r5
	umulh	r1, r1, r21
	beq	r18, L(ex2)
	lda	r18, -2(r18)	C n -= 2
	ldq	r0,  16(r17)
	blt	r18, L(ex3)
	ldq	r1,  24(r17)
	beq	r18, L(ex4)

	ALIGN(16)
L(top):	lda	r18, -2(r18)	C n -= 2
	stq	r4,   0(r16)
	mulq	r0, r0, r4
	stq	r20,  8(r16)
	umulh	r0, r0, r20
	ldq	r0,  32(r17)
	blt	r18, L(x)
	stq	r5,  16(r16)
	mulq	r1, r1, r5
	stq	r21, 24(r16)
	umulh	r1, r1, r21
	ldq	r1,  40(r17)
	lda	r16, 32(r16)	C rp += 4
	lda	r17, 16(r17)	C up += 2
	bne	r18, L(top)

	ALIGN(16)
L(ex4):	stq	r4,   0(r16)
	mulq	r0, r0, r4
	stq	r20,  8(r16)
	umulh	r0, r0, r20
	stq	r5,  16(r16)
	mulq	r1, r1, r5
	stq	r21, 24(r16)
	umulh	r1, r1, r21
	stq	r4,  32(r16)
	stq	r20, 40(r16)
	stq	r5,  48(r16)
	stq	r21, 56(r16)
	ret	r31, (r26), 1
	ALIGN(16)
L(x):	stq	r5,  16(r16)
	mulq	r1, r1, r5
	stq	r21, 24(r16)
	umulh	r1, r1, r21
	stq	r4,  32(r16)
	mulq	r0, r0, r4
	stq	r20, 40(r16)
	umulh	r0, r0, r20
	stq	r5,  48(r16)
	stq	r21, 56(r16)
	stq	r4,  64(r16)
	stq	r20, 72(r16)
	ret	r31, (r26), 1
L(ex1):	stq	r4,   0(r16)
	stq	r20,  8(r16)
	ret	r31, (r26), 1
	ALIGN(16)
L(ex2):	stq	r4,   0(r16)
	stq	r20,  8(r16)
	stq	r5,  16(r16)
	stq	r21, 24(r16)
	ret	r31, (r26), 1
	ALIGN(16)
L(ex3):	stq	r4,   0(r16)
	mulq	r0, r0, r4
	stq	r20,  8(r16)
	umulh	r0, r0, r20
	stq	r5,  16(r16)
	stq	r21, 24(r16)
	stq	r4,  32(r16)
	stq	r20, 40(r16)
	ret	r31, (r26), 1
EPILOGUE()
ASM_END()