Tizen 2.1 base
[external/gmp.git] / mpn / pa32 / hppa2_0 / sqr_diagonal.asm
1 dnl  HP-PA 32-bit mpn_sqr_diagonal optimized for the PA8x00.
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 include(`../config.m4')
21
22 C This code runs at 6 cycles/limb on the PA7100 and 2 cycles/limb on PA8x00.
23 C The 2-way unrolling is actually not helping the PA7100.
24
25 C INPUT PARAMETERS
26 define(`rp',`%r26')
27 define(`up',`%r25')
28 define(`n',`%r24')
29
30 ASM_START()
31 PROLOGUE(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
46 LDEF(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
58 LDEF(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
68 LDEF(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
78 LDEF(end1)
79         xmpyu           %fr4r,%fr4r,%fr5
80         fstws           %fr5r,-4(rp)
81         bv              0(%r2)
82         fstws,ma        %fr5l,8(rp)
83
84 LDEF(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
92 LDEF(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)
101 EPILOGUE(mpn_sqr_diagonal)