1 ;! HP-PA __udiv_qrnnd division support, used from longlong.h.
2 ;! This version runs fast on pre-PA7000 CPUs.
4 ;! Copyright (C) 1993, 1994 Free Software Foundation, Inc.
6 ;! This file is part of the GNU MP Library.
8 ;! The GNU MP Library is free software; you can redistribute it and/or modify
9 ;! it under the terms of the GNU Lesser General Public License as published by
10 ;! the Free Software Foundation; either version 2.1 of the License, or (at your
11 ;! option) any later version.
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 Lesser General Public
16 ;! License for more details.
18 ;! You should have received a copy of the GNU Lesser 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.
30 ;! The code size is a bit excessive. We could merge the last two ds;addc
31 ;! sequences by simply moving the "bb,< Odd" instruction down. The only
32 ;! trouble is the FFFFFFFF code that would need some hacking.
38 .callinfo frame=0,no_calls
41 comb,< %r23,0,L$largedivisor
42 sub %r0,%r23,%r1 ;! clear cy as side-effect
108 comclr,>= %r25,%r0,%r0
115 extru %r24,31,1,%r20 ;! r20 = n0 & 1
117 extru %r23,30,31,%r22 ;! r22 = d >> 1
118 shd %r25,%r24,1,%r24 ;! r24 = new n0
119 extru %r25,30,31,%r25 ;! r25 = new n1
186 comclr,>= %r25,%r0,%r0
188 sh1addl %r25,%r20,%r25
193 L$odd: addib,sv,n 1,%r22,L$FF.. ;! r22 = (d / 2 + 1)
194 shd %r25,%r24,1,%r24 ;! r24 = new n0
195 extru %r25,30,31,%r25 ;! r25 = new n1
263 comclr,>= %r25,%r0,%r0
265 sh1addl %r25,%r20,%r25
266 ;! We have computed (n1,,n0) / (d + 1), q' = r28, r' = r25
267 add,nuv %r28,%r25,%r25
276 ;! This is just a special case of the code above.
277 ;! We come here when d == 0xFFFFFFFF
278 L$FF..: add,uv %r25,%r24,%r24