]> git.ipfire.org Git - thirdparty/glibc.git/blob - sysdeps/sparc/sparc32/sparcv9/mul_1.S
Optimize sparc 32-bit V9 GMP multiply routines.
[thirdparty/glibc.git] / sysdeps / sparc / sparc32 / sparcv9 / mul_1.S
1 ! SPARC v9 32-bit mpn_mul_1.
2 !
3 ! Copyright 2010-2013 Free Software Foundation, Inc.
4 !
5 ! This file is part of the GNU MP Library.
6 !
7 ! The GNU MP Library is free software; you can redistribute it and/or modify
8 ! it under the terms of the GNU Lesser General Public License as published
9 ! by the Free Software Foundation; either version 3 of the License, or (at
10 ! your option) any later version.
11
12 ! The GNU MP Library is distributed in the hope that it will be useful, but
13 ! WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 ! or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
15 ! License for more details.
16 !
17 ! You should have received a copy of the GNU Lesser General Public License
18 ! along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
19
20 ! INPUT PARAMETERS
21 ! res_ptr %o0
22 ! s1_ptr %o1
23 ! size %o2
24 ! s2_limb %o3
25
26 #include <sysdep.h>
27
28 ENTRY(__mpn_mul_1)
29 srl %o2, 0, %o2
30 srl %o3, 0, %o3
31 subcc %o2, 1, %o2
32 be .Lfinal_one
33 clr %o5
34
35 .Ltop:
36 lduw [%o1+0], %g1
37 lduw [%o1+4], %g2
38 mulx %g1, %o3, %g3
39 add %o1, 8, %o1
40 mulx %g2, %o3, %o4
41 sub %o2, 2, %o2
42 add %o0, 8, %o0
43 add %o5, %g3, %g3
44 stw %g3, [%o0-8]
45 srlx %g3, 32, %o5
46 add %o5, %o4, %o4
47 stw %o4, [%o0-4]
48 brgz %o2, .Ltop
49 srlx %o4, 32, %o5
50
51 brlz,pt %o2, .Ldone
52 nop
53
54 .Lfinal_one:
55 lduw [%o1+0], %g1
56 mulx %g1, %o3, %g3
57 add %o5, %g3, %g3
58 stw %g3, [%o0+0]
59 srlx %g3, 32, %o5
60
61 .Ldone:
62 retl
63 mov %o5, %o0
64 END(__mpn_mul_1)