Upload Tizen:Base source
[external/gmp.git] / 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 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 3 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.  If not, see http://www.gnu.org/licenses/.
20
21
22 ! INPUT PARAMETERS
23 ! res_ptr       r4
24 ! s1_ptr        r5
25 ! s2_ptr        r6
26 ! size          r7
27
28         .text
29         .align 2
30         .global ___gmpn_sub_n
31 ___gmpn_sub_n:
32         mov     #0,r3           ! clear cy save reg
33
34 Loop:   mov.l   @r5+,r1
35         mov.l   @r6+,r2
36         shlr    r3              ! restore cy
37         subc    r2,r1
38         movt    r3              ! save cy
39         mov.l   r1,@r4
40         dt      r7
41         bf.s    Loop
42          add    #4,r4
43
44         rts
45         mov     r3,r0           ! return carry-out from most sign. limb