Annotation of OpenXM_contrib/gmp/mpn/sparc64/addmul_1.asm, Revision 1.1.1.1
1.1 maekawa 1: dnl SPARC 64-bit mpn_addmul_1 -- Multiply a limb vector with a limb and
2: dnl add the result to a second limb vector.
3:
4: dnl Copyright (C) 1998, 2000 Free Software Foundation, Inc.
5:
6: dnl This file is part of the GNU MP Library.
7:
8: dnl The GNU MP Library is free software; you can redistribute it and/or modify
9: dnl it under the terms of the GNU Lesser General Public License as published
10: dnl by the Free Software Foundation; either version 2.1 of the License, or (at
11: dnl your option) any later version.
12:
13: dnl The GNU MP Library is distributed in the hope that it will be useful, but
14: dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15: dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
16: dnl License for more details.
17:
18: dnl You should have received a copy of the GNU Lesser General Public License
19: dnl along with the GNU MP Library; see the file COPYING.LIB. If not, write to
20: dnl the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
21: dnl MA 02111-1307, USA.
22:
23: include(`../config.m4')
24:
25: C INPUT PARAMETERS
26: C res_ptr i0
27: C s1_ptr i1
28: C size i2
29: C s2_limb i3
30:
31: ASM_START()
32: .register %g2,#scratch
33: .register %g3,#scratch
34:
35: PROLOGUE(mpn_addmul_1)
36: save %sp,-256,%sp
37:
38: C We store 0.0 in f10 and keep it invariant accross thw two
39: C function calls below. Note that this is not ABI conformant,
40: C but since the functions are local, that's acceptable.
41: ifdef(`PIC',
42: `L(pc): rd %pc,%o7
43: ld [%o7+L(noll)-L(pc)],%f10',
44: ` sethi %hh(L(noll)),%g2
45: sethi %lm(L(noll)),%g1
46: or %g2,%hm(L(noll)),%g2
47: or %g1,%lo(L(noll)),%g1
48: sllx %g2,32,%g2
49: ld [%g1+%g2],%f10')
50:
51: sub %i1,%i0,%g1
52: srlx %g1,3,%g1
53: cmp %g1,%i2
54: bcc,pt %xcc,L(nooverlap)
55: nop
56:
57: sllx %i2,3,%g2 C compute stack allocation byte count
58: add %g2,15,%o0
59: and %o0,-16,%o0
60: sub %sp,%o0,%sp
61: add %sp,2223,%o0
62:
63: mov %i1,%o1 C copy s1_ptr to mpn_copyi's srcp
64: call mpn_copyi
65: mov %i2,%o2 C copy n to mpn_copyi's count parameter
66:
67: add %sp,2223,%i1
68:
69: L(nooverlap):
70: C First multiply-add with low 32 bits of s2_limb
71: mov %i0,%o0
72: mov %i1,%o1
73: add %i2,%i2,%o2
74: call addmull
75: srl %i3,0,%o3
76:
77: mov %o0,%l0 C keep carry-out from accmull
78:
79: C Now multiply-add with high 32 bits of s2_limb, unless it is zero.
80: srlx %i3,32,%o3
81: brz,a,pn %o3,L(small)
82: mov %o0,%i0
83: mov %i1,%o1
84: add %i2,%i2,%o2
85: call addmulu
86: add %i0,4,%o0
87:
88: add %l0,%o0,%i0
89: L(small):
90: ret
91: restore %g0,%g0,%g0
92: EPILOGUE(mpn_addmul_1)
93:
94: C Put a zero in the text segment to allow us to t the address
95: C quickly when compiling for PIC
96: TEXT
97: ALIGN(4)
98: L(noll):
99: .word 0
100:
101: define(`LO',`(+4)')
102: define(`HI',`(-4)')
103:
104: define(`DLO',`(+4)')
105: define(`DHI',`(-4)')
106: define(`LOWPART')
107: define(`E',`L(l.$1)')
108: include_mpn(`sparc64/addmul1h.asm')
109:
110: define(`DLO',`(-4)')
111: define(`DHI',`(+4)')
112: undefine(`LOWPART')
113: define(`E',`L(u.$1)')
114: include_mpn(`sparc64/addmul1h.asm')
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>