Annotation of cci/usr/src/lib/libc/tahoe/gen/divf.x, revision 1.1.1.1

1.1       root        1: 
                      2: #include       <machine/fp.h>
                      3: 
                      4: 
                      5:                        # here we count from 0 not from 1 as in fp.h
                      6: #define        HIDDEN  23      
                      7: 
                      8:        .text
                      9:        .globl  Xdivf
                     10: _divf:
                     11: Xdivf: .word   0xffc
                     12:        clrl    r1
                     13:        clrl    r3              # r3 - sign: 0 for positive,1 for negative.
                     14:        movl    4(fp),r0
                     15:        jgeq    1f
                     16:        movl    $1,r3
                     17: 1:     movl    12(fp),r2
                     18:        jgeq    2f
                     19:        bbc     $0,r3,1f        # seconed operand is negative.
                     20:        clrl    r3              # if first was negative, make result positive.
                     21:        jmp     2f
                     22: 1:     movl    $1,r3           # if first was positive, make result negative.
                     23: 2:     andl2   $EXPMASK,r0     # compute first 'pure'exponent.
                     24:        jeql    is_res1
                     25:        shrl    $EXPSHIFT,r0,r0
                     26:        subl2   $BIAS,r0        
                     27:        andl2   $EXPMASK,r2     # compute seconed 'pure'exponent.
                     28:        jeql    is_res2
                     29:        shrl    $EXPSHIFT,r2,r2
                     30:        subl2   $BIAS,r2
                     31:        subl3   r2,r0,r2        # subtruct the exponents.
                     32:        addl2   $BIAS,r2
                     33:        jleq    underf
                     34:                                # normalization can make the exp. smaller.
                     35:  #
                     36:  #     We have the sign in r3,the exponent in r2,now is the time to
                     37:  #     perform the division...
                     38:  #
                     39:        # fetch dividend. (r0)
                     40:        andl3   $(0!(EXPMASK | SIGNBIT)),4(fp),r0
                     41:        orl2    $(0!CLEARHID),r0
                     42:        clrl    r1
                     43:  
                     44:        # fetch divisor : (r6)
                     45:        andl3   $(0!(EXPMASK | SIGNBIT)),12(fp),r6
                     46:        orl2    $(0!CLEARHID),r6
                     47: 
                     48:        shll    $2,r6,r6        # make the divisor bigger so we will not
                     49:                                # get overflow at the divission.
                     50:        ediv    r6,r0,r0,r7     # quo to r0, rem to r7
                     51:        subl2   $6,r2           # to compensate for: normalization (-24),
                     52:                                # ediv (+32), shifting r6 (-2).
                     53:        
                     54: over:
                     55:        callf   $4,fnorm        # we can use fnorm because we have data
                     56:                                # at r1 as well.(sfnorm takes care only 
                     57:                                # of r0).
                     58: sign:
                     59: 1:     bbc     $0,r3,done
                     60:        orl2    $SIGNBIT,r0
                     61: done:  ret
                     62: 
                     63: is_res1:
                     64:        bbc     $31,4(fp),retz
                     65:        callf   $4,sfpresop
                     66:        ret
                     67: is_res2:
                     68:        bbc     $31,12(fp),z_div
                     69:        callf   $4,sfpresop
                     70:        ret
                     71: retz:
                     72:          clrl  r0
                     73:          ret
                     74: underf:
                     75:        callf   $4,sfpunder
                     76:        ret
                     77: z_div:
                     78:        callf   $4,sfpzdiv
                     79:        ret

unix.superglobalmegacorp.com

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