Tizen 2.1 base
[external/gmp.git] / mpn / z8000x / sub_n.s
1 ! Z8000 (32 bit limb version) __gmpn_sub_n -- Subtract two limb vectors of the
2 ! same length > 0 and store difference in a third limb vector.
3
4 ! Copyright 1993, 1994, 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       r7
24 ! s1_ptr        r6
25 ! s2_ptr        r5
26 ! size          r4
27
28 ! If we are really crazy, we can use push to write a few result words
29 ! backwards, using push just because it is faster than reg+disp.  We'd
30 ! then add 2x the number of words written to r7...
31
32         segm
33         .text
34         even
35         global ___gmpn_sub_n
36 ___gmpn_sub_n:
37         popl    rr0,@r6
38         popl    rr8,@r5
39         subl    rr0,rr8
40         ldl     @r7,rr0
41         dec     r4
42         jr      eq,Lend
43 Loop:   popl    rr0,@r6
44         popl    rr8,@r5
45         sbc     r1,r9
46         sbc     r0,r8
47         inc     r7,#4
48         ldl     @r7,rr0
49         dec     r4
50         jr      ne,Loop
51 Lend:   ld      r2,r4           ! use 0 already in r4
52         ld      r3,r4
53         adc     r2,r2
54         ret     t