Annotation of OpenXM/src/kan96xx/gmp-2.0.2/mpn/sparc32/udiv_nfp.S, Revision 1.1.1.1
1.1 maekawa 1: ! SPARC v7 __udiv_qrnnd division support, used from longlong.h.
2: ! This is for v7 CPUs without a floating-point unit.
3:
4: ! Copyright (C) 1993, 1994, 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: ! rem_ptr o0
26: ! n1 o1
27: ! n0 o2
28: ! d o3
29:
30: #include "sysdep.h"
31:
32: .text
33: .align 4
34: .global C_SYMBOL_NAME(__udiv_qrnnd)
35: C_SYMBOL_NAME(__udiv_qrnnd):
36: tst %o3
37: bneg Largedivisor
38: mov 8,%g1
39:
40: b Lp1
41: addxcc %o2,%o2,%o2
42:
43: Lplop: bcc Ln1
44: addxcc %o2,%o2,%o2
45: Lp1: addx %o1,%o1,%o1
46: subcc %o1,%o3,%o4
47: bcc Ln2
48: addxcc %o2,%o2,%o2
49: Lp2: addx %o1,%o1,%o1
50: subcc %o1,%o3,%o4
51: bcc Ln3
52: addxcc %o2,%o2,%o2
53: Lp3: addx %o1,%o1,%o1
54: subcc %o1,%o3,%o4
55: bcc Ln4
56: addxcc %o2,%o2,%o2
57: Lp4: addx %o1,%o1,%o1
58: addcc %g1,-1,%g1
59: bne Lplop
60: subcc %o1,%o3,%o4
61: bcc Ln5
62: addxcc %o2,%o2,%o2
63: Lp5: st %o1,[%o0]
64: retl
65: xnor %g0,%o2,%o0
66:
67: Lnlop: bcc Lp1
68: addxcc %o2,%o2,%o2
69: Ln1: addx %o4,%o4,%o4
70: subcc %o4,%o3,%o1
71: bcc Lp2
72: addxcc %o2,%o2,%o2
73: Ln2: addx %o4,%o4,%o4
74: subcc %o4,%o3,%o1
75: bcc Lp3
76: addxcc %o2,%o2,%o2
77: Ln3: addx %o4,%o4,%o4
78: subcc %o4,%o3,%o1
79: bcc Lp4
80: addxcc %o2,%o2,%o2
81: Ln4: addx %o4,%o4,%o4
82: addcc %g1,-1,%g1
83: bne Lnlop
84: subcc %o4,%o3,%o1
85: bcc Lp5
86: addxcc %o2,%o2,%o2
87: Ln5: st %o4,[%o0]
88: retl
89: xnor %g0,%o2,%o0
90:
91: Largedivisor:
92: and %o2,1,%o5 ! %o5 = n0 & 1
93:
94: srl %o2,1,%o2
95: sll %o1,31,%g2
96: or %g2,%o2,%o2 ! %o2 = lo(n1n0 >> 1)
97: srl %o1,1,%o1 ! %o1 = hi(n1n0 >> 1)
98:
99: and %o3,1,%g2
100: srl %o3,1,%g3 ! %g3 = floor(d / 2)
101: add %g3,%g2,%g3 ! %g3 = ceil(d / 2)
102:
103: b LLp1
104: addxcc %o2,%o2,%o2
105:
106: LLplop: bcc LLn1
107: addxcc %o2,%o2,%o2
108: LLp1: addx %o1,%o1,%o1
109: subcc %o1,%g3,%o4
110: bcc LLn2
111: addxcc %o2,%o2,%o2
112: LLp2: addx %o1,%o1,%o1
113: subcc %o1,%g3,%o4
114: bcc LLn3
115: addxcc %o2,%o2,%o2
116: LLp3: addx %o1,%o1,%o1
117: subcc %o1,%g3,%o4
118: bcc LLn4
119: addxcc %o2,%o2,%o2
120: LLp4: addx %o1,%o1,%o1
121: addcc %g1,-1,%g1
122: bne LLplop
123: subcc %o1,%g3,%o4
124: bcc LLn5
125: addxcc %o2,%o2,%o2
126: LLp5: add %o1,%o1,%o1 ! << 1
127: tst %g2
128: bne Oddp
129: add %o5,%o1,%o1
130: st %o1,[%o0]
131: retl
132: xnor %g0,%o2,%o0
133:
134: LLnlop: bcc LLp1
135: addxcc %o2,%o2,%o2
136: LLn1: addx %o4,%o4,%o4
137: subcc %o4,%g3,%o1
138: bcc LLp2
139: addxcc %o2,%o2,%o2
140: LLn2: addx %o4,%o4,%o4
141: subcc %o4,%g3,%o1
142: bcc LLp3
143: addxcc %o2,%o2,%o2
144: LLn3: addx %o4,%o4,%o4
145: subcc %o4,%g3,%o1
146: bcc LLp4
147: addxcc %o2,%o2,%o2
148: LLn4: addx %o4,%o4,%o4
149: addcc %g1,-1,%g1
150: bne LLnlop
151: subcc %o4,%g3,%o1
152: bcc LLp5
153: addxcc %o2,%o2,%o2
154: LLn5: add %o4,%o4,%o4 ! << 1
155: tst %g2
156: bne Oddn
157: add %o5,%o4,%o4
158: st %o4,[%o0]
159: retl
160: xnor %g0,%o2,%o0
161:
162: Oddp: xnor %g0,%o2,%o2
163: ! q' in %o2. r' in %o1
164: addcc %o1,%o2,%o1
165: bcc LLp6
166: addx %o2,0,%o2
167: sub %o1,%o3,%o1
168: LLp6: subcc %o1,%o3,%g0
169: bcs LLp7
170: subx %o2,-1,%o2
171: sub %o1,%o3,%o1
172: LLp7: st %o1,[%o0]
173: retl
174: mov %o2,%o0
175:
176: Oddn: xnor %g0,%o2,%o2
177: ! q' in %o2. r' in %o4
178: addcc %o4,%o2,%o4
179: bcc LLn6
180: addx %o2,0,%o2
181: sub %o4,%o3,%o4
182: LLn6: subcc %o4,%o3,%g0
183: bcs LLn7
184: subx %o2,-1,%o2
185: sub %o4,%o3,%o4
186: LLn7: st %o4,[%o0]
187: retl
188: mov %o2,%o0
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>