Upload Tizen:Base source
[external/gmp.git] / mpn / sh / sh2 / submul_1.s
1 ! SH2 __gmpn_submul_1 -- Multiply a limb vector with a limb and subtract
2 ! the result from a second limb vector.
3
4 ! Copyright 1995, 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 ! size          r6
26 ! s2_limb       r7
27
28         .text
29         .align 1
30         .global ___gmpn_submul_1
31 ___gmpn_submul_1:
32         mov     #0,r2           ! cy_limb = 0
33         mov     #0,r0           ! Keep r0 = 0 for entire loop
34         clrt
35
36 Loop:   mov.l   @r5+,r3
37         dmulu.l r3,r7
38         sts     macl,r1
39         addc    r2,r1           ! lo_prod += old cy_limb
40         sts     mach,r2         ! new cy_limb = hi_prod
41         mov.l   @r4,r3
42         addc    r0,r2           ! cy_limb += T, T = 0
43         subc    r3,r1
44         addc    r0,r2           ! cy_limb += T, T = 0
45         dt      r6
46         mov.l   r1,@r4
47         bf.s    Loop
48         add     #4,r4
49
50         rts
51         mov     r2,r0