[BACK]Return to udiv_qrnnd.asm CVS log [TXT][DIR] Up to [local] / OpenXM_contrib / gmp / mpn / pa64

Annotation of OpenXM_contrib/gmp/mpn/pa64/udiv_qrnnd.asm, Revision 1.1.1.1

1.1       ohara       1: dnl  HP-PA 2.0 64-bit mpn_udiv_qrnnd.
                      2:
                      3: dnl  Copyright 2001, 2002 Free Software Foundation, Inc.
                      4:
                      5: dnl  This file is part of the GNU MP Library.
                      6:
                      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.
                     11:
                     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.
                     16:
                     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 to
                     19: dnl  the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
                     20: dnl  MA 02111-1307, USA.
                     21:
                     22: include(`../config.m4')
                     23:
                     24: C This runs at about 280 cycles on both PA8000 and PA8500, corresponding to a
                     25: C bit more than 4 cycles/bit.
                     26:
                     27: C INPUT PARAMETERS
                     28: define(`n1',`%r26')
                     29: define(`n0',`%r25')
                     30: define(`d',`%r24')
                     31: define(`remptr',`%r23')
                     32:
                     33: define(`q',`%r28')
                     34: define(`dn',`%r29')
                     35:
                     36: define(`old_divstep',
                     37:        `add,dc         n0,n0,n0
                     38:        add,dc          n1,n1,n1
                     39:        sub,*<<         n1,d,%r22
                     40:        copy            %r22,n1')
                     41:
                     42: define(`divstep',
                     43:        `add            n0,n0,n0
                     44:        add,dc          n1,n1,n1
                     45:        sub             n1,d,%r1
                     46:        add,dc          q,q,q
                     47:        cmpclr,*<<      n1,d,%r0
                     48:        copy            %r1,n1
                     49: ')
                     50:
                     51: ifdef(`HAVE_ABI_2_0w',
                     52: `      .level  2.0W
                     53: ',`    .level  2.0N
                     54: ')
                     55: PROLOGUE(mpn_udiv_qrnnd)
                     56:        .proc
                     57:        .entry
                     58:        .callinfo       frame=0,no_calls,save_rp,entry_gr=7
                     59:
                     60: ifdef(`HAVE_ABI_2_0n',
                     61: `      depd            %r25,31,32,%r26
                     62:        depd            %r23,31,32,%r24
                     63:        copy            %r24,%r25
                     64:        ldd             -56(%r30),%r24
                     65:        ldw             -60(%r30),%r23
                     66: ')
                     67:        ldi             0,q
                     68:        cmpib,*>=       0,d,large_divisor
                     69:        ldi             8,%r31          C setup loop counter
                     70:
                     71:        sub             %r0,d,dn
                     72: Loop   divstep divstep divstep divstep divstep divstep divstep divstep
                     73:        addib,<>        -1,%r31,Loop
                     74:        nop
                     75:
                     76: ifdef(`HAVE_ABI_2_0n',
                     77: `      copy            %r28,%r29
                     78:        extrd,u         %r28,31,32,%r28
                     79: ')
                     80:        bve             (%r2)
                     81:        std             n1,0(remptr)    C store remainder
                     82:
                     83: large_divisor
                     84:        extrd,u         n0,63,1,%r19    C save lsb of dividend
                     85:        shrpd           n1,n0,1,n0      C n0 = lo(n1n0 >> 1)
                     86:        shrpd           %r0,n1,1,n1     C n1 = hi(n1n0 >> 1)
                     87:        extrd,u         d,63,1,%r20     C save lsb of divisor
                     88:        shrpd           %r0,d,1,d       C d = floor(orig_d / 2)
                     89:        add,l           %r20,d,d        C d = ceil(orig_d / 2)
                     90:
                     91:        sub             %r0,d,dn
                     92: Loop2  divstep divstep divstep divstep divstep divstep divstep divstep
                     93:        addib,<>        -1,%r31,Loop2
                     94:        nop
                     95:
                     96:        cmpib,*=        0,%r20,even_divisor
                     97:        shladd          n1,1,%r19,n1    C shift in omitted dividend lsb
                     98:
                     99:        add             d,d,d           C restore orig...
                    100:        sub             d,%r20,d        C ...d value
                    101:        sub             %r0,d,dn        C r21 = -d
                    102:
                    103:        add,*nuv        n1,q,n1         C fix remainder for omitted divisor lsb
                    104:        add,l           n1,dn,n1        C adjust remainder if rem. fix carried
                    105:        add,dc          %r0,q,q         C adjust quotient accordingly
                    106:
                    107:        sub,*<<         n1,d,%r0        C remainder >= divisor?
                    108:        add,l           n1,dn,n1        C adjust remainder
                    109:        add,dc          %r0,q,q         C adjust quotient
                    110:
                    111: even_divisor
                    112: ifdef(`HAVE_ABI_2_0n',
                    113: `      copy            %r28,%r29
                    114:        extrd,u         %r28,31,32,%r28
                    115: ')
                    116:        bve             (%r2)
                    117:        std             n1,0(remptr)    C store remainder
                    118:
                    119:        .procend
                    120: EPILOGUE(mpn_udiv_qrnnd)

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>