1/* Ksfnorm.s 1.3 86/01/05 */ 2 3#include "../tahoemath/fp.h" 4#include "../tahoemath/Kfp.h" 5#include "../tahoe/SYS.h" 6 7/* 8 * Ksfnorm(hfs) 9 */ 10 .text 11ENTRY(Ksfnorm, R6|R5|R4|R3|R2) 12 clrl r1 13 movl r0,r4 /* copy to temporary. */ 14 jeql retzero 15 clrl r3 /* r3 - pos of m.s.b */ 16inr00: ffs r4,r6 17 incl r6 18 addl2 r6,r3 19 shrl r6,r4,r4 20 jneq inr00 21 22cmpshift: 23 /* compute the shift (r4). */ 24 subl3 r3,$HID_POS,r4 25 jlss shiftr /* if less then zero we shift right. */ 26 shll r4,r0,r0 /* else we shift left. */ 27 subl2 r4,r2 /* uodate exponent. */ 28 jleq underflow /* if less then 0 (biased) it is underflow. */ 29 jmp combine /* go to combine exponent and fraction. */ 30shiftr: 31 mnegl r4,r4 32 shrl r4,r0,r0 /* shift right. */ 33 addl2 r4,r2 /* update exponent */ 34 cmpl r2,$256 35 jgeq overflow /* check for overflow. */ 36combine: 37 andl2 $CLEARHID,r0 /* clear the hidden bit. */ 38 shal $EXPSHIFT,r2,r2 /* shift the exponent to its proper place. */ 39 orl2 r2,r0 40 ret 41 42underflow: 43 orl2 $HFS_UNDF,*4(fp) 44 ret 45 46overflow: 47 orl2 $HFS_OVF,*4(fp) 48 ret 49retzero: 50 clrl r0 51 ret 52