xref: /netbsd-src/external/lgpl3/gmp/dist/mpn/pa32/hppa2_0/sqr_diagonal.asm (revision d11b170b9000ada93db553723522a63d5deac310)
1dnl  HP-PA 32-bit mpn_sqr_diagonal optimized for the PA8x00.
2
3dnl  Copyright 2001, 2002 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 This code runs at 6 cycles/limb on the PA7100 and 2 cycles/limb on PA8x00.
23C The 2-way unrolling is actually not helping the PA7100.
24
25C INPUT PARAMETERS
26define(`rp',`%r26')
27define(`up',`%r25')
28define(`n',`%r24')
29
30ASM_START()
31PROLOGUE(mpn_sqr_diagonal)
32
33	fldws,ma	4(up),%fr4r
34	addib,=		-1,n,L(end1)
35	ldo		4(rp),rp
36
37	fldws,ma	4(up),%fr6r
38	addib,=		-1,n,L(end2)
39	xmpyu		%fr4r,%fr4r,%fr5
40
41	fldws,ma	4(up),%fr4r
42	addib,=		-1,n,L(end3)
43	xmpyu		%fr6r,%fr6r,%fr7
44
45
46LDEF(loop)
47	fldws,ma	4(up),%fr6r
48	fstws		%fr5r,-4(rp)
49	fstws,ma	%fr5l,8(rp)
50	addib,=		-1,n,L(exite)
51	xmpyu		%fr4r,%fr4r,%fr5
52	fldws,ma	4(up),%fr4r
53	fstws		%fr7r,-4(rp)
54	fstws,ma	%fr7l,8(rp)
55	addib,<>	-1,n,L(loop)
56	xmpyu		%fr6r,%fr6r,%fr7
57
58LDEF(exito)
59	fstws		%fr5r,-4(rp)
60	fstws		%fr5l,0(rp)
61	xmpyu		%fr4r,%fr4r,%fr5
62	fstws		%fr7r,4(rp)
63	fstws		%fr7l,8(rp)
64	fstws,mb	%fr5r,12(rp)
65	bv		0(%r2)
66	fstws		%fr5l,4(rp)
67
68LDEF(exite)
69	fstws		%fr7r,-4(rp)
70	fstws		%fr7l,0(rp)
71	xmpyu		%fr6r,%fr6r,%fr7
72	fstws		%fr5r,4(rp)
73	fstws		%fr5l,8(rp)
74	fstws,mb	%fr7r,12(rp)
75	bv		0(%r2)
76	fstws		%fr7l,4(rp)
77
78LDEF(end1)
79	xmpyu		%fr4r,%fr4r,%fr5
80	fstws		%fr5r,-4(rp)
81	bv		0(%r2)
82	fstws,ma	%fr5l,8(rp)
83
84LDEF(end2)
85	xmpyu		%fr6r,%fr6r,%fr7
86	fstws		%fr5r,-4(rp)
87	fstws		%fr5l,0(rp)
88	fstws		%fr7r,4(rp)
89	bv		0(%r2)
90	fstws		%fr7l,8(rp)
91
92LDEF(end3)
93	fstws		%fr5r,-4(rp)
94	fstws		%fr5l,0(rp)
95	xmpyu		%fr4r,%fr4r,%fr5
96	fstws		%fr7r,4(rp)
97	fstws		%fr7l,8(rp)
98	fstws,mb	%fr5r,12(rp)
99	bv		0(%r2)
100	fstws		%fr5l,4(rp)
101EPILOGUE(mpn_sqr_diagonal)
102