Commit | Line | Data |
---|---|---|
9d1834ba | 1 | /* Kexpf.s 1.3 86/01/05 */ |
2b252132 | 2 | |
9d1834ba | 3 | #include "../tahoe/SYS.h" |
2b252132 | 4 | |
253ac037 | 5 | .text |
2b252132 | 6 | ENTRY(Kexpf, R4|R3) |
253ac037 SL |
7 | subl3 $88,fp,sp |
8 | tstl 4(fp) | |
2b252132 SL |
9 | jneq 1f |
10 | movl one,r0 | |
253ac037 | 11 | ret |
2b252132 SL |
12 | 1: |
13 | lnd _maxf | |
253ac037 | 14 | cmpd 4(fp) |
2b252132 | 15 | jleq 1f |
253ac037 SL |
16 | clrl r0 |
17 | ret | |
2b252132 SL |
18 | 1: |
19 | cmpd2 4(fp),_maxf | |
20 | jleq 1f | |
253ac037 SL |
21 | ldd _HUGE |
22 | cvdf | |
23 | stf r0 | |
24 | ret | |
2b252132 | 25 | 1: |
253ac037 | 26 | pushl 20(fp) # hfs |
2b252132 SL |
27 | ldd _log2e; pushd |
28 | ldd 4(fp); pushd | |
253ac037 SL |
29 | callf $24,_Kmuld |
30 | ldd r0 | |
31 | std 4(fp) | |
32 | ||
33 | pushl 20(fp) # hfs | |
34 | pushl 8(fp) | |
35 | pushl 4(fp) | |
36 | callf $16,_Kfloorf | |
37 | movl r0,-88(fp) # (int)ent from Kfloorf | |
38 | ||
39 | cvlf -88(fp) | |
40 | clrl r1 | |
41 | stf r0 | |
42 | pushl 20(fp) # hfs | |
43 | pushl r1 | |
44 | pushl r0 | |
2b252132 | 45 | ldd 4(fp); pushd |
253ac037 SL |
46 | callf $24,_Ksubd # (arg - ent) |
47 | ||
48 | pushl 20(fp) # hfs | |
2b252132 SL |
49 | ldd half; pushd |
50 | ldd r0; pushd | |
253ac037 | 51 | callf $24,_Ksubd |
2b252132 | 52 | ldd r0; std -60(fp) # fract |
253ac037 SL |
53 | |
54 | pushl 20(fp) # hfs | |
55 | pushd | |
56 | pushd | |
57 | callf $24,_Kmuld | |
2b252132 | 58 | ldd r0; std -84(fp) # xsq |
253ac037 SL |
59 | |
60 | pushl 20(fp) # hfs | |
61 | pushd # xsq | |
2b252132 | 62 | ldd _p2; pushd |
253ac037 SL |
63 | callf $24,_Kmuld |
64 | ||
65 | pushl 20(fp) # hfs | |
2b252132 SL |
66 | ldd _p1; pushd |
67 | ldd r0; pushd | |
253ac037 SL |
68 | callf $24,_Kaddd |
69 | ||
70 | pushl 20(fp) # hfs | |
2b252132 SL |
71 | ldd -84(fp); pushd |
72 | ldd r0; pushd | |
253ac037 SL |
73 | callf $24,_Kmuld |
74 | ||
75 | pushl 20(fp) # hfs | |
2b252132 SL |
76 | ldd _p0; pushd |
77 | ldd r0; pushd | |
253ac037 SL |
78 | callf $24,_Kaddd |
79 | ||
80 | pushl 20(fp) # hfs | |
2b252132 SL |
81 | ldd -60(fp); pushd # fract |
82 | ldd r0; pushd | |
253ac037 | 83 | callf $24,_Kmuld |
2b252132 | 84 | ldd r0; std -68(fp) # temp1 |
253ac037 SL |
85 | |
86 | pushl 20(fp) # hfs | |
2b252132 SL |
87 | ldd -84(fp); pushd # xsq |
88 | ldd _q2; pushd | |
253ac037 SL |
89 | callf $24,_Kmuld |
90 | ||
91 | pushl 20(fp) # hfs | |
2b252132 SL |
92 | ldd _q1; pushd |
93 | ldd r0; pushd | |
253ac037 SL |
94 | callf $24,_Kaddd |
95 | ||
96 | pushl 20(fp) # hfs | |
2b252132 SL |
97 | ldd -84(fp); pushd |
98 | ldd r0; pushd | |
253ac037 SL |
99 | callf $24,_Kmuld |
100 | ||
101 | pushl 20(fp) # hfs | |
2b252132 SL |
102 | ldd _q0; pushd |
103 | ldd r0; pushd | |
253ac037 | 104 | callf $24,_Kaddd |
2b252132 | 105 | ldd r0; std -76(fp) # temp2 |
253ac037 SL |
106 | |
107 | pushl 20(fp) # hfs for Kldexpf | |
108 | pushl -88(fp) # ent | |
109 | ||
110 | pushl 20(fp) # hfs tor temp2+temp1 | |
2b252132 SL |
111 | ldd -68(fp); pushd # temp1 |
112 | ldd -76(fp); pushd # temp2 | |
253ac037 SL |
113 | callf $24,_Kaddd |
114 | ||
115 | pushl 20(fp) # hfs | |
2b252132 SL |
116 | ldd _sqrt2; pushd |
117 | ldd r0; pushd # temp2+temp1 | |
253ac037 | 118 | callf $24,_Kmuld |
2b252132 | 119 | ldd r0; std r2 # sqrt2*(temp2+temp1) |
253ac037 SL |
120 | |
121 | pushl 20(fp) # hfs | |
122 | ldd -68(fp) | |
123 | pushd | |
124 | ldd -76(fp) | |
125 | pushd | |
126 | callf $24,_Ksubd # temp2-temp1 | |
127 | ||
128 | pushl 20(fp) # hfs | |
129 | ldd r0 | |
130 | pushd # temp2-temp1 | |
131 | ldd r2 | |
132 | pushd | |
133 | callf $24,_Kdivd | |
134 | ||
135 | ldd r0 | |
136 | pushd | |
137 | callf $20,_Kldexpf | |
138 | ||
139 | #pushl 20(fp) # hfs | |
140 | #pushl $0 | |
141 | #pushl r0 # cvlf r0 | |
142 | #pushl $0 | |
143 | #pushl $0 | |
144 | #callf $24,_Kcvtld | |
145 | ||
146 | #ldd r0 | |
147 | #cvdf | |
148 | #stf r0 | |
149 | ret | |
150 | ||
151 | /* file : Kfloorf.x | |
152 | */ | |
153 | .text | |
154 | .globl _Kfloorf | |
155 | .data | |
156 | .align 2 | |
157 | L19: .long 0x40800000, 0x00000000 # .double 1 | |
158 | .text | |
159 | .set L13,0x0 | |
160 | .data | |
161 | .text | |
162 | _Kfloorf: | |
163 | .word L13 | |
164 | subl3 $60,fp,sp | |
165 | tstl 4(fp) # if (d<0.0) { | |
166 | jgeq L17 | |
167 | lnd 4(fp) | |
168 | std 4(fp) # d = -d; | |
169 | pushl 12(fp) # hfs | |
170 | addl3 $4,fp,-(sp) # &d | |
171 | pushl 8(fp) | |
172 | pushl 4(fp) | |
173 | callf $20,_Kmodf | |
174 | clrl -60+4(fp) | |
175 | movl r0,-60(fp) # fract = modf(d,&d); | |
176 | tstl r0 # if (fract != 0.0) | |
177 | jeql L18 | |
178 | pushl 12(fp) # hfs | |
179 | ldd L19 | |
180 | pushd | |
181 | ldd 4(fp) | |
182 | pushd | |
183 | callf $24,_Kaddd | |
184 | ldd r0 | |
185 | std 4(fp) # d +=1; | |
186 | L18: lnd 4(fp) | |
187 | std 4(fp) # d = -d; | |
188 | jbr L20 | |
189 | L17: | |
190 | pushl 12(fp) # hfs | |
191 | addl3 $4,fp,-(sp) | |
192 | pushl 8(fp) | |
193 | pushl 4(fp) | |
194 | callf $20,_Kmodf | |
195 | L20: ldd 4(fp) | |
196 | cvdl r0 # for Kexpf call only! | |
197 | ret | |
198 | ||
2b252132 SL |
199 | .data |
200 | _p0: .long 0x45BD3D04, 0x7F734DBD # .double 1513.9067990543389 | |
201 | _p1: .long 0x42A19DD4, 0x989F60DA # .double 20.202065651286927 | |
202 | _p2: .long 0x3DBD2E42, 0xAB70BDA9 # .double .023093347753750233 | |
203 | _q0: .long 0x468881B1, 0x7C3A6529 # .double 4368.2116627275583 | |
204 | _q1: .long 0x44692F28, 0x7AE89541 # .double 233.18421142748162 | |
205 | _q2: .long 0x40800000, 0x00000000 # .double 1 | |
206 | _log2e: .long 0x40B8AA3B, 0x295C17F0 # .double 1.4426950408889634 | |
207 | _sqrt2: .long 0x40B504F3, 0x33F9DE64 # .double 1.414213562373095 | |
208 | _maxf: .long 0x471C4000, 0x00000000 # .double 10000 | |
209 | _HUGE: .long 0x7FFFFFFE, 0xFFFFFFFC # .double 1.701411733192644e+38 | |
210 | one: .long 0x40800000 # .float 1 | |
211 | half: .long 0x40000000, 0x00000000 # .double .5 |