Annotation of OpenXM_contrib/gmp/mpn/sparc64/mul_1h.asm, Revision 1.1.1.1
1.1 maekawa 1: dnl SPARC 64-bit mull -- Helper for mpn_mul_1.
2:
3: dnl Copyright (C) 1998, 2000 Free Software Foundation, Inc.
4:
5: dnl This file is part of the GNU MP Library.
6:
7: dnl The GNU MP Library is free software; you can redistribute it and/or modify
8: dnl it under the terms of the GNU Lesser General Public License as published
9: dnl by the Free Software Foundation; either version 2.1 of the License, or (at
10: dnl your option) any later version.
11:
12: dnl The GNU MP Library is distributed in the hope that it will be useful, but
13: dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14: dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
15: dnl License for more details.
16:
17: dnl You should have received a copy of the GNU Lesser General Public License
18: dnl along with the GNU MP Library; see the file COPYING.LIB. If not, write to
19: dnl the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
20: dnl MA 02111-1307, USA.
21:
22: mull:
23: save %sp,-256,%sp
24:
25: sethi %hi(0xffff0000),%o0
26: andn %i3,%o0,%o0
27: st %o0,[%fp-17]
28: ld [%fp-17],%f11
29: fxtod %f10,%f6
30:
31: srl %i3,16,%o0
32: st %o0,[%fp-17]
33: ld [%fp-17],%f11
34: fxtod %f10,%f8
35:
36: mov 0,%g3 C cy = 0
37:
38: ld [%i1+4],%f11
39: subcc %i2,1,%i2
40: dnl be,pn %icc,E(end1)
41: add %i1,4,%i1 C s1_ptr++
42:
43: fxtod %f10,%f2
44: ld [%i1-4],%f11
45: add %i1,4,%i1 C s1_ptr++
46: fmuld %f2,%f8,%f16
47: fmuld %f2,%f6,%f4
48: fdtox %f16,%f14
49: std %f14,[%fp-25]
50: fdtox %f4,%f12
51: subcc %i2,1,%i2
52: be,pn %icc,E(end2)
53: std %f12,[%fp-17]
54:
55: fxtod %f10,%f2
56: ld [%i1+4],%f11
57: add %i1,4,%i1 C s1_ptr++
58: fmuld %f2,%f8,%f16
59: fmuld %f2,%f6,%f4
60: fdtox %f16,%f14
61: std %f14,[%fp-41]
62: fdtox %f4,%f12
63: subcc %i2,1,%i2
64: dnl be,pn %icc,E(end3)
65: std %f12,[%fp-33]
66:
67: fxtod %f10,%f2
68: ld [%i1-4],%f11
69: add %i1,4,%i1 C s1_ptr++
70: ldx [%fp-25],%g2 C p16
71: fmuld %f2,%f8,%f16
72: ldx [%fp-17],%g1 C p0
73: fmuld %f2,%f6,%f4
74: sllx %g2,16,%g2 C align p16
75: fdtox %f16,%f14
76: add %g2,%g1,%g1 C add p16 to p0 (ADD1)
77: std %f14,[%fp-25]
78: fdtox %f4,%f12
79: add %i0,4,%i0 C res_ptr++
80: subcc %i2,1,%i2
81: be,pn %icc,E(end4)
82: std %f12,[%fp-17]
83:
84: b,a E(loop)
85: nop C nop is cheap to nullify
86:
87: ALIGN(16)
88: C BEGIN LOOP
89: E(loop):
90: fxtod %f10,%f2
91: ld [%i1+4],%f11
92: add %i1,4,%i1 C s1_ptr++
93: add %g3,%g1,%g4 C p += cy
94: srlx %g4,32,%g3
95: ldx [%fp-41],%g2 C p16
96: fmuld %f2,%f8,%f16
97: ldx [%fp-33],%g1 C p0
98: fmuld %f2,%f6,%f4
99: sllx %g2,16,%g2 C align p16
100: st %g4,[%i0-4+DLO]
101: fdtox %f16,%f14
102: add %g2,%g1,%g1 C add p16 to p0 (ADD1)
103: std %f14,[%fp-41]
104: fdtox %f4,%f12
105: std %f12,[%fp-33]
106: sub %i2,2,%i2
107: add %i0,4,%i0 C res_ptr++
108:
109: fxtod %f10,%f2
110: ld [%i1-4],%f11
111: add %i1,4,%i1 C s1_ptr++
112: add %g3,%g1,%g4 C p += cy
113: srlx %g4,32,%g3
114: ldx [%fp-25],%g2 C p16
115: fmuld %f2,%f8,%f16
116: ldx [%fp-17],%g1 C p0
117: fmuld %f2,%f6,%f4
118: sllx %g2,16,%g2 C align p16
119: st %g4,[%i0-4+DHI]
120: fdtox %f16,%f14
121: add %g2,%g1,%g1 C add p16 to p0 (ADD1)
122: std %f14,[%fp-25]
123: fdtox %f4,%f12
124: std %f12,[%fp-17]
125: brnz,pt %i2,E(loop)
126: add %i0,4,%i0 C res_ptr++
127: C END LOOP
128: E(loope):
129: E(end4):
130: fxtod %f10,%f2
131: add %g3,%g1,%g4 C p += cy
132: srlx %g4,32,%g3
133: ldx [%fp-41],%g2 C p16
134: fmuld %f2,%f8,%f16
135: ldx [%fp-33],%g1 C p0
136: fmuld %f2,%f6,%f4
137: sllx %g2,16,%g2 C align p16
138: st %g4,[%i0-4+DLO]
139: fdtox %f16,%f14
140: add %g2,%g1,%g1 C add p16 to p0 (ADD1)
141: std %f14,[%fp-41]
142: fdtox %f4,%f12
143: std %f12,[%fp-33]
144: add %i0,4,%i0 C res_ptr++
145:
146: add %g3,%g1,%g4 C p += cy
147: srlx %g4,32,%g3
148: ldx [%fp-25],%g2 C p16
149: ldx [%fp-17],%g1 C p0
150: sllx %g2,16,%g2 C align p16
151: st %g4,[%i0-4+DHI]
152: b,a E(yyy)
153:
154: E(end2):
155: fxtod %f10,%f2
156: fmuld %f2,%f8,%f16
157: fmuld %f2,%f6,%f4
158: fdtox %f16,%f14
159: std %f14,[%fp-41]
160: fdtox %f4,%f12
161: std %f12,[%fp-33]
162: ldx [%fp-25],%g2 C p16
163: ldx [%fp-17],%g1 C p0
164: sllx %g2,16,%g2 C align p16
165: E(yyy): add %g2,%g1,%g1 C add p16 to p0 (ADD1)
166: add %i0,4,%i0 C res_ptr++
167:
168: add %g3,%g1,%g4 C p += cy
169: srlx %g4,32,%g3
170: ldx [%fp-41],%g2 C p16
171: ldx [%fp-33],%g1 C p0
172: sllx %g2,16,%g2 C align p16
173: st %g4,[%i0-4+DLO]
174: add %g2,%g1,%g1 C add p16 to p0 (ADD1)
175: add %i0,4,%i0 C res_ptr++
176:
177: add %g3,%g1,%g4 C p += cy
178: st %g4,[%i0-4+DHI]
179: srlx %g4,32,%g4
180:
181: ret
182: restore %g0,%g4,%o0 C sideeffect: put cy in retreg
183: EPILOGUE(mull)
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>