Annotation of OpenXM_contrib/gmp/mpn/sparc32/v8/udiv.asm, Revision 1.1.1.1
1.1 ohara 1: dnl SuperSPARC mpn_udiv_qrnnd division support, used from longlong.h.
2: dnl This is for SuperSPARC only, to compensate for its semi-functional
3: dnl udiv instruction.
4:
5: dnl Copyright 1993, 1994, 1996, 2000 Free Software Foundation, Inc.
6:
7: dnl This file is part of the GNU MP Library.
8:
9: dnl The GNU MP Library is free software; you can redistribute it and/or modify
10: dnl it under the terms of the GNU Lesser General Public License as published
11: dnl by the Free Software Foundation; either version 2.1 of the License, or (at
12: dnl your option) any later version.
13:
14: dnl The GNU MP Library is distributed in the hope that it will be useful, but
15: dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
16: dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
17: dnl License for more details.
18:
19: dnl You should have received a copy of the GNU Lesser General Public License
20: dnl along with the GNU MP Library; see the file COPYING.LIB. If not, write to
21: dnl the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
22: dnl MA 02111-1307, USA.
23:
24:
25: include(`../config.m4')
26:
27: C INPUT PARAMETERS
28: C rem_ptr i0
29: C n1 i1
30: C n0 i2
31: C d i3
32:
33: ASM_START()
34:
35: ifdef(`PIC',
36: ` TEXT
37: L(getpc):
38: retl
39: nop')
40:
41: TEXT
42: ALIGN(8)
43: L(C0): .double 0r4294967296
44: L(C1): .double 0r2147483648
45:
46: PROLOGUE(mpn_udiv_qrnnd)
47: save %sp,-104,%sp
48: st %i1,[%fp-8]
49: ld [%fp-8],%f10
50:
51: ifdef(`PIC',
52: `L(pc): call L(getpc) C put address of this insn in %o7
53: ldd [%o7+L(C0)-L(pc)],%f8',
54: ` sethi %hi(L(C0)),%o7
55: ldd [%o7+%lo(L(C0))],%f8')
56:
57: fitod %f10,%f4
58: cmp %i1,0
59: bge L(248)
60: mov %i0,%i5
61: faddd %f4,%f8,%f4
62: L(248):
63: st %i2,[%fp-8]
64: ld [%fp-8],%f10
65: fmuld %f4,%f8,%f6
66: cmp %i2,0
67: bge L(249)
68: fitod %f10,%f2
69: faddd %f2,%f8,%f2
70: L(249):
71: st %i3,[%fp-8]
72: faddd %f6,%f2,%f2
73: ld [%fp-8],%f10
74: cmp %i3,0
75: bge L(250)
76: fitod %f10,%f4
77: faddd %f4,%f8,%f4
78: L(250):
79: fdivd %f2,%f4,%f2
80:
81: ifdef(`PIC',
82: ` ldd [%o7+L(C1)-L(pc)],%f4',
83: ` sethi %hi(L(C1)),%o7
84: ldd [%o7+%lo(L(C1))],%f4')
85:
86: fcmped %f2,%f4
87: nop
88: fbge,a L(251)
89: fsubd %f2,%f4,%f2
90: fdtoi %f2,%f2
91: st %f2,[%fp-8]
92: b L(252)
93: ld [%fp-8],%i4
94: L(251):
95: fdtoi %f2,%f2
96: st %f2,[%fp-8]
97: ld [%fp-8],%i4
98: sethi %hi(-2147483648),%g2
99: xor %i4,%g2,%i4
100: L(252):
101: umul %i3,%i4,%g3
102: rd %y,%i0
103: subcc %i2,%g3,%o7
104: subxcc %i1,%i0,%g0
105: be L(253)
106: cmp %o7,%i3
107:
108: add %i4,-1,%i0
109: add %o7,%i3,%o7
110: st %o7,[%i5]
111: ret
112: restore
113: L(253):
114: blu L(246)
115: mov %i4,%i0
116: add %i4,1,%i0
117: sub %o7,%i3,%o7
118: L(246):
119: st %o7,[%i5]
120: ret
121: restore
122: EPILOGUE(mpn_udiv_qrnnd)
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>