1
dnl HP-PA 2.0 64-bit mpn_udiv_qrnnd_r.
3
dnl Copyright 2001, 2002, 2003 Free Software Foundation, Inc.
5
dnl This file is part of the GNU MP Library.
7
dnl The GNU MP Library is free software; you can redistribute it and/or modify
8
dnl it under the terms of the GNU Lesser General Public License as published
9
dnl by the Free Software Foundation; either version 2.1 of the License, or (at
10
dnl your option) any later version.
12
dnl The GNU MP Library is distributed in the hope that it will be useful, but
13
dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14
dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
15
dnl License for more details.
17
dnl You should have received a copy of the GNU Lesser General Public License
18
dnl along with the GNU MP Library; see the file COPYING.LIB. If not, write
19
dnl to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20
dnl Boston, MA 02110-1301, USA.
22
include(`../config.m4')
24
C This runs at about 280 cycles on both PA8000 and PA8500, corresponding to a
25
C bit more than 4 cycles/bit.
31
define(`remptr',`%r23')
51
ifdef(`HAVE_ABI_2_0w',
55
PROLOGUE(mpn_udiv_qrnnd_r)
56
ifdef(`HAVE_ABI_2_0n',
57
` depd %r25,31,32,%r26
64
cmpib,*>= 0,d,L(large_divisor)
65
ldi 8,%r31 C setup loop counter
69
divstep divstep divstep divstep divstep divstep divstep divstep
70
addib,<> -1,%r31,L(Loop)
73
ifdef(`HAVE_ABI_2_0n',
75
extrd,u %r28,31,32,%r28
78
std n1,0(remptr) C store remainder
81
extrd,u n0,63,1,%r19 C save lsb of dividend
82
shrpd n1,n0,1,n0 C n0 = lo(n1n0 >> 1)
83
shrpd %r0,n1,1,n1 C n1 = hi(n1n0 >> 1)
84
extrd,u d,63,1,%r20 C save lsb of divisor
85
shrpd %r0,d,1,d C d = floor(orig_d / 2)
86
add,l %r20,d,d C d = ceil(orig_d / 2)
90
divstep divstep divstep divstep divstep divstep divstep divstep
91
addib,<> -1,%r31,L(Loop2)
94
cmpib,*= 0,%r20,L(even_divisor)
95
shladd n1,1,%r19,n1 C shift in omitted dividend lsb
97
add d,d,d C restore orig...
98
sub d,%r20,d C ...d value
99
sub %r0,d,dn C r21 = -d
101
add,*nuv n1,q,n1 C fix remainder for omitted divisor lsb
102
add,l n1,dn,n1 C adjust remainder if rem. fix carried
103
add,dc %r0,q,q C adjust quotient accordingly
105
sub,*<< n1,d,%r0 C remainder >= divisor?
106
add,l n1,dn,n1 C adjust remainder
107
add,dc %r0,q,q C adjust quotient
110
ifdef(`HAVE_ABI_2_0n',
112
extrd,u %r28,31,32,%r28
115
std n1,0(remptr) C store remainder
116
EPILOGUE(mpn_udiv_qrnnd_r)