Reorganisation of the source tree
[ghc-hetmet.git] / rts / gmp / mpn / pa64 / sub_n.s
1 ; HP-PA 2.0 __gmpn_sub_n -- Subtract two limb vectors of the same length > 0
2 ; and store difference in a third limb vector.
3
4 ; Copyright (C) 1997, 2000 Free Software Foundation, Inc.
5
6 ; This file is part of the GNU MP Library.
7
8 ; The GNU MP Library is free software; you can redistribute it and/or modify
9 ; it under the terms of the GNU Lesser General Public License as published by
10 ; the Free Software Foundation; either version 2.1 of the License, or (at your
11 ; option) any later version.
12
13 ; The GNU MP Library is distributed in the hope that it will be useful, but
14 ; WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15 ; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
16 ; License for more details.
17
18 ; You should have received a copy of the GNU Lesser General Public License
19 ; along with the GNU MP Library; see the file COPYING.LIB.  If not, write to
20 ; the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
21 ; MA 02111-1307, USA.
22
23
24 ; INPUT PARAMETERS
25 ; res_ptr       gr26
26 ; s1_ptr        gr25
27 ; s2_ptr        gr24
28 ; size          gr23
29
30 ; This runs at 2 cycles/limb on PA8000.
31
32         .level  2.0n
33         .code
34         .export __gmpn_sub_n,entry
35 __gmpn_sub_n
36         .proc
37         .callinfo frame=0,args_saved
38         .entry
39
40         sub             %r0,%r23,%r22
41         depw,z          %r22,30,3,%r28          ; r28 = 2 * (-n & 7)
42         depw,z          %r22,28,3,%r22          ; r22 = 8 * (-n & 7)
43         sub             %r25,%r22,%r25          ; offset s1_ptr
44         sub             %r24,%r22,%r24          ; offset s2_ptr
45         blr             %r28,%r0                ; branch into loop
46         sub             %r26,%r22,%r26          ; offset res_ptr and set carry
47
48 L$loop  ldd             0(%r25),%r20
49         ldd             0(%r24),%r31
50         sub,db          %r20,%r31,%r20
51         std             %r20,0(%r26)
52 L$7     ldd             8(%r25),%r21
53         ldd             8(%r24),%r19
54         sub,db          %r21,%r19,%r21
55         std             %r21,8(%r26)
56 L$6     ldd             16(%r25),%r20
57         ldd             16(%r24),%r31
58         sub,db          %r20,%r31,%r20
59         std             %r20,16(%r26)
60 L$5     ldd             24(%r25),%r21
61         ldd             24(%r24),%r19
62         sub,db          %r21,%r19,%r21
63         std             %r21,24(%r26)
64 L$4     ldd             32(%r25),%r20
65         ldd             32(%r24),%r31
66         sub,db          %r20,%r31,%r20
67         std             %r20,32(%r26)
68 L$3     ldd             40(%r25),%r21
69         ldd             40(%r24),%r19
70         sub,db          %r21,%r19,%r21
71         std             %r21,40(%r26)
72 L$2     ldd             48(%r25),%r20
73         ldd             48(%r24),%r31
74         sub,db          %r20,%r31,%r20
75         std             %r20,48(%r26)
76 L$1     ldd             56(%r25),%r21
77         ldo             64(%r25),%r25
78         ldd             56(%r24),%r19
79         sub,db          %r21,%r19,%r21
80         std             %r21,56(%r26)
81         ldo             64(%r24),%r24
82         addib,>         -8,%r23,L$loop
83         ldo             64(%r26),%r26
84
85         add,dc          %r0,%r0,%r29
86         subi            1,%r29,%r29
87         bve             (%r2)
88         .exit
89         ldi             0,%r28
90         .procend