|
|
1.1 root 1: /*-
2: * Copyright (c) 1985 The 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, with or without
9: * modification, are permitted provided that the following conditions
10: * are met:
11: * 1. Redistributions of source code must retain the above copyright
12: * notice, this list of conditions and the following disclaimer.
13: * 2. Redistributions in binary form must reproduce the above copyright
14: * notice, this list of conditions and the following disclaimer in the
15: * documentation and/or other materials provided with the distribution.
16: * 3. All advertising materials mentioning features or use of this software
17: * must display the following acknowledgement:
18: * This product includes software developed by the University of
19: * California, Berkeley and its contributors.
20: * 4. Neither the name of the University nor the names of its contributors
21: * may be used to endorse or promote products derived from this software
22: * without specific prior written permission.
23: *
24: * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
25: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27: * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34: * SUCH DAMAGE.
35: *
36: * @(#)Kexpf.s 7.1 (Berkeley) 12/6/90
37: */
38:
39: #include "../tahoe/SYS.h"
40:
41: .text
42: ENTRY(Kexpf, R4|R3)
43: subl3 $88,fp,sp
44: tstl 4(fp)
45: jneq 1f
46: movl one,r0
47: ret
48: 1:
49: lnd _maxf
50: cmpd 4(fp)
51: jleq 1f
52: clrl r0
53: ret
54: 1:
55: cmpd2 4(fp),_maxf
56: jleq 1f
57: ldd _HUGE
58: cvdf
59: stf r0
60: ret
61: 1:
62: pushl 20(fp) # hfs
63: ldd _log2e; pushd
64: ldd 4(fp); pushd
65: callf $24,_Kmuld
66: ldd r0
67: std 4(fp)
68:
69: pushl 20(fp) # hfs
70: pushl 8(fp)
71: pushl 4(fp)
72: callf $16,_Kfloorf
73: movl r0,-88(fp) # (int)ent from Kfloorf
74:
75: cvlf -88(fp)
76: clrl r1
77: stf r0
78: pushl 20(fp) # hfs
79: pushl r1
80: pushl r0
81: ldd 4(fp); pushd
82: callf $24,_Ksubd # (arg - ent)
83:
84: pushl 20(fp) # hfs
85: ldd half; pushd
86: ldd r0; pushd
87: callf $24,_Ksubd
88: ldd r0; std -60(fp) # fract
89:
90: pushl 20(fp) # hfs
91: pushd
92: pushd
93: callf $24,_Kmuld
94: ldd r0; std -84(fp) # xsq
95:
96: pushl 20(fp) # hfs
97: pushd # xsq
98: ldd _p2; pushd
99: callf $24,_Kmuld
100:
101: pushl 20(fp) # hfs
102: ldd _p1; pushd
103: ldd r0; pushd
104: callf $24,_Kaddd
105:
106: pushl 20(fp) # hfs
107: ldd -84(fp); pushd
108: ldd r0; pushd
109: callf $24,_Kmuld
110:
111: pushl 20(fp) # hfs
112: ldd _p0; pushd
113: ldd r0; pushd
114: callf $24,_Kaddd
115:
116: pushl 20(fp) # hfs
117: ldd -60(fp); pushd # fract
118: ldd r0; pushd
119: callf $24,_Kmuld
120: ldd r0; std -68(fp) # temp1
121:
122: pushl 20(fp) # hfs
123: ldd -84(fp); pushd # xsq
124: ldd _q2; pushd
125: callf $24,_Kmuld
126:
127: pushl 20(fp) # hfs
128: ldd _q1; pushd
129: ldd r0; pushd
130: callf $24,_Kaddd
131:
132: pushl 20(fp) # hfs
133: ldd -84(fp); pushd
134: ldd r0; pushd
135: callf $24,_Kmuld
136:
137: pushl 20(fp) # hfs
138: ldd _q0; pushd
139: ldd r0; pushd
140: callf $24,_Kaddd
141: ldd r0; std -76(fp) # temp2
142:
143: pushl 20(fp) # hfs for Kldexpf
144: pushl -88(fp) # ent
145:
146: pushl 20(fp) # hfs tor temp2+temp1
147: ldd -68(fp); pushd # temp1
148: ldd -76(fp); pushd # temp2
149: callf $24,_Kaddd
150:
151: pushl 20(fp) # hfs
152: ldd _sqrt2; pushd
153: ldd r0; pushd # temp2+temp1
154: callf $24,_Kmuld
155: ldd r0; std r2 # sqrt2*(temp2+temp1)
156:
157: pushl 20(fp) # hfs
158: ldd -68(fp)
159: pushd
160: ldd -76(fp)
161: pushd
162: callf $24,_Ksubd # temp2-temp1
163:
164: pushl 20(fp) # hfs
165: ldd r0
166: pushd # temp2-temp1
167: ldd r2
168: pushd
169: callf $24,_Kdivd
170:
171: ldd r0
172: pushd
173: callf $20,_Kldexpf
174:
175: #pushl 20(fp) # hfs
176: #pushl $0
177: #pushl r0 # cvlf r0
178: #pushl $0
179: #pushl $0
180: #callf $24,_Kcvtld
181:
182: #ldd r0
183: #cvdf
184: #stf r0
185: ret
186:
187: /* file : Kfloorf.x
188: */
189: .text
190: .globl _Kfloorf
191: .data
192: .align 2
193: L19: .long 0x40800000, 0x00000000 # .double 1
194: .text
195: .set L13,0x0
196: .data
197: .text
198: _Kfloorf:
199: .word L13
200: subl3 $60,fp,sp
201: tstl 4(fp) # if (d<0.0) {
202: jgeq L17
203: lnd 4(fp)
204: std 4(fp) # d = -d;
205: pushl 12(fp) # hfs
206: addl3 $4,fp,-(sp) # &d
207: pushl 8(fp)
208: pushl 4(fp)
209: callf $20,_Kmodf
210: clrl -60+4(fp)
211: movl r0,-60(fp) # fract = modf(d,&d);
212: tstl r0 # if (fract != 0.0)
213: jeql L18
214: pushl 12(fp) # hfs
215: ldd L19
216: pushd
217: ldd 4(fp)
218: pushd
219: callf $24,_Kaddd
220: ldd r0
221: std 4(fp) # d +=1;
222: L18: lnd 4(fp)
223: std 4(fp) # d = -d;
224: jbr L20
225: L17:
226: pushl 12(fp) # hfs
227: addl3 $4,fp,-(sp)
228: pushl 8(fp)
229: pushl 4(fp)
230: callf $20,_Kmodf
231: L20: ldd 4(fp)
232: cvdl r0 # for Kexpf call only!
233: ret
234:
235: .data
236: _p0: .long 0x45BD3D04, 0x7F734DBD # .double 1513.9067990543389
237: _p1: .long 0x42A19DD4, 0x989F60DA # .double 20.202065651286927
238: _p2: .long 0x3DBD2E42, 0xAB70BDA9 # .double .023093347753750233
239: _q0: .long 0x468881B1, 0x7C3A6529 # .double 4368.2116627275583
240: _q1: .long 0x44692F28, 0x7AE89541 # .double 233.18421142748162
241: _q2: .long 0x40800000, 0x00000000 # .double 1
242: _log2e: .long 0x40B8AA3B, 0x295C17F0 # .double 1.4426950408889634
243: _sqrt2: .long 0x40B504F3, 0x33F9DE64 # .double 1.414213562373095
244: _maxf: .long 0x471C4000, 0x00000000 # .double 10000
245: _HUGE: .long 0x7FFFFFFE, 0xFFFFFFFC # .double 1.701411733192644e+38
246: one: .long 0x40800000 # .float 1
247: half: .long 0x40000000, 0x00000000 # .double .5
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.