Annotation of OpenXM/src/kan96xx/gmp-2.0.2-ssh-2/mpn/sparc64/addmul_1.s, Revision 1.1.1.1
1.1 takayama 1: ! SPARC v9 __mpn_addmul_1 -- Multiply a limb vector with a single limb and
2: ! add the product to a second limb vector.
3:
4: ! Copyright (C) 1996 Free Software Foundation, Inc.
5:
6: ! This file is part of the GNU MP Library.
7:
8: ! The GNU MP Library is free software; you can redistribute it and/or modify
9: ! it under the terms of the GNU Library General Public License as published by
10: ! the Free Software Foundation; either version 2 of the License, or (at your
11: ! option) any later version.
12:
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
15: ! or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
16: ! License for more details.
17:
18: ! You should have received a copy of the GNU Library General Public License
19: ! along with the GNU MP Library; see the file COPYING.LIB. If not, write to
20: ! the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
21: ! MA 02111-1307, USA.
22:
23:
24: ! INPUT PARAMETERS
25: ! res_ptr o0
26: ! s1_ptr o1
27: ! size o2
28: ! s2_limb o3
29:
30: .section ".text"
31: .align 4
32: .global __mpn_addmul_1
33: .type __mpn_addmul_1,#function
34: .proc 016
35: __mpn_addmul_1:
36: !#PROLOGUE# 0
37: save %sp,-160,%sp
38: !#PROLOGUE# 1
39: sub %g0,%i2,%o7
40: sllx %o7,3,%g5
41: sub %i1,%g5,%o3
42: sub %i0,%g5,%o4
43: mov 0,%o0 ! zero cy_limb
44:
45: srl %i3,0,%o1 ! extract low 32 bits of s2_limb
46: srlx %i3,32,%i3 ! extract high 32 bits of s2_limb
47: mov 1,%o2
48: sllx %o2,32,%o2 ! o2 = 0x100000000
49:
50: ! hi !
51: ! mid-1 !
52: ! mid-2 !
53: ! lo !
54: .Loop:
55: sllx %o7,3,%g1
56: ldx [%o3+%g1],%g5
57: srl %g5,0,%i0 ! zero hi bits
58: srlx %g5,32,%g5
59: mulx %o1,%i0,%i4 ! lo product
60: mulx %i3,%i0,%i1 ! mid-1 product
61: mulx %o1,%g5,%l2 ! mid-2 product
62: mulx %i3,%g5,%i5 ! hi product
63: srlx %i4,32,%i0 ! extract high 32 bits of lo product...
64: add %i1,%i0,%i1 ! ...and add it to the mid-1 product
65: addcc %i1,%l2,%i1 ! add mid products
66: mov 0,%l0 ! we need the carry from that add...
67: movcs %xcc,%o2,%l0 ! ...compute it and...
68: add %i5,%l0,%i5 ! ...add to bit 32 of the hi product
69: sllx %i1,32,%i0 ! align low bits of mid product
70: srl %i4,0,%g5 ! zero high 32 bits of lo product
71: add %i0,%g5,%i0 ! combine into low 64 bits of result
72: srlx %i1,32,%i1 ! extract high bits of mid product...
73: add %i5,%i1,%i1 ! ...and add them to the high result
74: addcc %i0,%o0,%i0 ! add cy_limb to low 64 bits of result
75: mov 0,%g5
76: movcs %xcc,1,%g5
77: add %o7,1,%o7
78: ldx [%o4+%g1],%l1
79: addcc %l1,%i0,%i0
80: movcs %xcc,1,%g5
81: stx %i0,[%o4+%g1]
82: brnz %o7,.Loop
83: add %i1,%g5,%o0 ! compute new cy_limb
84:
85: mov %o0,%i0
86: ret
87: restore
88: .LLfe1:
89: .size __mpn_addmul_1,.LLfe1-__mpn_addmul_1
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>