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

1.1       root        1: #ifdef LIBC_SCCS
                      2:        .asciz  "@(#)fnorm.s    1.1 (Berkeley/CCI) 7/2/86"
                      3: #endif LIBC_SCCS
                      4: 
                      5: #include <tahoemath/fp.h>
                      6: #include "DEFS.h"
                      7: 
                      8: ENTRY(fnorm, R2|R3|R4|R5|R6)
                      9:        movl    r0,r4           # copy to temporary.
                     10:        jneq    inr0
                     11:        movl    r1,r5
                     12:        clrl    r3              # r3 - pos of m.s.b
                     13: inr1:  ffs     r5,r6
                     14:        incl    r6
                     15:        addl2   r6,r3
                     16:        shrl    r6,r5,r5
                     17:        jneq    inr1
                     18:        cmpl    $0,r3
                     19:        jeql    retzero
                     20:        jmp     cmpshift
                     21: inr0:  movl    $32,r3
                     22: inr00: ffs     r4,r6
                     23:        incl    r6
                     24:        addl2   r6,r3
                     25:        shrl    r6,r4,r4
                     26:        jneq    inr00
                     27: 
                     28: cmpshift:
                     29:                                # compute the shift (r4).
                     30:        subl3   r3,$HID_R0R1,r4
                     31:        jlss    shiftr          # if less then zero we shift right.
                     32:        shlq    r4,r0,r0        # else we shift left.
                     33:        subl2   r4,r2           # uodate exponent.
                     34:        jleq    underflow       # if less then 0 (biased) it is underflow.
                     35:        jmp     combine         # go to combine exponent and fraction.
                     36: shiftr:
                     37:        mnegl   r4,r4
                     38:        shrq    r4,r0,r0        # shift right.
                     39:        addl2   r4,r2           # update exponent
                     40:        cmpl    r2,$256
                     41:        jgeq    overflow        # check for overflow.
                     42: combine:
                     43:        andl2   $CLEARHID,r0    # clear the hidden bit.
                     44:        shal    $EXPSHIFT,r2,r2 # shift the exponent to its proper place.
                     45:        orl2    r2,r0
                     46:        ret
                     47: 
                     48: underflow:
                     49:        callf   $4,fpunder
                     50:        ret
                     51: 
                     52: overflow:
                     53:        callf   $4,fpover
                     54:        ret
                     55: retzero:
                     56:        clrl    r0
                     57:        clrl    r1
                     58:        ret

unix.superglobalmegacorp.com

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