511a7552c9f01830ebea8b45b9ea9383220541f7
[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
7 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
8 dnl  it under the terms of the GNU Lesser General Public License as published
9 dnl  by the Free Software Foundation; either version 3 of the License, or (at
10 dnl  your option) any later version.
11
12 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
13 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
15 dnl  License for more details.
16
17 dnl  You should have received a copy of the GNU Lesser General Public License
18 dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
19
20
21 dnl  INPUT PARAMETERS
22 dnl  rp         $4
23 dnl  up         $5
24 dnl  n          $6
25
26 include(`../config.m4')
27
28 ASM_START()
29 PROLOGUE(mpn_sqr_diagonal)
30         ld      r8,0(r5)
31         daddiu  r6,r6,-2
32         dmultu  r8,r8
33         bltz    r6,$Lend1
34         nop
35         ld      r8,8(r5)
36         beq     r6,r0,$Lend2
37         nop
38
39 $Loop:  mflo    r10
40         mfhi    r9
41         daddiu  r6,r6,-1
42         sd      r10,0(r4)
43         sd      r9,8(r4)
44         dmultu  r8,r8
45         ld      r8,16(r5)
46         daddiu  r5,r5,8
47         bne     r6,r0,$Loop
48         daddiu  r4,r4,16
49
50 $Lend2: mflo    r10
51         mfhi    r9
52         sd      r10,0(r4)
53         sd      r9,8(r4)
54         dmultu  r8,r8
55         mflo    r10
56         mfhi    r9
57         sd      r10,16(r4)
58         j       r31
59         sd      r9,24(r4)
60
61 $Lend1: mflo    r10
62         mfhi    r9
63         sd      r10,0(r4)
64         j       r31
65         sd      r9,8(r4)
66 EPILOGUE(mpn_sqr_diagonal)