Tizen 2.1 base
[external/gmp.git] / mpn / pa64 / lshift.asm
1 dnl  HP-PA 2.0 mpn_lshift -- Left shift.
2
3 dnl  Copyright 1997, 2000, 2002, 2003 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  This runs at 1.5 cycles/limb on PA8000 and 1.0 cycles/limb on PA8500.
22
23 include(`../config.m4')
24
25 dnl  INPUT PARAMETERS
26 define(`rp',`%r26')
27 define(`up',`%r25')
28 define(`n',`%r24')
29 define(`cnt',`%r23')
30
31 ifdef(`HAVE_ABI_2_0w',
32 `       .level  2.0w
33 ',`     .level  2.0
34 ')
35 PROLOGUE(mpn_lshift)
36         shladd          n, 3, up, up
37         shladd          n, 3, rp, rp
38         subi            64, cnt, cnt
39         mtsar           cnt
40         ldd             -8(up), %r21
41         addib,=         -1, n, L(end)
42         shrpd           %r0, %r21, %sar, %r29   C compute carry out limb
43         depw,z          n, 31, 3, %r28          C r28 = (size & 7)
44         sub             %r0, n, %r22
45         depw,z          %r22, 28, 3, %r22       C r22 = 8 * (-size & 7)
46         add             up, %r22, up            C offset up
47         blr             %r28, %r0               C branch into jump table
48         add             rp, %r22, rp            C offset rp
49         b               L(0)
50         nop
51         b               L(1)
52         copy            %r21, %r20
53         b               L(2)
54         nop
55         b               L(3)
56         copy            %r21, %r20
57         b               L(4)
58         nop
59         b               L(5)
60         copy            %r21, %r20
61         b               L(6)
62         nop
63         b               L(7)
64         copy            %r21, %r20
65
66 LDEF(loop)
67 LDEF(0) ldd             -16(up), %r20
68         shrpd           %r21, %r20, %sar, %r21
69         std             %r21, -8(rp)
70 LDEF(7) ldd             -24(up), %r21
71         shrpd           %r20, %r21, %sar, %r20
72         std             %r20, -16(rp)
73 LDEF(6) ldd             -32(up), %r20
74         shrpd           %r21, %r20, %sar, %r21
75         std             %r21, -24(rp)
76 LDEF(5) ldd             -40(up), %r21
77         shrpd           %r20, %r21, %sar, %r20
78         std             %r20, -32(rp)
79 LDEF(4) ldd             -48(up), %r20
80         shrpd           %r21, %r20, %sar, %r21
81         std             %r21, -40(rp)
82 LDEF(3) ldd             -56(up), %r21
83         shrpd           %r20, %r21, %sar, %r20
84         std             %r20, -48(rp)
85 LDEF(2) ldd             -64(up), %r20
86         shrpd           %r21, %r20, %sar, %r21
87         std             %r21, -56(rp)
88 LDEF(1) ldd             -72(up), %r21
89         ldo             -64(up), up
90         shrpd           %r20, %r21, %sar, %r20
91         std             %r20, -64(rp)
92         addib,>         -8, n, L(loop)
93         ldo             -64(rp), rp
94
95 LDEF(end)
96         shrpd           %r21, %r0, %sar, %r21
97         std             %r21, -8(rp)
98         bve             (%r2)
99 ifdef(`HAVE_ABI_2_0w',
100 `       copy            %r29,%r28
101 ',`     extrd,u         %r29, 31, 32, %r28
102 ')
103 EPILOGUE(mpn_lshift)