Annotation of cci/usr/src/lib/libc/tahoe/gen/divd.x, revision 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  Xdivd
        !            10: _divd:
        !            11: Xdivd: .word   0xffc
        !            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. (r4,r5)
        !            39:        andl3   $(0!(EXPMASK | SIGNBIT)),4(fp),r4
        !            40:        orl2    $(0!CLEARHID),r4
        !            41:        movl    8(fp),r5
        !            42:  
        !            43:        # fetch divisor : (r6,r7)
        !            44:        andl3   $(0!(EXPMASK | SIGNBIT)),12(fp),r6
        !            45:        orl2    $(0!CLEARHID),r6
        !            46:        movl    16(fp),r7
        !            47: 
        !            48:        movl    $0,r0           # init r0,r1 to be zeros
        !            49:        movl    $0,r1
        !            50:        movl    $(0!CLEARHID),r8# r8 first bit to set (if).
        !            51:        shll    $1,r8,r8        # to have one more bit,because we might
        !            52:                                # have to shift left to normelize.
        !            53:        movl    $0,r9
        !            54: 
        !            55: 2:
        !            56:        subl2   r7,r5
        !            57:        sbwc    r6,r4
        !            58:        jgeq    1f
        !            59:        addl2   r7,r5
        !            60:        adwc    r6,r4
        !            61:        shlq    $1,r4,r4
        !            62:        shrq    $1,r8,r8
        !            63:        jeql    over
        !            64:        jmp     2b
        !            65: 1:     
        !            66:        orl2    r8,r0
        !            67:        orl2    r9,r1
        !            68:        shlq    $1,r4,r4
        !            69:        shrq    $1,r8,r8
        !            70:        jneq    2b
        !            71:        
        !            72: over:
        !            73:        callf   $4,fnorm
        !            74: sign:
        !            75: 1:     bbc     $0,r3,done
        !            76:        orl2    $SIGNBIT,r0
        !            77: done:  ret
        !            78: 
        !            79: is_res1:
        !            80:        bbc     $31,4(fp),retz
        !            81:        callf   $4,fpresop
        !            82:        ret
        !            83: is_res2:
        !            84:        bbc     $31,12(fp),z_div
        !            85:        callf   $4,fpresop
        !            86:        ret
        !            87: retz:
        !            88:          clrl  r0
        !            89:          clrl  r1
        !            90:          ret
        !            91: underf:
        !            92:        callf   $4,fpunder
        !            93:        ret
        !            94: z_div:
        !            95:        callf   $4,fpzdiv
        !            96:        ret

unix.superglobalmegacorp.com

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