]>
Commit | Line | Data |
---|---|---|
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 | ! | |
2b778ceb | 4 | ! Copyright (C) 2013-2021 Free Software Foundation, Inc. |
32fcb36d | 5 | ! This file is part of the GNU C Library. |
32fcb36d DM |
6 | ! |
7 | ! The GNU C Library is free software; you can redistribute it and/or | |
8 | ! modify it under the terms of the GNU Lesser General Public | |
9 | ! License as published by the Free Software Foundation; either | |
10 | ! version 2.1 of the License, or (at your option) any later version. | |
11 | ! | |
12 | ! The GNU C Library is distributed in the hope that it will be useful, | |
13 | ! but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
15 | ! Lesser General Public License for more details. | |
16 | ! | |
17 | ! You should have received a copy of the GNU Lesser General Public | |
18 | ! License along with the GNU C Library; if not, see | |
5a82c748 | 19 | ! <https://www.gnu.org/licenses/>. |
32fcb36d DM |
20 | |
21 | #include <sysdep.h> | |
22 | ||
23 | #define res_ptr %o0 | |
24 | #define s1_ptr %o1 | |
25 | #define sz %o2 | |
26 | #define s2_limb %o3 | |
27 | #define carry %o5 | |
28 | #define tmp1 %g1 | |
29 | #define tmp2 %g2 | |
30 | #define tmp3 %g3 | |
31 | #define tmp4 %o4 | |
32 | ||
33 | .register %g2,#scratch | |
34 | .register %g3,#scratch | |
35 | ENTRY(__mpn_mul_1_vis3) | |
36 | subcc sz, 1, sz | |
37 | be .Lfinal_limb | |
38 | clr carry | |
39 | ||
40 | .Lloop: | |
41 | ldx [s1_ptr + 0x00], tmp1 | |
42 | ldx [s1_ptr + 0x08], tmp4 | |
43 | mulx tmp1, s2_limb, tmp3 | |
44 | add s1_ptr, 0x10, s1_ptr | |
45 | umulxhi tmp1, s2_limb, tmp2 | |
46 | sub sz, 2, sz | |
47 | mulx tmp4, s2_limb, tmp1 | |
48 | add res_ptr, 0x10, res_ptr | |
49 | umulxhi tmp4, s2_limb, tmp4 | |
50 | addcc carry, tmp3, tmp3 | |
51 | stx tmp3, [res_ptr - 0x10] | |
52 | addxc %g0, tmp2, carry | |
53 | addcc carry, tmp1, tmp1 | |
54 | addxc %g0, tmp4, carry | |
55 | brgz sz, .Lloop | |
56 | stx tmp1, [res_ptr - 0x08] | |
57 | ||
58 | brlz,pt sz, .Lfinish | |
59 | nop | |
60 | ||
61 | .Lfinal_limb: | |
62 | ldx [s1_ptr + 0x00], tmp1 | |
63 | mulx tmp1, s2_limb, tmp3 | |
64 | umulxhi tmp1, s2_limb, tmp2 | |
65 | addcc carry, tmp3, tmp3 | |
66 | addxc %g0, tmp2, carry | |
67 | stx tmp3, [res_ptr + 0x00] | |
68 | ||
69 | .Lfinish: | |
70 | retl | |
71 | mov carry, %o0 | |
72 | END(__mpn_mul_1_vis3) |