Upload Tizen:Base source
[external/gmp.git] / mpn / z8000 / add_n.s
1 ! Z8000 __gmpn_add_n -- Add two limb vectors of equal, non-zero length.
2
3 ! Copyright 1993, 1994, 2000 Free Software Foundation, Inc.
4
5 ! This file is part of the GNU MP Library.
6
7 ! The GNU MP Library is free software; you can redistribute it and/or modify
8 ! it under the terms of the GNU Lesser General Public License as published by
9 ! the Free Software Foundation; either version 3 of the License, or (at your
10 ! option) any later version.
11
12 ! The GNU MP Library is distributed in the hope that it will be useful, but
13 ! WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 ! or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
15 ! License for more details.
16
17 ! You should have received a copy of the GNU Lesser General Public License
18 ! along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
19
20
21 ! INPUT PARAMETERS
22 ! res_ptr       r7
23 ! s1_ptr        r6
24 ! s2_ptr        r5
25 ! size          r4
26
27 ! If we are really crazy, we can use push to write a few result words
28 ! backwards, using push just because it is faster than reg+disp.  We'd
29 ! then add 2x the number of words written to r7...
30
31         unseg
32         .text
33         even
34         global ___gmpn_add_n
35 ___gmpn_add_n:
36         pop     r0,@r6
37         pop     r1,@r5
38         add     r0,r1
39         ld      @r7,r0
40         dec     r4
41         jr      eq,Lend
42 Loop:   pop     r0,@r6
43         pop     r1,@r5
44         adc     r0,r1
45         inc     r7,#2
46         ld      @r7,r0
47         dec     r4
48         jr      ne,Loop
49 Lend:   ld      r2,r4           ! use 0 already in r4
50         adc     r2,r2
51         ret     t