1 dnl HP-PA __udiv_qrnnd division support, used from longlong.h.
2 dnl This version runs fast on pre-PA7000 CPUs.
4 dnl Copyright 1993, 1994, 2000, 2001, 2002 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 the GNU Lesser General Public License as published
10 dnl by the Free Software Foundation; either version 3 of the License, or (at
11 dnl your option) any later version.
13 dnl The GNU MP Library is distributed in the hope that it will be useful, but
14 dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15 dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
16 dnl License for more details.
18 dnl You should have received a copy of the GNU Lesser General Public License
19 dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
21 include(`../config.m4')
29 C The code size is a bit excessive. We could merge the last two ds;addc
30 C sequences by simply moving the "bb,< Odd" instruction down. The only
31 C trouble is the FFFFFFFF code that would need some hacking.
34 PROLOGUE(mpn_udiv_qrnnd)
35 comb,< %r23,0,L(largedivisor)
36 sub %r0,%r23,%r1 C clear cy as side-effect
102 comclr,>= %r25,%r0,%r0
109 extru %r24,31,1,%r19 C r19 = n0 & 1
111 extru %r23,30,31,%r22 C r22 = d >> 1
112 shd %r25,%r24,1,%r24 C r24 = new n0
113 extru %r25,30,31,%r25 C r25 = new n1
180 comclr,>= %r25,%r0,%r0
182 sh1addl %r25,%r19,%r25
188 addib,sv,n 1,%r22,L(FFFFFFFF) C r22 = (d / 2 + 1)
189 shd %r25,%r24,1,%r24 C r24 = new n0
190 extru %r25,30,31,%r25 C r25 = new n1
258 comclr,>= %r25,%r0,%r0
260 sh1addl %r25,%r19,%r25
261 C We have computed (n1,,n0) / (d + 1), q' = r28, r' = r25
262 add,nuv %r28,%r25,%r25
271 C This is just a special case of the code above.
272 C We come here when d == 0xFFFFFFFF
274 add,uv %r25,%r24,%r24