]> git.ipfire.org Git - thirdparty/glibc.git/blame - sysdeps/sparc/sparc64/multiarch/mul_1-vis3.S
Prefer https to http for gnu.org and fsf.org URLs
[thirdparty/glibc.git] / sysdeps / sparc / sparc64 / multiarch / mul_1-vis3.S
CommitLineData
32fcb36d
DM
1! SPARC v9 64-bit VIS3 __mpn_mul_1 -- Multiply a limb vector with a single
2! limb and store the product in a second limb vector.
3!
04277e02 4! Copyright (C) 2013-2019 Free Software Foundation, Inc.
32fcb36d
DM
5! This file is part of the GNU C Library.
6! Contributed by David S. Miller <davem@davemloft.net>
7!
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.
12!
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.
17!
18! You should have received a copy of the GNU Lesser General Public
19! License along with the GNU C Library; if not, see
5a82c748 20! <https://www.gnu.org/licenses/>.
32fcb36d
DM
21
22#include <sysdep.h>
23
24#define res_ptr %o0
25#define s1_ptr %o1
26#define sz %o2
27#define s2_limb %o3
28#define carry %o5
29#define tmp1 %g1
30#define tmp2 %g2
31#define tmp3 %g3
32#define tmp4 %o4
33
34 .register %g2,#scratch
35 .register %g3,#scratch
36ENTRY(__mpn_mul_1_vis3)
37 subcc sz, 1, sz
38 be .Lfinal_limb
39 clr carry
40
41.Lloop:
42 ldx [s1_ptr + 0x00], tmp1
43 ldx [s1_ptr + 0x08], tmp4
44 mulx tmp1, s2_limb, tmp3
45 add s1_ptr, 0x10, s1_ptr
46 umulxhi tmp1, s2_limb, tmp2
47 sub sz, 2, sz
48 mulx tmp4, s2_limb, tmp1
49 add res_ptr, 0x10, res_ptr
50 umulxhi tmp4, s2_limb, tmp4
51 addcc carry, tmp3, tmp3
52 stx tmp3, [res_ptr - 0x10]
53 addxc %g0, tmp2, carry
54 addcc carry, tmp1, tmp1
55 addxc %g0, tmp4, carry
56 brgz sz, .Lloop
57 stx tmp1, [res_ptr - 0x08]
58
59 brlz,pt sz, .Lfinish
60 nop
61
62.Lfinal_limb:
63 ldx [s1_ptr + 0x00], tmp1
64 mulx tmp1, s2_limb, tmp3
65 umulxhi tmp1, s2_limb, tmp2
66 addcc carry, tmp3, tmp3
67 addxc %g0, tmp2, carry
68 stx tmp3, [res_ptr + 0x00]
69
70.Lfinish:
71 retl
72 mov carry, %o0
73END(__mpn_mul_1_vis3)