FIX BUILD (with GHC 6.2.x): System.Directory.Internals is no more
[ghc-hetmet.git] / rts / gmp / mpn / pa64 / rshift.s
1 ; HP-PA 2.0 __gmpn_rshift --
2
3 ; Copyright (C) 1997, 2000 Free Software Foundation, Inc.
4
5 ; This file is part of the GNU MP Library.
6
7 ; The GNU MP Library is free software; you can redistribute it and/or modify
8 ; it under the terms of the GNU Lesser General Public License as published by
9 ; the Free Software Foundation; either version 2.1 of the License, or (at your
10 ; option) any later version.
11
12 ; The GNU MP Library is distributed in the hope that it will be useful, but
13 ; WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 ; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
15 ; License for more details.
16
17 ; You should have received a copy of the GNU Lesser General Public License
18 ; along with the GNU MP Library; see the file COPYING.LIB.  If not, write to
19 ; the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
20 ; MA 02111-1307, USA.
21
22
23 ; INPUT PARAMETERS
24 ; res_ptr       gr26
25 ; s1_ptr        gr25
26 ; size          gr24
27 ; cnt           gr23
28
29 ; This runs at 1.5 cycles/limb on PA8000.
30
31         .level  2.0n
32         .code
33         .export __gmpn_rshift,entry
34 __gmpn_rshift
35         .proc
36         .callinfo frame=0,args_saved
37         .entry
38
39         mtsar           %r23
40         ldd             0(%r25),%r21
41         addib,=         -1,%r24,L$end
42         shrpd           %r21,%r0,%sar,%r29      ; compute carry out limb
43         depw,z          %r24,31,3,%r28          ; r28 = (size & 7)
44         sub             %r0,%r24,%r22
45         depw,z          %r22,28,3,%r22          ; r22 = 8 * (-size & 7)
46         sub             %r25,%r22,%r25          ; offset s1_ptr
47         blr             %r28,%r0                ; branch into jump table
48         sub             %r26,%r22,%r26          ; offset res_ptr
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 L$loop
67 L$0     ldd             8(%r25),%r20
68         shrpd           %r20,%r21,%sar,%r21
69         std             %r21,0(%r26)
70 L$7     ldd             16(%r25),%r21
71         shrpd           %r21,%r20,%sar,%r20
72         std             %r20,8(%r26)
73 L$6     ldd             24(%r25),%r20
74         shrpd           %r20,%r21,%sar,%r21
75         std             %r21,16(%r26)
76 L$5     ldd             32(%r25),%r21
77         shrpd           %r21,%r20,%sar,%r20
78         std             %r20,24(%r26)
79 L$4     ldd             40(%r25),%r20
80         shrpd           %r20,%r21,%sar,%r21
81         std             %r21,32(%r26)
82 L$3     ldd             48(%r25),%r21
83         shrpd           %r21,%r20,%sar,%r20
84         std             %r20,40(%r26)
85 L$2     ldd             56(%r25),%r20
86         shrpd           %r20,%r21,%sar,%r21
87         std             %r21,48(%r26)
88 L$1     ldd             64(%r25),%r21
89         ldo             64(%r25),%r25
90         shrpd           %r21,%r20,%sar,%r20
91         std             %r20,56(%r26)
92         addib,>         -8,%r24,L$loop
93         ldo             64(%r26),%r26
94
95 L$end   shrpd           %r0,%r21,%sar,%r21
96         std             %r21,0(%r26)
97         bve             (%r2)
98         .exit
99         extrd,u         %r29,31,32,%r28
100         .procend