|
|
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 _Kdivd # _Kdivd(acc_most,acc_least,op_most,op_least,hfs)
11: _Kdivd: .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
1.1.1.2 ! root 18: bbc $0,r3,1f # second operand is negative.
1.1 root 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 retz
24: shrl $EXPSHIFT,r0,r0
25: subl2 $BIAS,r0
1.1.1.2 ! root 26: andl2 $EXPMASK,r2 # compute second 'pure'exponent.
1.1 root 27: jeql retz2
28: shrl $EXPSHIFT,r2,r2
29: subl2 $BIAS,r2
30: subl3 r2,r0,r2 # subtruct the exponents.
31: addl2 $BIAS,r2
32: jleq underf
33: # normalization can make the exp. smaller.
34: #
35: # We have the sign in r3,the exponent in r2,now is the time to
36: # perform the division...
37: #
38: # fetch dividend. (r4,r5)
39: andl3 $(0!(EXPMASK | SIGNBIT)),4(fp),r4
40: orl2 $(0!CLEARHID),r4
41: movl 8(fp),r5
42:
43: # fetch divisor : (r6,r7)
44: andl3 $(0!(EXPMASK | SIGNBIT)),12(fp),r6
45: orl2 $(0!CLEARHID),r6
46: movl 16(fp),r7
47:
48: movl $0,r0 # init r0,r1 to be zeros
49: movl $0,r1
50: movl $(0!CLEARHID),r8# r8 first bit to set (if).
51: shll $1,r8,r8 # to have one more bit,because we might
52: # have to shift left to normelize.
53: movl $0,r9
54:
55: 2:
56: subl2 r7,r5
57: sbwc r6,r4
58: jgeq 1f
59: addl2 r7,r5
60: adwc r6,r4
61: shlq $1,r4,r4
62: shrq $1,r8,r8
63: jeql over
64: jmp 2b
65: 1:
66: orl2 r8,r0
67: orl2 r9,r1
68: shlq $1,r4,r4
69: shrq $1,r8,r8
70: jneq 2b
71:
72: over:
1.1.1.2 ! root 73: pushal 20(fp)
1.1 root 74: callf $8,Kfnorm
75: sign:
76: 1: bbc $0,r3,done
77: orl2 $SIGNBIT,r0
78: done: ret
79:
80: retz:
81: clrl r0
82: clrl r1
83: ret
84:
85: retz2: bbc $31,12(fp),z_div
86: clrl r0
87: clrl r1
88: ret
89: underf:
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: clrl r1
1.1 root 95: ret
96: z_div:
97: orl2 $HFS_DIVZ,*20(fp)
1.1.1.2 ! root 98: jmp retz
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.