Update copyright dates with scripts/update-copyrights.
[glibc.git] / sysdeps / sparc / sparc64 / multiarch / addmul_1-vis3.S
blob6b5833b8eb4a9ded4d6b4fcfdfee88cb016c7a64
1 ! SPARC v9 64-bit VIS3 __mpn_addmul_1 -- Multiply a limb vector with a
2 ! limb and add the result to a second limb vector.
4 ! Copyright (C) 2013-2015 Free Software Foundation, Inc.
5 ! This file is part of the GNU C Library.
6 ! Contributed by David S. Miller <davem@davemloft.net>
8 ! The GNU C Library is free software; you can redistribute it and/or
9 ! modify it under the terms of the GNU Lesser General Public
10 ! License as published by the Free Software Foundation; either
11 ! version 2.1 of the License, or (at your option) any later version.
13 ! The GNU C Library is distributed in the hope that it will be useful,
14 ! but WITHOUT ANY WARRANTY; without even the implied warranty of
15 ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16 ! Lesser General Public License for more details.
18 ! You should have received a copy of the GNU Lesser General Public
19 ! License along with the GNU C Library; if not, see
20 ! <http://www.gnu.org/licenses/>.
22 #include <sysdep.h>
24 #define res_ptr %i0
25 #define s1_ptr  %i1
26 #define sz      %i2
27 #define s2_limb %i3
28 #define carry   %o5
29 #define tmp1    %g1
30 #define tmp2    %g2
31 #define tmp3    %g3
32 #define tmp4    %o4
33 #define tmp5    %l0
34 #define tmp6    %l1
35 #define tmp7    %l2
36 #define tmp8    %l3
38         .register       %g2,#scratch
39         .register       %g3,#scratch
40 ENTRY(__mpn_addmul_1_vis3)
41         save    %sp, -176, %sp
42         subcc   sz, 1, sz
43         be      .Lfinal_limb
44          clr    carry
46 .Lloop:
47         ldx     [s1_ptr  + 0x00], tmp1
48         ldx     [res_ptr + 0x00], tmp3
49         ldx     [s1_ptr  + 0x08], tmp2
50         ldx     [res_ptr + 0x08], tmp4
51         mulx    tmp1, s2_limb, tmp5
52         add     s1_ptr, 0x10, s1_ptr
53         umulxhi tmp1, s2_limb, tmp6
54         add     res_ptr, 0x10, res_ptr
55         mulx    tmp2, s2_limb, tmp7
56         sub     sz, 2, sz
57         umulxhi tmp2, s2_limb, tmp8
58         addcc   carry, tmp5, tmp5
59         addxc   %g0, tmp6, carry
60         addcc   tmp3, tmp5, tmp5
61         addxc   %g0, carry, carry
62         stx     tmp5, [res_ptr - 0x10]
63         addcc   carry, tmp7, tmp7
64         addxc   %g0, tmp8, carry
65         addcc   tmp4, tmp7, tmp7
66         addxc   %g0, carry, carry
67         brgz    sz, .Lloop
68          stx    tmp7, [res_ptr - 0x08]
70         brlz,pt sz, .Lfinish
71          nop
73 .Lfinal_limb:
74         ldx     [s1_ptr  + 0x00], tmp1
75         ldx     [res_ptr + 0x00], tmp3
76         mulx    tmp1, s2_limb, tmp5
77         umulxhi tmp1, s2_limb, tmp6
78         addcc   carry, tmp5, tmp5
79         addxc   %g0, tmp6, carry
80         addcc   tmp3, tmp5, tmp5
81         addxc   %g0, carry, carry
82         stx     tmp5, [res_ptr + 0x00]
84 .Lfinish:
85         jmpl    %i7 + 8, %g0
86          restore carry, 0, %o0
87 END(__mpn_addmul_1_vis3)