Annotation of researchv9/libc/sun/frexp.s, revision 1.1

1.1     ! root        1:        .data
        !             2: /*     .asciz  "@(#)frexp.s 1.1 86/02/03 SMI"  */
        !             3:        .text
        !             4: 
        !             5: #include "fpcrtdefs.h"
        !             6: 
        !             7:        NSAVED   = 5*4  | save registers d2-d7
        !             8:        SAVEMASK = 0x3f00
        !             9:        RESTMASK = 0x00fc
        !            10: 
        !            11:        M0      = d0
        !            12:        M1      = d1
        !            13:        EXP     = d2
        !            14:        TYPE    = d3
        !            15:        /* type values: */
        !            16:            ZERO  = 1 | wonderful
        !            17:            GU    = 2
        !            18:            PLAIN = 3
        !            19:            INF   = 4
        !            20:            NAN   = 5
        !            21: 
        !            22: /*
        !            23:  * double
        !            24:  * frexp( value, eptr)
        !            25:  *      double value;
        !            26:  *      int *eptr;
        !            27:  *
        !            28:  * return a value v s.t. fabs(v) < 1.0
        !            29:  * and return *eptr value e s.t.
        !            30:  *       v * (2**e) == value
        !            31:  */
        !            32: 
        !            33:        .globl  _frexp
        !            34: _frexp:        link    a6,#0
        !            35:        MCOUNT
        !            36:        movl    a6@(8),d0       | suck parameters into registers
        !            37:        movl    a6@(12),d1
        !            38:        movl    a6@(16),a0
        !            39:        moveml  #SAVEMASK,sp@-  | state save
        !            40:        jbsr    d_unpk
        !            41:        cmpb    #PLAIN,TYPE     | is it a funny number?
        !            42:        beqs    2$              | Branch if normal.
        !            43:        bgts    gohome          | yes -- repack and forget
        !            44:        cmpb    #ZERO,TYPE
        !            45:        beqs    gohome          | can't do much with zero, either
        !            46: 1$:
        !            47:        subqw   #1,EXP          | Subnormal requires normalization.
        !            48:        lsll    #1,d1
        !            49:        roxll   #1,d0
        !            50:        btst    #20,d0
        !            51:        beqs    1$              | Branch if not yet normalized.
        !            52: 2$:                    | normal path through here
        !            53:        addw    #(52+1),EXP     | return current exp val +1
        !            54:                                | 52 is unpacked bias -- mantissa has point on right?
        !            55:        extl    EXP
        !            56:        movl    EXP,a0@
        !            57:        movw    #-53,EXP        | repack with exp val of -1
        !            58: gohome:
        !            59:        jbsr    d_pack
        !            60: gone:  moveml  sp@+,#RESTMASK
        !            61:        unlk    a6
        !            62:        rts

unix.superglobalmegacorp.com

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