add a thp-based huge page alloc fallback
[pcsx_rearmed.git] / deps / lightning / check / branch.tst
CommitLineData
4a71579b
PC
1#if __WORDSIZE == 64
2# define I7f 0x7fffffffffffffff
3# define I80 0x8000000000000000
4# define I81 0x8000000000000001
5# define Iff 0xffffffffffffffff
6#else
7# define I7f 0x7fffffff
8# define I80 0x80000000
9# define I81 0x80000001
10# define Iff 0xffffffff
11#endif
12
13.data 12
14ok:
15.c "ok\n"
16. $($NaN = 0.0 / 0.0)
17
18#define BOP(N, Ls, Rs, Lu, Ru, R0, R1) \
19 movi %R0 Ls \
20 movi %R1 Rs \
21 b##N##r N##r_##R0##_##R1 %R0 %R1 \
22 calli @abort \
23N##r_##R0##_##R1: \
24 b##N##i N##i_##R0##_##R1 %R0 Rs \
25 calli @abort \
26N##i_##R0##_##R1: \
27 movi %R0 Lu \
28 movi %R1 Ru \
29 b##N##r_u N##r_u_##R0##_##R1 %R0 %R1 \
30 calli @abort \
31N##r_u_##R0##_##R1: \
32 b##N##i_u N##i_u_##R0##_##R1 %R0 Ru \
33 calli @abort \
34N##i_u_##R0##_##R1: \
35 movi %R0 Ls \
36 movi %R1 Rs \
37 N##r %R0 %R0 %R1 \
38 beqi _##N##r_##R0##_##R1 %R0 1 \
39 calli @abort \
40_##N##r_##R0##_##R1: \
41 movi %R0 Ls \
42 N##i %R1 %R0 Rs \
43 beqi _##N##i_##R0##_##R1 %R1 1 \
44 calli @abort \
45_##N##i_##R0##_##R1: \
46 movi %R0 Lu \
47 movi %R1 Ru \
48 N##r_u %R0 %R0 %R1 \
49 beqi _##N##r_u_##R0##_##R1 %R0 1 \
50 calli @abort \
51_##N##r_u_##R0##_##R1: \
52 movi %R0 Lu \
53 N##i_u %R1 %R0 Ru \
54 beqi _##N##i_u_##R0##_##R1 %R1 1 \
55 calli @abort \
56_##N##i_u_##R0##_##R1:
57
58#define EB(N, L, R, R0, R1) \
59 movi %R0 L \
60 movi %R1 R \
61 b##N##r N##r_##R0##_##R1 %R0 %R1 \
62 calli @abort \
63N##r_##R0##_##R1: \
64 b##N##i N##i_##R0##_##R1 %R0 R \
65 calli @abort \
66N##i_##R0##_##R1: \
67 movi %R0 L \
68 movi %R1 R \
69 N##r %R0 %R0 %R1 \
70 beqi _##N##r_##R0##_##R1 %R0 1 \
71 calli @abort \
72_##N##r_##R0##_##R1: \
73 movi %R0 L \
74 N##i %R1 %R0 R \
75 beqi _##N##i_##R0##_##R1 %R1 1 \
76 calli @abort \
77_##N##i_##R0##_##R1:
78
79#define XEB(N, L, R, R0, R1) \
80 movi %R0 L \
81 movi %R1 R \
82 b##N##r N##r_##R0##_##R1 %R0 %R1 \
83 calli @abort \
84N##r_##R0##_##R1: \
85 b##N##i N##i_##R0##_##R1 %R0 R \
86 calli @abort \
87N##i_##R0##_##R1:
88
89#define XBOP(N, Ls, Rs, Lu, Ru, R0, R1) \
90 movi %R0 Ls \
91 movi %R1 Rs \
92 b##N##r N##r_##R0##_##R1 %R0 %R1 \
93 calli @abort \
94N##r_##R0##_##R1: \
95 movi %R0 Ls \
96 b##N##i N##i_##R0##_##R1 %R0 Rs \
97 calli @abort \
98N##i_##R0##_##R1: \
99 movi %R0 Lu \
100 movi %R1 Ru \
101 b##N##r_u N##r_u_##R0##_##R1 %R0 %R1 \
102 calli @abort \
103N##r_u_##R0##_##R1: \
104 movi %R0 Lu \
105 b##N##i_u N##i_u_##R0##_##R1 %R0 Ru \
106 calli @abort \
107N##i_u_##R0##_##R1:
108
109#define BOPI(N, Ls, Rs, Lu, Ru) \
110 BOP(N, Ls, Rs, Lu, Ru, v0, v1) \
111 BOP(N, Ls, Rs, Lu, Ru, v0, v2) \
112 BOP(N, Ls, Rs, Lu, Ru, v0, r0) \
113 BOP(N, Ls, Rs, Lu, Ru, v0, r1) \
114 BOP(N, Ls, Rs, Lu, Ru, v0, r2) \
115 BOP(N, Ls, Rs, Lu, Ru, v1, v0) \
116 BOP(N, Ls, Rs, Lu, Ru, v1, v2) \
117 BOP(N, Ls, Rs, Lu, Ru, v1, r0) \
118 BOP(N, Ls, Rs, Lu, Ru, v1, r1) \
119 BOP(N, Ls, Rs, Lu, Ru, v1, r2) \
120 BOP(N, Ls, Rs, Lu, Ru, v2, v0) \
121 BOP(N, Ls, Rs, Lu, Ru, v2, v1) \
122 BOP(N, Ls, Rs, Lu, Ru, v2, r0) \
123 BOP(N, Ls, Rs, Lu, Ru, v2, r1) \
124 BOP(N, Ls, Rs, Lu, Ru, v2, r2) \
125 BOP(N, Ls, Rs, Lu, Ru, r0, v0) \
126 BOP(N, Ls, Rs, Lu, Ru, r0, v1) \
127 BOP(N, Ls, Rs, Lu, Ru, r0, v2) \
128 BOP(N, Ls, Rs, Lu, Ru, r0, r1) \
129 BOP(N, Ls, Rs, Lu, Ru, r0, r2) \
130 BOP(N, Ls, Rs, Lu, Ru, r1, v0) \
131 BOP(N, Ls, Rs, Lu, Ru, r1, v1) \
132 BOP(N, Ls, Rs, Lu, Ru, r1, v2) \
133 BOP(N, Ls, Rs, Lu, Ru, r1, r0) \
134 BOP(N, Ls, Rs, Lu, Ru, r1, r2) \
135 BOP(N, Ls, Rs, Lu, Ru, r2, v0) \
136 BOP(N, Ls, Rs, Lu, Ru, r2, v1) \
137 BOP(N, Ls, Rs, Lu, Ru, r2, v2) \
138 BOP(N, Ls, Rs, Lu, Ru, r2, r0) \
139 BOP(N, Ls, Rs, Lu, Ru, r2, r1)
140
141#define EBI(N, L, R) \
142 EB(N, L, R, v0, v1) \
143 EB(N, L, R, v0, v2) \
144 EB(N, L, R, v0, r0) \
145 EB(N, L, R, v0, r1) \
146 EB(N, L, R, v0, r2) \
147 EB(N, L, R, v1, v0) \
148 EB(N, L, R, v1, v2) \
149 EB(N, L, R, v1, r0) \
150 EB(N, L, R, v1, r1) \
151 EB(N, L, R, v1, r2) \
152 EB(N, L, R, v2, v0) \
153 EB(N, L, R, v2, v1) \
154 EB(N, L, R, v2, r0) \
155 EB(N, L, R, v2, r1) \
156 EB(N, L, R, v2, r2) \
157 EB(N, L, R, r0, v0) \
158 EB(N, L, R, r0, v1) \
159 EB(N, L, R, r0, v2) \
160 EB(N, L, R, r0, r1) \
161 EB(N, L, R, r0, r2) \
162 EB(N, L, R, r1, v0) \
163 EB(N, L, R, r1, v1) \
164 EB(N, L, R, r1, v2) \
165 EB(N, L, R, r1, r0) \
166 EB(N, L, R, r1, r2) \
167 EB(N, L, R, r2, v0) \
168 EB(N, L, R, r2, v1) \
169 EB(N, L, R, r2, v2) \
170 EB(N, L, R, r2, r0) \
171 EB(N, L, R, r2, r1)
172
173
174#define XEBI(N, L, R) \
175 XEB(N, L, R, v0, v1) \
176 XEB(N, L, R, v0, v2) \
177 XEB(N, L, R, v0, r0) \
178 XEB(N, L, R, v0, r1) \
179 XEB(N, L, R, v0, r2) \
180 XEB(N, L, R, v1, v0) \
181 XEB(N, L, R, v1, v2) \
182 XEB(N, L, R, v1, r0) \
183 XEB(N, L, R, v1, r1) \
184 XEB(N, L, R, v1, r2) \
185 XEB(N, L, R, v2, v0) \
186 XEB(N, L, R, v2, v1) \
187 XEB(N, L, R, v2, r0) \
188 XEB(N, L, R, v2, r1) \
189 XEB(N, L, R, v2, r2) \
190 XEB(N, L, R, r0, v0) \
191 XEB(N, L, R, r0, v1) \
192 XEB(N, L, R, r0, v2) \
193 XEB(N, L, R, r0, r1) \
194 XEB(N, L, R, r0, r2) \
195 XEB(N, L, R, r1, v0) \
196 XEB(N, L, R, r1, v1) \
197 XEB(N, L, R, r1, v2) \
198 XEB(N, L, R, r1, r0) \
199 XEB(N, L, R, r1, r2) \
200 XEB(N, L, R, r2, v0) \
201 XEB(N, L, R, r2, v1) \
202 XEB(N, L, R, r2, v2) \
203 XEB(N, L, R, r2, r0) \
204 XEB(N, L, R, r2, r1)
205
206#define XBOPI(N, Ls, Rs, Lu, Ru) \
207 XBOP(N, Ls, Rs, Lu, Ru, v0, v1) \
208 XBOP(N, Ls, Rs, Lu, Ru, v0, v2) \
209 XBOP(N, Ls, Rs, Lu, Ru, v0, r0) \
210 XBOP(N, Ls, Rs, Lu, Ru, v0, r1) \
211 XBOP(N, Ls, Rs, Lu, Ru, v0, r2) \
212 XBOP(N, Ls, Rs, Lu, Ru, v1, v0) \
213 XBOP(N, Ls, Rs, Lu, Ru, v1, v2) \
214 XBOP(N, Ls, Rs, Lu, Ru, v1, r0) \
215 XBOP(N, Ls, Rs, Lu, Ru, v1, r1) \
216 XBOP(N, Ls, Rs, Lu, Ru, v1, r2) \
217 XBOP(N, Ls, Rs, Lu, Ru, v2, v0) \
218 XBOP(N, Ls, Rs, Lu, Ru, v2, v1) \
219 XBOP(N, Ls, Rs, Lu, Ru, v2, r0) \
220 XBOP(N, Ls, Rs, Lu, Ru, v2, r1) \
221 XBOP(N, Ls, Rs, Lu, Ru, v2, r2) \
222 XBOP(N, Ls, Rs, Lu, Ru, r0, v0) \
223 XBOP(N, Ls, Rs, Lu, Ru, r0, v1) \
224 XBOP(N, Ls, Rs, Lu, Ru, r0, v2) \
225 XBOP(N, Ls, Rs, Lu, Ru, r0, r1) \
226 XBOP(N, Ls, Rs, Lu, Ru, r0, r2) \
227 XBOP(N, Ls, Rs, Lu, Ru, r1, v0) \
228 XBOP(N, Ls, Rs, Lu, Ru, r1, v1) \
229 XBOP(N, Ls, Rs, Lu, Ru, r1, v2) \
230 XBOP(N, Ls, Rs, Lu, Ru, r1, r0) \
231 XBOP(N, Ls, Rs, Lu, Ru, r1, r2) \
232 XBOP(N, Ls, Rs, Lu, Ru, r2, v0) \
233 XBOP(N, Ls, Rs, Lu, Ru, r2, v1) \
234 XBOP(N, Ls, Rs, Lu, Ru, r2, v2) \
235 XBOP(N, Ls, Rs, Lu, Ru, r2, r0) \
236 XBOP(N, Ls, Rs, Lu, Ru, r2, r1)
237
238#define TBOPF(N, T, L, R) \
239 movi_##T %f0 L \
240 movi_##T %f1 R \
241 b##N##r##_##T N##r_##T %f0 %f1 \
242 calli @abort \
243N##r_##T: \
244 b##N##i##_##T N##i_##T %f0 R \
245 calli @abort \
246N##i_##T: \
247 movi_##T %f1 $NaN \
248 b##N##r##_##T N##r_##T##_##u %f0 %f1 \
249 jmpi N##r_##T##_##u0 \
250N##r_##T##_##u: \
251 calli @abort \
252N##r##_##T##_##u0: \
253 b##N##i##_##T N##i_##T##_##u %f0 $NaN \
254 jmpi N##i_##T##_##u0 \
255N##i##_##T##_##u: \
256 calli @abort \
257N##i##_##T##_##u0:
258#define BOPF(N, L, R) \
259 TBOPF(N, f, L, R) \
260 TBOPF(N, d, L, R)
261
262#define TUBOPF(N, T, L, R) \
263 movi_##T %f0 L \
264 movi_##T %f1 R \
265 b##N##r##_##T N##r_##T %f0 %f1 \
266 calli @abort \
267N##r_##T: \
268 b##N##i##_##T N##i_##T %f0 R \
269 calli @abort \
270N##i_##T: \
271 movi_##T %f1 $NaN \
272 b##N##r##_##T N##r_##T##_##u %f0 %f1 \
273 calli @abort \
274N##r_##T##_##u: \
275 b##N##i##_##T N##i_##T##_##u %f0 $NaN \
276 calli @abort \
277N##i##_##T##_##u:
278
279#define UBOPF(N, L, R) \
280 TUBOPF(N, f, L, R) \
281 TUBOPF(N, d, L, R)
282
283.code
284 prolog
285
286 movi %r0 -1
287 movi %r1 1
288 bltr xltr_r0_r1 %r0 %r1
289 calli @abort
290xltr_r0_r1:
291 blti xlti_r0_r1 %r0 1
292 calli @abort
293xlti_r0_r1:
294 movi %r0 1
295 movi %r1 -1
296 bltr_u xltru_r0_r1 %r0 %r1
297 calli @abort
298xltru_r0_r1:
299 blti_u xltiu_r0_r1 %r0 -1
300 calli @abort
301xltiu_r0_r1:
302 movi %r0 -1
303 movi %r1 -1
304 bler xler_r0_r1 %r0 %r1
305 calli @abort
306xler_r0_r1:
307 blti xlei_r0_r1 %r0 1
308 calli @abort
309xlei_r0_r1:
310 movi %r0 1
311 movi %r1 -1
312 bltr_u xlteu_r0_r1 %r0 %r1
313 calli @abort
314xlteu_r0_r1:
315 blei_u xleiu_r0_r1 %r0 -1
316 calli @abort
317xleiu_r0_r1:
318 movi %r0 32
319 movi %r1 32
320 beqr xeqr_r0_r1 %r0 %r1
321 calli @abort
322xeqr_r0_r1:
323 beqi xeqi_r0_r1 %r0 32
324 calli @abort
325xeqi_r0_r1:
326 movi %r0 -2
327 movi %r1 -2
328 bger xger_r0_r1 %r0 %r1
329 calli @abort
330xger_r0_r1:
331 bgei xgei_r0_r1 %r0 -2
332 calli @abort
333xgei_r0_r1:
334 movi %r0 2
335 movi %r1 2
336 bger_u xgeru_r0_r1 %r0 %r1
337 calli @abort
338xgeru_r0_r1:
339 bgei_u xgeiu_r0_r1 %r0 2
340 calli @abort
341xgeiu_r0_r1:
342 movi %r0 2
343 movi %r1 -2
344 bgtr xgtr_r0_r1 %r0 %r1
345 calli @abort
346xgtr_r0_r1:
347 bgti xgti_r0_r1 %r0 -2
348 calli @abort
349xgti_r0_r1:
350 movi %r0 -2
351 movi %r1 2
352 bgtr_u xgtru_r0_r1 %r0 %r1
353 calli @abort
354xgtru_r0_r1:
355 bgti_u xgtiu_r0_r1 %r0 2
356 calli @abort
357xgtiu_r0_r1:
358 movi %r0 -3
359 movi %r1 3
360 bner xner_r0_r1 %r0 %r1
361 calli @abort
362xner_r0_r1:
363 bnei xnei_r0_r1 %r0 3
364 calli @abort
365xnei_r0_r1:
366 movi %r0 1
367 movi %r1 3
368 bmsr xmsr_r0_r1 %r0 %r1
369 calli @abort
370xmsr_r0_r1:
371 bmsi xmsi_r0_r1 %r0 3
372 calli @abort
373xmsi_r0_r1:
374 movi %r0 1
375 movi %r1 2
376 bmcr xmcr_r0_r1 %r0 %r1
377 calli @abort
378xmcr_r0_r1:
379 bmci xmci_r0_r1 %r0 2
380 calli @abort
381xmci_r0_r1:
382 movi %r0 I7f
383 movi %r1 1
384 boaddr xoaddr_r0_r1 %r0 %r1
385 calli @abort
386xoaddr_r0_r1:
387 movi %r0 Iff
388 movi %r1 1
389 boaddr_u xoaddr_u_r0_r1 %r0 %r1
390 calli @abort
391xoaddr_u_r0_r1:
392 movi %r0 I7f
393 boaddi xoaddi_r0_r1 %r0 1
394 calli @abort
395xoaddi_r0_r1:
396 movi %r0 Iff
397 boaddi_u xoaddi_u_r0_r1 %r0 1
398 calli @abort
399xoaddi_u_r0_r1:
400 movi %r0 I80
401 movi %r1 1
402 bxaddr xxaddr_r0_r1 %r0 %r1
403 calli @abort
404xxaddr_r0_r1:
405 movi %r0 I80
406 bxaddi xxaddi_r0_r1 %r0 1
407 calli @abort
408xxaddi_r0_r1:
409 movi %r0 I7f
410 movi %r1 1
411 bxaddr_u xxaddr_u_r0_r1 %r0 %r1
412 calli @abort
413xxaddr_u_r0_r1:
414 movi %r0 I7f
415 bxaddi_u xxaddi_u_r0_r1 %r0 1
416 calli @abort
417xxaddi_u_r0_r1:
418 movi %r0 I80
419 movi %r1 1
420 bosubr xosubr_r0_r1 %r0 %r1
421 calli @abort
422xosubr_r0_r1:
423 movi %r0 0
424 movi %r1 1
425 bosubr_u xosubr_u_r0_r1 %r0 %r1
426 calli @abort
427xosubr_u_r0_r1:
428 movi %r0 I80
429 bosubi xosubi_r0_r1 %r0 1
430 calli @abort
431xosubi_r0_r1:
432 movi %r0 0
433 bosubi_u xosubi_u_r0_r1 %r0 1
434 calli @abort
435xosubi_u_r0_r1:
436 movi %r0 I81
437 movi %r1 1
438 bxsubr xxsubr_r0_r1 %r0 %r1
439 calli @abort
440xxsubr_r0_r1:
441 movi %r0 I81
442 bxsubi xxsubi_r0_r1 %r0 1
443 calli @abort
444xxsubi_r0_r1:
445 movi %r0 I80
446 movi %r1 1
447 bxsubr_u xxsubr_u_r0_r1 %r0 %r1
448 calli @abort
449xxsubr_u_r0_r1:
450 movi %r0 I80
451 bxsubi_u xxsubi_u_r0_r1 %r0 1
452 calli @abort
453xxsubi_u_r0_r1:
454 movi_f %f0 1
455 movi_f %f1 2
456 bltr_f xltr_f_f0_f1 %f0 %f1
457 calli @abort
458xltr_f_f0_f1:
459 blti_f xlti_f_f0_f1 %f0 2
460 calli @abort
461xlti_f_f0_f1:
462 movi_f %f0 -1
463 movi_f %f1 -1
464 bler_f xler_f_f0_f1 %f0 %f1
465 calli @abort
466xler_f_f0_f1:
467 blei_f xlei_f_f0_f1 %f0 -1
468 calli @abort
469xlei_f_f0_f1:
470 movi_f %f0 -2
471 movi_f %f1 -2
472 beqr_f xeqr_f_f0_f1 %f0 %f1
473 calli @abort
474xeqr_f_f0_f1:
475 beqi_f xeqi_f_f0_f1 %f0 -2
476 calli @abort
477xeqi_f_f0_f1:
478 movi_f %f0 -3
479 movi_f %f1 -3
480 bger_f xger_f_f0_f1 %f0 %f1
481 calli @abort
482xger_f_f0_f1:
483 bgei_f xgei_f_f0_f1 %f0 -3
484 calli @abort
485xgei_f_f0_f1:
486 movi_f %f0 2
487 movi_f %f1 1
488 bgtr_f xgtr_f_f0_f1 %f0 %f1
489 calli @abort
490xgtr_f_f0_f1:
491 bgti_f xgti_f_f0_f1 %f0 1
492 calli @abort
493xgti_f_f0_f1:
494 movi_f %f0 0
495 movi_f %f1 2
496 bner_f xner_f_f0_f1 %f0 %f1
497 calli @abort
498xner_f_f0_f1:
499 bnei_f xnei_f_f0_f1 %f0 2
500 calli @abort
501xnei_f_f0_f1:
502
503 BOPI(lt, -1, 1, 1, -1)
504 BOPI(le, -1, -1, 1, 1)
505 EBI(eq, 32, 32)
506 BOPI(ge, -2, -2, 2, 2)
507 BOPI(gt, 2, -2, -2, 2)
508 EBI(ne, 3, -3)
509 XEBI(ms, 1, 3)
510 XEBI(mc, 1, 2)
511 XBOPI(oadd, I7f, 1, Iff, 1)
512 XBOPI(xadd, I80, 1, I7f, 1)
513 XBOPI(osub, I80, 1, 0, 1)
514 XBOPI(xsub, I81, 1, I80, 1)
515 BOPF(lt, 1, 2)
516 BOPF(le, 2, 2)
517 BOPF(eq, 3, 3)
518 BOPF(ge, 3, 3)
519 BOPF(gt, 4, 3)
520 UBOPF(ne, 4, 3)
521 UBOPF(unlt, 1, 2)
522 UBOPF(unle, 2, 2)
523 UBOPF(uneq, 3, 3)
524 UBOPF(unge, 3, 3)
525 UBOPF(ungt, 4, 3)
526 BOPF(ltgt, 4, 3)
527 movi_f %f0 5
528 movi_f %f1 5
529 bordr_f ordr_f %f0 %f1
530 calli @abort
531ordr_f:
532 bordi_f ordi_f %f0 1
533 calli @abort
534ordi_f:
535 bordi_f ordi_f_u %f0 $NaN
536 jmpi ordi_f_u0
537ordi_f_u:
538 calli @abort
539ordi_f_u0:
540 movi_f %f0 5
541 movi_f %f1 5
542 bunordr_f unordr_f %f0 %f1
543 jmpi unordr_f_0
544unordr_f:
545 calli @abort
546unordr_f_0:
547 bunordi_f unordi_f %f0 1
548 jmpi unordi_f_0
549unordi_f:
550 calli @abort
551unordi_f_0:
552 bunordi_f unordi_f_1 %f0 $NaN
553 calli @abort
554unordi_f_1:
555
556 // just to know did not crash or abort
557 prepare
558 pushargi ok
559 ellipsis
560 finishi @printf
561
562 ret
563 epilog