Commit | Line | Data |
---|---|---|
4a71579b PC |
1 | .data 1024 |
2 | ifmt: | |
3 | .c "%d %d %d %d %d %d %d %d %d %d\n" | |
4 | .align 4 | |
5 | ichk: | |
6 | .i 9 8 7 6 5 4 3 2 1 0 | |
7 | dfmt: | |
8 | .c "%.1f %.1f %.1f %.1f %.1f %.1f %.1f %.1f %.1f %.1f\n" | |
9 | lfmt: | |
10 | .c "%lf %lf %lf %lf %lf %lf %lf %lf %lf %lf\n" | |
11 | .align 8 | |
12 | dchk: | |
13 | .d 9.0 8.0 7.0 6.0 5.0 4.0 3.0 2.0 1.0 0.0 | |
14 | idfmt: | |
15 | .c "%d %.1f %d %.1f %d %.1f %d %.1f %d %.1f %d %.1f %d %.1f %d %.1f %d %.1f %d %.1f\n" | |
16 | ldfmt: | |
17 | .c "%d %lf %d %lf %d %lf %d %lf %d %lf %d %lf %d %lf %d %lf %d %lf %d %lf\n" | |
18 | difmt: | |
19 | .c "%.1f %d %.1f %d %.1f %d %.1f %d %.1f %d %.1f %d %.1f %d %.1f %d %.1f %d %.1f %d\n" | |
20 | dlfmt: | |
21 | .c "%lf %d %lf %d %lf %d %lf %d %lf %d %lf %d %lf %d %lf %d %lf %d %lf %d\n" | |
22 | .align 8 | |
23 | buff: | |
24 | .size 256 | |
25 | ||
26 | .code | |
27 | prolog | |
28 | ||
29 | /* | |
30 | sprintf(buff, "%d %d %d %d %d %d %d %d %d %d\n", | |
31 | 0, 1, 2, 3, 4, 5, 6, 7, 8, 9); | |
32 | */ | |
33 | prepare | |
34 | pushargi buff | |
35 | pushargi ifmt | |
36 | ellipsis | |
37 | pushargi 0 | |
38 | pushargi 1 | |
39 | pushargi 2 | |
40 | pushargi 3 | |
41 | pushargi 4 | |
42 | pushargi 5 | |
43 | pushargi 6 | |
44 | pushargi 7 | |
45 | pushargi 8 | |
46 | pushargi 9 | |
47 | finishi @sprintf | |
48 | ||
49 | /* | |
50 | sscanf(buff, "%d %d %d %d %d %d %d %d %d %d\n", | |
51 | ichk+0, ichk+1, ichk+2, ichk+3, ichk+4, | |
52 | ichk+5, ichk+6, ichk+7, ichk+8, ichk+9); | |
53 | */ | |
54 | movi %v0 ichk | |
55 | prepare | |
56 | pushargi buff | |
57 | pushargi ifmt | |
58 | ellipsis | |
59 | pushargr %v0 /* 0 */ | |
60 | addi %v0 %v0 4 | |
61 | pushargr %v0 /* 1 */ | |
62 | addi %v0 %v0 4 | |
63 | pushargr %v0 /* 2 */ | |
64 | addi %v0 %v0 4 | |
65 | pushargr %v0 /* 3 */ | |
66 | addi %v0 %v0 4 | |
67 | pushargr %v0 /* 4 */ | |
68 | addi %v0 %v0 4 | |
69 | pushargr %v0 /* 5 */ | |
70 | addi %v0 %v0 4 | |
71 | pushargr %v0 /* 6 */ | |
72 | addi %v0 %v0 4 | |
73 | pushargr %v0 /* 7 */ | |
74 | addi %v0 %v0 4 | |
75 | pushargr %v0 /* 8 */ | |
76 | addi %v0 %v0 4 | |
77 | pushargr %v0 /* 9 */ | |
78 | finishi @sscanf | |
79 | ||
80 | movi %v0 ichk | |
81 | movi %r0 0 | |
82 | loopi: | |
83 | ldr_i %r1 %v0 | |
84 | beqr nexti %r0 %r1 | |
85 | calli @abort | |
86 | nexti: | |
87 | addi %r0 %r0 1 | |
88 | bgei outi %r0 10 | |
89 | addi %v0 %v0 4 | |
90 | jmpi loopi | |
91 | outi: | |
92 | ||
93 | prepare | |
94 | pushargi buff | |
95 | ellipsis | |
96 | finishi @printf | |
97 | ||
98 | /* | |
99 | sprintf(buff, | |
100 | "%.1f %.1f %.1f %.1f %.1f " | |
101 | "%.1f %.1f %.1f %.1f %.1f\n", | |
102 | 0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0); | |
103 | */ | |
104 | prepare | |
105 | pushargi buff | |
106 | pushargi dfmt | |
107 | ellipsis | |
108 | pushargi_d 0.0 | |
109 | pushargi_d 1.0 | |
110 | pushargi_d 2.0 | |
111 | pushargi_d 3.0 | |
112 | pushargi_d 4.0 | |
113 | pushargi_d 5.0 | |
114 | pushargi_d 6.0 | |
115 | pushargi_d 7.0 | |
116 | pushargi_d 8.0 | |
117 | pushargi_d 9.0 | |
118 | finishi @sprintf | |
119 | ||
120 | /* | |
121 | sscanf(buff, "%lf %lf %lf %lf %lf %lf %lf %lf %lf %lf\n", | |
122 | dchk+0, dchk+1, dchk+2, dchk+3, dchk+4, | |
123 | dchk+5, dchk+6, dchk+7, dchk+8, dchk+9); | |
124 | */ | |
125 | movi %v0 dchk | |
126 | prepare | |
127 | pushargi buff | |
128 | pushargi lfmt | |
129 | ellipsis | |
130 | pushargr %v0 /* 0 */ | |
131 | addi %v0 %v0 8 | |
132 | pushargr %v0 /* 1 */ | |
133 | addi %v0 %v0 8 | |
134 | pushargr %v0 /* 2 */ | |
135 | addi %v0 %v0 8 | |
136 | pushargr %v0 /* 3 */ | |
137 | addi %v0 %v0 8 | |
138 | pushargr %v0 /* 4 */ | |
139 | addi %v0 %v0 8 | |
140 | pushargr %v0 /* 5 */ | |
141 | addi %v0 %v0 8 | |
142 | pushargr %v0 /* 6 */ | |
143 | addi %v0 %v0 8 | |
144 | pushargr %v0 /* 7 */ | |
145 | addi %v0 %v0 8 | |
146 | pushargr %v0 /* 8 */ | |
147 | addi %v0 %v0 8 | |
148 | pushargr %v0 /* 9 */ | |
149 | finishi @sscanf | |
150 | ||
151 | movi %v0 dchk | |
152 | movi_d %f0 0.0 | |
153 | loopd: | |
154 | ldr_d %f1 %v0 | |
155 | beqr_d nextd %f0 %f1 | |
156 | calli @abort | |
157 | nextd: | |
158 | addi_d %f0 %f0 1.0 | |
159 | bgei_d outd %f0 10.0 | |
160 | addi %v0 %v0 8 | |
161 | jmpi loopd | |
162 | outd: | |
163 | ||
164 | prepare | |
165 | pushargi buff | |
166 | ellipsis | |
167 | finishi @printf | |
168 | ||
169 | /* | |
170 | sprintf(buff, | |
171 | "%d %.1f %d %.1f %d %.1f %d %.1f %d %.1f " | |
172 | "%d %.1f %d %.1f %d %.1f %d %.1f %d %.1f\n", | |
173 | 0, 0.0, 1, 1.0, 2, 2.0, 3, 3.0, 4, 4.0, | |
174 | 5, 5.0, 6, 6.0, 7, 7.0, 8, 8.0, 9, 9.0); | |
175 | */ | |
176 | prepare | |
177 | pushargi buff | |
178 | pushargi idfmt | |
179 | ellipsis | |
180 | pushargi 0 | |
181 | pushargi_d 0.0 | |
182 | pushargi 1 | |
183 | pushargi_d 1.0 | |
184 | pushargi 2 | |
185 | pushargi_d 2.0 | |
186 | pushargi 3 | |
187 | pushargi_d 3.0 | |
188 | pushargi 4 | |
189 | pushargi_d 4.0 | |
190 | pushargi 5 | |
191 | pushargi_d 5.0 | |
192 | pushargi 6 | |
193 | pushargi_d 6.0 | |
194 | pushargi 7 | |
195 | pushargi_d 7.0 | |
196 | pushargi 8 | |
197 | pushargi_d 8.0 | |
198 | pushargi 9 | |
199 | pushargi_d 9.0 | |
200 | finishi @sprintf | |
201 | ||
202 | /* | |
203 | sscanf(buff, | |
204 | "%d %lf %d %lf %d %lf %d %lf %d %lf " | |
205 | "%d %lf %d %lf %d %lf %d %lf %d %lf\n", | |
206 | ichk+0, dchk+0, ichk+1, dchk+1, ichk+2, | |
207 | dchk+2, ichk+3, dchk+3, ichk+4, dchk+4, | |
208 | ichk+5, dchk+5, ichk+6, dchk+6, ichk+7, | |
209 | dchk+7, ichk+8, dchk+8, ichk+9, dchk+9); | |
210 | */ | |
211 | movi %v0 ichk | |
212 | movi %v1 dchk | |
213 | prepare | |
214 | pushargi buff | |
215 | pushargi ldfmt | |
216 | ellipsis | |
217 | pushargr %v0 /* 0 */ | |
218 | addi %v0 %v0 4 | |
219 | pushargr %v1 | |
220 | addi %v1 %v1 8 | |
221 | pushargr %v0 /* 1 */ | |
222 | addi %v0 %v0 4 | |
223 | pushargr %v1 | |
224 | addi %v1 %v1 8 | |
225 | pushargr %v0 /* 2 */ | |
226 | addi %v0 %v0 4 | |
227 | pushargr %v1 | |
228 | addi %v1 %v1 8 | |
229 | pushargr %v0 /* 3 */ | |
230 | addi %v0 %v0 4 | |
231 | pushargr %v1 | |
232 | addi %v1 %v1 8 | |
233 | pushargr %v0 /* 4 */ | |
234 | addi %v0 %v0 4 | |
235 | pushargr %v1 | |
236 | addi %v1 %v1 8 | |
237 | pushargr %v0 /* 5 */ | |
238 | addi %v0 %v0 4 | |
239 | pushargr %v1 | |
240 | addi %v1 %v1 8 | |
241 | pushargr %v0 /* 6 */ | |
242 | addi %v0 %v0 4 | |
243 | pushargr %v1 | |
244 | addi %v1 %v1 8 | |
245 | pushargr %v0 /* 7 */ | |
246 | addi %v0 %v0 4 | |
247 | pushargr %v1 | |
248 | addi %v1 %v1 8 | |
249 | pushargr %v0 /* 8 */ | |
250 | addi %v0 %v0 4 | |
251 | pushargr %v1 | |
252 | addi %v1 %v1 8 | |
253 | pushargr %v0 /* 9 */ | |
254 | pushargr %v1 | |
255 | finishi @sscanf | |
256 | ||
257 | movi %v0 ichk | |
258 | movi %v1 dchk | |
259 | movi %r0 0 | |
260 | movi_d %f0 0.0 | |
261 | loopid: | |
262 | ldr_i %r1 %v0 | |
263 | beqr checkd %r0 %r1 | |
264 | calli @abort | |
265 | checkd: | |
266 | ldr_d %f1 %v1 | |
267 | beqr_d nextid %f0 %f1 | |
268 | calli @abort | |
269 | nextid: | |
270 | addi %r0 %r0 1 | |
271 | addi_d %f0 %f0 1.0 | |
272 | bgei outid %r0 10 | |
273 | addi %v0 %v0 4 | |
274 | addi %v1 %v1 8 | |
275 | jmpi loopid | |
276 | outid: | |
277 | ||
278 | prepare | |
279 | pushargi buff | |
280 | ellipsis | |
281 | finishi @printf | |
282 | ||
283 | /* | |
284 | sprintf(buff, | |
285 | "%.1f %d %.1f %d %.1f %d %.1f %d %.1f %d " | |
286 | "%.1f %d %.1f %d %.1f %d %.1f %d %.1f %d\n", | |
287 | 0.0, 0, 1.0, 1, 2.0, 2, 3.0, 3, 4.0, 4, | |
288 | 5, 5.0, 6.0, 6, 7.0, 7, 8.0, 8, 9.0, 9); | |
289 | */ | |
290 | prepare | |
291 | pushargi buff | |
292 | pushargi difmt | |
293 | ellipsis | |
294 | pushargi_d 0.0 | |
295 | pushargi 0 | |
296 | pushargi_d 1.0 | |
297 | pushargi 1 | |
298 | pushargi_d 2.0 | |
299 | pushargi 2 | |
300 | pushargi_d 3.0 | |
301 | pushargi 3 | |
302 | pushargi_d 4.0 | |
303 | pushargi 4 | |
304 | pushargi_d 5.0 | |
305 | pushargi 5 | |
306 | pushargi_d 6.0 | |
307 | pushargi 6 | |
308 | pushargi_d 7.0 | |
309 | pushargi 7 | |
310 | pushargi_d 8.0 | |
311 | pushargi 8 | |
312 | pushargi_d 9.0 | |
313 | pushargi 9 | |
314 | finishi @sprintf | |
315 | ||
316 | /* | |
317 | sscanf(buff, | |
318 | "%lf %d %lf %d %lf %d %lf %d %lf %d " | |
319 | "%lf %d %lf %d %lf %d %lf %d %lf %d \n", | |
320 | dchk+0, ichk+0, dchk+1, ichk+1, dchk+2, | |
321 | ichk+2, dchk+3, ichk+3, dchk+4, ichk+4, | |
322 | dchk+5, ichk+5, dchk+6, ichk+6, dchk+7, | |
323 | ichk+7, dchk+8, ichk+8, dchk+9, ichk+9); | |
324 | */ | |
325 | movi %v0 dchk | |
326 | movi %v1 ichk | |
327 | prepare | |
328 | pushargi buff | |
329 | pushargi dlfmt | |
330 | ellipsis | |
331 | pushargr %v0 /* 0 */ | |
332 | addi %v0 %v0 8 | |
333 | pushargr %v1 | |
334 | addi %v1 %v1 4 | |
335 | pushargr %v0 /* 1 */ | |
336 | addi %v0 %v0 8 | |
337 | pushargr %v1 | |
338 | addi %v1 %v1 4 | |
339 | pushargr %v0 /* 2 */ | |
340 | addi %v0 %v0 8 | |
341 | pushargr %v1 | |
342 | addi %v1 %v1 4 | |
343 | pushargr %v0 /* 3 */ | |
344 | addi %v0 %v0 8 | |
345 | pushargr %v1 | |
346 | addi %v1 %v1 4 | |
347 | pushargr %v0 /* 4 */ | |
348 | addi %v0 %v0 8 | |
349 | pushargr %v1 | |
350 | addi %v1 %v1 4 | |
351 | pushargr %v0 /* 5 */ | |
352 | addi %v0 %v0 8 | |
353 | pushargr %v1 | |
354 | addi %v1 %v1 4 | |
355 | pushargr %v0 /* 6 */ | |
356 | addi %v0 %v0 8 | |
357 | pushargr %v1 | |
358 | addi %v1 %v1 4 | |
359 | pushargr %v0 /* 7 */ | |
360 | addi %v0 %v0 8 | |
361 | pushargr %v1 | |
362 | addi %v1 %v1 4 | |
363 | pushargr %v0 /* 8 */ | |
364 | addi %v0 %v0 8 | |
365 | pushargr %v1 | |
366 | addi %v1 %v1 4 | |
367 | pushargr %v0 /* 9 */ | |
368 | pushargr %v1 | |
369 | finishi @sscanf | |
370 | ||
371 | movi %v0 ichk | |
372 | movi %v1 dchk | |
373 | movi %r0 0 | |
374 | movi_d %f0 0.0 | |
375 | loopdi: | |
376 | ldr_i %r1 %v0 | |
377 | beqr check_d %r0 %r1 | |
378 | calli @abort | |
379 | check_d: | |
380 | ldr_d %f1 %v1 | |
381 | beqr_d nextdi %f0 %f1 | |
382 | calli @abort | |
383 | nextdi: | |
384 | addi %r0 %r0 1 | |
385 | addi_d %f0 %f0 1.0 | |
386 | bgei outdi %r0 10 | |
387 | addi %v0 %v0 4 | |
388 | addi %v1 %v1 8 | |
389 | jmpi loopdi | |
390 | outdi: | |
391 | ||
392 | prepare | |
393 | pushargi buff | |
394 | ellipsis | |
395 | finishi @printf | |
396 | ||
397 | ret | |
398 | epilog |