try a new github issue template
[pcsx_rearmed.git] / deps / lightning / check / ldstr-c.tst
CommitLineData
4a71579b
PC
1#include "ldst.inc"
2
3#if __WORDSIZE == 64
4# define LDSTL(N, R0, R1) \
5 movi %R0 $(t0 + $offui) \
6 str_i %R0 %R1 \
7 movi %R0 $(t0 + $offl) \
8 movi %R1 L##N \
9 str_l %R0 %R1
10
11# define SI(C, N, x, X, R0) \
12 movi %R0 $(t0 + $off##x) \
13 ldr_##x %R0 %R0 \
14 beqi L##x##C %R0 L##X##N \
15 calli @abort \
16L##x##C:
17
18# define LDRL(C, N, R0, R1) \
19 UI(C, N, i, I, R0) \
20 SI(C, N, l, L, R0)
21#else
22# define LDSTL(C, R0, R1)
23# define SI(C, N, x, X, R0) \
24 movi %R0 $(t0 + $off##x) \
25 ldr_##x %R0 %R0 \
26 beqi L##x##C %R0 I##X##N \
27 calli @abort \
28L##x##C:
29
30# define LDRL(C, N, R0, R1)
31
32#endif
33
34#define UI(C, N, x, X, R0) \
35 movi %R0 $(t0 + $offu##x) \
36 ldr_u##x %R0 %R0 \
37 beqi Lu##x##C %R0 X##N \
38 calli @abort \
39Lu##x##C:
40
41#define LDST1(X, N, R0, R1) \
42 movi %R0 $(t0 + $offc) \
43 movi %R1 C##N \
44 str_c %R0 %R1 \
45 movi %R0 $(t0 + $offuc) \
46 str_c %R0 %R1 \
47 movi %R0 $(t0 + $offs) \
48 movi %R1 S##N \
49 str_s %R0 %R1 \
50 movi %R0 $(t0 + $offus) \
51 str_s %R0 %R1 \
52 movi %R0 $(t0 + $offi) \
53 movi %R1 I##N \
54 str_i %R0 %R1 \
55 LDSTL(N, R0, R1) \
56 movi %R0 $(t0 + $offf) \
57 SI(X, N, c, C, R0) \
58 UI(X, N, c, C, R0) \
59 SI(X, N, s, S, R0) \
60 UI(X, N, s, S, R0) \
61 SI(X, N, i, I, R0) \
62 LDRL(X, N, R0, R1) \
63
64#define LDST0(R0, R1) \
65 LDST1(0_##R0##_##R1, 0, R0, R1) \
66 LDST1(1_##R0##_##R1, 1, R0, R1) \
67 LDST1(2_##R0##_##R1, 2, R0, R1) \
68 LDST1(3_##R0##_##R1, 3, R0, R1)
69
70#define LDST(V0, V1, V2, R0, R1, R2) \
71 LDST0(V0, V1) \
72 LDST0(V0, V2) \
73 LDST0(V0, R0) \
74 LDST0(V0, R1) \
75 LDST0(V0, R2) \
76 LDST0(V1, V0) \
77 LDST0(V1, V2) \
78 LDST0(V1, R0) \
79 LDST0(V1, R1) \
80 LDST0(V1, R2) \
81 LDST0(V2, R0) \
82 LDST0(V2, R1) \
83 LDST0(V2, R2)
84
85.code
86 prolog
87
88 /* Simple test to simplify validating encodings before
89 * brute force tests */
90 movi %r0 $(t0 + $offc)
91 movi %r1 0x81
92 str_c %r0 %r1
93 movi %r0 $(t0 + $offuc)
94 str_c %r0 %r1
95 movi %r0 $(t0 + $offs)
96 movi %r1 0x8001
97 str_s %r0 %r1
98 movi %r0 $(t0 + $offus)
99 str_s %r0 %r1
100 movi %r0 $(t0 + $offi)
101 movi %r1 0x80000001
102 str_i %r0 %r1
103#if __WORDSIZE == 64
104 movi %r0 $(t0 + $offui)
105 str_i %r0 %r1
106 movi %r0 $(t0 + $offl)
107 movi %r1 0x8000000000000001
108 str_l %r0 %r1
109#endif
110 movi %r0 $(t0 + $offc)
111 ldr_c %r0 %r0
112 beqi Lc %r0 XC
113 calli @abort
114Lc:
115 movi %r0 $(t0 + $offuc)
116 ldr_uc %r0 %r0
117 beqi Luc %r0 0x81
118 calli @abort
119Luc:
120 movi %r0 $(t0 + $offs)
121 ldr_s %r0 %r0
122 beqi Ls %r0 XS
123 calli @abort
124Ls:
125 movi %r0 $(t0 + $offus)
126 ldr_us %r0 %r0
127 beqi Lus %r0 0x8001
128 calli @abort
129Lus:
130 movi %r0 $(t0 + $offi)
131 ldr_i %r0 %r0
132 beqi Li %r0 XI
133 calli @abort
134Li:
135#if __WORDSIZE == 64
136 movi %r0 $(t0 + $offui)
137 ldr_ui %r0 %r0
138 beqi Lui %r0 0x80000001
139 calli @abort
140Lui:
141 movi %r0 $(t0 + $offl)
142 ldr_l %r0 %r0
143 beqi Ll %r0 0x8000000000000001
144 calli @abort
145Ll:
146#endif
147
148 LDST(v0, v1, v2, r0, r1, r2)
149 // just to know did not abort
150 prepare
151 pushargi ok
152 ellipsis
153 finishi @printf
154 ret
155 epilog