|
|
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 "@(#)fnorm.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: ENTRY(fnorm, R2|R3|R4|R5|R6) ! 31: movl r0,r4 # copy to temporary. ! 32: jneq inr0 ! 33: movl r1,r5 ! 34: clrl r3 # r3 - pos of m.s.b ! 35: inr1: ffs r5,r6 ! 36: incl r6 ! 37: addl2 r6,r3 ! 38: shrl r6,r5,r5 ! 39: jneq inr1 ! 40: cmpl $0,r3 ! 41: jeql retzero ! 42: jmp cmpshift ! 43: inr0: movl $32,r3 ! 44: inr00: ffs r4,r6 ! 45: incl r6 ! 46: addl2 r6,r3 ! 47: shrl r6,r4,r4 ! 48: jneq inr00 ! 49: ! 50: cmpshift: ! 51: # compute the shift (r4). ! 52: subl3 r3,$HID_R0R1,r4 ! 53: jlss shiftr # if less then zero we shift right. ! 54: shlq r4,r0,r0 # else we shift left. ! 55: subl2 r4,r2 # uodate exponent. ! 56: jleq underflow # if less then 0 (biased) it is underflow. ! 57: jmp combine # go to combine exponent and fraction. ! 58: shiftr: ! 59: mnegl r4,r4 ! 60: shrq r4,r0,r0 # shift right. ! 61: addl2 r4,r2 # update exponent ! 62: cmpl r2,$256 ! 63: jgeq overflow # check for overflow. ! 64: combine: ! 65: andl2 $CLEARHID,r0 # clear the hidden bit. ! 66: shal $EXPSHIFT,r2,r2 # shift the exponent to its proper place. ! 67: orl2 r2,r0 ! 68: ret ! 69: ! 70: underflow: ! 71: callf $4,fpunder ! 72: ret ! 73: ! 74: overflow: ! 75: callf $4,fpover ! 76: ret ! 77: retzero: ! 78: clrl r0 ! 79: clrl r1 ! 80: ret
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.