add a thp-based huge page alloc fallback
[pcsx_rearmed.git] / deps / lightning / check / ldstxr.tst
CommitLineData
4a71579b
PC
1#include "ldst.inc"
2
3#if __WORDSIZE == 64
4# define LDSTL(N, R0, R1, R2) \
5 movi %R2 $offui \
6 stxr_i %R2 %R0 %R1 \
7 movi %R1 L##N \
8 movi %R2 $offl \
9 stxr_l %R2 %R0 %R1
10
11# define SI(C, N, x, X, R0, R1, R2) \
12 movi %R2 $off##x \
13 ldxr_##x %R1 %R0 %R2 \
14 beqi L##x##C %R1 L##X##N \
15 calli @abort \
16L##x##C:
17
18# define LDRL(C, N, R0, R1, R2) \
19 UI(C, N, i, I, R0, R1, R2) \
20 SI(C, N, l, L, R0, R1, R2)
21#else
22# define LDSTL(C, R0, R1, R2)
23# define SI(C, N, x, X, R0, R1, R2) \
24 movi %R2 $off##x \
25 ldxr_##x %R1 %R0 %R2 \
26 beqi L##x##C %R1 I##X##N \
27 calli @abort \
28L##x##C:
29
30# define LDRL(C, N, R0, R1, R2)
31
32#endif
33
34#define UI(C, N, x, X, R0, R1, R2) \
35 movi %R2 $offu##x \
36 ldxr_u##x %R1 %R0 %R2 \
37 beqi Lu##x##C %R1 X##N \
38 calli @abort \
39Lu##x##C:
40
41#define FF(C, N, x, X, R0, R1, F0) \
42 movi %R1 $off##x \
43 ldxr_##x %F0 %R0 %R1 \
44 beqi_##x L##x##C %F0 X##N \
45L##x##C:
46
47#define LDST1(X, N, R0, R1, R2, F0) \
48 movi %R0 t0 \
49 movi %R1 C##N \
50 movi %R2 $offc \
51 stxr_c %R2 %R0 %R1 \
52 movi %R2 $offuc \
53 stxr_c %R2 %R0 %R1 \
54 movi %R1 S##N \
55 movi %R2 $offs \
56 stxr_s %R2 %R0 %R1 \
57 movi %R2 $offus \
58 stxr_s %R2 %R0 %R1 \
59 movi %R1 I##N \
60 movi %R2 $offi \
61 stxr_i %R2 %R0 %R1 \
62 LDSTL(N, R0, R1, R2) \
63 movi_f %F0 F##N \
64 movi %R2 $offf \
65 stxr_f %R2 %R0 %F0 \
66 movi_d %F0 D##N \
67 movi %R2 $offd \
68 stxr_d %R2 %R0 %F0 \
69 SI(X, N, c, C, R0, R1, R2) \
70 UI(X, N, c, C, R0, R1, R2) \
71 SI(X, N, s, S, R0, R1, R2) \
72 UI(X, N, s, S, R0, R1, R2) \
73 SI(X, N, i, I, R0, R1, R2) \
74 LDRL(X, N, R0, R1, R2) \
75 FF(X, N, f, F, R0, R1, F0) \
76 FF(X, N, d, D, R0, R1, F0)
77
78#define LDST0(R0, R1, R2, F0) \
79 LDST1(0_##R0##_##R1##_##R2##_##F0, 0, R0, R1, R2, F0) \
80 LDST1(1_##R0##_##R1##_##R2##_##F0, 1, R0, R1, R2, F0) \
81 LDST1(2_##R0##_##R1##_##R2##_##F0, 2, R0, R1, R2, F0) \
82 LDST1(3_##R0##_##R1##_##R2##_##F0, 3, R0, R1, R2, F0)
83
84#define LDST(V0, V1, V2, R0, R1, R2, F0, F1, F2, F3, F4, F5) \
85 LDST0(V0, V1, R0, F0) \
86 LDST0(V0, V1, R1, F1) \
87 LDST0(V0, V1, R2, F2) \
88 LDST0(V0, V2, R0, F3) \
89 LDST0(V0, V2, R1, F4) \
90 LDST0(V0, V2, R2, F5) \
91 LDST0(V0, R0, V1, F0) \
92 LDST0(V0, R0, V2, F1) \
93 LDST0(V0, R0, R1, F2) \
94 LDST0(V0, R0, R2, F3) \
95 LDST0(V0, R0, V1, F4) \
96 LDST0(V0, R1, V1, F5) \
97 LDST0(V0, R1, V2, F0) \
98 LDST0(V0, R1, R0, F1) \
99 LDST0(V0, R1, R2, F2) \
100 LDST0(V0, V1, V2, F3) \
101 LDST0(V0, R1, R0, F4) \
102 LDST0(V0, R1, R2, F5) \
103 LDST0(R0, V1, V0, F0) \
104 LDST0(R0, V1, R1, F1) \
105 LDST0(R0, V1, R2, F2) \
106 LDST0(R0, V2, V0, F3) \
107 LDST0(R0, V2, R1, F4) \
108 LDST0(R0, V2, R2, F5) \
109 LDST0(R0, V0, V1, F0) \
110 LDST0(R0, V0, V2, F1) \
111 LDST0(R0, V0, R1, F2) \
112 LDST0(R0, V0, R2, F3) \
113 LDST0(R0, V0, V1, F4) \
114 LDST0(R0, R1, V1, F5) \
115 LDST0(R0, R1, V2, F0) \
116 LDST0(R0, R1, V0, F1) \
117 LDST0(R0, R1, R2, F2) \
118 LDST0(R0, V1, V2, F3) \
119 LDST0(R0, R1, V0, F4) \
120 LDST0(R0, R1, R2, F5)
121
122.code
123 prolog
124
125 /* Simple test to simplify validating encodings before
126 * brute force tests */
127 movi %r0 t0
128 movi %r1 0x81
129 movi %r2 $offc
130 stxr_c %r2 %r0 %r1
131 movi %r2 $offuc
132 stxr_c %r2 %r0 %r1
133 movi %r1 0x8001
134 movi %r2 $offs
135 stxr_s %r2 %r0 %r1
136 movi %r2 $offus
137 stxr_s %r2 %r0 %r1
138 movi %r1 0x80000001
139 movi %r2 $offi
140 stxr_i %r2 %r0 %r1
141#if __WORDSIZE == 64
142 movi %r2 $offui
143 stxr_i %r2 %r0 %r1
144 movi %r1 0x8000000000000001
145 movi %r2 $offl
146 stxr_l %r2 %r0 %r1
147#endif
148 movi_f %f0 0.5
149 movi %r2 $offf
150 stxr_f %r2 %r0 %f0
151 movi_d %f0 0.25
152 movi %r2 $offd
153 stxr_d %r2 %r0 %f0
154 movi %r2 $offc
155 ldxr_c %r1 %r0 %r2
156 beqi Lc %r1 XC
157 calli @abort
158Lc:
159 movi %r2 $offuc
160 ldxr_uc %r1 %r0 %r2
161 beqi Luc %r1 0x81
162 calli @abort
163Luc:
164 movi %r2 $offs
165 ldxr_s %r1 %r0 %r2
166 beqi Ls %r1 XS
167 calli @abort
168Ls:
169 movi %r2 $offus
170 ldxr_us %r1 %r0 %r2
171 beqi Lus %r1 0x8001
172 calli @abort
173Lus:
174 movi %r2 $offi
175 ldxr_i %r1 %r0 %r2
176 beqi Li %r1 XI
177 calli @abort
178Li:
179#if __WORDSIZE == 64
180 movi %r2 $offui
181 ldxr_ui %r1 %r0 %r2
182 beqi Lui %r1 0x80000001
183 calli @abort
184Lui:
185 movi %r2 $offl
186 ldxr_l %r1 %r0 %r2
187 beqi Ll %r1 0x8000000000000001
188 calli @abort
189Ll:
190#endif
191 movi %r2 $offf
192 ldxr_f %f0 %r0 %r2
193 beqi_f Lf %f0 0.5
194 calli @abort
195Lf:
196 movi %r2 $offd
197 ldxr_d %f0 %r0 %r2
198 beqi_d Ld %f0 0.25
199 calli @abort
200Ld:
201
202 LDST(v0, v1, v2, r0, r1, r2, f0, f1, f2, f3, f4, f5)
203 // just to know did not abort
204 prepare
205 pushargi ok
206 ellipsis
207 finishi @printf
208 ret
209 epilog