dcb87dc21f1361dda15aab77c9801a0504a68241
[platform/upstream/gmp.git] / mpn / mips64 / sqr_diagonal.asm
1 dnl  MIPS64 mpn_sqr_diagonal.
2
3 dnl  Copyright 2001, 2002 Free Software Foundation, Inc.
4
5 dnl  This file is part of the GNU MP Library.
6 dnl
7 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
8 dnl  it under the terms of either:
9 dnl
10 dnl    * the GNU Lesser General Public License as published by the Free
11 dnl      Software Foundation; either version 3 of the License, or (at your
12 dnl      option) any later version.
13 dnl
14 dnl  or
15 dnl
16 dnl    * the GNU General Public License as published by the Free Software
17 dnl      Foundation; either version 2 of the License, or (at your option) any
18 dnl      later version.
19 dnl
20 dnl  or both in parallel, as here.
21 dnl
22 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
23 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
24 dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
25 dnl  for more details.
26 dnl
27 dnl  You should have received copies of the GNU General Public License and the
28 dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
29 dnl  see https://www.gnu.org/licenses/.
30
31
32 dnl  INPUT PARAMETERS
33 dnl  rp         $4
34 dnl  up         $5
35 dnl  n          $6
36
37 include(`../config.m4')
38
39 ASM_START()
40 PROLOGUE(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)
77 EPILOGUE(mpn_sqr_diagonal)