Upload Tizen:Base source
[external/gmp.git] / mpn / alpha / ev6 / sqr_diagonal.asm
1 dnl  Alpha mpn_sqr_diagonal.
2
3 dnl  Copyright 2001, 2002, 2006 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      cycles/limb
23 C EV4:      ?
24 C EV5:      ?
25 C EV6:      2.3
26
27 C  INPUT PARAMETERS
28 C  rp   r16
29 C  up   r17
30 C  n    r18
31
32
33 ASM_START()
34 PROLOGUE(mpn_sqr_diagonal)
35         lda     r18, -2(r18)    C n -= 2
36         ldq     r0,   0(r17)
37         mulq    r0, r0, r4
38         umulh   r0, r0, r20
39         blt     r18, L(ex1)
40         ldq     r1,   8(r17)
41         mulq    r1, r1, r5
42         umulh   r1, r1, r21
43         beq     r18, L(ex2)
44         lda     r18, -2(r18)    C n -= 2
45         ldq     r0,  16(r17)
46         blt     r18, L(ex3)
47         ldq     r1,  24(r17)
48         beq     r18, L(ex4)
49
50         ALIGN(16)
51 L(top): lda     r18, -2(r18)    C n -= 2
52         stq     r4,   0(r16)
53         mulq    r0, r0, r4
54         stq     r20,  8(r16)
55         umulh   r0, r0, r20
56         ldq     r0,  32(r17)
57         blt     r18, L(x)
58         stq     r5,  16(r16)
59         mulq    r1, r1, r5
60         stq     r21, 24(r16)
61         umulh   r1, r1, r21
62         ldq     r1,  40(r17)
63         lda     r16, 32(r16)    C rp += 4
64         lda     r17, 16(r17)    C up += 2
65         bne     r18, L(top)
66
67         ALIGN(16)
68 L(ex4): stq     r4,   0(r16)
69         mulq    r0, r0, r4
70         stq     r20,  8(r16)
71         umulh   r0, r0, r20
72         stq     r5,  16(r16)
73         mulq    r1, r1, r5
74         stq     r21, 24(r16)
75         umulh   r1, r1, r21
76         stq     r4,  32(r16)
77         stq     r20, 40(r16)
78         stq     r5,  48(r16)
79         stq     r21, 56(r16)
80         ret     r31, (r26), 1
81         ALIGN(16)
82 L(x):   stq     r5,  16(r16)
83         mulq    r1, r1, r5
84         stq     r21, 24(r16)
85         umulh   r1, r1, r21
86         stq     r4,  32(r16)
87         mulq    r0, r0, r4
88         stq     r20, 40(r16)
89         umulh   r0, r0, r20
90         stq     r5,  48(r16)
91         stq     r21, 56(r16)
92         stq     r4,  64(r16)
93         stq     r20, 72(r16)
94         ret     r31, (r26), 1
95 L(ex1): stq     r4,   0(r16)
96         stq     r20,  8(r16)
97         ret     r31, (r26), 1
98         ALIGN(16)
99 L(ex2): stq     r4,   0(r16)
100         stq     r20,  8(r16)
101         stq     r5,  16(r16)
102         stq     r21, 24(r16)
103         ret     r31, (r26), 1
104         ALIGN(16)
105 L(ex3): stq     r4,   0(r16)
106         mulq    r0, r0, r4
107         stq     r20,  8(r16)
108         umulh   r0, r0, r20
109         stq     r5,  16(r16)
110         stq     r21, 24(r16)
111         stq     r4,  32(r16)
112         stq     r20, 40(r16)
113         ret     r31, (r26), 1
114 EPILOGUE()
115 ASM_END()