xref: /netbsd-src/external/lgpl3/gmp/dist/mpn/pa32/hppa2_0/sqr_diagonal.asm (revision d90047b5d07facf36e6c01dcc0bded8997ce9cc2)
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.
6dnl
7dnl  The GNU MP Library is free software; you can redistribute it and/or modify
8dnl  it under the terms of either:
9dnl
10dnl    * the GNU Lesser General Public License as published by the Free
11dnl      Software Foundation; either version 3 of the License, or (at your
12dnl      option) any later version.
13dnl
14dnl  or
15dnl
16dnl    * the GNU General Public License as published by the Free Software
17dnl      Foundation; either version 2 of the License, or (at your option) any
18dnl      later version.
19dnl
20dnl  or both in parallel, as here.
21dnl
22dnl  The GNU MP Library is distributed in the hope that it will be useful, but
23dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
24dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
25dnl  for more details.
26dnl
27dnl  You should have received copies of the GNU General Public License and the
28dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
29dnl  see https://www.gnu.org/licenses/.
30
31include(`../config.m4')
32
33C This code runs at 6 cycles/limb on the PA7100 and 2 cycles/limb on PA8x00.
34C The 2-way unrolling is actually not helping the PA7100.
35
36C INPUT PARAMETERS
37define(`rp',`%r26')
38define(`up',`%r25')
39define(`n',`%r24')
40
41ASM_START()
42PROLOGUE(mpn_sqr_diagonal)
43
44	fldws,ma	4(up),%fr4r
45	addib,=		-1,n,L(end1)
46	ldo		4(rp),rp
47
48	fldws,ma	4(up),%fr6r
49	addib,=		-1,n,L(end2)
50	xmpyu		%fr4r,%fr4r,%fr5
51
52	fldws,ma	4(up),%fr4r
53	addib,=		-1,n,L(end3)
54	xmpyu		%fr6r,%fr6r,%fr7
55
56
57LDEF(loop)
58	fldws,ma	4(up),%fr6r
59	fstws		%fr5r,-4(rp)
60	fstws,ma	%fr5l,8(rp)
61	addib,=		-1,n,L(exite)
62	xmpyu		%fr4r,%fr4r,%fr5
63	fldws,ma	4(up),%fr4r
64	fstws		%fr7r,-4(rp)
65	fstws,ma	%fr7l,8(rp)
66	addib,<>	-1,n,L(loop)
67	xmpyu		%fr6r,%fr6r,%fr7
68
69LDEF(exito)
70	fstws		%fr5r,-4(rp)
71	fstws		%fr5l,0(rp)
72	xmpyu		%fr4r,%fr4r,%fr5
73	fstws		%fr7r,4(rp)
74	fstws		%fr7l,8(rp)
75	fstws,mb	%fr5r,12(rp)
76	bv		0(%r2)
77	fstws		%fr5l,4(rp)
78
79LDEF(exite)
80	fstws		%fr7r,-4(rp)
81	fstws		%fr7l,0(rp)
82	xmpyu		%fr6r,%fr6r,%fr7
83	fstws		%fr5r,4(rp)
84	fstws		%fr5l,8(rp)
85	fstws,mb	%fr7r,12(rp)
86	bv		0(%r2)
87	fstws		%fr7l,4(rp)
88
89LDEF(end1)
90	xmpyu		%fr4r,%fr4r,%fr5
91	fstws		%fr5r,-4(rp)
92	bv		0(%r2)
93	fstws,ma	%fr5l,8(rp)
94
95LDEF(end2)
96	xmpyu		%fr6r,%fr6r,%fr7
97	fstws		%fr5r,-4(rp)
98	fstws		%fr5l,0(rp)
99	fstws		%fr7r,4(rp)
100	bv		0(%r2)
101	fstws		%fr7l,8(rp)
102
103LDEF(end3)
104	fstws		%fr5r,-4(rp)
105	fstws		%fr5l,0(rp)
106	xmpyu		%fr4r,%fr4r,%fr5
107	fstws		%fr7r,4(rp)
108	fstws		%fr7l,8(rp)
109	fstws,mb	%fr5r,12(rp)
110	bv		0(%r2)
111	fstws		%fr5l,4(rp)
112EPILOGUE(mpn_sqr_diagonal)
113