|
|
1.1 root 1:
2: #include "fp.h"
3: #include "fp_in_krnl.h"
4:
5:
6: /* here we count from 0 not from 1 as in fp.h */
7: #define HIDDEN 23
8:
9: .text
10: .globl _Kmulf # _Kmulf(acc_most,acc_least,op_most,op_least,hfs)
11: _Kmulf: .word 0xffc
12: clrl r3 /* r3 - sign: 0 for positive,1 for negative. */
13: movl 4(fp),r0
14: jgeq 1f
15: movl $1,r3
16: 1: movl 12(fp),r2
17: jgeq 2f
18: bbc $0,r3,1f /* seconed operand is negative. */
19: clrl r3 /* if first was negative, make result positive. */
20: jmp 2f
21: 1: movl $1,r3 /* if first was positive, make result negative. */
22: 2: andl2 $EXPMASK,r0 /* compute first 'pure'exponent. */
23: jeql retzero
24: shrl $EXPSHIFT,r0,r0
25: subl2 $BIASP1,r0
26: andl2 $EXPMASK,r2 /* compute seconed 'pure'exponent. */
27: jeql retzero
28: shrl $EXPSHIFT,r2,r2
29: subl2 $BIASP1,r2
30: addl2 r0,r2 /* add the exponents. */
31: addl2 $(BIASP1+2),r2
32: jleq underflow
33: cmpl r2,$258 /* normalization can make the exp. smaller. */
34: jgeq overflow
35: /*
36: * We have the sign in r3,the exponent in r2,now is the time to
37: * perform the multiplication...
38: */
39: /* fetch first fraction: (r0) */
40: andl3 $(0!(EXPMASK | SIGNBIT)),4(fp),r0
41: orl2 $(0!CLEARHID),r0
42: shll $7,r0,r0 /* leave the sign bit cleared. */
43:
44: /* fetch seconed fraction: (r4) */
45: andl3 $(0!(EXPMASK | SIGNBIT)),12(fp),r4
46: orl2 $(0!CLEARHID),r4
47: shll $7,r4,r4 /* leave the sign bit cleared. */
48:
49:
50: emul r4,r0,$0,r0
51: movl r0,r4 /* to see how much we realy need to shift. */
52: movl $6,r5 /* r5 - shift counter. */
53: shrl $7,r4,r4 /* dummy shift. */
54: 1: bbs $HIDDEN,r4,realshift
55: shll $1,r4,r4
56: decl r2 /* update exponent. */
57: jeql underflow
58: decl r5 /* update shift counter. */
59: jmp 1b
60: realshift:
61: shrl r5,r0,r0
62: bbc $0,r1,shiftmore
63: incl r1 /* rounding. */
64: shiftmore:
65: shrl $1,r0,r0
66: comb:
67: andl2 $CLEARHID,r0
68: shll $EXPSHIFT,r2,r4
69: orl2 r4,r0
70: cmpl r2,$256
71: jlss 1f
72: orl2 $HFS_OVF,*20(fp)
73: sign:
74: 1: bbc $0,r3,done
75: orl2 $SIGNBIT,r0
76: done: ret
77:
78:
79:
80: retzero:
81: clrl r0
82: ret
83: overflow:
84: orl2 $HFS_OVF,*20(fp)
1.1.1.2 ! root 85: movl $0x7fffffff,r0
! 86: bbc $0,r3,1f
! 87: orl2 $SIGNBIT,r0
! 88: 1: ret
1.1 root 89: underflow:
90: orl2 $HFS_UNDF,*20(fp)
1.1.1.2 ! root 91: movl $0x800000,r0
! 92: bbc $0,r3,1f
! 93: orl2 $SIGNBIT,r0
! 94: 1: ret
1.1 root 95:
96:
97:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.