Update copyright dates with scripts/update-copyrights.
[glibc.git] / sysdeps / arm / addmul_1.S
blobe35aa19e7b263fcc4ab52f7749922d0e71040c3e
1 /* mpn_addmul_1 -- multiply and accumulate bignums.
2    Copyright (C) 2013-2015 Free Software Foundation, Inc.
3    This file is part of the GNU C Library.
5    The GNU C Library is free software; you can redistribute it and/or
6    modify it under the terms of the GNU Lesser General Public
7    License as published by the Free Software Foundation; either
8    version 2.1 of the License, or (at your option) any later version.
10    The GNU C Library is distributed in the hope that it will be useful,
11    but WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13    Lesser General Public License for more details.
15    You should have received a copy of the GNU Lesser General Public
16    License along with the GNU C Library.  If not, see
17    <http://www.gnu.org/licenses/>.  */
19 #include <sysdep.h>
21         .syntax unified
22         .text
24 @               cycles/limb
25 @ StrongArm        ?
26 @ Cortex-A8        ?
27 @ Cortex-A9        ?
28 @ Cortex-A15       4
30 /* mp_limb_t mpn_addmul_1(res_ptr, src1_ptr, size, s2_limb) */
32 ENTRY (__mpn_addmul_1)
33         push    { r4, r5, r6, r7 }
34         cfi_adjust_cfa_offset (16)
35         cfi_rel_offset (r4, 0)
36         cfi_rel_offset (r5, 4)
37         cfi_rel_offset (r6, 8)
38         cfi_rel_offset (r7, 12)
40         sfi_breg r1, \
41         ldr     r6, [\B], #4
42         sfi_breg r0, \
43         ldr     r5, [\B]
44         mov     r4, #0                  /* init carry in */
45         b       1f
47         sfi_breg r1, \
48         ldr     r6, [\B], #4            /* load next ul */
49         adds    r7, r4, r5              /* (out, c) = cl + lpl */
50         sfi_breg r0, \
51         ldr     r5, [\B, #4]            /* load next rl */
52         adc     r4, ip, #0              /* cl = hpl + c */
53         sfi_breg r0, \
54         str     r7, [\B], #4
56         mov     ip, #0                  /* zero-extend rl */
57         umlal   r5, ip, r6, r3          /* (hpl, lpl) = ul * vl + rl */
58         subs    r2, r2, #1
59         bne     0b
61         adds    r4, r4, r5              /* (out, c) = cl + llpl */
62         sfi_breg r0, \
63         str     r4, [\B]
64         adc     r0, ip, #0              /* return hpl + c */
66         pop     { r4, r5, r6, r7 }
67         cfi_adjust_cfa_offset (-16)
68         cfi_restore (r4)
69         cfi_restore (r5)
70         cfi_restore (r6)
71         cfi_restore (r7)
72         DO_RET  (lr)
73 END (__mpn_addmul_1)