add a thp-based huge page alloc fallback
[pcsx_rearmed.git] / deps / lightning / check / ldstxr-c.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) \
12 movi %R1 $off##x \
13 ldxr_##x %R1 %R0 %R1 \
14 beqi L##x##C##0 %R1 L##X##N \
15 calli @abort \
16L##x##C##0: \
17 movi %R1 $off##x \
18 ldxr_##x %R0 %R0 %R1 \
19 beqi L##x##C##1 %R0 L##X##N \
20 calli @abort \
21L##x##C##1:
22
23# define LDRL(C, N, R0, R1, R2) \
24 UI(C, N, i, I, R0, R1) \
25 movi %R0 t0 \
26 SI(C, N, l, L, R0, R1)
27#else
28# define LDSTL(C, R0, R1, R2)
29# define SI(C, N, x, X, R0, R1) \
30 movi %R1 $off##x \
31 ldxr_##x %R1 %R0 %R1 \
32 beqi L##x##C##0 %R1 I##X##N \
33 calli @abort \
34L##x##C##0: \
35 movi %R1 $off##x \
36 ldxr_##x %R0 %R0 %R1 \
37 beqi L##x##C##1 %R0 I##X##N \
38 calli @abort \
39L##x##C##1:
40
41# define LDRL(C, N, R0, R1, R2)
42
43#endif
44
45#define UI(C, N, x, X, R0, R1) \
46 movi %R1 $offu##x \
47 ldxr_u##x %R1 %R0 %R1 \
48 beqi Lu##x##C##0 %R1 X##N \
49 calli @abort \
50Lu##x##C##0: \
51 movi %R1 $offu##x \
52 ldxr_u##x %R0 %R0 %R1 \
53 beqi Lu##x##C##1 %R0 X##N \
54 calli @abort \
55Lu##x##C##1:
56
57#define LDST1(X, N, R0, R1, R2) \
58 movi %R0 t0 \
59 movi %R1 C##N \
60 movi %R2 $offc \
61 stxr_c %R2 %R0 %R1 \
62 movi %R2 $offuc \
63 stxr_c %R2 %R0 %R1 \
64 movi %R1 S##N \
65 movi %R2 $offs \
66 stxr_s %R2 %R0 %R1 \
67 movi %R2 $offus \
68 stxr_s %R2 %R0 %R1 \
69 movi %R1 I##N \
70 movi %R2 $offi \
71 stxr_i %R2 %R0 %R1 \
72 LDSTL(N, R0, R1, R2) \
73 SI(X, N, c, C, R0, R1) \
74 movi %R0 t0 \
75 UI(X, N, c, C, R0, R1) \
76 movi %R0 t0 \
77 SI(X, N, s, S, R0, R1) \
78 movi %R0 t0 \
79 UI(X, N, s, S, R0, R1) \
80 movi %R0 t0 \
81 SI(X, N, i, I, R0, R1) \
82 movi %R0 t0 \
83 LDRL(X, N, R0, R1, R2) \
84
85#define LDST0(R0, R1, R2) \
86 LDST1(0_##R0##_##R1##_##R2, 0, R0, R1, R2) \
87 LDST1(1_##R0##_##R1##_##R2, 1, R0, R1, R2) \
88 LDST1(2_##R0##_##R1##_##R2, 2, R0, R1, R2) \
89 LDST1(3_##R0##_##R1##_##R2, 3, R0, R1, R2)
90
91#define LDST(V0, V1, V2, R0, R1, R2) \
92 LDST0(V1, V2, V0) \
93 LDST0(V1, R0, V0) \
94 LDST0(V1, R1, V0) \
95 LDST0(V1, R2, V0) \
96 LDST0(V0, R0, V1) \
97 LDST0(V0, R1, V1) \
98 LDST0(V0, R2, V1) \
99 LDST0(V0, V2, V1) \
100 LDST0(V2, V0, V1) \
101 LDST0(V2, R0, V1) \
102 LDST0(V2, R1, V1) \
103 LDST0(V2, R2, V1) \
104 LDST0(R0, R1, V2) \
105 LDST0(R0, R2, V2)
106
107.code
108 prolog
109
110 /* Simple test to simplify validating encodings before
111 * brute force tests */
112 movi %r0 t0
113 movi %r1 0x81
114 movi %r2 $offc
115 stxr_c %r2 %r0 %r1
116 movi %r2 $offuc
117 stxr_c %r2 %r0 %r1
118 movi %r1 0x8001
119 movi %r2 $offs
120 stxr_s %r2 %r0 %r1
121 movi %r2 $offus
122 stxr_s %r2 %r0 %r1
123 movi %r1 0x80000001
124 movi %r2 $offi
125 stxr_i %r2 %r0 %r1
126#if __WORDSIZE == 64
127 movi %r2 $offui
128 stxr_i %r2 %r0 %r1
129 movi %r1 0x8000000000000001
130 movi %r2 $offl
131 stxr_l %r2 %r0 %r1
132#endif
133 movi %r1 $offc
134 ldxr_c %r1 %r0 %r1
135 beqi Lc0 %r1 XC
136 calli @abort
137Lc0:
138 movi %r1 $offc
139 ldxr_c %r0 %r0 %r1
140 beqi Lc1 %r0 XC
141 calli @abort
142Lc1:
143 movi %r0 t0
144 movi %r1 $offuc
145 ldxr_uc %r1 %r0 %r1
146 beqi Luc0 %r1 0x81
147 calli @abort
148Luc0:
149 movi %r1 $offuc
150 ldxr_uc %r0 %r0 %r1
151 beqi Luc1 %r0 0x81
152 calli @abort
153Luc1:
154 movi %r0 t0
155 movi %r1 $offs
156 ldxr_s %r1 %r0 %r1
157 beqi Ls0 %r1 XS
158 calli @abort
159Ls0:
160 movi %r1 $offs
161 ldxr_s %r0 %r0 %r1
162 beqi Ls1 %r0 XS
163 calli @abort
164Ls1:
165 movi %r0 t0
166 movi %r1 $offus
167 ldxr_us %r1 %r0 %r1
168 beqi Lus0 %r1 0x8001
169 calli @abort
170Lus0:
171 movi %r1 $offus
172 ldxr_us %r0 %r0 %r1
173 beqi Lus1 %r0 0x8001
174 calli @abort
175Lus1:
176 movi %r0 t0
177 movi %r1 $offi
178 ldxr_i %r1 %r0 %r1
179 beqi Li0 %r1 XI
180 calli @abort
181Li0:
182 movi %r1 $offi
183 ldxr_i %r0 %r0 %r1
184 beqi Li1 %r0 XI
185 calli @abort
186Li1:
187#if __WORDSIZE == 64
188 movi %r0 t0
189 movi %r1 $offui
190 ldxr_ui %r1 %r0 %r1
191 beqi Lui0 %r1 0x80000001
192 calli @abort
193Lui0:
194 movi %r1 $offui
195 ldxr_ui %r0 %r0 %r1
196 beqi Lui1 %r0 0x80000001
197 calli @abort
198Lui1:
199 movi %r0 t0
200 movi %r1 $offl
201 ldxr_l %r1 %r0 %r1
202 beqi Ll0 %r1 0x8000000000000001
203 calli @abort
204Ll0:
205 movi %r1 $offl
206 ldxr_l %r0 %r0 %r1
207 beqi Ll1 %r0 0x8000000000000001
208 calli @abort
209Ll1:
210#endif
211
212 LDST(v0, v1, v2, r0, r1, r2)
213 // just to know did not abort
214 prepare
215 pushargi ok
216 ellipsis
217 finishi @printf
218 ret
219 epilog