remove empty dir
[ghc-hetmet.git] / ghc / rts / gmp / mpn / pyr / sub_n.s
1 # Pyramid __gmpn_sub_n -- Subtract two limb vectors of the same length > 0 and
2 # store difference in a third limb vector.
3
4 # Copyright (C) 1995, 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 .text
24         .align  2
25 .globl  ___gmpn_sub_n
26 ___gmpn_sub_n:
27         movw    $-1,tr0         # representation for carry clear
28
29         movw    pr3,tr2
30         andw    $3,tr2
31         beq     Lend0
32         subw    tr2,pr3
33
34 Loop0:  rsubw   $0,tr0          # restore carry bit from carry-save register
35
36         movw    (pr1),tr1
37         subwb   (pr2),tr1
38         movw    tr1,(pr0)
39
40         subwb   tr0,tr0
41         addw    $4,pr0
42         addw    $4,pr1
43         addw    $4,pr2
44         addw    $-1,tr2
45         bne     Loop0
46
47         mtstw   pr3,pr3
48         beq     Lend
49 Lend0:
50 Loop:   rsubw   $0,tr0          # restore carry bit from carry-save register
51
52         movw    (pr1),tr1
53         subwb   (pr2),tr1
54         movw    tr1,(pr0)
55
56         movw    4(pr1),tr1
57         subwb   4(pr2),tr1
58         movw    tr1,4(pr0)
59
60         movw    8(pr1),tr1
61         subwb   8(pr2),tr1
62         movw    tr1,8(pr0)
63
64         movw    12(pr1),tr1
65         subwb   12(pr2),tr1
66         movw    tr1,12(pr0)
67
68         subwb   tr0,tr0
69         addw    $16,pr0
70         addw    $16,pr1
71         addw    $16,pr2
72         addw    $-4,pr3
73         bne     Loop
74 Lend:
75         mnegw   tr0,pr0
76         ret