]> git.ipfire.org Git - thirdparty/glibc.git/blame - sysdeps/sparc/sparc64/mul_1.S
Update copyright dates with scripts/update-copyrights.
[thirdparty/glibc.git] / sysdeps / sparc / sparc64 / mul_1.S
CommitLineData
5ae3e846
UD
1/* SPARC v9 __mpn_mul_1 -- Multiply a limb vector with a single limb and
2 store the product in a second limb vector.
6b628d36 3
f7a9f785 4 Copyright (C) 1995-2016 Free Software Foundation, Inc.
6b628d36 5
5ae3e846 6 This file is part of the GNU MP Library.
6b628d36 7
5ae3e846 8 The GNU MP Library is free software; you can redistribute it and/or modify
6d84f89a
AJ
9 it under the terms of the GNU Lesser General Public License as published by
10 the Free Software Foundation; either version 2.1 of the License, or (at your
5ae3e846 11 option) any later version.
6b628d36 12
5ae3e846
UD
13 The GNU MP Library is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
6d84f89a 15 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
5ae3e846 16 License for more details.
6b628d36 17
6d84f89a 18 You should have received a copy of the GNU Lesser General Public License
59ba27a6
PE
19 along with the GNU MP Library; see the file COPYING.LIB. If not,
20 see <http://www.gnu.org/licenses/>. */
6b628d36 21
5ae3e846 22#include <sysdep.h>
6b628d36 23
6b628d36 24
5ae3e846
UD
25/* INPUT PARAMETERS
26 res_ptr o0
27 s1_ptr o1
28 size o2
29 s2_limb o3 */
30
31ENTRY(__mpn_mul_1)
6b628d36 32 !#PROLOGUE# 0
9c4c0024 33 save %sp,-192,%sp
6b628d36 34 !#PROLOGUE# 1
5ae3e846 35
6b628d36
RM
36 sub %g0,%i2,%o7
37 sllx %o7,3,%g5
38 sub %i1,%g5,%o3
39 sub %i0,%g5,%o4
40 mov 0,%o0 ! zero cy_limb
41
42 srl %i3,0,%o1 ! extract low 32 bits of s2_limb
43 srlx %i3,32,%i3 ! extract high 32 bits of s2_limb
44 mov 1,%o2
45 sllx %o2,32,%o2 ! o2 = 0x100000000
46
47 ! hi !
48 ! mid-1 !
49 ! mid-2 !
50 ! lo !
51.Loop:
52 sllx %o7,3,%g1
53 ldx [%o3+%g1],%g5
54 srl %g5,0,%i0 ! zero hi bits
55 srlx %g5,32,%g5
56 mulx %o1,%i0,%i4 ! lo product
57 mulx %i3,%i0,%i1 ! mid-1 product
58 mulx %o1,%g5,%l2 ! mid-2 product
59 mulx %i3,%g5,%i5 ! hi product
60 srlx %i4,32,%i0 ! extract high 32 bits of lo product...
61 add %i1,%i0,%i1 ! ...and add it to the mid-1 product
62 addcc %i1,%l2,%i1 ! add mid products
63 mov 0,%l0 ! we need the carry from that add...
64 movcs %xcc,%o2,%l0 ! ...compute it and...
65 add %i5,%l0,%i5 ! ...add to bit 32 of the hi product
66 sllx %i1,32,%i0 ! align low bits of mid product
67 srl %i4,0,%g5 ! zero high 32 bits of lo product
68 add %i0,%g5,%i0 ! combine into low 64 bits of result
69 srlx %i1,32,%i1 ! extract high bits of mid product...
70 add %i5,%i1,%i1 ! ...and add them to the high result
71 addcc %i0,%o0,%i0 ! add cy_limb to low 64 bits of result
72 mov 0,%g5
73 movcs %xcc,1,%g5
2e65ca2b 74 addcc %o7,1,%o7
6b628d36 75 stx %i0,[%o4+%g1]
2e65ca2b 76 bne,pt %xcc,.Loop
5ae3e846 77 add %i1,%g5,%o0 ! compute new cy_limb
6b628d36 78
5ae3e846 79 jmpl %i7+8,%g0
2e65ca2b 80 restore %o0,%g0,%o0
5ae3e846
UD
81
82END(__mpn_mul_1)