Commit | Line | Data |
---|---|---|
1f92ea9c TL |
1 | # optimized (and corrected) from output of C compiler |
2 | # -16(fp) --> r0 | |
3 | # -20(fp) --> r8 | |
4 | # -8(fp) --> r6 | |
5 | # -21(fp) --> r5 | |
6 | # -22(fp) --> r4 | |
7 | .set one,010 # 1.0 in floating immediate format | |
8 | .set ten,042 # 10.0 in floating immediate format | |
9 | big: .word 0x5c80,0,0,0 # 2**56 in double floating | |
10 | huge: .word 0x8000,0,0,0 # reserved operand | |
11 | L49: .double 0d1.00000000000000000000e+21 | |
12 | .set .R1,0xff0 | |
13 | .set .F1,24 | |
14 | .globl _atof | |
15 | _atof: | |
16 | .word .R1 | |
17 | movl 4(ap),r11 | |
18 | L15: | |
19 | cvtbl (r11)+,r10 | |
20 | cmpl r10,$32 | |
21 | jeql L15 | |
22 | clrb r5 | |
23 | cmpb r10,$45 | |
24 | jneq L17 | |
25 | incb r5 | |
26 | jbr L18 | |
27 | L17: | |
28 | cmpb r10,$43 | |
29 | jeql L18 | |
30 | decl r11 | |
31 | L18: | |
32 | clrd r0 | |
33 | clrl r9 | |
34 | jbr L22 | |
35 | L20001: | |
36 | muld2 $ten,r0 | |
37 | subl3 $48,r10,r6 | |
38 | cvtld r6,r6 | |
39 | addd2 r6,r0 | |
40 | jbr L22 | |
41 | L20003: | |
42 | cmpb r10,$48 | |
43 | jlss L23 | |
44 | cmpd r0,big | |
45 | jlss L20001 | |
46 | incl r9 | |
47 | L22: | |
48 | cvtbl (r11)+,r10 | |
49 | cmpl r10,$57 | |
50 | jleq L20003 | |
51 | L23: | |
52 | cmpb r10,$46 | |
53 | jeql L28 | |
54 | jbr L27 | |
55 | L20005: | |
56 | cmpb r10,$48 | |
57 | jlss L27 | |
58 | cmpd r0,big | |
59 | jgeq L28 | |
60 | decl r9 | |
61 | muld2 $ten,r0 | |
62 | subl3 $48,r10,r6 | |
63 | cvtld r6,r6 | |
64 | addd2 r6,r0 | |
65 | L28: | |
66 | cvtbl (r11)+,r10 | |
67 | cmpl r10,$57 | |
68 | jleq L20005 | |
69 | L27: | |
70 | tstb r5 | |
71 | jeql L8827 | |
72 | mnegd r0,r0 | |
73 | L8827: | |
74 | clrl r8 | |
75 | cmpb r10,$69 | |
76 | jeql L10000 | |
77 | cmpb r10,$101 | |
78 | jneq L32 | |
79 | L10000: | |
80 | clrb r4 | |
81 | cvtbl (r11)+,r10 | |
82 | cmpl r10,$45 | |
83 | jneq L33 | |
84 | incb r4 | |
85 | jbr L37 | |
86 | L33: | |
87 | cmpb r10,$43 | |
88 | jeql L37 | |
89 | decl r11 | |
90 | jbr L37 | |
91 | L20007: | |
92 | cmpb r10,$48 | |
93 | jlss L38 | |
94 | moval (r8)[r8],r8 | |
95 | movaw -48(r10)[r8],r8 | |
96 | L37: | |
97 | cvtbl (r11)+,r10 | |
98 | cmpl r10,$57 | |
99 | jleq L20007 | |
100 | L38: | |
101 | tstb r4 | |
102 | jeql L32 | |
103 | mnegl r8,r8 | |
104 | L32: | |
105 | addl2 r8,r9 | |
106 | jneq L40 | |
107 | ret | |
108 | L40: | |
109 | clrb r4 | |
110 | tstl r9 | |
111 | jgeq L41 | |
112 | incb r4 | |
113 | mnegl r9,r9 | |
114 | L41: | |
115 | cmpl r9,$38 | |
116 | jleq L42 | |
117 | tstb r4 | |
118 | jeql L43 | |
119 | clrd r0 | |
120 | ret | |
121 | L43: | |
122 | tstb r5 | |
123 | jeql L8843 | |
124 | mnegd huge,r0 | |
125 | ret | |
126 | L8843: | |
127 | movd huge,r0 | |
128 | ret | |
129 | L42: | |
130 | movd $one,r6 | |
131 | jbr L46 | |
132 | L20009: | |
133 | divd2 r6,r0 | |
134 | ret | |
135 | L48: | |
136 | muld2 $ten,r6 | |
137 | decl r9 | |
138 | L46: | |
139 | tstl r9 | |
140 | jeql L47 | |
141 | cmpl r9,$21 | |
142 | jneq L48 | |
143 | muld2 L49,r6 | |
144 | L47: | |
145 | tstb r4 | |
146 | jneq L20009 | |
147 | muld2 r6,r0 | |
148 | ret |