remove empty dir
[ghc-hetmet.git] / ghc / rts / gmp / mpn / arm / sub_n.S
1 @ ARM mpn_sub -- Subtract two limb vectors of the same length > 0 and store
2 @ difference in a third limb vector.
3 @ Contributed by Robert Harley.
4
5 @ Copyright (C) 1997, 2000 Free Software Foundation, Inc.
6
7 @ This file is part of the GNU MP Library.
8
9 @ The GNU MP Library is free software; you can redistribute it and/or modify
10 @ it under the terms of the GNU Lesser General Public License as published by
11 @ the Free Software Foundation; either version 2.1 of the License, or (at your
12 @ option) any later version.
13
14 @ The GNU MP Library is distributed in the hope that it will be useful, but
15 @ WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
16 @ or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
17 @ License for more details.
18
19 @ You should have received a copy of the GNU Lesser General Public License
20 @ along with the GNU MP Library; see the file COPYING.LIB.  If not, write to
21 @ the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
22 @ MA 02111-1307, USA.
23
24 #define d r0
25 #define a r1
26 #define b r2
27 #define n r3
28
29 #define sl r10
30 #define fp r11
31 #define ip r12
32 #define sp r13
33 #define lr r14
34 #define pc r15
35
36 .text
37         .align  0
38         .global __gmpn_sub_n
39         .type   __gmpn_sub_n,%function
40 __gmpn_sub_n:
41         stmfd   sp!, { r8, r9, lr }
42         subs    ip, ip, ip
43         tst     n, #1
44         beq     skip1
45         ldr     ip, [a], #4
46         ldr     lr, [b], #4
47         subs    ip, ip, lr
48         str     ip, [d], #4
49 skip1:
50         tst     n, #2
51         beq     skip2
52         ldmia   a!, { r8, r9 }
53         ldmia   b!, { ip, lr }
54         sbcs    r8, r8, ip
55         sbcs    r9, r9, lr
56         stmia   d!, { r8, r9 }
57 skip2:
58         bics    n, n, #3
59         beq     return
60         stmfd   sp!, { r4, r5, r6, r7 }
61 sub_n_loop:
62         ldmia   a!, { r4, r5, r6, r7 }
63         ldmia   b!, { r8, r9, ip, lr }
64         sbcs    r4, r4, r8
65         ldr     r8, [d] /* Bring stuff into cache. */
66         sbcs    r5, r5, r9
67         sbcs    r6, r6, ip
68         sbcs    r7, r7, lr
69         stmia   d!, { r4, r5, r6, r7 }
70         sub     n, n, #4
71         teq     n, #0
72         bne     sub_n_loop
73         ldmfd   sp!, { r4, r5, r6, r7 }
74 return:
75         sbc     r0, r0, r0
76         and     r0, r0, #1
77         ldmfd   sp!, { r8, r9, pc }
78 end:
79         .size   __gmpn_sub_n, end - __gmpn_sub_n