1 ;! HP-PA __udiv_qrnnd division support, used from longlong.h.
2 ;! This version runs fast on pre-PA7000 CPUs.
4 ;! Copyright (C) 1993-2023 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. If not, see
20 ;! <https://www.gnu.org/licenses/>.
29 ;! The code size is a bit excessive. We could merge the last two ds;addc
30 ;! sequences by simply moving the "bb,< Odd" instruction down. The only
31 ;! trouble is the FFFFFFFF code that would need some hacking.
37 .callinfo frame=0,no_calls
40 comb,< %r23,%r0,L$largedivisor
41 sub %r0,%r23,%r1 ;! clear cy as side-effect
107 comclr,>= %r25,%r0,%r0
114 extru %r24,31,1,%r20 ;! r20 = n0 & 1
116 extru %r23,30,31,%r22 ;! r22 = d >> 1
117 shd %r25,%r24,1,%r24 ;! r24 = new n0
118 extru %r25,30,31,%r25 ;! r25 = new n1
185 comclr,>= %r25,%r0,%r0
187 sh1addl %r25,%r20,%r25
192 L$odd: addib,sv,n 1,%r22,L$FF.. ;! r22 = (d / 2 + 1)
193 shd %r25,%r24,1,%r24 ;! r24 = new n0
194 extru %r25,30,31,%r25 ;! r25 = new n1
262 comclr,>= %r25,%r0,%r0
264 sh1addl %r25,%r20,%r25
265 ;! We have computed (n1,,n0) / (d + 1), q' = r28, r' = r25
266 add,nuv %r28,%r25,%r25
275 ;! This is just a special case of the code above.
276 ;! We come here when d == 0xFFFFFFFF
277 L$FF..: add,uv %r25,%r24,%r24