|
|
1.1 root 1: .data
2: .asciz "@(#)Fstod.s 1.1 86/02/03 Copyr 1985 Sun Micro"
3: .even
4: .text
5:
6: | Copyright (c) 1985 by Sun Microsystems, Inc.
7:
8: #include "fpcrtdefs.h"
9:
10: RTENTRY(Fstod)
11: movel d0,a0 | a0 saves x.
12: rotate3:
13: rorl #3,d0 | d0 gets 3|1|8|20
14: movel d0,d1 | d1 gets 3|1|8|20
15: andl #0xe0000000,d1 | d1 gets 3 low order significand bits.
16: andl #0x0fffffff,d0 | d0 gets exponent and 20 high order significand.
17: addl #(0x3ff00000-0x7f00000),d0 | Adjust exponent from single to double.
18: cmpl #0x38100000,d0
19: blts minexp | Branch if zero or subnormal.
20: cmpl #0x47f00000,d0
21: bges maxexp | Branch if inf or nan.
22: sign:
23: cmpl #0,a0
24: bges 1f | Branch if sign of x is positive.
25: orl #0x80000000,d0 | Set negative.
26: 1:
27: RET
28:
29: maxexp:
30: orl #0x7ff00000,d0 | d0 gets max double exponent.
31: cmpl #0x7ff00000,d0
32: bgts nan | Branch if nan.
33: tstl d1
34: beqs sign | Branch if inf.
35: nan:
36: orl #0x00400000,d0 | Force quiet nan.
37: bras sign
38: minexp:
39: movel a0,d0 | d0 gets x.
40: andl #0x007fffff,d0 | d0 gets x significand.
41: beqs sign | Branch if x is true zero.
42: movel #0x4000,d1 | d1 gets single format exponent +1.
43: bras 2f
44: norm:
45: subw #0x0080,d1 | Decrement exponent by 1.
46: 2:
47: lsll #1,d0
48: btst #23,d0
49: beqs norm | Branch if not yet normalized.
50: andl #0x007fffff,d0 | Clear exponent.
51: swap d1
52: orl d1,d0 | Insert single exponent.
53: bsrs rotate3 | Try again with biased exponent.
54: subl #0x08000000,d0 | Unbias exponent.
55: rts
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.