Annotation of 43BSDReno/lib/libc/tahoe/fpe/sfnorm.s, revision 1.1

1.1     ! root        1: /*
        !             2:  * Copyright (c) 1986 Regents of the University of California.
        !             3:  * All rights reserved.
        !             4:  *
        !             5:  * This code is derived from software contributed to Berkeley by
        !             6:  * Computer Consoles Inc.
        !             7:  *
        !             8:  * Redistribution and use in source and binary forms are permitted
        !             9:  * provided that: (1) source distributions retain this entire copyright
        !            10:  * notice and comment, and (2) distributions including binaries display
        !            11:  * the following acknowledgement:  ``This product includes software
        !            12:  * developed by the University of California, Berkeley and its contributors''
        !            13:  * in the documentation or other materials provided with the distribution
        !            14:  * and in all advertising materials mentioning features or use of this
        !            15:  * software. Neither the name of the University nor the names of its
        !            16:  * contributors may be used to endorse or promote products derived
        !            17:  * from this software without specific prior written permission.
        !            18:  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
        !            19:  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
        !            20:  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
        !            21:  */
        !            22: 
        !            23: #if defined(SYSLIBC_SCCS) && !defined(lint)
        !            24:        .asciz "@(#)sfnorm.s    1.3 (Berkeley) 6/1/90"
        !            25: #endif /* SYSLIBC_SCCS and not lint */
        !            26: 
        !            27: #include <tahoemath/fp.h>
        !            28: #include "DEFS.h"
        !            29: 
        !            30: XENTRY(sfnorm, R2|R3|R4|R5|R6)
        !            31:        clrl    r1
        !            32:        movl    r0,r4           /* copy to temporary. */
        !            33:        jeql    retzero
        !            34:        clrl    r3              /* r3 - pos of m.s.b */
        !            35: inr00: ffs     r4,r6
        !            36:        incl    r6
        !            37:        addl2   r6,r3
        !            38:        shrl    r6,r4,r4
        !            39:        jneq    inr00
        !            40: 
        !            41: cmpshift:
        !            42:                                /* compute the shift (r4). */
        !            43:        subl3   r3,$HID_POS,r4
        !            44:        jlss    shiftr          /* if less then zero we shift right. */
        !            45:        shll    r4,r0,r0        /* else we shift left. */
        !            46:        subl2   r4,r2           /* uodate exponent. */
        !            47:        jleq    underflow       /* if less then 0 (biased) it is underflow. */
        !            48:        jmp     combine         /* go to combine exponent and fraction. */
        !            49: shiftr:
        !            50:        mnegl   r4,r4
        !            51:        shrl    r4,r0,r0        /* shift right. */
        !            52:        addl2   r4,r2           /* update exponent */
        !            53:        cmpl    r2,$256
        !            54:        jgeq    overflow        /* check for overflow. */
        !            55: combine:
        !            56:        andl2   $CLEARHID,r0    /* clear the hidden bit. */
        !            57:        shal    $EXPSHIFT,r2,r2 /* shift the exponent to its proper place. */
        !            58:        orl2    r2,r0
        !            59:        ret
        !            60: 
        !            61: underflow:
        !            62:        callf   $4,sfpunder
        !            63:        ret
        !            64: 
        !            65: overflow:
        !            66:        callf   $4,sfpover
        !            67:        ret
        !            68: retzero:
        !            69:        clrl    r0
        !            70:        ret

unix.superglobalmegacorp.com

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