beta-0.89.2
[luatex.git] / source / libs / gmp / gmp-src / mpn / sparc32 / ultrasparct1 / addmul_1.asm
blob89da1864577fff16bbf385d2be203b4513560b7f
1 dnl SPARC T1 32-bit mpn_addmul_1.
3 dnl Contributed to the GNU project by David Miller.
5 dnl Copyright 2010, 2013 Free Software Foundation, Inc.
7 dnl This file is part of the GNU MP Library.
8 dnl
9 dnl The GNU MP Library is free software; you can redistribute it and/or modify
10 dnl it under the terms of either:
11 dnl
12 dnl * the GNU Lesser General Public License as published by the Free
13 dnl Software Foundation; either version 3 of the License, or (at your
14 dnl option) any later version.
15 dnl
16 dnl or
17 dnl
18 dnl * the GNU General Public License as published by the Free Software
19 dnl Foundation; either version 2 of the License, or (at your option) any
20 dnl later version.
21 dnl
22 dnl or both in parallel, as here.
23 dnl
24 dnl The GNU MP Library is distributed in the hope that it will be useful, but
25 dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
26 dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
27 dnl for more details.
28 dnl
29 dnl You should have received copies of the GNU General Public License and the
30 dnl GNU Lesser General Public License along with the GNU MP Library. If not,
31 dnl see https://www.gnu.org/licenses/.
33 include(`../config.m4')
35 C cycles/limb
36 C UltraSPARC T1: 24
37 C UltraSPARC T2: 19
38 C UltraSPARC T3: 19
39 C UltraSPARC T4: 5
41 C INPUT PARAMETERS
42 define(`rp', `%i0')
43 define(`up', `%i1')
44 define(`n', `%i2')
45 define(`v0', `%i3')
47 ASM_START()
48 PROLOGUE(mpn_addmul_1)
49 save %sp, -96, %sp
50 srl n, 0, %o4
51 srl v0, 0, %g1
52 subcc %o4, 1, %o4
53 be L(final_one)
54 clr %o5
56 L(top): lduw [up+0], %l0
57 lduw [rp+0], %l2
58 lduw [up+4], %l1
59 lduw [rp+4], %l3
60 mulx %l0, %g1, %g3
61 add up, 8, up
62 mulx %l1, %g1, %o3
63 sub %o4, 2, %o4
64 add rp, 8, rp
65 add %l2, %g3, %g3
66 add %o5, %g3, %g3
67 stw %g3, [rp-8]
68 srlx %g3, 32, %o5
69 add %l3, %o3, %o3
70 add %o5, %o3, %o3
71 stw %o3, [rp-4]
72 brgz %o4, L(top)
73 srlx %o3, 32, %o5
75 brlz,pt %o4, L(done)
76 nop
78 L(final_one):
79 lduw [up+0], %l0
80 lduw [rp+0], %l2
81 mulx %l0, %g1, %g3
82 add %l2, %g3, %g3
83 add %o5, %g3, %g3
84 stw %g3, [rp+0]
85 srlx %g3, 32, %o5
87 L(done):
88 ret
89 restore %o5, 0, %o0
90 EPILOGUE()