Annotation of OpenXM_contrib/pari-2.2/src/kernel/sparcv8/level0_sparcv8_super.S, Revision 1.1.1.1
1.1 noro 1: /* $Id: level0_sparcv8_super.S,v 1.2 2000/11/03 21:00:27 karim Exp $
2:
3: Copyright (C) 2000 The PARI group.
4:
5: This file is part of the PARI/GP package.
6:
7: PARI/GP is free software; you can redistribute it and/or modify it under the
8: terms of the GNU General Public License as published by the Free Software
9: Foundation. It is distributed in the hope that it will be useful, but WITHOUT
10: ANY WARRANTY WHATSOEVER.
11:
12: Check the License for details. You should have received a copy of it, along
13: with the package; see the file 'COPYING'. If not, write to the Free Software
14: Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
15:
16: /* This file defines some "level 0" kernel functions for SPARC V8 */
17: /* These are optimised for SuperSparc */
18: /* The following symbols are defined in this file : */
19: /* divll bfffo (& tabshi) */
20: /* But divll have to use hiremainder, so it is different when */
21: /* hiremainder is inline or not */
22: /* If libpari.so is compiled with gcc, you should compile all */
23: /* files with gcc */
24:
25: #if defined(sun) || defined(NeXT)
26: # ifdef __STDC__
27: # define C(entrypoint) _##entrypoint
28: # else
29: # define C(entrypoint) _/**/entrypoint
30: # endif
31: #elif defined(linux)
32: # define C(entrypoint) entrypoint
33: #endif
34: #if defined(sun) || defined(linux)
35: # define GLOBL .global
36: #elif defined(NeXT)
37: # define GLOBL .globl
38: #endif
39:
40: #if defined(sun) || defined(linux)
41: .seg "data"
42: .align 4
43: C(tabshi): .word 4,3,2,2,1,1,1,1,0,0,0,0,0,0,0,0
44:
45: .seg "text"
46: #elif defined(NeXT)
47: .data
48: .align 3
49: C(tabshi):
50: .long 4
51: .long 3
52: .long 2
53: .long 2
54: .long 1
55: .long 1
56: .long 1
57: .long 1
58: .long 0
59: .long 0
60: .long 0
61: .long 0
62: .long 0
63: .long 0
64: .long 0
65: .long 0
66:
67: .text
68: .align 2
69: #endif
70: GLOBL C(bfffo),C(divll)
71:
72: C(bfffo): sethi %hi(65535),%o2
73: or %o2,%lo(65535),%o2
74: cmp %o0,%o2
75: bleu 1f
76: mov 28,%o1
77: mov 12,%o1
78: srl %o0,16,%o0
79: 1: cmp %o0,255
80: bleu 2f
81: cmp %o0,15
82: add %o1,-8,%o1
83: srl %o0,8,%o0
84: cmp %o0,15
85: 2: bleu 3f
86: sethi %hi(C(tabshi)),%o2
87: add %o1,-4,%o1
88: srl %o0,4,%o0
89: 3: or %o2,%lo(C(tabshi)),%o2
90: sll %o0,2,%o3
91: ld [%o3+%o2],%o0
92: retl
93: add %o1,%o0,%o0
94:
95: #ifdef __GNUC__
96: #define SAVE_HI(X) mov X,%g5
97: #define LOAD_HI(X) mov %g5,X
98: #define LOAD_Hi(X)
99: #else
100: #define SAVE_HI(X) st X,[%o4+%lo(C(hiremainder))]
101: #define LOAD_HI(X) sethi %hi(C(hiremainder)),%o4
102: #define LOAD_Hi(X) ld [%o4+%lo(C(hiremainder))],X
103: #endif
104:
105: C(divll): LOAD_HI(%o2)
106: LOAD_Hi(%o2)
107: sethi %hi(0xfff00000),%o5
108: andcc %o5,%o2,%g0
109: bnz,a C(divlllong)
110: subcc %o2,%o1,%g0
111: wr %o2,%g0,%y
112: mov %o0,%o3
113: nop
114: nop
115: udivcc %o0,%o1,%o0
116: bvc 1f
117: umul %o0,%o1,%o5
118: mov 0x2f,%o0
119: call C(pari_err),1
120: nop
121: 1: subcc %o3,%o5,%o2
122: retl
123: SAVE_HI(%o2)
124:
125: #define SS0(label) \
126: addx %o2,%o2,%o2;\
127: subcc %o2,%o1,%o3;\
128: bcc label;\
129: addxcc %o0,%o0,%o0
130:
131: #define SS1(label) \
132: addx %o3,%o3,%o3;\
133: subcc %o3,%o1,%o2;\
134: bcc label;\
135: addxcc %o0,%o0,%o0
136:
137:
138: C(divlllong):
139: blu 1f
140: addcc %o1,%o1,%g0
141: mov 0x2f,%o0
142: call C(pari_err),1
143: nop
144: 1: bcc Lsmalldiv
145: andcc %o1,1,%g0
146: be Levendiv
147: srl %o1,1,%o1
148: add %o1,1,%o1
149: subcc %o2,%o1,%o3
150: bcc Lb01
151: addxcc %o0,%o0,%o0
152: La01: SS0(Lb02)
153: La02: SS0(Lb03)
154: La03: SS0(Lb04)
155: La04: SS0(Lb05)
156: La05: SS0(Lb06)
157: La06: SS0(Lb07)
158: La07: SS0(Lb08)
159: La08: SS0(Lb09)
160: La09: SS0(Lb10)
161: La10: SS0(Lb11)
162: La11: SS0(Lb12)
163: La12: SS0(Lb13)
164: La13: SS0(Lb14)
165: La14: SS0(Lb15)
166: La15: SS0(Lb16)
167: La16: SS0(Lb17)
168: La17: SS0(Lb18)
169: La18: SS0(Lb19)
170: La19: SS0(Lb20)
171: La20: SS0(Lb21)
172: La21: SS0(Lb22)
173: La22: SS0(Lb23)
174: La23: SS0(Lb24)
175: La24: SS0(Lb25)
176: La25: SS0(Lb26)
177: La26: SS0(Lb27)
178: La27: SS0(Lb28)
179: La28: SS0(Lb29)
180: La29: SS0(Lb30)
181: La30: SS0(Lb31)
182: La31: SS0(Lb32)
183: La32: addx %o2,%o2,%o2
184: xor %o0,-1,%o0
185: add %o1,%o1,%o1
186: sub %o1,1,%o1
187: addcc %o0,%o2,%o2
188: bcc 1f
189: subcc %o2,%o1,%o3
190: subcc %o3,%o1,%o2
191: bcs 2f
192: add %o0,1,%o0
193: add %o0,1,%o0
194: 3: retl
195: SAVE_HI(%o2)
196: 1: bcs 3b
197: nop
198: add %o0,1,%o0
199: 2: retl
200: SAVE_HI(%o3)
201:
202: Lb01: SS1(La02)
203: Lb02: SS1(La03)
204: Lb03: SS1(La04)
205: Lb04: SS1(La05)
206: Lb05: SS1(La06)
207: Lb06: SS1(La07)
208: Lb07: SS1(La08)
209: Lb08: SS1(La09)
210: Lb09: SS1(La10)
211: Lb10: SS1(La11)
212: Lb11: SS1(La12)
213: Lb12: SS1(La13)
214: Lb13: SS1(La14)
215: Lb14: SS1(La15)
216: Lb15: SS1(La16)
217: Lb16: SS1(La17)
218: Lb17: SS1(La18)
219: Lb18: SS1(La19)
220: Lb19: SS1(La20)
221: Lb20: SS1(La21)
222: Lb21: SS1(La22)
223: Lb22: SS1(La23)
224: Lb23: SS1(La24)
225: Lb24: SS1(La25)
226: Lb25: SS1(La26)
227: Lb26: SS1(La27)
228: Lb27: SS1(La28)
229: Lb28: SS1(La29)
230: Lb29: SS1(La30)
231: Lb30: SS1(La31)
232: Lb31: SS1(La32)
233: Lb32: addx %o3,%o3,%o2
234: xor %o0,-1,%o0
235: add %o1,%o1,%o1
236: sub %o1,1,%o1
237: addcc %o0,%o2,%o2
238: bcc 1f
239: subcc %o2,%o1,%o3
240: subcc %o3,%o1,%o2
241: bcs 2f
242: add %o0,1,%o0
243: add %o0,1,%o0
244: 3: retl
245: SAVE_HI(%o2)
246: 1: bcs 3b
247: nop
248: add %o0,1,%o0
249: 2: retl
250: SAVE_HI(%o3)
251:
252: Lsmalldiv:
253: addcc %o0,%o0,%o0
254: Lc00: SS0(Ld01)
255: Lc01: SS0(Ld02)
256: Lc02: SS0(Ld03)
257: Lc03: SS0(Ld04)
258: Lc04: SS0(Ld05)
259: Lc05: SS0(Ld06)
260: Lc06: SS0(Ld07)
261: Lc07: SS0(Ld08)
262: Lc08: SS0(Ld09)
263: Lc09: SS0(Ld10)
264: Lc10: SS0(Ld11)
265: Lc11: SS0(Ld12)
266: Lc12: SS0(Ld13)
267: Lc13: SS0(Ld14)
268: Lc14: SS0(Ld15)
269: Lc15: SS0(Ld16)
270: Lc16: SS0(Ld17)
271: Lc17: SS0(Ld18)
272: Lc18: SS0(Ld19)
273: Lc19: SS0(Ld20)
274: Lc20: SS0(Ld21)
275: Lc21: SS0(Ld22)
276: Lc22: SS0(Ld23)
277: Lc23: SS0(Ld24)
278: Lc24: SS0(Ld25)
279: Lc25: SS0(Ld26)
280: Lc26: SS0(Ld27)
281: Lc27: SS0(Ld28)
282: Lc28: SS0(Ld29)
283: Lc29: SS0(Ld30)
284: Lc30: SS0(Ld31)
285: Lc31: SS0(Ld32)
286: Lc32: xor %o0,-1,%o0
287: retl
288: SAVE_HI(%o2)
289:
290: Ld01: SS1(Lc02)
291: Ld02: SS1(Lc03)
292: Ld03: SS1(Lc04)
293: Ld04: SS1(Lc05)
294: Ld05: SS1(Lc06)
295: Ld06: SS1(Lc07)
296: Ld07: SS1(Lc08)
297: Ld08: SS1(Lc09)
298: Ld09: SS1(Lc10)
299: Ld10: SS1(Lc11)
300: Ld11: SS1(Lc12)
301: Ld12: SS1(Lc13)
302: Ld13: SS1(Lc14)
303: Ld14: SS1(Lc15)
304: Ld15: SS1(Lc16)
305: Ld16: SS1(Lc17)
306: Ld17: SS1(Lc18)
307: Ld18: SS1(Lc19)
308: Ld19: SS1(Lc20)
309: Ld20: SS1(Lc21)
310: Ld21: SS1(Lc22)
311: Ld22: SS1(Lc23)
312: Ld23: SS1(Lc24)
313: Ld24: SS1(Lc25)
314: Ld25: SS1(Lc26)
315: Ld26: SS1(Lc27)
316: Ld27: SS1(Lc28)
317: Ld28: SS1(Lc29)
318: Ld29: SS1(Lc30)
319: Ld30: SS1(Lc31)
320: Ld31: SS1(Lc32)
321: Ld32: xor %o0,-1,%o0
322: retl
323: SAVE_HI(%o3)
324:
325: Levendiv:
326: subcc %o2,%o1,%o3
327: bcc Lf01
328: addxcc %o0,%o0,%o0
329: Le01: SS0(Lf02)
330: Le02: SS0(Lf03)
331: Le03: SS0(Lf04)
332: Le04: SS0(Lf05)
333: Le05: SS0(Lf06)
334: Le06: SS0(Lf07)
335: Le07: SS0(Lf08)
336: Le08: SS0(Lf09)
337: Le09: SS0(Lf10)
338: Le10: SS0(Lf11)
339: Le11: SS0(Lf12)
340: Le12: SS0(Lf13)
341: Le13: SS0(Lf14)
342: Le14: SS0(Lf15)
343: Le15: SS0(Lf16)
344: Le16: SS0(Lf17)
345: Le17: SS0(Lf18)
346: Le18: SS0(Lf19)
347: Le19: SS0(Lf20)
348: Le20: SS0(Lf21)
349: Le21: SS0(Lf22)
350: Le22: SS0(Lf23)
351: Le23: SS0(Lf24)
352: Le24: SS0(Lf25)
353: Le25: SS0(Lf26)
354: Le26: SS0(Lf27)
355: Le27: SS0(Lf28)
356: Le28: SS0(Lf29)
357: Le29: SS0(Lf30)
358: Le30: SS0(Lf31)
359: Le31: SS0(Lf32)
360: Le32: addx %o2,%o2,%o2
361: xor %o0,-1,%o0
362: retl
363: SAVE_HI(%o2)
364:
365: Lf01: SS1(Le02)
366: Lf02: SS1(Le03)
367: Lf03: SS1(Le04)
368: Lf04: SS1(Le05)
369: Lf05: SS1(Le06)
370: Lf06: SS1(Le07)
371: Lf07: SS1(Le08)
372: Lf08: SS1(Le09)
373: Lf09: SS1(Le10)
374: Lf10: SS1(Le11)
375: Lf11: SS1(Le12)
376: Lf12: SS1(Le13)
377: Lf13: SS1(Le14)
378: Lf14: SS1(Le15)
379: Lf15: SS1(Le16)
380: Lf16: SS1(Le17)
381: Lf17: SS1(Le18)
382: Lf18: SS1(Le19)
383: Lf19: SS1(Le20)
384: Lf20: SS1(Le21)
385: Lf21: SS1(Le22)
386: Lf22: SS1(Le23)
387: Lf23: SS1(Le24)
388: Lf24: SS1(Le25)
389: Lf25: SS1(Le26)
390: Lf26: SS1(Le27)
391: Lf27: SS1(Le28)
392: Lf28: SS1(Le29)
393: Lf29: SS1(Le30)
394: Lf30: SS1(Le31)
395: Lf31: SS1(Le32)
396: Lf32: addx %o3,%o3,%o3
397: xor %o0,-1,%o0
398: retl
399: SAVE_HI(%o3)
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>