Annotation of 43BSDReno/sys/tahoemath/Kdivd.s, revision 1.1.1.1

1.1       root        1: /*     Kdivd.s 1.3     86/01/05        */
                      2: 
                      3: #include "../tahoemath/fp.h"
                      4: #include "../tahoemath/Kfp.h"
                      5: #include "../tahoe/SYS.h"
                      6: 
                      7: #define        HIDDEN  23              # here we count from 0 not from 1 as in fp.h
                      8: 
                      9:        .text
                     10: ENTRY(Kdivd, R9|R8|R7|R6|R5|R4|R3|R2)
                     11:        clrl    r3              # r3 - sign: 0 for positive,1 for negative.
                     12:        movl    4(fp),r0
                     13:        jgeq    1f
                     14:        movl    $1,r3
                     15: 1:     movl    12(fp),r2
                     16:        jgeq    2f
                     17:        bbc     $0,r3,1f        # seconed operand is negative.
                     18:        clrl    r3              # if first was negative, make result positive.
                     19:        jmp     2f
                     20: 1:     movl    $1,r3           # if first was positive, make result negative.
                     21: 2:     andl2   $EXPMASK,r0     # compute first 'pure'exponent.
                     22:        jeql    retz
                     23:        shrl    $EXPSHIFT,r0,r0
                     24:        subl2   $BIAS,r0        
                     25:        andl2   $EXPMASK,r2     # compute seconed 'pure'exponent.
                     26:        jeql    retz2
                     27:        shrl    $EXPSHIFT,r2,r2
                     28:        subl2   $BIAS,r2
                     29:        subl3   r2,r0,r2        # subtruct the exponents.
                     30:        addl2   $BIAS,r2
                     31:        jleq    underf
                     32:                                # normalization can make the exp. smaller.
                     33:  #
                     34:  #     We have the sign in r3,the exponent in r2,now is the time to
                     35:  #     perform the division...
                     36:  #
                     37:        # fetch dividend. (r4,r5)
                     38:        andl3   $(0!(EXPMASK | SIGNBIT)),4(fp),r4
                     39:        orl2    $(0!CLEARHID),r4
                     40:        movl    8(fp),r5
                     41:  
                     42:        # fetch divisor : (r6,r7)
                     43:        andl3   $(0!(EXPMASK | SIGNBIT)),12(fp),r6
                     44:        orl2    $(0!CLEARHID),r6
                     45:        movl    16(fp),r7
                     46: 
                     47:        movl    $0,r0           # init r0,r1 to be zeros
                     48:        movl    $0,r1
                     49:        movl    $(0!CLEARHID),r8# r8 first bit to set (if).
                     50:        shll    $1,r8,r8        # to have one more bit,because we might
                     51:                                # have to shift left to normelize.
                     52:        movl    $0,r9
                     53: 
                     54: 2:
                     55:        subl2   r7,r5
                     56:        sbwc    r6,r4
                     57:        jgeq    1f
                     58:        addl2   r7,r5
                     59:        adwc    r6,r4
                     60:        shlq    $1,r4,r4
                     61:        shrq    $1,r8,r8
                     62:        jeql    over
                     63:        jmp     2b
                     64: 1:     
                     65:        orl2    r8,r0
                     66:        orl2    r9,r1
                     67:        shlq    $1,r4,r4
                     68:        shrq    $1,r8,r8
                     69:        jneq    2b
                     70:        
                     71: over:
                     72:        pushl   20(fp)
                     73:        callf   $8,_Kfnorm
                     74: sign:
                     75: 1:     bbc     $0,r3,done
                     76:        orl2    $SIGNBIT,r0
                     77: done:  ret
                     78: 
                     79: retz:
                     80:          clrl  r0
                     81:          clrl  r1
                     82:          ret
                     83: 
                     84: retz2: bbc     $31,12(fp),z_div
                     85:          clrl  r0
                     86:          clrl  r1
                     87:          ret
                     88: underf:
                     89:        orl2    $HFS_UNDF,*20(fp)       
                     90:        ret
                     91: z_div:
                     92:        orl2    $HFS_DIVZ,*20(fp)
                     93:        ret

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.