xref: /netbsd-src/external/lgpl3/gmp/dist/mpn/mips64/hilo/sqr_diagonal.asm (revision 15a984a0d95c8f96abe9717ee6241762c55dc106)
1dnl  MIPS64 mpn_sqr_diagonal.
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
31
32dnl  INPUT PARAMETERS
33dnl  rp		$4
34dnl  up		$5
35dnl  n		$6
36
37include(`../config.m4')
38
39ASM_START()
40PROLOGUE(mpn_sqr_diagonal)
41	ld	r8,0(r5)
42	daddiu	r6,r6,-2
43	dmultu	r8,r8
44	bltz	r6,$Lend1
45	nop
46	ld	r8,8(r5)
47	beq	r6,r0,$Lend2
48	nop
49
50$Loop:	mflo	r10
51	mfhi	r9
52	daddiu	r6,r6,-1
53	sd	r10,0(r4)
54	sd	r9,8(r4)
55	dmultu	r8,r8
56	ld	r8,16(r5)
57	daddiu	r5,r5,8
58	bne	r6,r0,$Loop
59	daddiu	r4,r4,16
60
61$Lend2: mflo	r10
62	mfhi	r9
63	sd	r10,0(r4)
64	sd	r9,8(r4)
65	dmultu	r8,r8
66	mflo	r10
67	mfhi	r9
68	sd	r10,16(r4)
69	j	r31
70	sd	r9,24(r4)
71
72$Lend1: mflo	r10
73	mfhi	r9
74	sd	r10,0(r4)
75	j	r31
76	sd	r9,8(r4)
77EPILOGUE(mpn_sqr_diagonal)
78