Reorganisation of the source tree
[ghc-hetmet.git] / rts / gmp / mpn / sh / sub_n.s
1 ! SH __gmpn_sub_n -- Subtract two limb vectors of the same length > 0 and store
2 ! difference in a third limb vector.
3
4 ! Copyright (C) 1995, 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       r4
26 ! s1_ptr        r5
27 ! s2_ptr        r6
28 ! size          r7
29
30         .text
31         .align 2
32         .global ___gmpn_sub_n
33 ___gmpn_sub_n:
34         mov     #0,r3           ! clear cy save reg
35
36 Loop:   mov.l   @r5+,r1
37         mov.l   @r6+,r2
38         shlr    r3              ! restore cy
39         subc    r2,r1
40         movt    r3              ! save cy
41         mov.l   r1,@r4
42         dt      r7
43         bf.s    Loop
44          add    #4,r4
45
46         rts
47         mov     r3,r0           ! return carry-out from most sign. limb