git subrepo pull --force deps/lightrec
[pcsx_rearmed.git] / deps / lightning / check / cvt.tst
CommitLineData
4a71579b
PC
1.data 12
2ok:
3.c "ok\n"
4
5#if __WORDSIZE == 32
6# define w7f 0x7fffffff
7# define w80 0x80000000
8# define w81 0x80000001
9# define wff 0xffffffff
10# define LEXTII2(N, R0, R1)
11# define LEXTIC2(N, R0)
12#else
13# define w7f 0x7fffffffffffffff
14# define w80 0x8000000000000000
15# define w81 0x8000000000000001
16# define wff 0xffffffffffffffff
17# define i7f wff
18# define ui7f 0xffffffff
19# define i80 0
20# define ui80 0
21# define i81 1
22# define ui81 1
23# define iff wff
24# define uiff 0xffffffff
25# define LEXTII2(N, R0, R1) \
26 EXTII2(N, i, R0, R1) \
27 EXTII2(N, ui, R0, R1)
28# define LEXTIC2(N, R0) \
29 EXTIC2(N, i, R0) \
30 EXTIC2(N, ui, R0)
31#endif
32#define c7f wff
33#define uc7f 0xff
34#define s7f wff
35#define us7f 0xffff
36#define c80 0
37#define uc80 0
38#define s80 0
39#define us80 0
40#define c81 1
41#define uc81 1
42#define s81 1
43#define us81 1
44#define cff wff
45#define ucff 0xff
46#define sff wff
47#define usff 0xffff
48
49#define EXTII2(N, T, R0, R1) \
50 movi %R0 w##N \
51 extr_##T %R1 %R0 \
52 beqi T##_##R0##_##R1##_##N %R1 T##N \
53 calli @abort \
54T##_##R0##_##R1##_##N:
55#define EXTII1(N, R0, R1) \
56 EXTII2(N, c, R0, R1) \
57 EXTII2(N, uc, R0, R1) \
58 EXTII2(N, s, R0, R1) \
59 EXTII2(N, us, R0, R1) \
60 LEXTII2(N, R0, R1)
61#define EXTII0(R0, R1) \
62 EXTII1(7f, R0, R1) \
63 EXTII1(80, R0, R1) \
64 EXTII1(81, R0, R1) \
65 EXTII1(ff, R0, R1)
66
67#define EXTIC2(N, T, R0) \
68 movi %R0 w##N \
69 extr_##T %R0 %R0 \
70 beqi T##_##R0##_##N %R0 T##N \
71 calli @abort \
72T##_##R0##_##N:
73#define EXTIC1(N, R0) \
74 EXTIC2(N, c, R0) \
75 EXTIC2(N, uc, R0) \
76 EXTIC2(N, s, R0) \
77 EXTIC2(N, us, R0) \
78 LEXTIC2(N, R0)
79#define EXTIC0(R0) \
80 EXTIC1(7f, R0) \
81 EXTIC1(80, R0) \
82 EXTIC1(81, R0) \
83 EXTIC1(ff, R0)
84
85#define EXTII(V0, V1, V2, R0, R1, R2) \
86 EXTII0(V0, V1) \
87 EXTII0(V0, V2) \
88 EXTII0(V0, R0) \
89 EXTII0(V0, R1) \
90 EXTII0(V0, R2) \
91 EXTII0(V1, V0) \
92 EXTII0(V1, V2) \
93 EXTII0(V1, R0) \
94 EXTII0(V1, R1) \
95 EXTII0(V1, R2) \
96 EXTII0(V2, V0) \
97 EXTII0(V2, V1) \
98 EXTII0(V2, R0) \
99 EXTII0(V2, R1) \
100 EXTII0(V2, R2) \
101 EXTII0(R0, V0) \
102 EXTII0(R0, V1) \
103 EXTII0(R0, V2) \
104 EXTII0(R0, R1) \
105 EXTII0(R0, R2) \
106 EXTII0(R1, V0) \
107 EXTII0(R1, V1) \
108 EXTII0(R1, V2) \
109 EXTII0(R1, R0) \
110 EXTII0(R1, R2) \
111 EXTII0(R2, V0) \
112 EXTII0(R2, V1) \
113 EXTII0(R2, V2) \
114 EXTII0(R2, R0) \
115 EXTII0(R2, R1) \
116 EXTIC0(V0) \
117 EXTIC0(V1) \
118 EXTIC0(V2) \
119 EXTIC0(R0) \
120 EXTIC0(R1) \
121 EXTIC0(R2)
122
123#define EXIF1(N, V, R0, R1) \
124 movi %R0 V \
125 extr_f %R1 %R0 \
126 beqi_f wf##_##R0##_##R1##_##N %R1 V \
127wf##_##R0##_##R1##_##N:
128#define EXIF0(R0, R1) \
129 EXIF1(0, -1, R0, R1) \
130 EXIF1(1, 64, R0, R1)
131#define EXIF(V0, V1, V2, R0, R1, R2, F0, F1, F2, F3, F4, F5) \
132 EXIF0(V0, F0) \
133 EXIF0(V1, F1) \
134 EXIF0(V2, F2) \
135 EXIF0(R0, F3) \
136 EXIF0(R1, F4) \
137 EXIF0(R2, F5)
138#define EXID1(N, V, R0, R1) \
139 movi %R0 V \
140 extr_d %R1 %R0 \
141 beqi_d wd##_##R0##_##R1##_##N %R1 V \
142wd##_##R0##_##R1##_##N:
143#define EXID0(R0, R1) \
144 EXID1(0, -1, R0, R1) \
145 EXID1(1, 64, R0, R1)
146#define EXID(V0, V1, V2, R0, R1, R2, F0, F1, F2, F3, F4, F5) \
147 EXID0(V0, F0) \
148 EXID0(V1, F1) \
149 EXID0(V2, F2) \
150 EXID0(R0, F3) \
151 EXID0(R1, F4) \
152 EXID0(R2, F5)
153
154#define EXFI1(N, V, R0, R1) \
155 movi_f %R1 V \
156 truncr_f %R0 %R1 \
157 beqi fi##_##R0##_##R1##_##N %R0 V \
158 calli @abort \
159fi##_##R0##_##R1##_##N:
160#define EXFI0(R0, R1) \
161 EXFI1(0, 42, R0, R1) \
162 EXFI1(1, -128, R0, R1)
163#define EXFI(V0, V1, V2, R0, R1, R2, F0, F1, F2, F3, F4, F5) \
164 EXFI0(V0, F5) \
165 EXFI0(V1, F4) \
166 EXFI0(V2, F3) \
167 EXFI0(R0, F2) \
168 EXFI0(R1, F1) \
169 EXFI0(R2, F0)
170#define EXDI1(N, V, R0, R1) \
171 movi_d %R1 V \
172 truncr_d %R0 %R1 \
173 beqi di##_##R0##_##R1##_##N %R0 V \
174 calli @abort \
175di##_##R0##_##R1##_##N:
176#define EXDI0(R0, R1) \
177 EXDI1(0, 42, R0, R1) \
178 EXDI1(1, -128, R0, R1)
179#define EXDI(V0, V1, V2, R0, R1, R2, F0, F1, F2, F3, F4, F5) \
180 EXDI0(V0, F5) \
181 EXDI0(V1, F4) \
182 EXDI0(V2, F3) \
183 EXDI0(R0, F2) \
184 EXDI0(R1, F1) \
185 EXDI0(R2, F0)
186
187#define LEXFI1(N, V, R0, R1) \
188 movi_f %R1 V \
189 truncr_f_i %R0 %R1 \
190 andi %R0 %R0 0xffffffff \
191 beqi lfi##_##R0##_##R1##_##N %R0 $(V & 0xffffffff) \
192 calli @abort \
193lfi##_##R0##_##R1##_##N:
194#define LEXFI0(R0, R1) \
195 LEXFI1(0, 42, R0, R1) \
196 LEXFI1(1, -128, R0, R1)
197#define LEXFI(V0, V1, V2, R0, R1, R2, F0, F1, F2, F3, F4, F5) \
198 LEXFI0(V0, F5) \
199 LEXFI0(V1, F4) \
200 LEXFI0(V2, F3) \
201 LEXFI0(R0, F2) \
202 LEXFI0(R1, F1) \
203 LEXFI0(R2, F0)
204#define LEXDI1(N, V, R0, R1) \
205 movi_d %R1 V \
206 truncr_d_i %R0 %R1 \
207 andi %R0 %R0 0xffffffff \
208 beqi ldi##_##R0##_##R1##_##N %R0 $(V & 0xffffffff) \
209 calli @abort \
210ldi##_##R0##_##R1##_##N:
211#define LEXDI0(R0, R1) \
212 LEXDI1(0, 42, R0, R1) \
213 LEXDI1(1, -128, R0, R1)
214#define LEXDI(V0, V1, V2, R0, R1, R2, F0, F1, F2, F3, F4, F5) \
215 LEXDI0(V0, F5) \
216 LEXDI0(V1, F4) \
217 LEXDI0(V2, F3) \
218 LEXDI0(R0, F2) \
219 LEXDI0(R1, F1) \
220 LEXDI0(R2, F0)
221
222#define EXTFD2(V, R0, R1) \
223 movi_f %R0 V \
224 extr_f_d %R1 %R0 \
225 beqi_d fd##_##R0##_##R1 %R1 V \
226 calli @abort \
227fd##_##R0##_##R1:
228#define EXTFD1(R0, R1) \
229 EXTFD2(1.25, R0, R1)
230#define EXTFDC2(V, R0) \
231 movi_f %R0 V \
232 extr_f_d %R0 %R0 \
233 beqi_d fdc##_##R0 %R0 V \
234 calli @abort \
235fdc##_##R0:
236#define EXTFDC1(R0) \
237 EXTFDC2(-0.75, R0)
238#define EXTFD(R0, R1, R2, R3, R4, R5) \
239 EXTFD1(R0, R1) \
240 EXTFD1(R0, R2) \
241 EXTFD1(R0, R3) \
242 EXTFD1(R0, R4) \
243 EXTFD1(R0, R5) \
244 EXTFDC1(R0) \
245 EXTFDC1(R1) \
246 EXTFDC1(R2) \
247 EXTFDC1(R3) \
248 EXTFDC1(R4) \
249 EXTFDC1(R5)
250
251#define EXTDF2(V, R0, R1) \
252 movi_d %R0 V \
253 extr_d_f %R1 %R0 \
254 beqi_f df##_##R0##_##R1 %R1 V \
255 calli @abort \
256df##_##R0##_##R1:
257#define EXTDF1(R0, R1) \
258 EXTDF2(1.25, R0, R1)
259#define EXTDFC2(V, R0) \
260 movi_d %R0 V \
261 extr_d_f %R0 %R0 \
262 beqi_f dfc##_##R0 %R0 V \
263 calli @abort \
264dfc##_##R0:
265#define EXTDFC1(R0) \
266 EXTDFC2(-0.75, R0)
267#define EXTDF(R0, R1, R2, R3, R4, R5) \
268 EXTDF1(R0, R1) \
269 EXTDF1(R0, R2) \
270 EXTDF1(R0, R3) \
271 EXTDF1(R0, R4) \
272 EXTDF1(R0, R5) \
273 EXTDFC1(R0) \
274 EXTDFC1(R1) \
275 EXTDFC1(R2) \
276 EXTDFC1(R3) \
277 EXTDFC1(R4) \
278 EXTDFC1(R5)
279
ba86ff93
PC
280#define MVFW(R0, F0, F1) \
281 movi_f %F0 0.5 \
282 movr_f_w %R0 %F0 \
283 movr_w_f %F1 %R0 \
284 beqr_f fw##R0##F0##F1 %F0 %F1 \
285 calli @abort \
286fw##R0##F0##F1:
287#define FW(R0, R1, R2, R3, R4, R5, F0, F1, F2, F3, F4, F5) \
288 MVFW(R0, F0, F1) \
289 MVFW(R1, F1, F2) \
290 MVFW(R2, F2, F3) \
291 MVFW(R3, F3, F4) \
292 MVFW(R4, F4, F5) \
293 MVFW(R5, F5, F0)
294#define MVFWI(R0, F0, F1) \
295 movi_f %F1 0.25 \
296 movi_f_w %R0 0.25 \
297 movr_w_f %F0 %R0 \
298 beqr_f ifw##R0##F0##F1 %F0 %F1 \
299 calli @abort \
300ifw##R0##F0##F1:
301#define FWI(R0, R1, R2, R3, R4, R5, F0, F1, F2, F3, F4, F5) \
302 MVFWI(R0, F0, F1) \
303 MVFWI(R1, F1, F2) \
304 MVFWI(R2, F2, F3) \
305 MVFWI(R3, F3, F4) \
306 MVFWI(R4, F4, F5) \
307 MVFWI(R5, F5, F0)
308
309#if __WORDSIZE == 32
310# define MVDW(R0, R1, F0, F1) \
311 movi_d %F0 0.5 \
312 movr_d_ww %R0 %R1 %F0 \
313 movr_ww_d %F1 %R0 %R1 \
314 beqr_d dw##R0##R1##F0##F1 %F0 %F1 \
315 calli @abort \
316dw##R0##R1##F0##F1:
317# define DW(R0, R1, R2, R3, R4, R5, F0, F1, F2, F3, F4, F5) \
318 MVDW(R0, R1, F0, F1) \
319 MVDW(R1, R2, F1, F2) \
320 MVDW(R2, R3, F2, F3) \
321 MVDW(R3, R4, F3, F4) \
322 MVDW(R4, R5, F4, F5) \
323 MVDW(R5, R0, F5, F0)
324# define MVDWI(R0, R1, F0, F1) \
325 movi_d %F1 0.25 \
326 movi_d_ww %R0 %R1 0.25 \
327 movr_ww_d %F0 %R0 %R1 \
328 beqr_d idw##R0##R1##F0##F1 %F0 %F1 \
329 calli @abort \
330idw##R0##R1##F0##F1:
331# define DWI(R0, R1, R2, R3, R4, R5, F0, F1, F2, F3, F4, F5) \
332 MVDWI(R0, R1, F0, F1) \
333 MVDWI(R1, R2, F1, F2) \
334 MVDWI(R2, R3, F2, F3) \
335 MVDWI(R3, R4, F3, F4) \
336 MVDWI(R4, R5, F4, F5) \
337 MVDWI(R5, R0, F5, F0)
338#else
339# define MVDW(R0, F0, F1) \
340 movi_d %F0 0.5 \
341 movr_d_w %R0 %F0 \
342 movr_w_d %F1 %R0 \
343 beqr_d dw##R0##F0##F1 %F0 %F1 \
344 calli @abort \
345dw##R0##F0##F1:
346# define DW(R0, R1, R2, R3, R4, R5, F0, F1, F2, F3, F4, F5) \
347 MVDW(R0, F0, F1) \
348 MVDW(R1, F1, F2) \
349 MVDW(R2, F2, F3) \
350 MVDW(R3, F3, F4) \
351 MVDW(R4, F4, F5) \
352 MVDW(R5, F5, F0)
353# define MVDWI(R0, F0, F1) \
354 movi_d %F1 0.25 \
355 movi_d_w %R0 0.25 \
356 movr_w_d %F0 %R0 \
357 beqr_d idw##R0##F0##F1 %F0 %F1 \
358 calli @abort \
359idw##R0##F0##F1:
360# define DWI(R0, R1, R2, R3, R4, R5, F0, F1, F2, F3, F4, F5) \
361 MVDWI(R0, F0, F1) \
362 MVDWI(R1, F1, F2) \
363 MVDWI(R2, F2, F3) \
364 MVDWI(R3, F3, F4) \
365 MVDWI(R4, F4, F5) \
366 MVDWI(R5, F5, F0)
367#endif
368
369#define MVWFI(F0, F1) \
370 movi_f %F1 0.25 \
371 movi_w_f %F0 0x3e800000 \
372 beqr_f iwf##F0##F1 %F0 %F1 \
373 calli @abort \
374iwf##F0##F1:
375#define WFI(F0, F1, F2, F3, F4, F5) \
376 MVWFI(F0, F1) \
377 MVWFI(F1, F2) \
378 MVWFI(F2, F3) \
379 MVWFI(F3, F4) \
380 MVWFI(F4, F5) \
381 MVWFI(F5, F0)
382
383#if __WORDSIZE == 32
384# define MVWDI(F0, F1) \
385 movi_d %F1 0.5 \
386 movi_ww_d %F0 0 0x3fe00000 \
387 beqr_d iwwd##F0##F1 %F0 %F1 \
388 calli @abort \
389iwwd##F0##F1:
390# define WDI(F0, F1, F2, F3, F4, F5) \
391 MVWDI(F0, F1) \
392 MVWDI(F1, F2) \
393 MVWDI(F2, F3) \
394 MVWDI(F3, F4) \
395 MVWDI(F4, F5) \
396 MVWDI(F5, F0)
397#else
398# define MVWDI(F0, F1) \
399 movi_d %F1 0.5 \
400 movi_w_d %F0 0x3fe0000000000000 \
401 beqr_d iwd##F0##F1 %F0 %F1 \
402 calli @abort \
403iwd##F0##F1:
404#define WDI(F0, F1, F2, F3, F4, F5) \
405 MVWDI(F0, F1) \
406 MVWDI(F1, F2) \
407 MVWDI(F2, F3) \
408 MVWDI(F3, F4) \
409 MVWDI(F4, F5) \
410 MVWDI(F5, F0)
411#endif
412
4a71579b
PC
413.code
414 prolog
415
416 /* simple sequence for easier disassembly reading and encoding check */
417 movi %r0 w7f
418 extr_c %r1 %r0
419 beqi xc %r1 c7f
420 calli @abort
421xc:
422 movi %r0 w7f
423 extr_uc %r1 %r0
424 beqi xuc %r1 uc7f
425 calli @abort
426xuc:
427 movi %r0 w7f
428 extr_s %r1 %r0
429 beqi xs %r1 s7f
430 calli @abort
431xs:
432 movi %r0 w7f
433 extr_us %r1 %r0
434 beqi xus %r1 us7f
435 calli @abort
436xus:
437#if __WORDSIZE == 64
438 movi %r0 w7f
439 extr_i %r1 %r0
440 beqi xi %r1 i7f
441 calli @abort
442xi:
443 movi %r0 w7f
444 extr_ui %r1 %r0
445 beqi xui %r1 ui7f
446 calli @abort
447xui:
448#endif
449 movi %r0 -2
450 extr_f %f0 %r0
451 beqi_f xif %f0 -2
452 calli @abort
453xif:
454 movi %r0 32
455 extr_d %f0 %r0
456 beqi_d xid %f0 32
457 calli @abort
458xid:
459 movi_f %f0 -128
460 truncr_f %r0 %f0
461 beqi xfi %r0 -128
462 calli @abort
463xfi:
464 movi_d %f0 -128
465 truncr_d %r0 %f0
466 beqi xdi %r0 -128
467 calli @abort
468xdi:
469#if __WORDSIZE == 64
470 movi_f %f0 -128
471 truncr_f_i %r0 %f0
472 andi %r0 %r0 0xffffffff
473 beqi yfi %r0 $(-128 & 0xffffffff)
474 calli @abort
475yfi:
476 movi_d %f0 -128
477 truncr_d_i %r0 %f0
478 andi %r0 %r0 0xffffffff
479 beqi ydi %r0 $(-128 & 0xffffffff)
480 calli @abort
481ydi:
482#endif
483 movi_f %f0 0.5
484 extr_f_d %f1 %f0
485 beqi_d xfd %f1 0.5
486 calli @abort
487xfd:
488 movi_d %f0 0.5
489 extr_d_f %f1 %f0
490 beqi_f xdf %f1 0.5
491 calli @abort
492xdf:
ba86ff93
PC
493 movi_f %f0 0.5
494 movr_f_w %r0 %f0
495 movr_w_f %f1 %r0
496 beqr_f fw %f0 %f1
497 calli @abort
498fw:
499 movi_f %f1 0.25
500 movi_f_w %r0 0.25
501 movr_w_f %f0 %r0
502 beqr_f ifw %f0 %f1
503 calli @abort
504ifw:
505#if __WORDSIZE == 32
506 movi_d %f0 0.5
507 movr_d_ww %r0 %r1 %f0
508 movr_ww_d %f1 %r0 %r1
509 beqr_d dww %f0 %f1
510 calli @abort
511dww:
512 movi_d %f1 0.25
513 movi_d_ww %r0 %r1 0.25
514 movr_ww_d %f0 %r0 %r1
515 beqr_d idww %f0 %f1
516 calli @abort
517idww:
518#else
519 movi_d %f0 0.5
520 movr_d_w %r0 %f0
521 movr_w_d %f1 %r0
522 beqr_d dw %f0 %f1
523 calli @abort
524dw:
525 movi_d %f1 0.25
526 movi_d_w %r0 0.25
527 movr_w_d %f0 %r0
528 beqr_d idw %f0 %f1
529 calli @abort
530idw:
531#endif
532
533 movi_f %f1 0.25
534 movi_w_f %f0 0x3e800000
535 beqr_f iwf %f0 %f1
536 calli @abort
537iwf:
538#if __WORDSIZE == 32
539 movi_d %f1 0.5
540 movi_ww_d %f0 0 0x3fe00000
541 beqr_d iwwd %f0 %f1
542 calli @abort
543iwwd:
544#else
545 movi_d %f1 0.5
546 movi_w_d %f0 0x3fe0000000000000
547 beqr_d iwd %f0 %f1
548 calli @abort
549iwd:
550#endif
4a71579b
PC
551
552 EXTII(v0, v1, v2, r0, r1, r2)
553 EXIF(v0, v1, v2, r0, r1, r2, f0, f1, f2, f3, f4, f5)
554 EXID(v0, v1, v2, r0, r1, r2, f0, f1, f2, f3, f4, f5)
555 EXFI(v0, v1, v2, r0, r1, r2, f0, f1, f2, f3, f4, f5)
556#if __WORDSIZE == 64
557 LEXFI(v0, v1, v2, r0, r1, r2, f0, f1, f2, f3, f4, f5)
558 LEXDI(v0, v1, v2, r0, r1, r2, f0, f1, f2, f3, f4, f5)
559#endif
560 EXDI(v0, v1, v2, r0, r1, r2, f0, f1, f2, f3, f4, f5)
561 EXTFD(f0, f1, f2, f3, f4, f5)
562 EXTDF(f0, f1, f2, f3, f4, f5)
ba86ff93
PC
563 FW(v0, v1, v2, r0, r1, r2, f0, f1, f2, f3, f4, f5)
564 FWI(v0, v1, v2, r0, r1, r2, f0, f1, f2, f3, f4, f5)
565 DW(v0, v1, v2, r0, r1, r2, f0, f1, f2, f3, f4, f5)
566 DWI(v0, v1, v2, r0, r1, r2, f0, f1, f2, f3, f4, f5)
567 WFI(f0, f1, f2, f3, f4, f5)
568 WDI(f0, f1, f2, f3, f4, f5)
4a71579b
PC
569
570 // just to know did not abort
571 prepare
572 pushargi ok
573 ellipsis
574 finishi @printf
575
576 ret
577 epilog