Annotation of 43BSDTahoe/lib/libc/tahoe/fpe/divf.s, revision 1.1.1.1

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

unix.superglobalmegacorp.com

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