Annotation of cci/usr/src/lib/libc/tahoe/gen/mulf.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  Xmulf
                     10: _mulf:
                     11: Xmulf: .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   $BIASP1,r0      
                     26:        andl2   $EXPMASK,r2     /* compute seconed 'pure'exponent. */
                     27:        jeql    is_res2
                     28:        shrl    $EXPSHIFT,r2,r2
                     29:        subl2   $BIASP1,r2
                     30:        addl2   r0,r2           /* add the exponents. */
                     31:        addl2   $(BIASP1+2),r2
                     32:        jleq    underflow
                     33:        cmpl    r2,$258         /* normalization can make the exp. smaller. */
                     34:        jgeq    overflow
                     35:  /*
                     36:  *     We have the sign in r3,the exponent in r2,now is the time to
                     37:  *     perform the multiplication...
                     38:  */
                     39:        /* fetch first fraction: (r0) */
                     40:        andl3   $(0!(EXPMASK | SIGNBIT)),4(fp),r0
                     41:        orl2    $(0!CLEARHID),r0
                     42:        shll    $7,r0,r0        /* leave the sign bit cleared. */
                     43:  
                     44:        /* fetch seconed fraction: (r4) */
                     45:        andl3   $(0!(EXPMASK | SIGNBIT)),12(fp),r4
                     46:        orl2    $(0!CLEARHID),r4
                     47:        shll    $7,r4,r4        /* leave the sign bit cleared. */
                     48: 
                     49:  
                     50:        emul    r4,r0,$0,r0
                     51:        movl    r0,r4           /* to see how much we realy need to shift. */
                     52:        movl    $6,r5           /* r5 - shift counter. */
                     53:        shrl    $7,r4,r4        /* dummy shift. */
                     54: 1:     bbs     $HIDDEN,r4,realshift
                     55:        shll    $1,r4,r4
                     56:        decl    r2              /* update exponent. */
                     57:        jeql    underflow
                     58:        decl    r5              /* update shift counter. */
                     59:        jmp     1b
                     60: realshift:
                     61:        shrl    r5,r0,r0
                     62:        bbc     $0,r1,shiftmore
                     63:        incl    r1              /* rounding. */
                     64: shiftmore:
                     65:        shrl    $1,r0,r0
                     66: comb:
                     67:        andl2   $CLEARHID,r0
                     68:        shll    $EXPSHIFT,r2,r4
                     69:        orl2    r4,r0
                     70:        cmpl    r2,$256
                     71:        jlss    1f
                     72:        callf   $4,sfpover
                     73: sign:
                     74: 1:     bbc     $0,r3,done
                     75:        orl2    $SIGNBIT,r0
                     76: done:  ret
                     77: 
                     78: 
                     79: 
                     80: is_res1:
                     81:        bbc     $31,4(fp),retzero
                     82:        callf   $4,sfpresop
                     83:        ret
                     84: is_res2:
                     85:        bbc     $31,12(fp),retzero
                     86:        callf   $4,sfpresop
                     87:        ret
                     88:   retzero:
                     89:          clrl  r0
                     90:          ret
                     91:   overflow:
                     92:        callf   $4,sfpover
                     93:        jmp     sign
                     94:   underflow:
                     95:        callf   $4,sfpunder
                     96:        ret
                     97: 
                     98: 
                     99:        

unix.superglobalmegacorp.com

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