1 dnl SPARC v7 __udiv_qrnnd division support
, used from longlong.h.
2 dnl
This is for v7 CPUs without a floating
-point unit.
4 dnl Copyright
1993, 1994, 1996, 2000 Free Software Foundation
, Inc.
6 dnl
This file is part of the GNU MP Library.
8 dnl The GNU MP Library is free software
; you can redistribute it and/or modify
9 dnl it under the terms of
either:
11 dnl
* the GNU Lesser General
Public License as published by the Free
12 dnl Software Foundation
; either version 3 of the License, or (at your
13 dnl option
) any later version.
17 dnl
* the GNU General
Public License as published by the Free Software
18 dnl Foundation
; either version 2 of the License, or (at your option) any
21 dnl
or both
in parallel
, as here.
23 dnl The GNU MP Library is distributed
in the hope that it will be useful
, but
24 dnl WITHOUT ANY WARRANTY
; without even the implied warranty of MERCHANTABILITY
25 dnl
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
Public License
28 dnl You should have received copies of the GNU General
Public License
and the
29 dnl GNU Lesser General
Public License along with the GNU MP Library. If
not,
30 dnl see
https://www.gnu.
org/licenses
/.
33 include(`..
/config.m4
')
42 PROLOGUE(mpn_udiv_qrnnd)
53 L(p1): addx %o1,%o1,%o1
57 L(p2): addx %o1,%o1,%o1
61 L(p3): addx %o1,%o1,%o1
65 L(p4): addx %o1,%o1,%o1
78 L(n1): addx %o4,%o4,%o4
82 L(n2): addx %o4,%o4,%o4
86 L(n3): addx %o4,%o4,%o4
90 L(n4): addx %o4,%o4,%o4
101 and %o2,1,%o5 C %o5 = n0 & 1
105 or %g2,%o2,%o2 C %o2 = lo(n1n0 >> 1)
106 srl %o1,1,%o1 C %o1 = hi(n1n0 >> 1)
109 srl %o3,1,%g3 C %g3 = floor(d / 2)
110 add %g3,%g2,%g3 C %g3 = ceil(d / 2)
118 L(Lp1): addx %o1,%o1,%o1
122 L(Lp2): addx %o1,%o1,%o1
126 L(Lp3): addx %o1,%o1,%o1
130 L(Lp4): addx %o1,%o1,%o1
136 L(Lp5): add %o1,%o1,%o1 C << 1
147 L(Ln1): addx %o4,%o4,%o4
151 L(Ln2): addx %o4,%o4,%o4
155 L(Ln3): addx %o4,%o4,%o4
159 L(Ln4): addx %o4,%o4,%o4
165 L(Ln5): add %o4,%o4,%o4 C << 1
175 C q' in %o2. r
' in %o1
180 L(Lp6): subcc %o1,%o3,%g0
190 C q' in %o2. r
' in %o4
195 L(Ln6): subcc %o4,%o3,%g0
202 EPILOGUE(mpn_udiv_qrnnd)