1 // Copyright 2016, VIXL authors
2 // All rights reserved.
3 //
4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions are met:
6 //
7 // * Redistributions of source code must retain the above copyright notice,
8 // this list of conditions and the following disclaimer.
9 // * Redistributions in binary form must reproduce the above copyright notice,
10 // this list of conditions and the following disclaimer in the documentation
11 // and/or other materials provided with the distribution.
12 // * Neither the name of ARM Limited nor the names of its contributors may be
13 // used to endorse or promote products derived from this software without
14 // specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS CONTRIBUTORS "AS IS" AND
17 // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 // DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
20 // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22 // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23 // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 // OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26
27
28 // -----------------------------------------------------------------------------
29 // This file is auto generated from the
30 // test/aarch32/config/template-simulator-aarch32.cc.in template file using
31 // tools/generate_tests.py.
32 //
33 // PLEASE DO NOT EDIT.
34 // -----------------------------------------------------------------------------
35
36
37 #include "test-runner.h"
38
39 #include "test-utils.h"
40 #include "test-utils-aarch32.h"
41
42 #include "aarch32/assembler-aarch32.h"
43 #include "aarch32/macro-assembler-aarch32.h"
44 #include "aarch32/disasm-aarch32.h"
45
46 #define __ masm.
47 #define BUF_SIZE (4096)
48
49 #ifdef VIXL_INCLUDE_SIMULATOR_AARCH32
50 // Run tests with the simulator.
51
52 #define SETUP() MacroAssembler masm(BUF_SIZE)
53
54 #define START() masm.GetBuffer()->Reset()
55
56 #define END() \
57 __ Hlt(0); \
58 __ FinalizeCode();
59
60 // TODO: Run the tests in the simulator.
61 #define RUN()
62
63 #define TEARDOWN()
64
65 #else // ifdef VIXL_INCLUDE_SIMULATOR_AARCH32.
66
67 #define SETUP() \
68 MacroAssembler masm(BUF_SIZE); \
69 UseScratchRegisterScope harness_scratch(&masm); \
70 harness_scratch.ExcludeAll();
71
72 #define START() \
73 masm.GetBuffer()->Reset(); \
74 __ Push(r4); \
75 __ Push(r5); \
76 __ Push(r6); \
77 __ Push(r7); \
78 __ Push(r8); \
79 __ Push(r9); \
80 __ Push(r10); \
81 __ Push(r11); \
82 __ Push(lr); \
83 harness_scratch.Include(ip);
84
85 #define END() \
86 harness_scratch.Exclude(ip); \
87 __ Pop(lr); \
88 __ Pop(r11); \
89 __ Pop(r10); \
90 __ Pop(r9); \
91 __ Pop(r8); \
92 __ Pop(r7); \
93 __ Pop(r6); \
94 __ Pop(r5); \
95 __ Pop(r4); \
96 __ Bx(lr); \
97 __ FinalizeCode();
98
99 #define RUN() \
100 { \
101 int pcs_offset = masm.IsUsingT32() ? 1 : 0; \
102 masm.GetBuffer()->SetExecutable(); \
103 ExecuteMemory(masm.GetBuffer()->GetStartAddress<byte*>(), \
104 masm.GetSizeOfCodeGenerated(), \
105 pcs_offset); \
106 masm.GetBuffer()->SetWritable(); \
107 }
108
109 #define TEARDOWN() harness_scratch.Close();
110
111 #endif // ifdef VIXL_INCLUDE_SIMULATOR_AARCH32
112
113 namespace vixl {
114 namespace aarch32 {
115
116 // List of instruction encodings:
117 #define FOREACH_INSTRUCTION(M) \
118 M(Sxtab) \
119 M(Sxtab16) \
120 M(Sxtah) \
121 M(Uxtab) \
122 M(Uxtab16) \
123 M(Uxtah)
124
125
126 // The following definitions are defined again in each generated test, therefore
127 // we need to place them in an anomymous namespace. It expresses that they are
128 // local to this file only, and the compiler is not allowed to share these types
129 // across test files during template instantiation. Specifically, `Operands` and
130 // `Inputs` have various layouts across generated tests so they absolutely
131 // cannot be shared.
132
133 #ifdef VIXL_INCLUDE_TARGET_A32
134 namespace {
135
136 // Values to be passed to the assembler to produce the instruction under test.
137 struct Operands {
138 Condition cond;
139 Register rd;
140 Register rn;
141 Register rm;
142 ShiftType ror;
143 uint32_t amount;
144 };
145
146 // Input data to feed to the instruction.
147 struct Inputs {
148 uint32_t apsr;
149 uint32_t rd;
150 uint32_t rn;
151 uint32_t rm;
152 };
153
154 // This structure contains all input data needed to test one specific encoding.
155 // It used to generate a loop over an instruction.
156 struct TestLoopData {
157 // The `operands` fields represents the values to pass to the assembler to
158 // produce the instruction.
159 Operands operands;
160 // Description of the operands, used for error reporting.
161 const char* operands_description;
162 // Unique identifier, used for generating traces.
163 const char* identifier;
164 // Array of values to be fed to the instruction.
165 size_t input_size;
166 const Inputs* inputs;
167 };
168
169 static const Inputs kCondition[] =
170 {{NFlag, 0xabababab, 0xabababab, 0xabababab},
171 {ZFlag, 0xabababab, 0xabababab, 0xabababab},
172 {CFlag, 0xabababab, 0xabababab, 0xabababab},
173 {VFlag, 0xabababab, 0xabababab, 0xabababab},
174 {NZFlag, 0xabababab, 0xabababab, 0xabababab},
175 {NCFlag, 0xabababab, 0xabababab, 0xabababab},
176 {NVFlag, 0xabababab, 0xabababab, 0xabababab},
177 {ZCFlag, 0xabababab, 0xabababab, 0xabababab},
178 {ZVFlag, 0xabababab, 0xabababab, 0xabababab},
179 {CVFlag, 0xabababab, 0xabababab, 0xabababab},
180 {NZCFlag, 0xabababab, 0xabababab, 0xabababab},
181 {NZVFlag, 0xabababab, 0xabababab, 0xabababab},
182 {NCVFlag, 0xabababab, 0xabababab, 0xabababab},
183 {ZCVFlag, 0xabababab, 0xabababab, 0xabababab},
184 {NZCVFlag, 0xabababab, 0xabababab, 0xabababab}};
185
186 static const Inputs kRdIsRn[] = {{NoFlag, 0xffffff83, 0xffffff83, 0xffff8002},
187 {NoFlag, 0x0000007e, 0x0000007e, 0x7fffffff},
188 {NoFlag, 0x0000007d, 0x0000007d, 0xffffffe0},
189 {NoFlag, 0x7fffffff, 0x7fffffff, 0x00000002},
190 {NoFlag, 0xffff8002, 0xffff8002, 0xfffffffd},
191 {NoFlag, 0xffffffe0, 0xffffffe0, 0x00007fff},
192 {NoFlag, 0xffff8000, 0xffff8000, 0xffffff83},
193 {NoFlag, 0xffff8002, 0xffff8002, 0x80000001},
194 {NoFlag, 0x00007ffd, 0x00007ffd, 0xffff8003},
195 {NoFlag, 0x00007fff, 0x00007fff, 0xffffffff},
196 {NoFlag, 0x00000000, 0x00000000, 0xffffff80},
197 {NoFlag, 0xffff8001, 0xffff8001, 0x33333333},
198 {NoFlag, 0xffffff80, 0xffffff80, 0x0000007e},
199 {NoFlag, 0x0000007e, 0x0000007e, 0x7ffffffd},
200 {NoFlag, 0xffffff80, 0xffffff80, 0xfffffffd},
201 {NoFlag, 0x00000020, 0x00000020, 0xffff8002},
202 {NoFlag, 0xffffff80, 0xffffff80, 0xfffffffe},
203 {NoFlag, 0x00000002, 0x00000002, 0x00000000},
204 {NoFlag, 0x0000007e, 0x0000007e, 0x00000001},
205 {NoFlag, 0x00000002, 0x00000002, 0x0000007f},
206 {NoFlag, 0x80000000, 0x80000000, 0x80000000},
207 {NoFlag, 0x7fffffff, 0x7fffffff, 0xffffff80},
208 {NoFlag, 0x00000001, 0x00000001, 0xfffffffe},
209 {NoFlag, 0x33333333, 0x33333333, 0x0000007d},
210 {NoFlag, 0x00000001, 0x00000001, 0x7ffffffe},
211 {NoFlag, 0x00007ffe, 0x00007ffe, 0x7fffffff},
212 {NoFlag, 0x80000000, 0x80000000, 0xffffff83},
213 {NoFlag, 0x00000000, 0x00000000, 0x7ffffffe},
214 {NoFlag, 0x00000000, 0x00000000, 0x0000007f},
215 {NoFlag, 0x7fffffff, 0x7fffffff, 0xcccccccc},
216 {NoFlag, 0xffffff82, 0xffffff82, 0x00000002},
217 {NoFlag, 0x7ffffffd, 0x7ffffffd, 0xaaaaaaaa},
218 {NoFlag, 0xcccccccc, 0xcccccccc, 0xffff8001},
219 {NoFlag, 0xfffffffe, 0xfffffffe, 0xffff8001},
220 {NoFlag, 0x7fffffff, 0x7fffffff, 0x00000020},
221 {NoFlag, 0xffffffe0, 0xffffffe0, 0x00007ffe},
222 {NoFlag, 0x80000001, 0x80000001, 0xffff8000},
223 {NoFlag, 0xffffff82, 0xffffff82, 0x0000007d},
224 {NoFlag, 0x0000007e, 0x0000007e, 0x7ffffffe},
225 {NoFlag, 0x00007ffd, 0x00007ffd, 0xffffff80},
226 {NoFlag, 0x0000007d, 0x0000007d, 0x0000007e},
227 {NoFlag, 0xffff8002, 0xffff8002, 0x7fffffff},
228 {NoFlag, 0xffffffe0, 0xffffffe0, 0x0000007f},
229 {NoFlag, 0x00007ffe, 0x00007ffe, 0xffffff81},
230 {NoFlag, 0x80000000, 0x80000000, 0x0000007e},
231 {NoFlag, 0xffffffff, 0xffffffff, 0xaaaaaaaa},
232 {NoFlag, 0xfffffffe, 0xfffffffe, 0x00000020},
233 {NoFlag, 0xffffff82, 0xffffff82, 0xffff8003},
234 {NoFlag, 0x7ffffffd, 0x7ffffffd, 0xffff8002},
235 {NoFlag, 0x7ffffffe, 0x7ffffffe, 0x00000000},
236 {NoFlag, 0xfffffffd, 0xfffffffd, 0xffffffe0},
237 {NoFlag, 0xffff8000, 0xffff8000, 0xffff8002},
238 {NoFlag, 0xffffff82, 0xffffff82, 0x7ffffffd},
239 {NoFlag, 0xcccccccc, 0xcccccccc, 0x80000000},
240 {NoFlag, 0x80000001, 0x80000001, 0x33333333},
241 {NoFlag, 0x00000001, 0x00000001, 0x00000002},
242 {NoFlag, 0x55555555, 0x55555555, 0x0000007f},
243 {NoFlag, 0xffffffff, 0xffffffff, 0xfffffffd},
244 {NoFlag, 0xffffff80, 0xffffff80, 0x80000000},
245 {NoFlag, 0x00000000, 0x00000000, 0x00000020},
246 {NoFlag, 0xfffffffe, 0xfffffffe, 0xffff8003},
247 {NoFlag, 0xffff8001, 0xffff8001, 0xffff8000},
248 {NoFlag, 0x55555555, 0x55555555, 0x55555555},
249 {NoFlag, 0x00007fff, 0x00007fff, 0xffff8000},
250 {NoFlag, 0x7fffffff, 0x7fffffff, 0xffffffe0},
251 {NoFlag, 0x00000001, 0x00000001, 0x55555555},
252 {NoFlag, 0x33333333, 0x33333333, 0x7ffffffe},
253 {NoFlag, 0x80000000, 0x80000000, 0xffffffe0},
254 {NoFlag, 0xffffff83, 0xffffff83, 0x0000007d},
255 {NoFlag, 0xffff8003, 0xffff8003, 0x00000002},
256 {NoFlag, 0x7ffffffe, 0x7ffffffe, 0xffffff81},
257 {NoFlag, 0xfffffffe, 0xfffffffe, 0xffffff80},
258 {NoFlag, 0x00007ffe, 0x00007ffe, 0xffff8002},
259 {NoFlag, 0x80000001, 0x80000001, 0xfffffffe},
260 {NoFlag, 0x7ffffffd, 0x7ffffffd, 0xfffffffd},
261 {NoFlag, 0x7ffffffd, 0x7ffffffd, 0xfffffffe},
262 {NoFlag, 0x7ffffffe, 0x7ffffffe, 0xffffff83},
263 {NoFlag, 0xfffffffd, 0xfffffffd, 0x00007ffe},
264 {NoFlag, 0x7fffffff, 0x7fffffff, 0x80000000},
265 {NoFlag, 0xffffff82, 0xffffff82, 0x7fffffff},
266 {NoFlag, 0xffffffe0, 0xffffffe0, 0xffffff83},
267 {NoFlag, 0xffff8000, 0xffff8000, 0xffff8000},
268 {NoFlag, 0x00000001, 0x00000001, 0x7fffffff},
269 {NoFlag, 0xfffffffe, 0xfffffffe, 0xffffffff},
270 {NoFlag, 0xffffff82, 0xffffff82, 0xffffffff},
271 {NoFlag, 0xffffffff, 0xffffffff, 0xfffffffe},
272 {NoFlag, 0xaaaaaaaa, 0xaaaaaaaa, 0x0000007d},
273 {NoFlag, 0xffff8001, 0xffff8001, 0xfffffffe},
274 {NoFlag, 0x00007ffe, 0x00007ffe, 0x0000007d},
275 {NoFlag, 0xffffff82, 0xffffff82, 0xfffffffe},
276 {NoFlag, 0x00000000, 0x00000000, 0x00007ffd},
277 {NoFlag, 0xaaaaaaaa, 0xaaaaaaaa, 0xffff8002},
278 {NoFlag, 0x0000007f, 0x0000007f, 0xffffff82},
279 {NoFlag, 0x00007fff, 0x00007fff, 0x33333333},
280 {NoFlag, 0xfffffffd, 0xfffffffd, 0x80000000},
281 {NoFlag, 0x00000000, 0x00000000, 0xfffffffd},
282 {NoFlag, 0x0000007d, 0x0000007d, 0x0000007f},
283 {NoFlag, 0xfffffffd, 0xfffffffd, 0x0000007e},
284 {NoFlag, 0xffffffe0, 0xffffffe0, 0x55555555},
285 {NoFlag, 0xffffffff, 0xffffffff, 0x80000000},
286 {NoFlag, 0xffffffe0, 0xffffffe0, 0x0000007e},
287 {NoFlag, 0xffffff81, 0xffffff81, 0x00007ffd},
288 {NoFlag, 0x00000020, 0x00000020, 0xffff8001},
289 {NoFlag, 0x00007fff, 0x00007fff, 0xffffff83},
290 {NoFlag, 0x33333333, 0x33333333, 0x00000000},
291 {NoFlag, 0xffff8000, 0xffff8000, 0xffffff82},
292 {NoFlag, 0xffff8001, 0xffff8001, 0x0000007e},
293 {NoFlag, 0xffffff80, 0xffffff80, 0x00000001},
294 {NoFlag, 0x80000000, 0x80000000, 0xcccccccc},
295 {NoFlag, 0x00000002, 0x00000002, 0x00007ffd},
296 {NoFlag, 0x7ffffffe, 0x7ffffffe, 0x80000001},
297 {NoFlag, 0x00000020, 0x00000020, 0x00007ffe},
298 {NoFlag, 0xffff8000, 0xffff8000, 0xfffffffd},
299 {NoFlag, 0x7fffffff, 0x7fffffff, 0xffff8001},
300 {NoFlag, 0x00000000, 0x00000000, 0xffffff83},
301 {NoFlag, 0x0000007f, 0x0000007f, 0x00000020},
302 {NoFlag, 0x80000001, 0x80000001, 0xffff8003},
303 {NoFlag, 0xffff8001, 0xffff8001, 0x0000007f},
304 {NoFlag, 0x0000007f, 0x0000007f, 0x80000001},
305 {NoFlag, 0x00000002, 0x00000002, 0x7ffffffe},
306 {NoFlag, 0xffffff82, 0xffffff82, 0xffffff83},
307 {NoFlag, 0x00007ffd, 0x00007ffd, 0x7fffffff},
308 {NoFlag, 0x7ffffffe, 0x7ffffffe, 0xfffffffe},
309 {NoFlag, 0xffffff82, 0xffffff82, 0xffff8000},
310 {NoFlag, 0xfffffffe, 0xfffffffe, 0xffff8000},
311 {NoFlag, 0xffff8002, 0xffff8002, 0xffffff81},
312 {NoFlag, 0x33333333, 0x33333333, 0x7fffffff},
313 {NoFlag, 0x80000001, 0x80000001, 0x00007fff},
314 {NoFlag, 0xffff8002, 0xffff8002, 0xcccccccc},
315 {NoFlag, 0xffffffff, 0xffffffff, 0x00000002},
316 {NoFlag, 0x33333333, 0x33333333, 0xffffff81},
317 {NoFlag, 0xfffffffd, 0xfffffffd, 0xffffff80},
318 {NoFlag, 0x55555555, 0x55555555, 0xaaaaaaaa},
319 {NoFlag, 0x33333333, 0x33333333, 0xffffff82},
320 {NoFlag, 0xffffff80, 0xffffff80, 0xaaaaaaaa},
321 {NoFlag, 0x0000007e, 0x0000007e, 0x00000020},
322 {NoFlag, 0xffffff83, 0xffffff83, 0x00007ffd},
323 {NoFlag, 0xffffff82, 0xffffff82, 0xaaaaaaaa},
324 {NoFlag, 0xffff8003, 0xffff8003, 0xffffffff},
325 {NoFlag, 0xaaaaaaaa, 0xaaaaaaaa, 0xfffffffe},
326 {NoFlag, 0xaaaaaaaa, 0xaaaaaaaa, 0x00000000},
327 {NoFlag, 0xaaaaaaaa, 0xaaaaaaaa, 0x0000007f},
328 {NoFlag, 0x0000007f, 0x0000007f, 0x0000007d},
329 {NoFlag, 0xfffffffd, 0xfffffffd, 0x55555555},
330 {NoFlag, 0xffffffff, 0xffffffff, 0x00000020},
331 {NoFlag, 0x00007ffe, 0x00007ffe, 0xffffff83},
332 {NoFlag, 0x7fffffff, 0x7fffffff, 0x55555555},
333 {NoFlag, 0x55555555, 0x55555555, 0xcccccccc},
334 {NoFlag, 0xffffffe0, 0xffffffe0, 0xffff8003},
335 {NoFlag, 0x7ffffffe, 0x7ffffffe, 0x00007ffe},
336 {NoFlag, 0x00007ffd, 0x00007ffd, 0xffff8002},
337 {NoFlag, 0x00007ffd, 0x00007ffd, 0x00000001},
338 {NoFlag, 0x00000000, 0x00000000, 0x00007ffe},
339 {NoFlag, 0xffffff80, 0xffffff80, 0x00000020},
340 {NoFlag, 0xffff8000, 0xffff8000, 0x0000007d},
341 {NoFlag, 0xffff8003, 0xffff8003, 0x00000000},
342 {NoFlag, 0x0000007e, 0x0000007e, 0x80000000},
343 {NoFlag, 0xfffffffd, 0xfffffffd, 0x00000000},
344 {NoFlag, 0xffffff80, 0xffffff80, 0xffffffff},
345 {NoFlag, 0xcccccccc, 0xcccccccc, 0x0000007f},
346 {NoFlag, 0x7ffffffd, 0x7ffffffd, 0x00000000},
347 {NoFlag, 0x00007fff, 0x00007fff, 0x00000000},
348 {NoFlag, 0x0000007f, 0x0000007f, 0x00000001},
349 {NoFlag, 0xffffffff, 0xffffffff, 0xffffff82},
350 {NoFlag, 0x00007ffe, 0x00007ffe, 0x00007ffd},
351 {NoFlag, 0xaaaaaaaa, 0xaaaaaaaa, 0x33333333},
352 {NoFlag, 0xffffff82, 0xffffff82, 0x55555555},
353 {NoFlag, 0xffff8003, 0xffff8003, 0x0000007e},
354 {NoFlag, 0xffffff83, 0xffffff83, 0x00000002},
355 {NoFlag, 0xffffff82, 0xffffff82, 0x33333333},
356 {NoFlag, 0x55555555, 0x55555555, 0xffffffff},
357 {NoFlag, 0xaaaaaaaa, 0xaaaaaaaa, 0x80000001},
358 {NoFlag, 0xffffff83, 0xffffff83, 0xffffffe0},
359 {NoFlag, 0x00000001, 0x00000001, 0xffffffe0},
360 {NoFlag, 0x33333333, 0x33333333, 0x33333333},
361 {NoFlag, 0x55555555, 0x55555555, 0x00000001},
362 {NoFlag, 0xffffff83, 0xffffff83, 0x00007fff},
363 {NoFlag, 0x00000002, 0x00000002, 0xfffffffd},
364 {NoFlag, 0xffffffe0, 0xffffffe0, 0xffff8002},
365 {NoFlag, 0x80000000, 0x80000000, 0x00007ffd},
366 {NoFlag, 0xffffff83, 0xffffff83, 0xfffffffe},
367 {NoFlag, 0x80000001, 0x80000001, 0xffffffff},
368 {NoFlag, 0xffff8003, 0xffff8003, 0x00000020},
369 {NoFlag, 0xffffff82, 0xffffff82, 0xcccccccc},
370 {NoFlag, 0x00000020, 0x00000020, 0x7fffffff},
371 {NoFlag, 0xffffff80, 0xffffff80, 0x55555555},
372 {NoFlag, 0x00000001, 0x00000001, 0x00000020},
373 {NoFlag, 0xffff8001, 0xffff8001, 0x00007fff},
374 {NoFlag, 0x00000020, 0x00000020, 0xaaaaaaaa},
375 {NoFlag, 0x55555555, 0x55555555, 0x7fffffff},
376 {NoFlag, 0xfffffffe, 0xfffffffe, 0x7fffffff},
377 {NoFlag, 0x00007fff, 0x00007fff, 0x55555555},
378 {NoFlag, 0x55555555, 0x55555555, 0x0000007d},
379 {NoFlag, 0xcccccccc, 0xcccccccc, 0x7ffffffe},
380 {NoFlag, 0xffff8002, 0xffff8002, 0x00007ffe},
381 {NoFlag, 0xfffffffe, 0xfffffffe, 0xffffff81},
382 {NoFlag, 0xffffff81, 0xffffff81, 0x0000007d},
383 {NoFlag, 0x00000020, 0x00000020, 0x0000007e},
384 {NoFlag, 0xffffffff, 0xffffffff, 0x00007ffe},
385 {NoFlag, 0xffff8002, 0xffff8002, 0x0000007e}};
386
387 static const Inputs kRdIsRm[] = {{NoFlag, 0x55555555, 0x7ffffffe, 0x55555555},
388 {NoFlag, 0xfffffffe, 0x00000001, 0xfffffffe},
389 {NoFlag, 0xffffff82, 0xffffff82, 0xffffff82},
390 {NoFlag, 0xffff8000, 0xffff8003, 0xffff8000},
391 {NoFlag, 0x00000001, 0x00000000, 0x00000001},
392 {NoFlag, 0xffffff81, 0x00007fff, 0xffffff81},
393 {NoFlag, 0x0000007d, 0xffff8002, 0x0000007d},
394 {NoFlag, 0x80000000, 0xffff8000, 0x80000000},
395 {NoFlag, 0xffffff80, 0x00000020, 0xffffff80},
396 {NoFlag, 0x55555555, 0xffffff81, 0x55555555},
397 {NoFlag, 0x00007ffd, 0xffffff82, 0x00007ffd},
398 {NoFlag, 0x55555555, 0x00007fff, 0x55555555},
399 {NoFlag, 0x7ffffffd, 0xffff8000, 0x7ffffffd},
400 {NoFlag, 0xffffffff, 0xffffff83, 0xffffffff},
401 {NoFlag, 0x00000000, 0xffffffff, 0x00000000},
402 {NoFlag, 0xffff8002, 0x33333333, 0xffff8002},
403 {NoFlag, 0x00007ffd, 0xaaaaaaaa, 0x00007ffd},
404 {NoFlag, 0x55555555, 0xffff8000, 0x55555555},
405 {NoFlag, 0x80000001, 0xffffffff, 0x80000001},
406 {NoFlag, 0x0000007d, 0xffffff83, 0x0000007d},
407 {NoFlag, 0x0000007e, 0xffffff82, 0x0000007e},
408 {NoFlag, 0xcccccccc, 0x0000007d, 0xcccccccc},
409 {NoFlag, 0xffff8002, 0xffffffff, 0xffff8002},
410 {NoFlag, 0xffffff81, 0x0000007f, 0xffffff81},
411 {NoFlag, 0xffff8000, 0xffffff83, 0xffff8000},
412 {NoFlag, 0xffffffff, 0xffffffe0, 0xffffffff},
413 {NoFlag, 0xfffffffd, 0x80000001, 0xfffffffd},
414 {NoFlag, 0x55555555, 0x80000000, 0x55555555},
415 {NoFlag, 0xffff8000, 0x0000007d, 0xffff8000},
416 {NoFlag, 0xaaaaaaaa, 0xffff8003, 0xaaaaaaaa},
417 {NoFlag, 0x00000001, 0x00007ffd, 0x00000001},
418 {NoFlag, 0x0000007e, 0x7ffffffe, 0x0000007e},
419 {NoFlag, 0x00000020, 0x00007ffd, 0x00000020},
420 {NoFlag, 0xffffff81, 0x7ffffffd, 0xffffff81},
421 {NoFlag, 0xffffff83, 0x0000007f, 0xffffff83},
422 {NoFlag, 0x00000001, 0x0000007e, 0x00000001},
423 {NoFlag, 0xffffff82, 0xfffffffd, 0xffffff82},
424 {NoFlag, 0xffff8003, 0x7ffffffe, 0xffff8003},
425 {NoFlag, 0x00000002, 0x00000002, 0x00000002},
426 {NoFlag, 0xffffff83, 0xffff8001, 0xffffff83},
427 {NoFlag, 0xffff8002, 0xfffffffe, 0xffff8002},
428 {NoFlag, 0xffffff80, 0xffffff81, 0xffffff80},
429 {NoFlag, 0x7fffffff, 0xffffff81, 0x7fffffff},
430 {NoFlag, 0x00000020, 0xffffff81, 0x00000020},
431 {NoFlag, 0x0000007f, 0xffffffff, 0x0000007f},
432 {NoFlag, 0x0000007d, 0xcccccccc, 0x0000007d},
433 {NoFlag, 0x00007fff, 0x55555555, 0x00007fff},
434 {NoFlag, 0xffff8003, 0x00007ffd, 0xffff8003},
435 {NoFlag, 0x80000001, 0x80000001, 0x80000001},
436 {NoFlag, 0xffffffff, 0xfffffffd, 0xffffffff},
437 {NoFlag, 0xffff8000, 0xfffffffe, 0xffff8000},
438 {NoFlag, 0xcccccccc, 0x0000007f, 0xcccccccc},
439 {NoFlag, 0x00000001, 0x00000002, 0x00000001},
440 {NoFlag, 0xffffff82, 0xffffff81, 0xffffff82},
441 {NoFlag, 0xfffffffd, 0x00007ffd, 0xfffffffd},
442 {NoFlag, 0x80000001, 0x33333333, 0x80000001},
443 {NoFlag, 0xffffff82, 0xffff8002, 0xffffff82},
444 {NoFlag, 0xffff8003, 0xfffffffd, 0xffff8003},
445 {NoFlag, 0xffffff81, 0x00000020, 0xffffff81},
446 {NoFlag, 0xffff8001, 0xffff8003, 0xffff8001},
447 {NoFlag, 0x00000001, 0x80000001, 0x00000001},
448 {NoFlag, 0xfffffffd, 0x00000002, 0xfffffffd},
449 {NoFlag, 0xffff8003, 0x7ffffffd, 0xffff8003},
450 {NoFlag, 0x0000007e, 0xaaaaaaaa, 0x0000007e},
451 {NoFlag, 0x7ffffffe, 0x7fffffff, 0x7ffffffe},
452 {NoFlag, 0x00007ffd, 0x00007ffe, 0x00007ffd},
453 {NoFlag, 0x00007fff, 0x80000001, 0x00007fff},
454 {NoFlag, 0x00007fff, 0xfffffffe, 0x00007fff},
455 {NoFlag, 0x00000001, 0xffffff80, 0x00000001},
456 {NoFlag, 0x55555555, 0xcccccccc, 0x55555555},
457 {NoFlag, 0x7ffffffd, 0xffffffe0, 0x7ffffffd},
458 {NoFlag, 0xffffff81, 0xfffffffe, 0xffffff81},
459 {NoFlag, 0xffffff82, 0x00007ffe, 0xffffff82},
460 {NoFlag, 0xffffff82, 0x80000001, 0xffffff82},
461 {NoFlag, 0x0000007f, 0xffff8001, 0x0000007f},
462 {NoFlag, 0x7ffffffd, 0xffffff83, 0x7ffffffd},
463 {NoFlag, 0xffffff82, 0xcccccccc, 0xffffff82},
464 {NoFlag, 0x00000020, 0xffffff83, 0x00000020},
465 {NoFlag, 0x00007ffe, 0x80000000, 0x00007ffe},
466 {NoFlag, 0x0000007f, 0xffff8000, 0x0000007f},
467 {NoFlag, 0xffffff82, 0x33333333, 0xffffff82},
468 {NoFlag, 0x7ffffffd, 0x7ffffffd, 0x7ffffffd},
469 {NoFlag, 0xffffff80, 0xffff8001, 0xffffff80},
470 {NoFlag, 0x00000002, 0xaaaaaaaa, 0x00000002},
471 {NoFlag, 0xffffffff, 0x7fffffff, 0xffffffff},
472 {NoFlag, 0xfffffffd, 0xfffffffe, 0xfffffffd},
473 {NoFlag, 0x00000020, 0x00000001, 0x00000020},
474 {NoFlag, 0x55555555, 0x00000001, 0x55555555},
475 {NoFlag, 0x55555555, 0xffffff80, 0x55555555},
476 {NoFlag, 0xffffffff, 0x00007fff, 0xffffffff},
477 {NoFlag, 0x00000020, 0xaaaaaaaa, 0x00000020},
478 {NoFlag, 0x00000002, 0x00007ffe, 0x00000002},
479 {NoFlag, 0x00000001, 0xcccccccc, 0x00000001},
480 {NoFlag, 0xffff8001, 0x00000000, 0xffff8001},
481 {NoFlag, 0x00000001, 0xffff8000, 0x00000001},
482 {NoFlag, 0xffffffe0, 0x00007fff, 0xffffffe0},
483 {NoFlag, 0xfffffffe, 0x00007fff, 0xfffffffe},
484 {NoFlag, 0xffffff83, 0x00000001, 0xffffff83},
485 {NoFlag, 0x00007fff, 0xffff8002, 0x00007fff},
486 {NoFlag, 0x7ffffffd, 0x7ffffffe, 0x7ffffffd},
487 {NoFlag, 0x80000001, 0xaaaaaaaa, 0x80000001},
488 {NoFlag, 0x80000001, 0xcccccccc, 0x80000001},
489 {NoFlag, 0x00007ffe, 0xffffffe0, 0x00007ffe},
490 {NoFlag, 0x00007ffe, 0xfffffffd, 0x00007ffe},
491 {NoFlag, 0x55555555, 0xaaaaaaaa, 0x55555555},
492 {NoFlag, 0xffffffe0, 0x00000001, 0xffffffe0},
493 {NoFlag, 0x0000007e, 0x00007fff, 0x0000007e},
494 {NoFlag, 0xfffffffe, 0xfffffffd, 0xfffffffe},
495 {NoFlag, 0x33333333, 0x0000007d, 0x33333333},
496 {NoFlag, 0xffffff81, 0x7fffffff, 0xffffff81},
497 {NoFlag, 0x0000007e, 0x0000007d, 0x0000007e},
498 {NoFlag, 0x00000001, 0xffffff81, 0x00000001},
499 {NoFlag, 0x80000000, 0x00000002, 0x80000000},
500 {NoFlag, 0x0000007d, 0xffff8003, 0x0000007d},
501 {NoFlag, 0x7ffffffe, 0x00007ffd, 0x7ffffffe},
502 {NoFlag, 0x7ffffffe, 0xaaaaaaaa, 0x7ffffffe},
503 {NoFlag, 0x00000000, 0xffff8000, 0x00000000},
504 {NoFlag, 0x33333333, 0x00000002, 0x33333333},
505 {NoFlag, 0xffffff81, 0xffffff83, 0xffffff81},
506 {NoFlag, 0x7ffffffe, 0x00007ffe, 0x7ffffffe},
507 {NoFlag, 0x80000000, 0x0000007d, 0x80000000},
508 {NoFlag, 0x00000020, 0x00000002, 0x00000020},
509 {NoFlag, 0x33333333, 0x80000001, 0x33333333},
510 {NoFlag, 0xffffff83, 0x00007ffd, 0xffffff83},
511 {NoFlag, 0x00007ffd, 0xffffff83, 0x00007ffd},
512 {NoFlag, 0xffff8001, 0x80000000, 0xffff8001},
513 {NoFlag, 0x00000000, 0x80000000, 0x00000000},
514 {NoFlag, 0xffffffe0, 0xffffffff, 0xffffffe0},
515 {NoFlag, 0x80000000, 0xffffff83, 0x80000000},
516 {NoFlag, 0x00000020, 0xffffff80, 0x00000020},
517 {NoFlag, 0x7ffffffd, 0xffff8001, 0x7ffffffd},
518 {NoFlag, 0x80000001, 0xffff8003, 0x80000001},
519 {NoFlag, 0x00007ffe, 0x7fffffff, 0x00007ffe},
520 {NoFlag, 0x7fffffff, 0x00000002, 0x7fffffff},
521 {NoFlag, 0xffffff83, 0xffff8003, 0xffffff83},
522 {NoFlag, 0xaaaaaaaa, 0xcccccccc, 0xaaaaaaaa},
523 {NoFlag, 0x0000007f, 0xffffff80, 0x0000007f},
524 {NoFlag, 0x80000001, 0x00007ffd, 0x80000001},
525 {NoFlag, 0xffff8000, 0x80000001, 0xffff8000},
526 {NoFlag, 0x00007fff, 0x00007ffd, 0x00007fff},
527 {NoFlag, 0x0000007e, 0x0000007f, 0x0000007e},
528 {NoFlag, 0x00000002, 0x0000007d, 0x00000002},
529 {NoFlag, 0x80000001, 0x7fffffff, 0x80000001},
530 {NoFlag, 0x0000007e, 0xffffff81, 0x0000007e},
531 {NoFlag, 0x7ffffffe, 0xffff8001, 0x7ffffffe},
532 {NoFlag, 0x7fffffff, 0x80000001, 0x7fffffff},
533 {NoFlag, 0x7ffffffd, 0x0000007f, 0x7ffffffd},
534 {NoFlag, 0xffffff81, 0xffffff81, 0xffffff81},
535 {NoFlag, 0x00000001, 0xfffffffd, 0x00000001},
536 {NoFlag, 0x00000001, 0xffffffff, 0x00000001},
537 {NoFlag, 0x7ffffffd, 0x55555555, 0x7ffffffd},
538 {NoFlag, 0x55555555, 0x0000007f, 0x55555555},
539 {NoFlag, 0x55555555, 0xffff8003, 0x55555555},
540 {NoFlag, 0xaaaaaaaa, 0x00007ffd, 0xaaaaaaaa},
541 {NoFlag, 0x0000007e, 0x33333333, 0x0000007e},
542 {NoFlag, 0xfffffffe, 0x80000001, 0xfffffffe},
543 {NoFlag, 0xfffffffe, 0xffff8000, 0xfffffffe},
544 {NoFlag, 0xffffffe0, 0xffffff81, 0xffffffe0},
545 {NoFlag, 0x7fffffff, 0x0000007f, 0x7fffffff},
546 {NoFlag, 0xffff8003, 0x0000007f, 0xffff8003},
547 {NoFlag, 0xffffff82, 0x00007ffd, 0xffffff82},
548 {NoFlag, 0x33333333, 0xffffffff, 0x33333333},
549 {NoFlag, 0xffffffe0, 0xcccccccc, 0xffffffe0},
550 {NoFlag, 0xffffff83, 0x7ffffffd, 0xffffff83},
551 {NoFlag, 0x0000007e, 0xcccccccc, 0x0000007e},
552 {NoFlag, 0x00000002, 0xfffffffd, 0x00000002},
553 {NoFlag, 0x00007fff, 0xcccccccc, 0x00007fff},
554 {NoFlag, 0x7fffffff, 0x00007fff, 0x7fffffff},
555 {NoFlag, 0xffffffe0, 0x33333333, 0xffffffe0},
556 {NoFlag, 0x0000007f, 0x0000007d, 0x0000007f},
557 {NoFlag, 0x0000007f, 0xffffffe0, 0x0000007f},
558 {NoFlag, 0x00007fff, 0xffff8000, 0x00007fff},
559 {NoFlag, 0x7fffffff, 0xffffffff, 0x7fffffff},
560 {NoFlag, 0xffff8000, 0x7ffffffd, 0xffff8000},
561 {NoFlag, 0xcccccccc, 0x0000007e, 0xcccccccc},
562 {NoFlag, 0x33333333, 0xffff8003, 0x33333333},
563 {NoFlag, 0x55555555, 0x00000002, 0x55555555},
564 {NoFlag, 0x00000001, 0x00000001, 0x00000001},
565 {NoFlag, 0xaaaaaaaa, 0x33333333, 0xaaaaaaaa},
566 {NoFlag, 0x7ffffffd, 0x00000001, 0x7ffffffd},
567 {NoFlag, 0xffffff82, 0xffff8000, 0xffffff82},
568 {NoFlag, 0x0000007d, 0x55555555, 0x0000007d},
569 {NoFlag, 0xffff8000, 0x7ffffffe, 0xffff8000},
570 {NoFlag, 0x7fffffff, 0xffffffe0, 0x7fffffff},
571 {NoFlag, 0x7fffffff, 0xffff8003, 0x7fffffff},
572 {NoFlag, 0xffffff82, 0xaaaaaaaa, 0xffffff82},
573 {NoFlag, 0xfffffffd, 0xffffff80, 0xfffffffd},
574 {NoFlag, 0x7ffffffd, 0x80000001, 0x7ffffffd},
575 {NoFlag, 0x00000000, 0x00007ffd, 0x00000000},
576 {NoFlag, 0xffffffff, 0xffffff80, 0xffffffff},
577 {NoFlag, 0xffffff80, 0xcccccccc, 0xffffff80},
578 {NoFlag, 0x00007ffe, 0x55555555, 0x00007ffe},
579 {NoFlag, 0xffff8000, 0xffff8000, 0xffff8000},
580 {NoFlag, 0xffffffff, 0xffff8000, 0xffffffff},
581 {NoFlag, 0x80000001, 0x0000007d, 0x80000001},
582 {NoFlag, 0xffffffe0, 0xffff8002, 0xffffffe0},
583 {NoFlag, 0xfffffffe, 0xffffffe0, 0xfffffffe},
584 {NoFlag, 0x80000000, 0xffff8003, 0x80000000},
585 {NoFlag, 0x80000001, 0xffffff81, 0x80000001},
586 {NoFlag, 0xffffffe0, 0x00007ffe, 0xffffffe0}};
587
588 static const Inputs kRdIsNotRnIsNotRm[] =
589 {{NoFlag, 0x0000007e, 0x0000007e, 0x0000007d},
590 {NoFlag, 0x55555555, 0x00000002, 0xffff8002},
591 {NoFlag, 0xffffffe0, 0x80000001, 0x00000000},
592 {NoFlag, 0x55555555, 0xffffff83, 0x00000002},
593 {NoFlag, 0xffffffe0, 0xffffffe0, 0x00000002},
594 {NoFlag, 0x00000000, 0x80000001, 0xffffff82},
595 {NoFlag, 0x80000001, 0x00007fff, 0x0000007f},
596 {NoFlag, 0xffffff80, 0x0000007d, 0x7ffffffe},
597 {NoFlag, 0xaaaaaaaa, 0x00000020, 0xffff8002},
598 {NoFlag, 0x33333333, 0x55555555, 0x00000001},
599 {NoFlag, 0x7ffffffe, 0x33333333, 0x00000000},
600 {NoFlag, 0x80000000, 0x7ffffffd, 0x55555555},
601 {NoFlag, 0xcccccccc, 0xffff8001, 0x7ffffffe},
602 {NoFlag, 0x00000020, 0xffffff83, 0xffff8003},
603 {NoFlag, 0x00007fff, 0xffffffe0, 0xffffff81},
604 {NoFlag, 0xffff8000, 0xffff8001, 0x0000007e},
605 {NoFlag, 0x33333333, 0x0000007e, 0x00000020},
606 {NoFlag, 0x0000007f, 0xfffffffd, 0xaaaaaaaa},
607 {NoFlag, 0xffffff83, 0xffffff82, 0x7ffffffd},
608 {NoFlag, 0x0000007e, 0xcccccccc, 0x7fffffff},
609 {NoFlag, 0xffff8001, 0x80000001, 0xffffffff},
610 {NoFlag, 0xffffff81, 0x00000020, 0x7ffffffe},
611 {NoFlag, 0xffffff83, 0xffffff81, 0xffffffe0},
612 {NoFlag, 0xffffffe0, 0xffffff81, 0xfffffffd},
613 {NoFlag, 0x80000001, 0xffffffff, 0xffffffff},
614 {NoFlag, 0x7ffffffe, 0xffff8000, 0xcccccccc},
615 {NoFlag, 0xffffff80, 0x00007ffe, 0xffffff82},
616 {NoFlag, 0x0000007e, 0x0000007d, 0xffff8003},
617 {NoFlag, 0xffff8002, 0xffffff81, 0x0000007e},
618 {NoFlag, 0x00007fff, 0x7ffffffd, 0xfffffffe},
619 {NoFlag, 0x00007ffe, 0x80000001, 0xffffff81},
620 {NoFlag, 0xffffff81, 0x00007ffd, 0xfffffffd},
621 {NoFlag, 0x00000020, 0x7fffffff, 0xffff8003},
622 {NoFlag, 0x0000007e, 0x0000007d, 0x33333333},
623 {NoFlag, 0xcccccccc, 0xffff8000, 0x00007ffe},
624 {NoFlag, 0x00007fff, 0xffff8000, 0x00000020},
625 {NoFlag, 0x00007ffd, 0x00007fff, 0xffffffe0},
626 {NoFlag, 0x7ffffffd, 0x00000000, 0x00007ffe},
627 {NoFlag, 0xffffff82, 0x33333333, 0x00000001},
628 {NoFlag, 0x7ffffffe, 0xffffff80, 0x00000020},
629 {NoFlag, 0x00007fff, 0xffffff83, 0x00007ffd},
630 {NoFlag, 0xffff8001, 0xffffffff, 0x80000001},
631 {NoFlag, 0x00000002, 0xffffff81, 0xcccccccc},
632 {NoFlag, 0x55555555, 0x0000007f, 0xffff8001},
633 {NoFlag, 0x80000000, 0x00000020, 0x80000000},
634 {NoFlag, 0xffffff83, 0x00007fff, 0xffffff80},
635 {NoFlag, 0x33333333, 0x7ffffffe, 0x7ffffffd},
636 {NoFlag, 0xffffff80, 0xffffffff, 0x00000001},
637 {NoFlag, 0x00007ffd, 0x7ffffffd, 0xffffff83},
638 {NoFlag, 0x33333333, 0xffff8001, 0xffffffe0},
639 {NoFlag, 0xffff8001, 0xffffff80, 0x00007ffd},
640 {NoFlag, 0xffffffe0, 0x00007fff, 0x00007ffe},
641 {NoFlag, 0x0000007d, 0x00000000, 0xffff8000},
642 {NoFlag, 0x7ffffffe, 0xaaaaaaaa, 0x7ffffffe},
643 {NoFlag, 0x0000007e, 0x00007ffd, 0xffffffe0},
644 {NoFlag, 0xfffffffd, 0xffffffe0, 0xffffff83},
645 {NoFlag, 0x00000001, 0xffffffe0, 0x7ffffffd},
646 {NoFlag, 0xfffffffd, 0xffff8002, 0x80000000},
647 {NoFlag, 0x00000020, 0xffffffff, 0x80000000},
648 {NoFlag, 0x00000001, 0x80000001, 0xffff8003},
649 {NoFlag, 0xffff8003, 0xaaaaaaaa, 0xffffff81},
650 {NoFlag, 0x0000007f, 0xfffffffd, 0xffffffe0},
651 {NoFlag, 0x00007ffe, 0xffffff80, 0x00007ffe},
652 {NoFlag, 0xffff8002, 0xffff8003, 0xffffffff},
653 {NoFlag, 0x7ffffffe, 0xffffff82, 0xffff8000},
654 {NoFlag, 0xffff8000, 0x00000002, 0x80000000},
655 {NoFlag, 0xffffff80, 0xffffff82, 0xffffff81},
656 {NoFlag, 0x00000000, 0xcccccccc, 0x00007ffd},
657 {NoFlag, 0x55555555, 0x00007ffe, 0x7fffffff},
658 {NoFlag, 0x00000002, 0xffffff81, 0xaaaaaaaa},
659 {NoFlag, 0x00007ffd, 0x0000007e, 0x00000002},
660 {NoFlag, 0xffffff83, 0x0000007e, 0xffffff80},
661 {NoFlag, 0xcccccccc, 0x00007ffe, 0xaaaaaaaa},
662 {NoFlag, 0x7ffffffe, 0x55555555, 0xffff8003},
663 {NoFlag, 0xfffffffd, 0x00000001, 0xffffff80},
664 {NoFlag, 0x00007ffd, 0x55555555, 0x80000001},
665 {NoFlag, 0x0000007f, 0x00000000, 0x0000007e},
666 {NoFlag, 0x7fffffff, 0xaaaaaaaa, 0x00000000},
667 {NoFlag, 0x7ffffffd, 0xffffff81, 0xcccccccc},
668 {NoFlag, 0xffffffe0, 0xcccccccc, 0xfffffffd},
669 {NoFlag, 0x00000002, 0xffff8000, 0x7ffffffd},
670 {NoFlag, 0xffffffe0, 0xffff8000, 0x80000001},
671 {NoFlag, 0x7ffffffd, 0xffff8003, 0xffff8001},
672 {NoFlag, 0x33333333, 0x00007ffd, 0x80000000},
673 {NoFlag, 0x7ffffffd, 0x00007fff, 0xcccccccc},
674 {NoFlag, 0xffffffff, 0xffffff80, 0x00007ffe},
675 {NoFlag, 0xffffff83, 0x7ffffffd, 0xaaaaaaaa},
676 {NoFlag, 0xfffffffd, 0xffff8003, 0x0000007f},
677 {NoFlag, 0xfffffffe, 0xfffffffe, 0xfffffffd},
678 {NoFlag, 0x00007fff, 0xfffffffe, 0x55555555},
679 {NoFlag, 0x7ffffffd, 0xfffffffe, 0xfffffffe},
680 {NoFlag, 0xfffffffe, 0xffffffff, 0x00007fff},
681 {NoFlag, 0x7ffffffd, 0x0000007e, 0x00007ffd},
682 {NoFlag, 0x7ffffffd, 0xffffffe0, 0x00000002},
683 {NoFlag, 0xffffffff, 0x00007ffd, 0xffffff81},
684 {NoFlag, 0xffff8001, 0x00000020, 0xfffffffd},
685 {NoFlag, 0x00007fff, 0x0000007d, 0xffffff83},
686 {NoFlag, 0x00000002, 0x55555555, 0x7ffffffe},
687 {NoFlag, 0x00007fff, 0x00007ffe, 0x00000002},
688 {NoFlag, 0x80000001, 0x7fffffff, 0x00007ffd},
689 {NoFlag, 0x0000007f, 0xffffffff, 0x00000001},
690 {NoFlag, 0xffff8001, 0x33333333, 0xffffff83},
691 {NoFlag, 0x00007fff, 0xcccccccc, 0x33333333},
692 {NoFlag, 0x33333333, 0xffffff80, 0x00000001},
693 {NoFlag, 0x00007fff, 0xcccccccc, 0x00007ffd},
694 {NoFlag, 0xffff8002, 0xfffffffd, 0x7ffffffe},
695 {NoFlag, 0x00007ffe, 0x7ffffffe, 0xffffff83},
696 {NoFlag, 0xffffffe0, 0x0000007f, 0xffff8001},
697 {NoFlag, 0x80000000, 0x00007fff, 0xffffff80},
698 {NoFlag, 0x7fffffff, 0x00007fff, 0x7ffffffe},
699 {NoFlag, 0xffff8002, 0x55555555, 0xffff8001},
700 {NoFlag, 0xffffff80, 0x00000000, 0xffffff80},
701 {NoFlag, 0x00007ffd, 0x00007fff, 0x00000002},
702 {NoFlag, 0x00000000, 0x55555555, 0xffff8003},
703 {NoFlag, 0x0000007f, 0xffff8003, 0x00000020},
704 {NoFlag, 0x00000000, 0xffff8002, 0x7fffffff},
705 {NoFlag, 0x00007fff, 0x55555555, 0x00000000},
706 {NoFlag, 0x7fffffff, 0x00007ffe, 0xffffff81},
707 {NoFlag, 0x0000007e, 0x80000001, 0x00007ffe},
708 {NoFlag, 0x7ffffffd, 0xaaaaaaaa, 0x00000020},
709 {NoFlag, 0xfffffffd, 0xfffffffe, 0x00000002},
710 {NoFlag, 0xffffff80, 0xffff8000, 0xffff8002},
711 {NoFlag, 0x0000007d, 0x00007fff, 0xaaaaaaaa},
712 {NoFlag, 0xfffffffd, 0xffffff80, 0x00007ffd},
713 {NoFlag, 0xffffff82, 0x80000000, 0xffffff80},
714 {NoFlag, 0xffffffe0, 0x55555555, 0xfffffffd},
715 {NoFlag, 0xffffffff, 0xffffffff, 0x00007ffd},
716 {NoFlag, 0x0000007e, 0xfffffffe, 0xffffff80},
717 {NoFlag, 0xffff8000, 0xffffff82, 0xffff8002},
718 {NoFlag, 0xaaaaaaaa, 0x7ffffffe, 0xffff8000},
719 {NoFlag, 0x55555555, 0xffff8003, 0xffffff80},
720 {NoFlag, 0x7ffffffe, 0x00000020, 0xffffffe0},
721 {NoFlag, 0x00000001, 0xffff8001, 0xffffffe0},
722 {NoFlag, 0xcccccccc, 0xffff8000, 0xffff8002},
723 {NoFlag, 0x80000000, 0x00000002, 0x7ffffffe},
724 {NoFlag, 0x00000002, 0x0000007f, 0xffffff81},
725 {NoFlag, 0xffffffff, 0x00000001, 0x7fffffff},
726 {NoFlag, 0xffffff83, 0x00000000, 0x33333333},
727 {NoFlag, 0xffff8000, 0xffffff83, 0xcccccccc},
728 {NoFlag, 0x80000000, 0x00000020, 0x00007ffd},
729 {NoFlag, 0xffffff81, 0xcccccccc, 0x00000000},
730 {NoFlag, 0xffffffff, 0xffff8000, 0x00007fff},
731 {NoFlag, 0xffff8003, 0xcccccccc, 0x00007ffe},
732 {NoFlag, 0xffffffff, 0xfffffffd, 0x7ffffffe},
733 {NoFlag, 0xffff8003, 0xaaaaaaaa, 0x55555555},
734 {NoFlag, 0x00000000, 0xaaaaaaaa, 0xffffff81},
735 {NoFlag, 0x0000007f, 0xfffffffe, 0xffff8000},
736 {NoFlag, 0x00000001, 0xffffffe0, 0xfffffffd},
737 {NoFlag, 0x33333333, 0x33333333, 0xfffffffd},
738 {NoFlag, 0xffffff82, 0xffff8002, 0x80000001},
739 {NoFlag, 0x55555555, 0xffffff83, 0xffffff83},
740 {NoFlag, 0xffffff83, 0xffff8002, 0x00000020},
741 {NoFlag, 0x0000007d, 0x7fffffff, 0x0000007f},
742 {NoFlag, 0x00000000, 0xcccccccc, 0xffff8000},
743 {NoFlag, 0x00000002, 0x7ffffffe, 0x00007fff},
744 {NoFlag, 0xffffff82, 0x7ffffffd, 0x7ffffffd},
745 {NoFlag, 0xaaaaaaaa, 0xfffffffd, 0xffff8002},
746 {NoFlag, 0xfffffffd, 0x00000002, 0x7fffffff},
747 {NoFlag, 0xfffffffe, 0xfffffffe, 0x00000020},
748 {NoFlag, 0x80000001, 0x0000007e, 0x00007ffe},
749 {NoFlag, 0x00007ffd, 0x00007ffd, 0xfffffffd},
750 {NoFlag, 0xffff8000, 0x0000007f, 0x00000002},
751 {NoFlag, 0x7ffffffd, 0x80000000, 0x7ffffffd},
752 {NoFlag, 0x0000007d, 0x00007fff, 0x80000001},
753 {NoFlag, 0xffffffff, 0x80000000, 0xaaaaaaaa},
754 {NoFlag, 0x00000000, 0xaaaaaaaa, 0xffff8001},
755 {NoFlag, 0xaaaaaaaa, 0xffffffe0, 0xffff8003},
756 {NoFlag, 0xffffff82, 0xffffffff, 0x00007ffd},
757 {NoFlag, 0x00000001, 0xffffff81, 0x00000001},
758 {NoFlag, 0x7fffffff, 0xaaaaaaaa, 0x80000001},
759 {NoFlag, 0x7fffffff, 0xffff8000, 0xffff8000},
760 {NoFlag, 0xaaaaaaaa, 0x00007ffd, 0xaaaaaaaa},
761 {NoFlag, 0x0000007f, 0x7ffffffe, 0x80000000},
762 {NoFlag, 0x00007ffd, 0x00007ffe, 0xffffff81},
763 {NoFlag, 0x0000007d, 0x0000007d, 0xffff8002},
764 {NoFlag, 0x80000001, 0x00000002, 0xffffff81},
765 {NoFlag, 0xffff8000, 0xfffffffd, 0x7ffffffd},
766 {NoFlag, 0xfffffffe, 0x00000020, 0xffffff80},
767 {NoFlag, 0x00000020, 0x7fffffff, 0xffffffe0},
768 {NoFlag, 0xffff8002, 0xffff8002, 0x0000007f},
769 {NoFlag, 0xffff8003, 0x7fffffff, 0xffff8002},
770 {NoFlag, 0x00000020, 0xfffffffd, 0x00000020},
771 {NoFlag, 0x7ffffffd, 0xffffffe0, 0x0000007e},
772 {NoFlag, 0x00000020, 0x00000020, 0x7ffffffe},
773 {NoFlag, 0xfffffffe, 0x0000007f, 0xffff8000},
774 {NoFlag, 0x80000001, 0x80000001, 0x0000007d},
775 {NoFlag, 0x55555555, 0x0000007f, 0x00007ffd},
776 {NoFlag, 0x55555555, 0xffffffe0, 0xffffff82},
777 {NoFlag, 0xffff8001, 0x0000007e, 0xffff8002},
778 {NoFlag, 0xffffffe0, 0x55555555, 0x0000007f},
779 {NoFlag, 0xffff8000, 0x7fffffff, 0x7ffffffe},
780 {NoFlag, 0xffffffff, 0xfffffffe, 0xffffff80},
781 {NoFlag, 0xffff8001, 0xffff8002, 0x33333333},
782 {NoFlag, 0x7ffffffd, 0xfffffffd, 0xaaaaaaaa},
783 {NoFlag, 0xaaaaaaaa, 0xfffffffd, 0x00000020},
784 {NoFlag, 0x0000007f, 0x00007ffe, 0x55555555},
785 {NoFlag, 0x00000020, 0x00000020, 0x00000002},
786 {NoFlag, 0x80000001, 0xffff8002, 0xfffffffe},
787 {NoFlag, 0x7fffffff, 0x80000001, 0xffff8002},
788 {NoFlag, 0x00000020, 0x0000007e, 0x33333333}};
789
790 static const Inputs kRotations[] =
791 {{NoFlag, 0xabababab, 0xabababab, 0x00000000},
792 {NoFlag, 0xabababab, 0xabababab, 0x00000001},
793 {NoFlag, 0xabababab, 0xabababab, 0x00000002},
794 {NoFlag, 0xabababab, 0xabababab, 0x00000020},
795 {NoFlag, 0xabababab, 0xabababab, 0x0000007d},
796 {NoFlag, 0xabababab, 0xabababab, 0x0000007e},
797 {NoFlag, 0xabababab, 0xabababab, 0x0000007f},
798 {NoFlag, 0xabababab, 0xabababab, 0x00007ffd},
799 {NoFlag, 0xabababab, 0xabababab, 0x00007ffe},
800 {NoFlag, 0xabababab, 0xabababab, 0x00007fff},
801 {NoFlag, 0xabababab, 0xabababab, 0x33333333},
802 {NoFlag, 0xabababab, 0xabababab, 0x55555555},
803 {NoFlag, 0xabababab, 0xabababab, 0x7ffffffd},
804 {NoFlag, 0xabababab, 0xabababab, 0x7ffffffe},
805 {NoFlag, 0xabababab, 0xabababab, 0x7fffffff},
806 {NoFlag, 0xabababab, 0xabababab, 0x80000000},
807 {NoFlag, 0xabababab, 0xabababab, 0x80000001},
808 {NoFlag, 0xabababab, 0xabababab, 0xaaaaaaaa},
809 {NoFlag, 0xabababab, 0xabababab, 0xcccccccc},
810 {NoFlag, 0xabababab, 0xabababab, 0xffff8000},
811 {NoFlag, 0xabababab, 0xabababab, 0xffff8001},
812 {NoFlag, 0xabababab, 0xabababab, 0xffff8002},
813 {NoFlag, 0xabababab, 0xabababab, 0xffff8003},
814 {NoFlag, 0xabababab, 0xabababab, 0xffffff80},
815 {NoFlag, 0xabababab, 0xabababab, 0xffffff81},
816 {NoFlag, 0xabababab, 0xabababab, 0xffffff82},
817 {NoFlag, 0xabababab, 0xabababab, 0xffffff83},
818 {NoFlag, 0xabababab, 0xabababab, 0xffffffe0},
819 {NoFlag, 0xabababab, 0xabababab, 0xfffffffd},
820 {NoFlag, 0xabababab, 0xabababab, 0xfffffffe},
821 {NoFlag, 0xabababab, 0xabababab, 0xffffffff}};
822
823
824 // A loop will be generated for each element of this array.
825 const TestLoopData kTests[] = {{{eq, r0, r0, r0, ROR, 0},
826 "eq r0 r0 r0 ROR 0",
827 "Condition_eq_r0_r0_r0_ROR_0",
828 ARRAY_SIZE(kCondition),
829 kCondition},
830 {{ne, r0, r0, r0, ROR, 0},
831 "ne r0 r0 r0 ROR 0",
832 "Condition_ne_r0_r0_r0_ROR_0",
833 ARRAY_SIZE(kCondition),
834 kCondition},
835 {{cs, r0, r0, r0, ROR, 0},
836 "cs r0 r0 r0 ROR 0",
837 "Condition_cs_r0_r0_r0_ROR_0",
838 ARRAY_SIZE(kCondition),
839 kCondition},
840 {{cc, r0, r0, r0, ROR, 0},
841 "cc r0 r0 r0 ROR 0",
842 "Condition_cc_r0_r0_r0_ROR_0",
843 ARRAY_SIZE(kCondition),
844 kCondition},
845 {{mi, r0, r0, r0, ROR, 0},
846 "mi r0 r0 r0 ROR 0",
847 "Condition_mi_r0_r0_r0_ROR_0",
848 ARRAY_SIZE(kCondition),
849 kCondition},
850 {{pl, r0, r0, r0, ROR, 0},
851 "pl r0 r0 r0 ROR 0",
852 "Condition_pl_r0_r0_r0_ROR_0",
853 ARRAY_SIZE(kCondition),
854 kCondition},
855 {{vs, r0, r0, r0, ROR, 0},
856 "vs r0 r0 r0 ROR 0",
857 "Condition_vs_r0_r0_r0_ROR_0",
858 ARRAY_SIZE(kCondition),
859 kCondition},
860 {{vc, r0, r0, r0, ROR, 0},
861 "vc r0 r0 r0 ROR 0",
862 "Condition_vc_r0_r0_r0_ROR_0",
863 ARRAY_SIZE(kCondition),
864 kCondition},
865 {{hi, r0, r0, r0, ROR, 0},
866 "hi r0 r0 r0 ROR 0",
867 "Condition_hi_r0_r0_r0_ROR_0",
868 ARRAY_SIZE(kCondition),
869 kCondition},
870 {{ls, r0, r0, r0, ROR, 0},
871 "ls r0 r0 r0 ROR 0",
872 "Condition_ls_r0_r0_r0_ROR_0",
873 ARRAY_SIZE(kCondition),
874 kCondition},
875 {{ge, r0, r0, r0, ROR, 0},
876 "ge r0 r0 r0 ROR 0",
877 "Condition_ge_r0_r0_r0_ROR_0",
878 ARRAY_SIZE(kCondition),
879 kCondition},
880 {{lt, r0, r0, r0, ROR, 0},
881 "lt r0 r0 r0 ROR 0",
882 "Condition_lt_r0_r0_r0_ROR_0",
883 ARRAY_SIZE(kCondition),
884 kCondition},
885 {{gt, r0, r0, r0, ROR, 0},
886 "gt r0 r0 r0 ROR 0",
887 "Condition_gt_r0_r0_r0_ROR_0",
888 ARRAY_SIZE(kCondition),
889 kCondition},
890 {{le, r0, r0, r0, ROR, 0},
891 "le r0 r0 r0 ROR 0",
892 "Condition_le_r0_r0_r0_ROR_0",
893 ARRAY_SIZE(kCondition),
894 kCondition},
895 {{al, r0, r0, r0, ROR, 0},
896 "al r0 r0 r0 ROR 0",
897 "Condition_al_r0_r0_r0_ROR_0",
898 ARRAY_SIZE(kCondition),
899 kCondition},
900 {{al, r3, r3, r4, ROR, 0},
901 "al r3 r3 r4 ROR 0",
902 "RdIsRn_al_r3_r3_r4_ROR_0",
903 ARRAY_SIZE(kRdIsRn),
904 kRdIsRn},
905 {{al, r2, r2, r12, ROR, 0},
906 "al r2 r2 r12 ROR 0",
907 "RdIsRn_al_r2_r2_r12_ROR_0",
908 ARRAY_SIZE(kRdIsRn),
909 kRdIsRn},
910 {{al, r8, r8, r5, ROR, 0},
911 "al r8 r8 r5 ROR 0",
912 "RdIsRn_al_r8_r8_r5_ROR_0",
913 ARRAY_SIZE(kRdIsRn),
914 kRdIsRn},
915 {{al, r14, r14, r0, ROR, 0},
916 "al r14 r14 r0 ROR 0",
917 "RdIsRn_al_r14_r14_r0_ROR_0",
918 ARRAY_SIZE(kRdIsRn),
919 kRdIsRn},
920 {{al, r11, r11, r10, ROR, 0},
921 "al r11 r11 r10 ROR 0",
922 "RdIsRn_al_r11_r11_r10_ROR_0",
923 ARRAY_SIZE(kRdIsRn),
924 kRdIsRn},
925 {{al, r12, r12, r10, ROR, 0},
926 "al r12 r12 r10 ROR 0",
927 "RdIsRn_al_r12_r12_r10_ROR_0",
928 ARRAY_SIZE(kRdIsRn),
929 kRdIsRn},
930 {{al, r4, r4, r8, ROR, 0},
931 "al r4 r4 r8 ROR 0",
932 "RdIsRn_al_r4_r4_r8_ROR_0",
933 ARRAY_SIZE(kRdIsRn),
934 kRdIsRn},
935 {{al, r5, r5, r14, ROR, 0},
936 "al r5 r5 r14 ROR 0",
937 "RdIsRn_al_r5_r5_r14_ROR_0",
938 ARRAY_SIZE(kRdIsRn),
939 kRdIsRn},
940 {{al, r0, r0, r6, ROR, 0},
941 "al r0 r0 r6 ROR 0",
942 "RdIsRn_al_r0_r0_r6_ROR_0",
943 ARRAY_SIZE(kRdIsRn),
944 kRdIsRn},
945 {{al, r12, r12, r1, ROR, 0},
946 "al r12 r12 r1 ROR 0",
947 "RdIsRn_al_r12_r12_r1_ROR_0",
948 ARRAY_SIZE(kRdIsRn),
949 kRdIsRn},
950 {{al, r6, r11, r6, ROR, 0},
951 "al r6 r11 r6 ROR 0",
952 "RdIsRm_al_r6_r11_r6_ROR_0",
953 ARRAY_SIZE(kRdIsRm),
954 kRdIsRm},
955 {{al, r11, r9, r11, ROR, 0},
956 "al r11 r9 r11 ROR 0",
957 "RdIsRm_al_r11_r9_r11_ROR_0",
958 ARRAY_SIZE(kRdIsRm),
959 kRdIsRm},
960 {{al, r0, r8, r0, ROR, 0},
961 "al r0 r8 r0 ROR 0",
962 "RdIsRm_al_r0_r8_r0_ROR_0",
963 ARRAY_SIZE(kRdIsRm),
964 kRdIsRm},
965 {{al, r2, r11, r2, ROR, 0},
966 "al r2 r11 r2 ROR 0",
967 "RdIsRm_al_r2_r11_r2_ROR_0",
968 ARRAY_SIZE(kRdIsRm),
969 kRdIsRm},
970 {{al, r9, r4, r9, ROR, 0},
971 "al r9 r4 r9 ROR 0",
972 "RdIsRm_al_r9_r4_r9_ROR_0",
973 ARRAY_SIZE(kRdIsRm),
974 kRdIsRm},
975 {{al, r14, r10, r14, ROR, 0},
976 "al r14 r10 r14 ROR 0",
977 "RdIsRm_al_r14_r10_r14_ROR_0",
978 ARRAY_SIZE(kRdIsRm),
979 kRdIsRm},
980 {{al, r7, r0, r7, ROR, 0},
981 "al r7 r0 r7 ROR 0",
982 "RdIsRm_al_r7_r0_r7_ROR_0",
983 ARRAY_SIZE(kRdIsRm),
984 kRdIsRm},
985 {{al, r4, r9, r4, ROR, 0},
986 "al r4 r9 r4 ROR 0",
987 "RdIsRm_al_r4_r9_r4_ROR_0",
988 ARRAY_SIZE(kRdIsRm),
989 kRdIsRm},
990 {{al, r6, r10, r6, ROR, 0},
991 "al r6 r10 r6 ROR 0",
992 "RdIsRm_al_r6_r10_r6_ROR_0",
993 ARRAY_SIZE(kRdIsRm),
994 kRdIsRm},
995 {{al, r7, r6, r7, ROR, 0},
996 "al r7 r6 r7 ROR 0",
997 "RdIsRm_al_r7_r6_r7_ROR_0",
998 ARRAY_SIZE(kRdIsRm),
999 kRdIsRm},
1000 {{al, r3, r9, r10, ROR, 0},
1001 "al r3 r9 r10 ROR 0",
1002 "RdIsNotRnIsNotRm_al_r3_r9_r10_ROR_0",
1003 ARRAY_SIZE(kRdIsNotRnIsNotRm),
1004 kRdIsNotRnIsNotRm},
1005 {{al, r7, r12, r5, ROR, 0},
1006 "al r7 r12 r5 ROR 0",
1007 "RdIsNotRnIsNotRm_al_r7_r12_r5_ROR_0",
1008 ARRAY_SIZE(kRdIsNotRnIsNotRm),
1009 kRdIsNotRnIsNotRm},
1010 {{al, r8, r5, r6, ROR, 0},
1011 "al r8 r5 r6 ROR 0",
1012 "RdIsNotRnIsNotRm_al_r8_r5_r6_ROR_0",
1013 ARRAY_SIZE(kRdIsNotRnIsNotRm),
1014 kRdIsNotRnIsNotRm},
1015 {{al, r0, r6, r0, ROR, 0},
1016 "al r0 r6 r0 ROR 0",
1017 "RdIsNotRnIsNotRm_al_r0_r6_r0_ROR_0",
1018 ARRAY_SIZE(kRdIsNotRnIsNotRm),
1019 kRdIsNotRnIsNotRm},
1020 {{al, r11, r7, r8, ROR, 0},
1021 "al r11 r7 r8 ROR 0",
1022 "RdIsNotRnIsNotRm_al_r11_r7_r8_ROR_0",
1023 ARRAY_SIZE(kRdIsNotRnIsNotRm),
1024 kRdIsNotRnIsNotRm},
1025 {{al, r12, r2, r3, ROR, 0},
1026 "al r12 r2 r3 ROR 0",
1027 "RdIsNotRnIsNotRm_al_r12_r2_r3_ROR_0",
1028 ARRAY_SIZE(kRdIsNotRnIsNotRm),
1029 kRdIsNotRnIsNotRm},
1030 {{al, r7, r4, r10, ROR, 0},
1031 "al r7 r4 r10 ROR 0",
1032 "RdIsNotRnIsNotRm_al_r7_r4_r10_ROR_0",
1033 ARRAY_SIZE(kRdIsNotRnIsNotRm),
1034 kRdIsNotRnIsNotRm},
1035 {{al, r9, r6, r1, ROR, 0},
1036 "al r9 r6 r1 ROR 0",
1037 "RdIsNotRnIsNotRm_al_r9_r6_r1_ROR_0",
1038 ARRAY_SIZE(kRdIsNotRnIsNotRm),
1039 kRdIsNotRnIsNotRm},
1040 {{al, r10, r14, r3, ROR, 0},
1041 "al r10 r14 r3 ROR 0",
1042 "RdIsNotRnIsNotRm_al_r10_r14_r3_ROR_0",
1043 ARRAY_SIZE(kRdIsNotRnIsNotRm),
1044 kRdIsNotRnIsNotRm},
1045 {{al, r14, r3, r6, ROR, 0},
1046 "al r14 r3 r6 ROR 0",
1047 "RdIsNotRnIsNotRm_al_r14_r3_r6_ROR_0",
1048 ARRAY_SIZE(kRdIsNotRnIsNotRm),
1049 kRdIsNotRnIsNotRm},
1050 {{al, r0, r1, r2, ROR, 0},
1051 "al r0 r1 r2 ROR 0",
1052 "Rotations_al_r0_r1_r2_ROR_0",
1053 ARRAY_SIZE(kRotations),
1054 kRotations},
1055 {{al, r0, r1, r2, ROR, 8},
1056 "al r0 r1 r2 ROR 8",
1057 "Rotations_al_r0_r1_r2_ROR_8",
1058 ARRAY_SIZE(kRotations),
1059 kRotations},
1060 {{al, r0, r1, r2, ROR, 16},
1061 "al r0 r1 r2 ROR 16",
1062 "Rotations_al_r0_r1_r2_ROR_16",
1063 ARRAY_SIZE(kRotations),
1064 kRotations},
1065 {{al, r0, r1, r2, ROR, 24},
1066 "al r0 r1 r2 ROR 24",
1067 "Rotations_al_r0_r1_r2_ROR_24",
1068 ARRAY_SIZE(kRotations),
1069 kRotations}};
1070
1071 // We record all inputs to the instructions as outputs. This way, we also check
1072 // that what shouldn't change didn't change.
1073 struct TestResult {
1074 size_t output_size;
1075 const Inputs* outputs;
1076 };
1077
1078 // These headers each contain an array of `TestResult` with the reference output
1079 // values. The reference arrays are names `kReference{mnemonic}`.
1080 #include "aarch32/traces/simulator-cond-rd-rn-operand-rm-ror-amount-a32-sxtab.h"
1081 #include "aarch32/traces/simulator-cond-rd-rn-operand-rm-ror-amount-a32-sxtab16.h"
1082 #include "aarch32/traces/simulator-cond-rd-rn-operand-rm-ror-amount-a32-sxtah.h"
1083 #include "aarch32/traces/simulator-cond-rd-rn-operand-rm-ror-amount-a32-uxtab.h"
1084 #include "aarch32/traces/simulator-cond-rd-rn-operand-rm-ror-amount-a32-uxtab16.h"
1085 #include "aarch32/traces/simulator-cond-rd-rn-operand-rm-ror-amount-a32-uxtah.h"
1086
1087
1088 // The maximum number of errors to report in detail for each test.
1089 const unsigned kErrorReportLimit = 8;
1090
1091 typedef void (MacroAssembler::*Fn)(Condition cond,
1092 Register rd,
1093 Register rn,
1094 const Operand& op);
1095
TestHelper(Fn instruction,const char * mnemonic,const TestResult reference[])1096 void TestHelper(Fn instruction,
1097 const char* mnemonic,
1098 const TestResult reference[]) {
1099 SETUP();
1100 masm.UseA32();
1101 START();
1102
1103 // Data to compare to `reference`.
1104 TestResult* results[ARRAY_SIZE(kTests)];
1105
1106 // Test cases for memory bound instructions may allocate a buffer and save its
1107 // address in this array.
1108 byte* scratch_memory_buffers[ARRAY_SIZE(kTests)];
1109
1110 // Generate a loop for each element in `kTests`. Each loop tests one specific
1111 // instruction.
1112 for (unsigned i = 0; i < ARRAY_SIZE(kTests); i++) {
1113 // Allocate results on the heap for this test.
1114 results[i] = new TestResult;
1115 results[i]->outputs = new Inputs[kTests[i].input_size];
1116 results[i]->output_size = kTests[i].input_size;
1117
1118 size_t input_stride = sizeof(kTests[i].inputs[0]) * kTests[i].input_size;
1119 VIXL_ASSERT(IsUint32(input_stride));
1120
1121 scratch_memory_buffers[i] = NULL;
1122
1123 Label loop;
1124 UseScratchRegisterScope scratch_registers(&masm);
1125 // Include all registers from r0 ro r12.
1126 scratch_registers.Include(RegisterList(0x1fff));
1127
1128 // Values to pass to the macro-assembler.
1129 Condition cond = kTests[i].operands.cond;
1130 Register rd = kTests[i].operands.rd;
1131 Register rn = kTests[i].operands.rn;
1132 Register rm = kTests[i].operands.rm;
1133 ShiftType ror = kTests[i].operands.ror;
1134 uint32_t amount = kTests[i].operands.amount;
1135 Operand op(rm, ror, amount);
1136 scratch_registers.Exclude(rd);
1137 scratch_registers.Exclude(rn);
1138 scratch_registers.Exclude(rm);
1139
1140 // Allocate reserved registers for our own use.
1141 Register input_ptr = scratch_registers.Acquire();
1142 Register input_end = scratch_registers.Acquire();
1143 Register result_ptr = scratch_registers.Acquire();
1144
1145 // Initialize `input_ptr` to the first element and `input_end` the address
1146 // after the array.
1147 __ Mov(input_ptr, Operand::From(kTests[i].inputs));
1148 __ Add(input_end, input_ptr, static_cast<uint32_t>(input_stride));
1149 __ Mov(result_ptr, Operand::From(results[i]->outputs));
1150 __ Bind(&loop);
1151
1152 {
1153 UseScratchRegisterScope temp_registers(&masm);
1154 Register nzcv_bits = temp_registers.Acquire();
1155 Register saved_q_bit = temp_registers.Acquire();
1156 // Save the `Q` bit flag.
1157 __ Mrs(saved_q_bit, APSR);
1158 __ And(saved_q_bit, saved_q_bit, QFlag);
1159 // Set the `NZCV` and `Q` flags together.
1160 __ Ldr(nzcv_bits, MemOperand(input_ptr, offsetof(Inputs, apsr)));
1161 __ Orr(nzcv_bits, nzcv_bits, saved_q_bit);
1162 __ Msr(APSR_nzcvq, nzcv_bits);
1163 }
1164 __ Ldr(rd, MemOperand(input_ptr, offsetof(Inputs, rd)));
1165 __ Ldr(rn, MemOperand(input_ptr, offsetof(Inputs, rn)));
1166 __ Ldr(rm, MemOperand(input_ptr, offsetof(Inputs, rm)));
1167
1168 (masm.*instruction)(cond, rd, rn, op);
1169
1170 {
1171 UseScratchRegisterScope temp_registers(&masm);
1172 Register nzcv_bits = temp_registers.Acquire();
1173 __ Mrs(nzcv_bits, APSR);
1174 // Only record the NZCV bits.
1175 __ And(nzcv_bits, nzcv_bits, NZCVFlag);
1176 __ Str(nzcv_bits, MemOperand(result_ptr, offsetof(Inputs, apsr)));
1177 }
1178 __ Str(rd, MemOperand(result_ptr, offsetof(Inputs, rd)));
1179 __ Str(rn, MemOperand(result_ptr, offsetof(Inputs, rn)));
1180 __ Str(rm, MemOperand(result_ptr, offsetof(Inputs, rm)));
1181
1182 // Advance the result pointer.
1183 __ Add(result_ptr, result_ptr, Operand::From(sizeof(kTests[i].inputs[0])));
1184 // Loop back until `input_ptr` is lower than `input_base`.
1185 __ Add(input_ptr, input_ptr, Operand::From(sizeof(kTests[i].inputs[0])));
1186 __ Cmp(input_ptr, input_end);
1187 __ B(ne, &loop);
1188 }
1189
1190 END();
1191
1192 RUN();
1193
1194 if (Test::generate_test_trace()) {
1195 // Print the results.
1196 for (size_t i = 0; i < ARRAY_SIZE(kTests); i++) {
1197 printf("const Inputs kOutputs_%s_%s[] = {\n",
1198 mnemonic,
1199 kTests[i].identifier);
1200 for (size_t j = 0; j < results[i]->output_size; j++) {
1201 printf(" { ");
1202 printf("0x%08" PRIx32, results[i]->outputs[j].apsr);
1203 printf(", ");
1204 printf("0x%08" PRIx32, results[i]->outputs[j].rd);
1205 printf(", ");
1206 printf("0x%08" PRIx32, results[i]->outputs[j].rn);
1207 printf(", ");
1208 printf("0x%08" PRIx32, results[i]->outputs[j].rm);
1209 printf(" },\n");
1210 }
1211 printf("};\n");
1212 }
1213 printf("const TestResult kReference%s[] = {\n", mnemonic);
1214 for (size_t i = 0; i < ARRAY_SIZE(kTests); i++) {
1215 printf(" {\n");
1216 printf(" ARRAY_SIZE(kOutputs_%s_%s),\n",
1217 mnemonic,
1218 kTests[i].identifier);
1219 printf(" kOutputs_%s_%s,\n", mnemonic, kTests[i].identifier);
1220 printf(" },\n");
1221 }
1222 printf("};\n");
1223 } else if (kCheckSimulatorTestResults) {
1224 // Check the results.
1225 unsigned total_error_count = 0;
1226 for (size_t i = 0; i < ARRAY_SIZE(kTests); i++) {
1227 bool instruction_has_errors = false;
1228 for (size_t j = 0; j < kTests[i].input_size; j++) {
1229 uint32_t apsr = results[i]->outputs[j].apsr;
1230 uint32_t rd = results[i]->outputs[j].rd;
1231 uint32_t rn = results[i]->outputs[j].rn;
1232 uint32_t rm = results[i]->outputs[j].rm;
1233 uint32_t apsr_input = kTests[i].inputs[j].apsr;
1234 uint32_t rd_input = kTests[i].inputs[j].rd;
1235 uint32_t rn_input = kTests[i].inputs[j].rn;
1236 uint32_t rm_input = kTests[i].inputs[j].rm;
1237 uint32_t apsr_ref = reference[i].outputs[j].apsr;
1238 uint32_t rd_ref = reference[i].outputs[j].rd;
1239 uint32_t rn_ref = reference[i].outputs[j].rn;
1240 uint32_t rm_ref = reference[i].outputs[j].rm;
1241
1242 if (((apsr != apsr_ref) || (rd != rd_ref) || (rn != rn_ref) ||
1243 (rm != rm_ref)) &&
1244 (++total_error_count <= kErrorReportLimit)) {
1245 // Print the instruction once even if it triggered multiple failures.
1246 if (!instruction_has_errors) {
1247 printf("Error(s) when testing \"%s %s\":\n",
1248 mnemonic,
1249 kTests[i].operands_description);
1250 instruction_has_errors = true;
1251 }
1252 // Print subsequent errors.
1253 printf(" Input: ");
1254 printf("0x%08" PRIx32, apsr_input);
1255 printf(", ");
1256 printf("0x%08" PRIx32, rd_input);
1257 printf(", ");
1258 printf("0x%08" PRIx32, rn_input);
1259 printf(", ");
1260 printf("0x%08" PRIx32, rm_input);
1261 printf("\n");
1262 printf(" Expected: ");
1263 printf("0x%08" PRIx32, apsr_ref);
1264 printf(", ");
1265 printf("0x%08" PRIx32, rd_ref);
1266 printf(", ");
1267 printf("0x%08" PRIx32, rn_ref);
1268 printf(", ");
1269 printf("0x%08" PRIx32, rm_ref);
1270 printf("\n");
1271 printf(" Found: ");
1272 printf("0x%08" PRIx32, apsr);
1273 printf(", ");
1274 printf("0x%08" PRIx32, rd);
1275 printf(", ");
1276 printf("0x%08" PRIx32, rn);
1277 printf(", ");
1278 printf("0x%08" PRIx32, rm);
1279 printf("\n\n");
1280 }
1281 }
1282 }
1283
1284 if (total_error_count > kErrorReportLimit) {
1285 printf("%u other errors follow.\n",
1286 total_error_count - kErrorReportLimit);
1287 }
1288 VIXL_CHECK(total_error_count == 0);
1289 } else {
1290 VIXL_WARNING("Assembled the code, but did not run anything.\n");
1291 }
1292
1293 for (size_t i = 0; i < ARRAY_SIZE(kTests); i++) {
1294 delete[] results[i]->outputs;
1295 delete results[i];
1296 delete[] scratch_memory_buffers[i];
1297 }
1298
1299 TEARDOWN();
1300 }
1301
1302 // Instantiate tests for each instruction in the list.
1303 // TODO: Remove this limitation by having a sandboxing mechanism.
1304 #if defined(VIXL_HOST_POINTER_32)
1305 #define TEST(mnemonic) \
1306 void Test_##mnemonic() { \
1307 TestHelper(&MacroAssembler::mnemonic, #mnemonic, kReference##mnemonic); \
1308 } \
1309 Test test_##mnemonic( \
1310 "AARCH32_SIMULATOR_COND_RD_RN_OPERAND_RM_ROR_AMOUNT_A32_" #mnemonic, \
1311 &Test_##mnemonic);
1312 #else
1313 #define TEST(mnemonic) \
1314 void Test_##mnemonic() { \
1315 VIXL_WARNING("This test can only run on a 32-bit host.\n"); \
1316 USE(TestHelper); \
1317 } \
1318 Test test_##mnemonic( \
1319 "AARCH32_SIMULATOR_COND_RD_RN_OPERAND_RM_ROR_AMOUNT_A32_" #mnemonic, \
1320 &Test_##mnemonic);
1321 #endif
1322
1323 FOREACH_INSTRUCTION(TEST)
1324 #undef TEST
1325
1326 } // namespace
1327 #endif
1328
1329 } // namespace aarch32
1330 } // namespace vixl
1331