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/disasm-aarch32.h"
44 #include "aarch32/macro-assembler-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 #else  // ifdef VIXL_INCLUDE_SIMULATOR_AARCH32.
64 
65 #define SETUP()                  \
66   MacroAssembler masm(BUF_SIZE); \
67   UseScratchRegisterScope harness_scratch;
68 
69 #define START()                 \
70   harness_scratch.Open(&masm);  \
71   harness_scratch.ExcludeAll(); \
72   masm.GetBuffer()->Reset();    \
73   __ Push(r4);                  \
74   __ Push(r5);                  \
75   __ Push(r6);                  \
76   __ Push(r7);                  \
77   __ Push(r8);                  \
78   __ Push(r9);                  \
79   __ Push(r10);                 \
80   __ Push(r11);                 \
81   __ Push(lr);                  \
82   harness_scratch.Include(ip);
83 
84 #define END()                  \
85   harness_scratch.Exclude(ip); \
86   __ Pop(lr);                  \
87   __ Pop(r11);                 \
88   __ Pop(r10);                 \
89   __ Pop(r9);                  \
90   __ Pop(r8);                  \
91   __ Pop(r7);                  \
92   __ Pop(r6);                  \
93   __ Pop(r5);                  \
94   __ Pop(r4);                  \
95   __ Bx(lr);                   \
96   __ FinalizeCode();           \
97   harness_scratch.Close();
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 #endif  // ifdef VIXL_INCLUDE_SIMULATOR_AARCH32
110 
111 namespace vixl {
112 namespace aarch32 {
113 
114 // List of instruction encodings:
115 #define FOREACH_INSTRUCTION(M) \
116   M(Clz)                       \
117   M(Rbit)                      \
118   M(Rev)                       \
119   M(Rev16)                     \
120   M(Revsh)                     \
121   M(Rrx)                       \
122   M(Rrxs)
123 
124 
125 // The following definitions are defined again in each generated test, therefore
126 // we need to place them in an anomymous namespace. It expresses that they are
127 // local to this file only, and the compiler is not allowed to share these types
128 // across test files during template instantiation. Specifically, `Operands` and
129 // `Inputs` have various layouts across generated tests so they absolutely
130 // cannot be shared.
131 
132 #ifdef VIXL_INCLUDE_TARGET_T32
133 namespace {
134 
135 // Values to be passed to the assembler to produce the instruction under test.
136 struct Operands {
137   Condition cond;
138   Register rd;
139   Register rn;
140 };
141 
142 // Input data to feed to the instruction.
143 struct Inputs {
144   uint32_t apsr;
145   uint32_t rd;
146   uint32_t rn;
147 };
148 
149 // This structure contains all input data needed to test one specific encoding.
150 // It used to generate a loop over an instruction.
151 struct TestLoopData {
152   // The `operands` fields represents the values to pass to the assembler to
153   // produce the instruction.
154   Operands operands;
155   // Description of the operands, used for error reporting.
156   const char* operands_description;
157   // Unique identifier, used for generating traces.
158   const char* identifier;
159   // Array of values to be fed to the instruction.
160   size_t input_size;
161   const Inputs* inputs;
162 };
163 
164 static const Inputs kCondition[] = {{NFlag, 0xabababab, 0xabababab},
165                                     {ZFlag, 0xabababab, 0xabababab},
166                                     {CFlag, 0xabababab, 0xabababab},
167                                     {VFlag, 0xabababab, 0xabababab},
168                                     {NZFlag, 0xabababab, 0xabababab},
169                                     {NCFlag, 0xabababab, 0xabababab},
170                                     {NVFlag, 0xabababab, 0xabababab},
171                                     {ZCFlag, 0xabababab, 0xabababab},
172                                     {ZVFlag, 0xabababab, 0xabababab},
173                                     {CVFlag, 0xabababab, 0xabababab},
174                                     {NZCFlag, 0xabababab, 0xabababab},
175                                     {NZVFlag, 0xabababab, 0xabababab},
176                                     {NCVFlag, 0xabababab, 0xabababab},
177                                     {ZCVFlag, 0xabababab, 0xabababab},
178                                     {NZCVFlag, 0xabababab, 0xabababab}};
179 
180 static const Inputs kRdIsRn[] =
181     {{NoFlag, 0x00000000, 0x00000000}, {NoFlag, 0x00000001, 0x00000001},
182      {NoFlag, 0x00000002, 0x00000002}, {NoFlag, 0x00000020, 0x00000020},
183      {NoFlag, 0x0000007d, 0x0000007d}, {NoFlag, 0x0000007e, 0x0000007e},
184      {NoFlag, 0x0000007f, 0x0000007f}, {NoFlag, 0x00007ffd, 0x00007ffd},
185      {NoFlag, 0x00007ffe, 0x00007ffe}, {NoFlag, 0x00007fff, 0x00007fff},
186      {NoFlag, 0x33333333, 0x33333333}, {NoFlag, 0x55555555, 0x55555555},
187      {NoFlag, 0x7ffffffd, 0x7ffffffd}, {NoFlag, 0x7ffffffe, 0x7ffffffe},
188      {NoFlag, 0x7fffffff, 0x7fffffff}, {NoFlag, 0x80000000, 0x80000000},
189      {NoFlag, 0x80000001, 0x80000001}, {NoFlag, 0xaaaaaaaa, 0xaaaaaaaa},
190      {NoFlag, 0xcccccccc, 0xcccccccc}, {NoFlag, 0xffff8000, 0xffff8000},
191      {NoFlag, 0xffff8001, 0xffff8001}, {NoFlag, 0xffff8002, 0xffff8002},
192      {NoFlag, 0xffff8003, 0xffff8003}, {NoFlag, 0xffffff80, 0xffffff80},
193      {NoFlag, 0xffffff81, 0xffffff81}, {NoFlag, 0xffffff82, 0xffffff82},
194      {NoFlag, 0xffffff83, 0xffffff83}, {NoFlag, 0xffffffe0, 0xffffffe0},
195      {NoFlag, 0xfffffffd, 0xfffffffd}, {NoFlag, 0xfffffffe, 0xfffffffe},
196      {NoFlag, 0xffffffff, 0xffffffff}};
197 
198 static const Inputs kRdIsNotRn[] =
199     {{NoFlag, 0x00000000, 0x00000001}, {NoFlag, 0x00000000, 0x00000002},
200      {NoFlag, 0x00000000, 0x00000020}, {NoFlag, 0x00000000, 0x0000007d},
201      {NoFlag, 0x00000000, 0x0000007e}, {NoFlag, 0x00000000, 0x0000007f},
202      {NoFlag, 0x00000000, 0x00007ffd}, {NoFlag, 0x00000000, 0x00007ffe},
203      {NoFlag, 0x00000000, 0x00007fff}, {NoFlag, 0x00000000, 0x33333333},
204      {NoFlag, 0x00000000, 0x55555555}, {NoFlag, 0x00000000, 0x7ffffffd},
205      {NoFlag, 0x00000000, 0x7ffffffe}, {NoFlag, 0x00000000, 0x7fffffff},
206      {NoFlag, 0x00000000, 0x80000000}, {NoFlag, 0x00000000, 0x80000001},
207      {NoFlag, 0x00000000, 0xaaaaaaaa}, {NoFlag, 0x00000000, 0xcccccccc},
208      {NoFlag, 0x00000000, 0xffff8000}, {NoFlag, 0x00000000, 0xffff8001},
209      {NoFlag, 0x00000000, 0xffff8002}, {NoFlag, 0x00000000, 0xffff8003},
210      {NoFlag, 0x00000000, 0xffffff80}, {NoFlag, 0x00000000, 0xffffff81},
211      {NoFlag, 0x00000000, 0xffffff82}, {NoFlag, 0x00000000, 0xffffff83},
212      {NoFlag, 0x00000000, 0xffffffe0}, {NoFlag, 0x00000000, 0xfffffffd},
213      {NoFlag, 0x00000000, 0xfffffffe}, {NoFlag, 0x00000000, 0xffffffff},
214      {NoFlag, 0x00000001, 0x00000000}, {NoFlag, 0x00000001, 0x00000002},
215      {NoFlag, 0x00000001, 0x00000020}, {NoFlag, 0x00000001, 0x0000007d},
216      {NoFlag, 0x00000001, 0x0000007e}, {NoFlag, 0x00000001, 0x0000007f},
217      {NoFlag, 0x00000001, 0x00007ffd}, {NoFlag, 0x00000001, 0x00007ffe},
218      {NoFlag, 0x00000001, 0x00007fff}, {NoFlag, 0x00000001, 0x33333333},
219      {NoFlag, 0x00000001, 0x55555555}, {NoFlag, 0x00000001, 0x7ffffffd},
220      {NoFlag, 0x00000001, 0x7ffffffe}, {NoFlag, 0x00000001, 0x7fffffff},
221      {NoFlag, 0x00000001, 0x80000000}, {NoFlag, 0x00000001, 0x80000001},
222      {NoFlag, 0x00000001, 0xaaaaaaaa}, {NoFlag, 0x00000001, 0xcccccccc},
223      {NoFlag, 0x00000001, 0xffff8000}, {NoFlag, 0x00000001, 0xffff8001},
224      {NoFlag, 0x00000001, 0xffff8002}, {NoFlag, 0x00000001, 0xffff8003},
225      {NoFlag, 0x00000001, 0xffffff80}, {NoFlag, 0x00000001, 0xffffff81},
226      {NoFlag, 0x00000001, 0xffffff82}, {NoFlag, 0x00000001, 0xffffff83},
227      {NoFlag, 0x00000001, 0xffffffe0}, {NoFlag, 0x00000001, 0xfffffffd},
228      {NoFlag, 0x00000001, 0xfffffffe}, {NoFlag, 0x00000001, 0xffffffff},
229      {NoFlag, 0x00000002, 0x00000000}, {NoFlag, 0x00000002, 0x00000001},
230      {NoFlag, 0x00000002, 0x00000020}, {NoFlag, 0x00000002, 0x0000007d},
231      {NoFlag, 0x00000002, 0x0000007e}, {NoFlag, 0x00000002, 0x0000007f},
232      {NoFlag, 0x00000002, 0x00007ffd}, {NoFlag, 0x00000002, 0x00007ffe},
233      {NoFlag, 0x00000002, 0x00007fff}, {NoFlag, 0x00000002, 0x33333333},
234      {NoFlag, 0x00000002, 0x55555555}, {NoFlag, 0x00000002, 0x7ffffffd},
235      {NoFlag, 0x00000002, 0x7ffffffe}, {NoFlag, 0x00000002, 0x7fffffff},
236      {NoFlag, 0x00000002, 0x80000000}, {NoFlag, 0x00000002, 0x80000001},
237      {NoFlag, 0x00000002, 0xaaaaaaaa}, {NoFlag, 0x00000002, 0xcccccccc},
238      {NoFlag, 0x00000002, 0xffff8000}, {NoFlag, 0x00000002, 0xffff8001},
239      {NoFlag, 0x00000002, 0xffff8002}, {NoFlag, 0x00000002, 0xffff8003},
240      {NoFlag, 0x00000002, 0xffffff80}, {NoFlag, 0x00000002, 0xffffff81},
241      {NoFlag, 0x00000002, 0xffffff82}, {NoFlag, 0x00000002, 0xffffff83},
242      {NoFlag, 0x00000002, 0xffffffe0}, {NoFlag, 0x00000002, 0xfffffffd},
243      {NoFlag, 0x00000002, 0xfffffffe}, {NoFlag, 0x00000002, 0xffffffff},
244      {NoFlag, 0x00000020, 0x00000000}, {NoFlag, 0x00000020, 0x00000001},
245      {NoFlag, 0x00000020, 0x00000002}, {NoFlag, 0x00000020, 0x0000007d},
246      {NoFlag, 0x00000020, 0x0000007e}, {NoFlag, 0x00000020, 0x0000007f},
247      {NoFlag, 0x00000020, 0x00007ffd}, {NoFlag, 0x00000020, 0x00007ffe},
248      {NoFlag, 0x00000020, 0x00007fff}, {NoFlag, 0x00000020, 0x33333333},
249      {NoFlag, 0x00000020, 0x55555555}, {NoFlag, 0x00000020, 0x7ffffffd},
250      {NoFlag, 0x00000020, 0x7ffffffe}, {NoFlag, 0x00000020, 0x7fffffff},
251      {NoFlag, 0x00000020, 0x80000000}, {NoFlag, 0x00000020, 0x80000001},
252      {NoFlag, 0x00000020, 0xaaaaaaaa}, {NoFlag, 0x00000020, 0xcccccccc},
253      {NoFlag, 0x00000020, 0xffff8000}, {NoFlag, 0x00000020, 0xffff8001},
254      {NoFlag, 0x00000020, 0xffff8002}, {NoFlag, 0x00000020, 0xffff8003},
255      {NoFlag, 0x00000020, 0xffffff80}, {NoFlag, 0x00000020, 0xffffff81},
256      {NoFlag, 0x00000020, 0xffffff82}, {NoFlag, 0x00000020, 0xffffff83},
257      {NoFlag, 0x00000020, 0xffffffe0}, {NoFlag, 0x00000020, 0xfffffffd},
258      {NoFlag, 0x00000020, 0xfffffffe}, {NoFlag, 0x00000020, 0xffffffff},
259      {NoFlag, 0x0000007d, 0x00000000}, {NoFlag, 0x0000007d, 0x00000001},
260      {NoFlag, 0x0000007d, 0x00000002}, {NoFlag, 0x0000007d, 0x00000020},
261      {NoFlag, 0x0000007d, 0x0000007e}, {NoFlag, 0x0000007d, 0x0000007f},
262      {NoFlag, 0x0000007d, 0x00007ffd}, {NoFlag, 0x0000007d, 0x00007ffe},
263      {NoFlag, 0x0000007d, 0x00007fff}, {NoFlag, 0x0000007d, 0x33333333},
264      {NoFlag, 0x0000007d, 0x55555555}, {NoFlag, 0x0000007d, 0x7ffffffd},
265      {NoFlag, 0x0000007d, 0x7ffffffe}, {NoFlag, 0x0000007d, 0x7fffffff},
266      {NoFlag, 0x0000007d, 0x80000000}, {NoFlag, 0x0000007d, 0x80000001},
267      {NoFlag, 0x0000007d, 0xaaaaaaaa}, {NoFlag, 0x0000007d, 0xcccccccc},
268      {NoFlag, 0x0000007d, 0xffff8000}, {NoFlag, 0x0000007d, 0xffff8001},
269      {NoFlag, 0x0000007d, 0xffff8002}, {NoFlag, 0x0000007d, 0xffff8003},
270      {NoFlag, 0x0000007d, 0xffffff80}, {NoFlag, 0x0000007d, 0xffffff81},
271      {NoFlag, 0x0000007d, 0xffffff82}, {NoFlag, 0x0000007d, 0xffffff83},
272      {NoFlag, 0x0000007d, 0xffffffe0}, {NoFlag, 0x0000007d, 0xfffffffd},
273      {NoFlag, 0x0000007d, 0xfffffffe}, {NoFlag, 0x0000007d, 0xffffffff},
274      {NoFlag, 0x0000007e, 0x00000000}, {NoFlag, 0x0000007e, 0x00000001},
275      {NoFlag, 0x0000007e, 0x00000002}, {NoFlag, 0x0000007e, 0x00000020},
276      {NoFlag, 0x0000007e, 0x0000007d}, {NoFlag, 0x0000007e, 0x0000007f},
277      {NoFlag, 0x0000007e, 0x00007ffd}, {NoFlag, 0x0000007e, 0x00007ffe},
278      {NoFlag, 0x0000007e, 0x00007fff}, {NoFlag, 0x0000007e, 0x33333333},
279      {NoFlag, 0x0000007e, 0x55555555}, {NoFlag, 0x0000007e, 0x7ffffffd},
280      {NoFlag, 0x0000007e, 0x7ffffffe}, {NoFlag, 0x0000007e, 0x7fffffff},
281      {NoFlag, 0x0000007e, 0x80000000}, {NoFlag, 0x0000007e, 0x80000001},
282      {NoFlag, 0x0000007e, 0xaaaaaaaa}, {NoFlag, 0x0000007e, 0xcccccccc},
283      {NoFlag, 0x0000007e, 0xffff8000}, {NoFlag, 0x0000007e, 0xffff8001},
284      {NoFlag, 0x0000007e, 0xffff8002}, {NoFlag, 0x0000007e, 0xffff8003},
285      {NoFlag, 0x0000007e, 0xffffff80}, {NoFlag, 0x0000007e, 0xffffff81},
286      {NoFlag, 0x0000007e, 0xffffff82}, {NoFlag, 0x0000007e, 0xffffff83},
287      {NoFlag, 0x0000007e, 0xffffffe0}, {NoFlag, 0x0000007e, 0xfffffffd},
288      {NoFlag, 0x0000007e, 0xfffffffe}, {NoFlag, 0x0000007e, 0xffffffff},
289      {NoFlag, 0x0000007f, 0x00000000}, {NoFlag, 0x0000007f, 0x00000001},
290      {NoFlag, 0x0000007f, 0x00000002}, {NoFlag, 0x0000007f, 0x00000020},
291      {NoFlag, 0x0000007f, 0x0000007d}, {NoFlag, 0x0000007f, 0x0000007e},
292      {NoFlag, 0x0000007f, 0x00007ffd}, {NoFlag, 0x0000007f, 0x00007ffe},
293      {NoFlag, 0x0000007f, 0x00007fff}, {NoFlag, 0x0000007f, 0x33333333},
294      {NoFlag, 0x0000007f, 0x55555555}, {NoFlag, 0x0000007f, 0x7ffffffd},
295      {NoFlag, 0x0000007f, 0x7ffffffe}, {NoFlag, 0x0000007f, 0x7fffffff},
296      {NoFlag, 0x0000007f, 0x80000000}, {NoFlag, 0x0000007f, 0x80000001},
297      {NoFlag, 0x0000007f, 0xaaaaaaaa}, {NoFlag, 0x0000007f, 0xcccccccc},
298      {NoFlag, 0x0000007f, 0xffff8000}, {NoFlag, 0x0000007f, 0xffff8001},
299      {NoFlag, 0x0000007f, 0xffff8002}, {NoFlag, 0x0000007f, 0xffff8003},
300      {NoFlag, 0x0000007f, 0xffffff80}, {NoFlag, 0x0000007f, 0xffffff81},
301      {NoFlag, 0x0000007f, 0xffffff82}, {NoFlag, 0x0000007f, 0xffffff83},
302      {NoFlag, 0x0000007f, 0xffffffe0}, {NoFlag, 0x0000007f, 0xfffffffd},
303      {NoFlag, 0x0000007f, 0xfffffffe}, {NoFlag, 0x0000007f, 0xffffffff},
304      {NoFlag, 0x00007ffd, 0x00000000}, {NoFlag, 0x00007ffd, 0x00000001},
305      {NoFlag, 0x00007ffd, 0x00000002}, {NoFlag, 0x00007ffd, 0x00000020},
306      {NoFlag, 0x00007ffd, 0x0000007d}, {NoFlag, 0x00007ffd, 0x0000007e},
307      {NoFlag, 0x00007ffd, 0x0000007f}, {NoFlag, 0x00007ffd, 0x00007ffe},
308      {NoFlag, 0x00007ffd, 0x00007fff}, {NoFlag, 0x00007ffd, 0x33333333},
309      {NoFlag, 0x00007ffd, 0x55555555}, {NoFlag, 0x00007ffd, 0x7ffffffd},
310      {NoFlag, 0x00007ffd, 0x7ffffffe}, {NoFlag, 0x00007ffd, 0x7fffffff},
311      {NoFlag, 0x00007ffd, 0x80000000}, {NoFlag, 0x00007ffd, 0x80000001},
312      {NoFlag, 0x00007ffd, 0xaaaaaaaa}, {NoFlag, 0x00007ffd, 0xcccccccc},
313      {NoFlag, 0x00007ffd, 0xffff8000}, {NoFlag, 0x00007ffd, 0xffff8001},
314      {NoFlag, 0x00007ffd, 0xffff8002}, {NoFlag, 0x00007ffd, 0xffff8003},
315      {NoFlag, 0x00007ffd, 0xffffff80}, {NoFlag, 0x00007ffd, 0xffffff81},
316      {NoFlag, 0x00007ffd, 0xffffff82}, {NoFlag, 0x00007ffd, 0xffffff83},
317      {NoFlag, 0x00007ffd, 0xffffffe0}, {NoFlag, 0x00007ffd, 0xfffffffd},
318      {NoFlag, 0x00007ffd, 0xfffffffe}, {NoFlag, 0x00007ffd, 0xffffffff},
319      {NoFlag, 0x00007ffe, 0x00000000}, {NoFlag, 0x00007ffe, 0x00000001},
320      {NoFlag, 0x00007ffe, 0x00000002}, {NoFlag, 0x00007ffe, 0x00000020},
321      {NoFlag, 0x00007ffe, 0x0000007d}, {NoFlag, 0x00007ffe, 0x0000007e},
322      {NoFlag, 0x00007ffe, 0x0000007f}, {NoFlag, 0x00007ffe, 0x00007ffd},
323      {NoFlag, 0x00007ffe, 0x00007fff}, {NoFlag, 0x00007ffe, 0x33333333},
324      {NoFlag, 0x00007ffe, 0x55555555}, {NoFlag, 0x00007ffe, 0x7ffffffd},
325      {NoFlag, 0x00007ffe, 0x7ffffffe}, {NoFlag, 0x00007ffe, 0x7fffffff},
326      {NoFlag, 0x00007ffe, 0x80000000}, {NoFlag, 0x00007ffe, 0x80000001},
327      {NoFlag, 0x00007ffe, 0xaaaaaaaa}, {NoFlag, 0x00007ffe, 0xcccccccc},
328      {NoFlag, 0x00007ffe, 0xffff8000}, {NoFlag, 0x00007ffe, 0xffff8001},
329      {NoFlag, 0x00007ffe, 0xffff8002}, {NoFlag, 0x00007ffe, 0xffff8003},
330      {NoFlag, 0x00007ffe, 0xffffff80}, {NoFlag, 0x00007ffe, 0xffffff81},
331      {NoFlag, 0x00007ffe, 0xffffff82}, {NoFlag, 0x00007ffe, 0xffffff83},
332      {NoFlag, 0x00007ffe, 0xffffffe0}, {NoFlag, 0x00007ffe, 0xfffffffd},
333      {NoFlag, 0x00007ffe, 0xfffffffe}, {NoFlag, 0x00007ffe, 0xffffffff},
334      {NoFlag, 0x00007fff, 0x00000000}, {NoFlag, 0x00007fff, 0x00000001},
335      {NoFlag, 0x00007fff, 0x00000002}, {NoFlag, 0x00007fff, 0x00000020},
336      {NoFlag, 0x00007fff, 0x0000007d}, {NoFlag, 0x00007fff, 0x0000007e},
337      {NoFlag, 0x00007fff, 0x0000007f}, {NoFlag, 0x00007fff, 0x00007ffd},
338      {NoFlag, 0x00007fff, 0x00007ffe}, {NoFlag, 0x00007fff, 0x33333333},
339      {NoFlag, 0x00007fff, 0x55555555}, {NoFlag, 0x00007fff, 0x7ffffffd},
340      {NoFlag, 0x00007fff, 0x7ffffffe}, {NoFlag, 0x00007fff, 0x7fffffff},
341      {NoFlag, 0x00007fff, 0x80000000}, {NoFlag, 0x00007fff, 0x80000001},
342      {NoFlag, 0x00007fff, 0xaaaaaaaa}, {NoFlag, 0x00007fff, 0xcccccccc},
343      {NoFlag, 0x00007fff, 0xffff8000}, {NoFlag, 0x00007fff, 0xffff8001},
344      {NoFlag, 0x00007fff, 0xffff8002}, {NoFlag, 0x00007fff, 0xffff8003},
345      {NoFlag, 0x00007fff, 0xffffff80}, {NoFlag, 0x00007fff, 0xffffff81},
346      {NoFlag, 0x00007fff, 0xffffff82}, {NoFlag, 0x00007fff, 0xffffff83},
347      {NoFlag, 0x00007fff, 0xffffffe0}, {NoFlag, 0x00007fff, 0xfffffffd},
348      {NoFlag, 0x00007fff, 0xfffffffe}, {NoFlag, 0x00007fff, 0xffffffff},
349      {NoFlag, 0x33333333, 0x00000000}, {NoFlag, 0x33333333, 0x00000001},
350      {NoFlag, 0x33333333, 0x00000002}, {NoFlag, 0x33333333, 0x00000020},
351      {NoFlag, 0x33333333, 0x0000007d}, {NoFlag, 0x33333333, 0x0000007e},
352      {NoFlag, 0x33333333, 0x0000007f}, {NoFlag, 0x33333333, 0x00007ffd},
353      {NoFlag, 0x33333333, 0x00007ffe}, {NoFlag, 0x33333333, 0x00007fff},
354      {NoFlag, 0x33333333, 0x55555555}, {NoFlag, 0x33333333, 0x7ffffffd},
355      {NoFlag, 0x33333333, 0x7ffffffe}, {NoFlag, 0x33333333, 0x7fffffff},
356      {NoFlag, 0x33333333, 0x80000000}, {NoFlag, 0x33333333, 0x80000001},
357      {NoFlag, 0x33333333, 0xaaaaaaaa}, {NoFlag, 0x33333333, 0xcccccccc},
358      {NoFlag, 0x33333333, 0xffff8000}, {NoFlag, 0x33333333, 0xffff8001},
359      {NoFlag, 0x33333333, 0xffff8002}, {NoFlag, 0x33333333, 0xffff8003},
360      {NoFlag, 0x33333333, 0xffffff80}, {NoFlag, 0x33333333, 0xffffff81},
361      {NoFlag, 0x33333333, 0xffffff82}, {NoFlag, 0x33333333, 0xffffff83},
362      {NoFlag, 0x33333333, 0xffffffe0}, {NoFlag, 0x33333333, 0xfffffffd},
363      {NoFlag, 0x33333333, 0xfffffffe}, {NoFlag, 0x33333333, 0xffffffff},
364      {NoFlag, 0x55555555, 0x00000000}, {NoFlag, 0x55555555, 0x00000001},
365      {NoFlag, 0x55555555, 0x00000002}, {NoFlag, 0x55555555, 0x00000020},
366      {NoFlag, 0x55555555, 0x0000007d}, {NoFlag, 0x55555555, 0x0000007e},
367      {NoFlag, 0x55555555, 0x0000007f}, {NoFlag, 0x55555555, 0x00007ffd},
368      {NoFlag, 0x55555555, 0x00007ffe}, {NoFlag, 0x55555555, 0x00007fff},
369      {NoFlag, 0x55555555, 0x33333333}, {NoFlag, 0x55555555, 0x7ffffffd},
370      {NoFlag, 0x55555555, 0x7ffffffe}, {NoFlag, 0x55555555, 0x7fffffff},
371      {NoFlag, 0x55555555, 0x80000000}, {NoFlag, 0x55555555, 0x80000001},
372      {NoFlag, 0x55555555, 0xaaaaaaaa}, {NoFlag, 0x55555555, 0xcccccccc},
373      {NoFlag, 0x55555555, 0xffff8000}, {NoFlag, 0x55555555, 0xffff8001},
374      {NoFlag, 0x55555555, 0xffff8002}, {NoFlag, 0x55555555, 0xffff8003},
375      {NoFlag, 0x55555555, 0xffffff80}, {NoFlag, 0x55555555, 0xffffff81},
376      {NoFlag, 0x55555555, 0xffffff82}, {NoFlag, 0x55555555, 0xffffff83},
377      {NoFlag, 0x55555555, 0xffffffe0}, {NoFlag, 0x55555555, 0xfffffffd},
378      {NoFlag, 0x55555555, 0xfffffffe}, {NoFlag, 0x55555555, 0xffffffff},
379      {NoFlag, 0x7ffffffd, 0x00000000}, {NoFlag, 0x7ffffffd, 0x00000001},
380      {NoFlag, 0x7ffffffd, 0x00000002}, {NoFlag, 0x7ffffffd, 0x00000020},
381      {NoFlag, 0x7ffffffd, 0x0000007d}, {NoFlag, 0x7ffffffd, 0x0000007e},
382      {NoFlag, 0x7ffffffd, 0x0000007f}, {NoFlag, 0x7ffffffd, 0x00007ffd},
383      {NoFlag, 0x7ffffffd, 0x00007ffe}, {NoFlag, 0x7ffffffd, 0x00007fff},
384      {NoFlag, 0x7ffffffd, 0x33333333}, {NoFlag, 0x7ffffffd, 0x55555555},
385      {NoFlag, 0x7ffffffd, 0x7ffffffe}, {NoFlag, 0x7ffffffd, 0x7fffffff},
386      {NoFlag, 0x7ffffffd, 0x80000000}, {NoFlag, 0x7ffffffd, 0x80000001},
387      {NoFlag, 0x7ffffffd, 0xaaaaaaaa}, {NoFlag, 0x7ffffffd, 0xcccccccc},
388      {NoFlag, 0x7ffffffd, 0xffff8000}, {NoFlag, 0x7ffffffd, 0xffff8001},
389      {NoFlag, 0x7ffffffd, 0xffff8002}, {NoFlag, 0x7ffffffd, 0xffff8003},
390      {NoFlag, 0x7ffffffd, 0xffffff80}, {NoFlag, 0x7ffffffd, 0xffffff81},
391      {NoFlag, 0x7ffffffd, 0xffffff82}, {NoFlag, 0x7ffffffd, 0xffffff83},
392      {NoFlag, 0x7ffffffd, 0xffffffe0}, {NoFlag, 0x7ffffffd, 0xfffffffd},
393      {NoFlag, 0x7ffffffd, 0xfffffffe}, {NoFlag, 0x7ffffffd, 0xffffffff},
394      {NoFlag, 0x7ffffffe, 0x00000000}, {NoFlag, 0x7ffffffe, 0x00000001},
395      {NoFlag, 0x7ffffffe, 0x00000002}, {NoFlag, 0x7ffffffe, 0x00000020},
396      {NoFlag, 0x7ffffffe, 0x0000007d}, {NoFlag, 0x7ffffffe, 0x0000007e},
397      {NoFlag, 0x7ffffffe, 0x0000007f}, {NoFlag, 0x7ffffffe, 0x00007ffd},
398      {NoFlag, 0x7ffffffe, 0x00007ffe}, {NoFlag, 0x7ffffffe, 0x00007fff},
399      {NoFlag, 0x7ffffffe, 0x33333333}, {NoFlag, 0x7ffffffe, 0x55555555},
400      {NoFlag, 0x7ffffffe, 0x7ffffffd}, {NoFlag, 0x7ffffffe, 0x7fffffff},
401      {NoFlag, 0x7ffffffe, 0x80000000}, {NoFlag, 0x7ffffffe, 0x80000001},
402      {NoFlag, 0x7ffffffe, 0xaaaaaaaa}, {NoFlag, 0x7ffffffe, 0xcccccccc},
403      {NoFlag, 0x7ffffffe, 0xffff8000}, {NoFlag, 0x7ffffffe, 0xffff8001},
404      {NoFlag, 0x7ffffffe, 0xffff8002}, {NoFlag, 0x7ffffffe, 0xffff8003},
405      {NoFlag, 0x7ffffffe, 0xffffff80}, {NoFlag, 0x7ffffffe, 0xffffff81},
406      {NoFlag, 0x7ffffffe, 0xffffff82}, {NoFlag, 0x7ffffffe, 0xffffff83},
407      {NoFlag, 0x7ffffffe, 0xffffffe0}, {NoFlag, 0x7ffffffe, 0xfffffffd},
408      {NoFlag, 0x7ffffffe, 0xfffffffe}, {NoFlag, 0x7ffffffe, 0xffffffff},
409      {NoFlag, 0x7fffffff, 0x00000000}, {NoFlag, 0x7fffffff, 0x00000001},
410      {NoFlag, 0x7fffffff, 0x00000002}, {NoFlag, 0x7fffffff, 0x00000020},
411      {NoFlag, 0x7fffffff, 0x0000007d}, {NoFlag, 0x7fffffff, 0x0000007e},
412      {NoFlag, 0x7fffffff, 0x0000007f}, {NoFlag, 0x7fffffff, 0x00007ffd},
413      {NoFlag, 0x7fffffff, 0x00007ffe}, {NoFlag, 0x7fffffff, 0x00007fff},
414      {NoFlag, 0x7fffffff, 0x33333333}, {NoFlag, 0x7fffffff, 0x55555555},
415      {NoFlag, 0x7fffffff, 0x7ffffffd}, {NoFlag, 0x7fffffff, 0x7ffffffe},
416      {NoFlag, 0x7fffffff, 0x80000000}, {NoFlag, 0x7fffffff, 0x80000001},
417      {NoFlag, 0x7fffffff, 0xaaaaaaaa}, {NoFlag, 0x7fffffff, 0xcccccccc},
418      {NoFlag, 0x7fffffff, 0xffff8000}, {NoFlag, 0x7fffffff, 0xffff8001},
419      {NoFlag, 0x7fffffff, 0xffff8002}, {NoFlag, 0x7fffffff, 0xffff8003},
420      {NoFlag, 0x7fffffff, 0xffffff80}, {NoFlag, 0x7fffffff, 0xffffff81},
421      {NoFlag, 0x7fffffff, 0xffffff82}, {NoFlag, 0x7fffffff, 0xffffff83},
422      {NoFlag, 0x7fffffff, 0xffffffe0}, {NoFlag, 0x7fffffff, 0xfffffffd},
423      {NoFlag, 0x7fffffff, 0xfffffffe}, {NoFlag, 0x7fffffff, 0xffffffff},
424      {NoFlag, 0x80000000, 0x00000000}, {NoFlag, 0x80000000, 0x00000001},
425      {NoFlag, 0x80000000, 0x00000002}, {NoFlag, 0x80000000, 0x00000020},
426      {NoFlag, 0x80000000, 0x0000007d}, {NoFlag, 0x80000000, 0x0000007e},
427      {NoFlag, 0x80000000, 0x0000007f}, {NoFlag, 0x80000000, 0x00007ffd},
428      {NoFlag, 0x80000000, 0x00007ffe}, {NoFlag, 0x80000000, 0x00007fff},
429      {NoFlag, 0x80000000, 0x33333333}, {NoFlag, 0x80000000, 0x55555555},
430      {NoFlag, 0x80000000, 0x7ffffffd}, {NoFlag, 0x80000000, 0x7ffffffe},
431      {NoFlag, 0x80000000, 0x7fffffff}, {NoFlag, 0x80000000, 0x80000001},
432      {NoFlag, 0x80000000, 0xaaaaaaaa}, {NoFlag, 0x80000000, 0xcccccccc},
433      {NoFlag, 0x80000000, 0xffff8000}, {NoFlag, 0x80000000, 0xffff8001},
434      {NoFlag, 0x80000000, 0xffff8002}, {NoFlag, 0x80000000, 0xffff8003},
435      {NoFlag, 0x80000000, 0xffffff80}, {NoFlag, 0x80000000, 0xffffff81},
436      {NoFlag, 0x80000000, 0xffffff82}, {NoFlag, 0x80000000, 0xffffff83},
437      {NoFlag, 0x80000000, 0xffffffe0}, {NoFlag, 0x80000000, 0xfffffffd},
438      {NoFlag, 0x80000000, 0xfffffffe}, {NoFlag, 0x80000000, 0xffffffff},
439      {NoFlag, 0x80000001, 0x00000000}, {NoFlag, 0x80000001, 0x00000001},
440      {NoFlag, 0x80000001, 0x00000002}, {NoFlag, 0x80000001, 0x00000020},
441      {NoFlag, 0x80000001, 0x0000007d}, {NoFlag, 0x80000001, 0x0000007e},
442      {NoFlag, 0x80000001, 0x0000007f}, {NoFlag, 0x80000001, 0x00007ffd},
443      {NoFlag, 0x80000001, 0x00007ffe}, {NoFlag, 0x80000001, 0x00007fff},
444      {NoFlag, 0x80000001, 0x33333333}, {NoFlag, 0x80000001, 0x55555555},
445      {NoFlag, 0x80000001, 0x7ffffffd}, {NoFlag, 0x80000001, 0x7ffffffe},
446      {NoFlag, 0x80000001, 0x7fffffff}, {NoFlag, 0x80000001, 0x80000000},
447      {NoFlag, 0x80000001, 0xaaaaaaaa}, {NoFlag, 0x80000001, 0xcccccccc},
448      {NoFlag, 0x80000001, 0xffff8000}, {NoFlag, 0x80000001, 0xffff8001},
449      {NoFlag, 0x80000001, 0xffff8002}, {NoFlag, 0x80000001, 0xffff8003},
450      {NoFlag, 0x80000001, 0xffffff80}, {NoFlag, 0x80000001, 0xffffff81},
451      {NoFlag, 0x80000001, 0xffffff82}, {NoFlag, 0x80000001, 0xffffff83},
452      {NoFlag, 0x80000001, 0xffffffe0}, {NoFlag, 0x80000001, 0xfffffffd},
453      {NoFlag, 0x80000001, 0xfffffffe}, {NoFlag, 0x80000001, 0xffffffff},
454      {NoFlag, 0xaaaaaaaa, 0x00000000}, {NoFlag, 0xaaaaaaaa, 0x00000001},
455      {NoFlag, 0xaaaaaaaa, 0x00000002}, {NoFlag, 0xaaaaaaaa, 0x00000020},
456      {NoFlag, 0xaaaaaaaa, 0x0000007d}, {NoFlag, 0xaaaaaaaa, 0x0000007e},
457      {NoFlag, 0xaaaaaaaa, 0x0000007f}, {NoFlag, 0xaaaaaaaa, 0x00007ffd},
458      {NoFlag, 0xaaaaaaaa, 0x00007ffe}, {NoFlag, 0xaaaaaaaa, 0x00007fff},
459      {NoFlag, 0xaaaaaaaa, 0x33333333}, {NoFlag, 0xaaaaaaaa, 0x55555555},
460      {NoFlag, 0xaaaaaaaa, 0x7ffffffd}, {NoFlag, 0xaaaaaaaa, 0x7ffffffe},
461      {NoFlag, 0xaaaaaaaa, 0x7fffffff}, {NoFlag, 0xaaaaaaaa, 0x80000000},
462      {NoFlag, 0xaaaaaaaa, 0x80000001}, {NoFlag, 0xaaaaaaaa, 0xcccccccc},
463      {NoFlag, 0xaaaaaaaa, 0xffff8000}, {NoFlag, 0xaaaaaaaa, 0xffff8001},
464      {NoFlag, 0xaaaaaaaa, 0xffff8002}, {NoFlag, 0xaaaaaaaa, 0xffff8003},
465      {NoFlag, 0xaaaaaaaa, 0xffffff80}, {NoFlag, 0xaaaaaaaa, 0xffffff81},
466      {NoFlag, 0xaaaaaaaa, 0xffffff82}, {NoFlag, 0xaaaaaaaa, 0xffffff83},
467      {NoFlag, 0xaaaaaaaa, 0xffffffe0}, {NoFlag, 0xaaaaaaaa, 0xfffffffd},
468      {NoFlag, 0xaaaaaaaa, 0xfffffffe}, {NoFlag, 0xaaaaaaaa, 0xffffffff},
469      {NoFlag, 0xcccccccc, 0x00000000}, {NoFlag, 0xcccccccc, 0x00000001},
470      {NoFlag, 0xcccccccc, 0x00000002}, {NoFlag, 0xcccccccc, 0x00000020},
471      {NoFlag, 0xcccccccc, 0x0000007d}, {NoFlag, 0xcccccccc, 0x0000007e},
472      {NoFlag, 0xcccccccc, 0x0000007f}, {NoFlag, 0xcccccccc, 0x00007ffd},
473      {NoFlag, 0xcccccccc, 0x00007ffe}, {NoFlag, 0xcccccccc, 0x00007fff},
474      {NoFlag, 0xcccccccc, 0x33333333}, {NoFlag, 0xcccccccc, 0x55555555},
475      {NoFlag, 0xcccccccc, 0x7ffffffd}, {NoFlag, 0xcccccccc, 0x7ffffffe},
476      {NoFlag, 0xcccccccc, 0x7fffffff}, {NoFlag, 0xcccccccc, 0x80000000},
477      {NoFlag, 0xcccccccc, 0x80000001}, {NoFlag, 0xcccccccc, 0xaaaaaaaa},
478      {NoFlag, 0xcccccccc, 0xffff8000}, {NoFlag, 0xcccccccc, 0xffff8001},
479      {NoFlag, 0xcccccccc, 0xffff8002}, {NoFlag, 0xcccccccc, 0xffff8003},
480      {NoFlag, 0xcccccccc, 0xffffff80}, {NoFlag, 0xcccccccc, 0xffffff81},
481      {NoFlag, 0xcccccccc, 0xffffff82}, {NoFlag, 0xcccccccc, 0xffffff83},
482      {NoFlag, 0xcccccccc, 0xffffffe0}, {NoFlag, 0xcccccccc, 0xfffffffd},
483      {NoFlag, 0xcccccccc, 0xfffffffe}, {NoFlag, 0xcccccccc, 0xffffffff},
484      {NoFlag, 0xffff8000, 0x00000000}, {NoFlag, 0xffff8000, 0x00000001},
485      {NoFlag, 0xffff8000, 0x00000002}, {NoFlag, 0xffff8000, 0x00000020},
486      {NoFlag, 0xffff8000, 0x0000007d}, {NoFlag, 0xffff8000, 0x0000007e},
487      {NoFlag, 0xffff8000, 0x0000007f}, {NoFlag, 0xffff8000, 0x00007ffd},
488      {NoFlag, 0xffff8000, 0x00007ffe}, {NoFlag, 0xffff8000, 0x00007fff},
489      {NoFlag, 0xffff8000, 0x33333333}, {NoFlag, 0xffff8000, 0x55555555},
490      {NoFlag, 0xffff8000, 0x7ffffffd}, {NoFlag, 0xffff8000, 0x7ffffffe},
491      {NoFlag, 0xffff8000, 0x7fffffff}, {NoFlag, 0xffff8000, 0x80000000},
492      {NoFlag, 0xffff8000, 0x80000001}, {NoFlag, 0xffff8000, 0xaaaaaaaa},
493      {NoFlag, 0xffff8000, 0xcccccccc}, {NoFlag, 0xffff8000, 0xffff8001},
494      {NoFlag, 0xffff8000, 0xffff8002}, {NoFlag, 0xffff8000, 0xffff8003},
495      {NoFlag, 0xffff8000, 0xffffff80}, {NoFlag, 0xffff8000, 0xffffff81},
496      {NoFlag, 0xffff8000, 0xffffff82}, {NoFlag, 0xffff8000, 0xffffff83},
497      {NoFlag, 0xffff8000, 0xffffffe0}, {NoFlag, 0xffff8000, 0xfffffffd},
498      {NoFlag, 0xffff8000, 0xfffffffe}, {NoFlag, 0xffff8000, 0xffffffff},
499      {NoFlag, 0xffff8001, 0x00000000}, {NoFlag, 0xffff8001, 0x00000001},
500      {NoFlag, 0xffff8001, 0x00000002}, {NoFlag, 0xffff8001, 0x00000020},
501      {NoFlag, 0xffff8001, 0x0000007d}, {NoFlag, 0xffff8001, 0x0000007e},
502      {NoFlag, 0xffff8001, 0x0000007f}, {NoFlag, 0xffff8001, 0x00007ffd},
503      {NoFlag, 0xffff8001, 0x00007ffe}, {NoFlag, 0xffff8001, 0x00007fff},
504      {NoFlag, 0xffff8001, 0x33333333}, {NoFlag, 0xffff8001, 0x55555555},
505      {NoFlag, 0xffff8001, 0x7ffffffd}, {NoFlag, 0xffff8001, 0x7ffffffe},
506      {NoFlag, 0xffff8001, 0x7fffffff}, {NoFlag, 0xffff8001, 0x80000000},
507      {NoFlag, 0xffff8001, 0x80000001}, {NoFlag, 0xffff8001, 0xaaaaaaaa},
508      {NoFlag, 0xffff8001, 0xcccccccc}, {NoFlag, 0xffff8001, 0xffff8000},
509      {NoFlag, 0xffff8001, 0xffff8002}, {NoFlag, 0xffff8001, 0xffff8003},
510      {NoFlag, 0xffff8001, 0xffffff80}, {NoFlag, 0xffff8001, 0xffffff81},
511      {NoFlag, 0xffff8001, 0xffffff82}, {NoFlag, 0xffff8001, 0xffffff83},
512      {NoFlag, 0xffff8001, 0xffffffe0}, {NoFlag, 0xffff8001, 0xfffffffd},
513      {NoFlag, 0xffff8001, 0xfffffffe}, {NoFlag, 0xffff8001, 0xffffffff},
514      {NoFlag, 0xffff8002, 0x00000000}, {NoFlag, 0xffff8002, 0x00000001},
515      {NoFlag, 0xffff8002, 0x00000002}, {NoFlag, 0xffff8002, 0x00000020},
516      {NoFlag, 0xffff8002, 0x0000007d}, {NoFlag, 0xffff8002, 0x0000007e},
517      {NoFlag, 0xffff8002, 0x0000007f}, {NoFlag, 0xffff8002, 0x00007ffd},
518      {NoFlag, 0xffff8002, 0x00007ffe}, {NoFlag, 0xffff8002, 0x00007fff},
519      {NoFlag, 0xffff8002, 0x33333333}, {NoFlag, 0xffff8002, 0x55555555},
520      {NoFlag, 0xffff8002, 0x7ffffffd}, {NoFlag, 0xffff8002, 0x7ffffffe},
521      {NoFlag, 0xffff8002, 0x7fffffff}, {NoFlag, 0xffff8002, 0x80000000},
522      {NoFlag, 0xffff8002, 0x80000001}, {NoFlag, 0xffff8002, 0xaaaaaaaa},
523      {NoFlag, 0xffff8002, 0xcccccccc}, {NoFlag, 0xffff8002, 0xffff8000},
524      {NoFlag, 0xffff8002, 0xffff8001}, {NoFlag, 0xffff8002, 0xffff8003},
525      {NoFlag, 0xffff8002, 0xffffff80}, {NoFlag, 0xffff8002, 0xffffff81},
526      {NoFlag, 0xffff8002, 0xffffff82}, {NoFlag, 0xffff8002, 0xffffff83},
527      {NoFlag, 0xffff8002, 0xffffffe0}, {NoFlag, 0xffff8002, 0xfffffffd},
528      {NoFlag, 0xffff8002, 0xfffffffe}, {NoFlag, 0xffff8002, 0xffffffff},
529      {NoFlag, 0xffff8003, 0x00000000}, {NoFlag, 0xffff8003, 0x00000001},
530      {NoFlag, 0xffff8003, 0x00000002}, {NoFlag, 0xffff8003, 0x00000020},
531      {NoFlag, 0xffff8003, 0x0000007d}, {NoFlag, 0xffff8003, 0x0000007e},
532      {NoFlag, 0xffff8003, 0x0000007f}, {NoFlag, 0xffff8003, 0x00007ffd},
533      {NoFlag, 0xffff8003, 0x00007ffe}, {NoFlag, 0xffff8003, 0x00007fff},
534      {NoFlag, 0xffff8003, 0x33333333}, {NoFlag, 0xffff8003, 0x55555555},
535      {NoFlag, 0xffff8003, 0x7ffffffd}, {NoFlag, 0xffff8003, 0x7ffffffe},
536      {NoFlag, 0xffff8003, 0x7fffffff}, {NoFlag, 0xffff8003, 0x80000000},
537      {NoFlag, 0xffff8003, 0x80000001}, {NoFlag, 0xffff8003, 0xaaaaaaaa},
538      {NoFlag, 0xffff8003, 0xcccccccc}, {NoFlag, 0xffff8003, 0xffff8000},
539      {NoFlag, 0xffff8003, 0xffff8001}, {NoFlag, 0xffff8003, 0xffff8002},
540      {NoFlag, 0xffff8003, 0xffffff80}, {NoFlag, 0xffff8003, 0xffffff81},
541      {NoFlag, 0xffff8003, 0xffffff82}, {NoFlag, 0xffff8003, 0xffffff83},
542      {NoFlag, 0xffff8003, 0xffffffe0}, {NoFlag, 0xffff8003, 0xfffffffd},
543      {NoFlag, 0xffff8003, 0xfffffffe}, {NoFlag, 0xffff8003, 0xffffffff},
544      {NoFlag, 0xffffff80, 0x00000000}, {NoFlag, 0xffffff80, 0x00000001},
545      {NoFlag, 0xffffff80, 0x00000002}, {NoFlag, 0xffffff80, 0x00000020},
546      {NoFlag, 0xffffff80, 0x0000007d}, {NoFlag, 0xffffff80, 0x0000007e},
547      {NoFlag, 0xffffff80, 0x0000007f}, {NoFlag, 0xffffff80, 0x00007ffd},
548      {NoFlag, 0xffffff80, 0x00007ffe}, {NoFlag, 0xffffff80, 0x00007fff},
549      {NoFlag, 0xffffff80, 0x33333333}, {NoFlag, 0xffffff80, 0x55555555},
550      {NoFlag, 0xffffff80, 0x7ffffffd}, {NoFlag, 0xffffff80, 0x7ffffffe},
551      {NoFlag, 0xffffff80, 0x7fffffff}, {NoFlag, 0xffffff80, 0x80000000},
552      {NoFlag, 0xffffff80, 0x80000001}, {NoFlag, 0xffffff80, 0xaaaaaaaa},
553      {NoFlag, 0xffffff80, 0xcccccccc}, {NoFlag, 0xffffff80, 0xffff8000},
554      {NoFlag, 0xffffff80, 0xffff8001}, {NoFlag, 0xffffff80, 0xffff8002},
555      {NoFlag, 0xffffff80, 0xffff8003}, {NoFlag, 0xffffff80, 0xffffff81},
556      {NoFlag, 0xffffff80, 0xffffff82}, {NoFlag, 0xffffff80, 0xffffff83},
557      {NoFlag, 0xffffff80, 0xffffffe0}, {NoFlag, 0xffffff80, 0xfffffffd},
558      {NoFlag, 0xffffff80, 0xfffffffe}, {NoFlag, 0xffffff80, 0xffffffff},
559      {NoFlag, 0xffffff81, 0x00000000}, {NoFlag, 0xffffff81, 0x00000001},
560      {NoFlag, 0xffffff81, 0x00000002}, {NoFlag, 0xffffff81, 0x00000020},
561      {NoFlag, 0xffffff81, 0x0000007d}, {NoFlag, 0xffffff81, 0x0000007e},
562      {NoFlag, 0xffffff81, 0x0000007f}, {NoFlag, 0xffffff81, 0x00007ffd},
563      {NoFlag, 0xffffff81, 0x00007ffe}, {NoFlag, 0xffffff81, 0x00007fff},
564      {NoFlag, 0xffffff81, 0x33333333}, {NoFlag, 0xffffff81, 0x55555555},
565      {NoFlag, 0xffffff81, 0x7ffffffd}, {NoFlag, 0xffffff81, 0x7ffffffe},
566      {NoFlag, 0xffffff81, 0x7fffffff}, {NoFlag, 0xffffff81, 0x80000000},
567      {NoFlag, 0xffffff81, 0x80000001}, {NoFlag, 0xffffff81, 0xaaaaaaaa},
568      {NoFlag, 0xffffff81, 0xcccccccc}, {NoFlag, 0xffffff81, 0xffff8000},
569      {NoFlag, 0xffffff81, 0xffff8001}, {NoFlag, 0xffffff81, 0xffff8002},
570      {NoFlag, 0xffffff81, 0xffff8003}, {NoFlag, 0xffffff81, 0xffffff80},
571      {NoFlag, 0xffffff81, 0xffffff82}, {NoFlag, 0xffffff81, 0xffffff83},
572      {NoFlag, 0xffffff81, 0xffffffe0}, {NoFlag, 0xffffff81, 0xfffffffd},
573      {NoFlag, 0xffffff81, 0xfffffffe}, {NoFlag, 0xffffff81, 0xffffffff},
574      {NoFlag, 0xffffff82, 0x00000000}, {NoFlag, 0xffffff82, 0x00000001},
575      {NoFlag, 0xffffff82, 0x00000002}, {NoFlag, 0xffffff82, 0x00000020},
576      {NoFlag, 0xffffff82, 0x0000007d}, {NoFlag, 0xffffff82, 0x0000007e},
577      {NoFlag, 0xffffff82, 0x0000007f}, {NoFlag, 0xffffff82, 0x00007ffd},
578      {NoFlag, 0xffffff82, 0x00007ffe}, {NoFlag, 0xffffff82, 0x00007fff},
579      {NoFlag, 0xffffff82, 0x33333333}, {NoFlag, 0xffffff82, 0x55555555},
580      {NoFlag, 0xffffff82, 0x7ffffffd}, {NoFlag, 0xffffff82, 0x7ffffffe},
581      {NoFlag, 0xffffff82, 0x7fffffff}, {NoFlag, 0xffffff82, 0x80000000},
582      {NoFlag, 0xffffff82, 0x80000001}, {NoFlag, 0xffffff82, 0xaaaaaaaa},
583      {NoFlag, 0xffffff82, 0xcccccccc}, {NoFlag, 0xffffff82, 0xffff8000},
584      {NoFlag, 0xffffff82, 0xffff8001}, {NoFlag, 0xffffff82, 0xffff8002},
585      {NoFlag, 0xffffff82, 0xffff8003}, {NoFlag, 0xffffff82, 0xffffff80},
586      {NoFlag, 0xffffff82, 0xffffff81}, {NoFlag, 0xffffff82, 0xffffff83},
587      {NoFlag, 0xffffff82, 0xffffffe0}, {NoFlag, 0xffffff82, 0xfffffffd},
588      {NoFlag, 0xffffff82, 0xfffffffe}, {NoFlag, 0xffffff82, 0xffffffff},
589      {NoFlag, 0xffffff83, 0x00000000}, {NoFlag, 0xffffff83, 0x00000001},
590      {NoFlag, 0xffffff83, 0x00000002}, {NoFlag, 0xffffff83, 0x00000020},
591      {NoFlag, 0xffffff83, 0x0000007d}, {NoFlag, 0xffffff83, 0x0000007e},
592      {NoFlag, 0xffffff83, 0x0000007f}, {NoFlag, 0xffffff83, 0x00007ffd},
593      {NoFlag, 0xffffff83, 0x00007ffe}, {NoFlag, 0xffffff83, 0x00007fff},
594      {NoFlag, 0xffffff83, 0x33333333}, {NoFlag, 0xffffff83, 0x55555555},
595      {NoFlag, 0xffffff83, 0x7ffffffd}, {NoFlag, 0xffffff83, 0x7ffffffe},
596      {NoFlag, 0xffffff83, 0x7fffffff}, {NoFlag, 0xffffff83, 0x80000000},
597      {NoFlag, 0xffffff83, 0x80000001}, {NoFlag, 0xffffff83, 0xaaaaaaaa},
598      {NoFlag, 0xffffff83, 0xcccccccc}, {NoFlag, 0xffffff83, 0xffff8000},
599      {NoFlag, 0xffffff83, 0xffff8001}, {NoFlag, 0xffffff83, 0xffff8002},
600      {NoFlag, 0xffffff83, 0xffff8003}, {NoFlag, 0xffffff83, 0xffffff80},
601      {NoFlag, 0xffffff83, 0xffffff81}, {NoFlag, 0xffffff83, 0xffffff82},
602      {NoFlag, 0xffffff83, 0xffffffe0}, {NoFlag, 0xffffff83, 0xfffffffd},
603      {NoFlag, 0xffffff83, 0xfffffffe}, {NoFlag, 0xffffff83, 0xffffffff},
604      {NoFlag, 0xffffffe0, 0x00000000}, {NoFlag, 0xffffffe0, 0x00000001},
605      {NoFlag, 0xffffffe0, 0x00000002}, {NoFlag, 0xffffffe0, 0x00000020},
606      {NoFlag, 0xffffffe0, 0x0000007d}, {NoFlag, 0xffffffe0, 0x0000007e},
607      {NoFlag, 0xffffffe0, 0x0000007f}, {NoFlag, 0xffffffe0, 0x00007ffd},
608      {NoFlag, 0xffffffe0, 0x00007ffe}, {NoFlag, 0xffffffe0, 0x00007fff},
609      {NoFlag, 0xffffffe0, 0x33333333}, {NoFlag, 0xffffffe0, 0x55555555},
610      {NoFlag, 0xffffffe0, 0x7ffffffd}, {NoFlag, 0xffffffe0, 0x7ffffffe},
611      {NoFlag, 0xffffffe0, 0x7fffffff}, {NoFlag, 0xffffffe0, 0x80000000},
612      {NoFlag, 0xffffffe0, 0x80000001}, {NoFlag, 0xffffffe0, 0xaaaaaaaa},
613      {NoFlag, 0xffffffe0, 0xcccccccc}, {NoFlag, 0xffffffe0, 0xffff8000},
614      {NoFlag, 0xffffffe0, 0xffff8001}, {NoFlag, 0xffffffe0, 0xffff8002},
615      {NoFlag, 0xffffffe0, 0xffff8003}, {NoFlag, 0xffffffe0, 0xffffff80},
616      {NoFlag, 0xffffffe0, 0xffffff81}, {NoFlag, 0xffffffe0, 0xffffff82},
617      {NoFlag, 0xffffffe0, 0xffffff83}, {NoFlag, 0xffffffe0, 0xfffffffd},
618      {NoFlag, 0xffffffe0, 0xfffffffe}, {NoFlag, 0xffffffe0, 0xffffffff},
619      {NoFlag, 0xfffffffd, 0x00000000}, {NoFlag, 0xfffffffd, 0x00000001},
620      {NoFlag, 0xfffffffd, 0x00000002}, {NoFlag, 0xfffffffd, 0x00000020},
621      {NoFlag, 0xfffffffd, 0x0000007d}, {NoFlag, 0xfffffffd, 0x0000007e},
622      {NoFlag, 0xfffffffd, 0x0000007f}, {NoFlag, 0xfffffffd, 0x00007ffd},
623      {NoFlag, 0xfffffffd, 0x00007ffe}, {NoFlag, 0xfffffffd, 0x00007fff},
624      {NoFlag, 0xfffffffd, 0x33333333}, {NoFlag, 0xfffffffd, 0x55555555},
625      {NoFlag, 0xfffffffd, 0x7ffffffd}, {NoFlag, 0xfffffffd, 0x7ffffffe},
626      {NoFlag, 0xfffffffd, 0x7fffffff}, {NoFlag, 0xfffffffd, 0x80000000},
627      {NoFlag, 0xfffffffd, 0x80000001}, {NoFlag, 0xfffffffd, 0xaaaaaaaa},
628      {NoFlag, 0xfffffffd, 0xcccccccc}, {NoFlag, 0xfffffffd, 0xffff8000},
629      {NoFlag, 0xfffffffd, 0xffff8001}, {NoFlag, 0xfffffffd, 0xffff8002},
630      {NoFlag, 0xfffffffd, 0xffff8003}, {NoFlag, 0xfffffffd, 0xffffff80},
631      {NoFlag, 0xfffffffd, 0xffffff81}, {NoFlag, 0xfffffffd, 0xffffff82},
632      {NoFlag, 0xfffffffd, 0xffffff83}, {NoFlag, 0xfffffffd, 0xffffffe0},
633      {NoFlag, 0xfffffffd, 0xfffffffe}, {NoFlag, 0xfffffffd, 0xffffffff},
634      {NoFlag, 0xfffffffe, 0x00000000}, {NoFlag, 0xfffffffe, 0x00000001},
635      {NoFlag, 0xfffffffe, 0x00000002}, {NoFlag, 0xfffffffe, 0x00000020},
636      {NoFlag, 0xfffffffe, 0x0000007d}, {NoFlag, 0xfffffffe, 0x0000007e},
637      {NoFlag, 0xfffffffe, 0x0000007f}, {NoFlag, 0xfffffffe, 0x00007ffd},
638      {NoFlag, 0xfffffffe, 0x00007ffe}, {NoFlag, 0xfffffffe, 0x00007fff},
639      {NoFlag, 0xfffffffe, 0x33333333}, {NoFlag, 0xfffffffe, 0x55555555},
640      {NoFlag, 0xfffffffe, 0x7ffffffd}, {NoFlag, 0xfffffffe, 0x7ffffffe},
641      {NoFlag, 0xfffffffe, 0x7fffffff}, {NoFlag, 0xfffffffe, 0x80000000},
642      {NoFlag, 0xfffffffe, 0x80000001}, {NoFlag, 0xfffffffe, 0xaaaaaaaa},
643      {NoFlag, 0xfffffffe, 0xcccccccc}, {NoFlag, 0xfffffffe, 0xffff8000},
644      {NoFlag, 0xfffffffe, 0xffff8001}, {NoFlag, 0xfffffffe, 0xffff8002},
645      {NoFlag, 0xfffffffe, 0xffff8003}, {NoFlag, 0xfffffffe, 0xffffff80},
646      {NoFlag, 0xfffffffe, 0xffffff81}, {NoFlag, 0xfffffffe, 0xffffff82},
647      {NoFlag, 0xfffffffe, 0xffffff83}, {NoFlag, 0xfffffffe, 0xffffffe0},
648      {NoFlag, 0xfffffffe, 0xfffffffd}, {NoFlag, 0xfffffffe, 0xffffffff},
649      {NoFlag, 0xffffffff, 0x00000000}, {NoFlag, 0xffffffff, 0x00000001},
650      {NoFlag, 0xffffffff, 0x00000002}, {NoFlag, 0xffffffff, 0x00000020},
651      {NoFlag, 0xffffffff, 0x0000007d}, {NoFlag, 0xffffffff, 0x0000007e},
652      {NoFlag, 0xffffffff, 0x0000007f}, {NoFlag, 0xffffffff, 0x00007ffd},
653      {NoFlag, 0xffffffff, 0x00007ffe}, {NoFlag, 0xffffffff, 0x00007fff},
654      {NoFlag, 0xffffffff, 0x33333333}, {NoFlag, 0xffffffff, 0x55555555},
655      {NoFlag, 0xffffffff, 0x7ffffffd}, {NoFlag, 0xffffffff, 0x7ffffffe},
656      {NoFlag, 0xffffffff, 0x7fffffff}, {NoFlag, 0xffffffff, 0x80000000},
657      {NoFlag, 0xffffffff, 0x80000001}, {NoFlag, 0xffffffff, 0xaaaaaaaa},
658      {NoFlag, 0xffffffff, 0xcccccccc}, {NoFlag, 0xffffffff, 0xffff8000},
659      {NoFlag, 0xffffffff, 0xffff8001}, {NoFlag, 0xffffffff, 0xffff8002},
660      {NoFlag, 0xffffffff, 0xffff8003}, {NoFlag, 0xffffffff, 0xffffff80},
661      {NoFlag, 0xffffffff, 0xffffff81}, {NoFlag, 0xffffffff, 0xffffff82},
662      {NoFlag, 0xffffffff, 0xffffff83}, {NoFlag, 0xffffffff, 0xffffffe0},
663      {NoFlag, 0xffffffff, 0xfffffffd}, {NoFlag, 0xffffffff, 0xfffffffe}};
664 
665 
666 // A loop will be generated for each element of this array.
667 const TestLoopData kTests[] = {
668     {{eq, r0, r0},
669      "eq r0 r0",
670      "Condition_eq_r0_r0",
671      ARRAY_SIZE(kCondition),
672      kCondition},
673     {{ne, r0, r0},
674      "ne r0 r0",
675      "Condition_ne_r0_r0",
676      ARRAY_SIZE(kCondition),
677      kCondition},
678     {{cs, r0, r0},
679      "cs r0 r0",
680      "Condition_cs_r0_r0",
681      ARRAY_SIZE(kCondition),
682      kCondition},
683     {{cc, r0, r0},
684      "cc r0 r0",
685      "Condition_cc_r0_r0",
686      ARRAY_SIZE(kCondition),
687      kCondition},
688     {{mi, r0, r0},
689      "mi r0 r0",
690      "Condition_mi_r0_r0",
691      ARRAY_SIZE(kCondition),
692      kCondition},
693     {{pl, r0, r0},
694      "pl r0 r0",
695      "Condition_pl_r0_r0",
696      ARRAY_SIZE(kCondition),
697      kCondition},
698     {{vs, r0, r0},
699      "vs r0 r0",
700      "Condition_vs_r0_r0",
701      ARRAY_SIZE(kCondition),
702      kCondition},
703     {{vc, r0, r0},
704      "vc r0 r0",
705      "Condition_vc_r0_r0",
706      ARRAY_SIZE(kCondition),
707      kCondition},
708     {{hi, r0, r0},
709      "hi r0 r0",
710      "Condition_hi_r0_r0",
711      ARRAY_SIZE(kCondition),
712      kCondition},
713     {{ls, r0, r0},
714      "ls r0 r0",
715      "Condition_ls_r0_r0",
716      ARRAY_SIZE(kCondition),
717      kCondition},
718     {{ge, r0, r0},
719      "ge r0 r0",
720      "Condition_ge_r0_r0",
721      ARRAY_SIZE(kCondition),
722      kCondition},
723     {{lt, r0, r0},
724      "lt r0 r0",
725      "Condition_lt_r0_r0",
726      ARRAY_SIZE(kCondition),
727      kCondition},
728     {{gt, r0, r0},
729      "gt r0 r0",
730      "Condition_gt_r0_r0",
731      ARRAY_SIZE(kCondition),
732      kCondition},
733     {{le, r0, r0},
734      "le r0 r0",
735      "Condition_le_r0_r0",
736      ARRAY_SIZE(kCondition),
737      kCondition},
738     {{al, r0, r0},
739      "al r0 r0",
740      "Condition_al_r0_r0",
741      ARRAY_SIZE(kCondition),
742      kCondition},
743     {{al, r0, r0}, "al r0 r0", "RdIsRn_al_r0_r0", ARRAY_SIZE(kRdIsRn), kRdIsRn},
744     {{al, r1, r1}, "al r1 r1", "RdIsRn_al_r1_r1", ARRAY_SIZE(kRdIsRn), kRdIsRn},
745     {{al, r2, r2}, "al r2 r2", "RdIsRn_al_r2_r2", ARRAY_SIZE(kRdIsRn), kRdIsRn},
746     {{al, r3, r3}, "al r3 r3", "RdIsRn_al_r3_r3", ARRAY_SIZE(kRdIsRn), kRdIsRn},
747     {{al, r4, r4}, "al r4 r4", "RdIsRn_al_r4_r4", ARRAY_SIZE(kRdIsRn), kRdIsRn},
748     {{al, r5, r5}, "al r5 r5", "RdIsRn_al_r5_r5", ARRAY_SIZE(kRdIsRn), kRdIsRn},
749     {{al, r6, r6}, "al r6 r6", "RdIsRn_al_r6_r6", ARRAY_SIZE(kRdIsRn), kRdIsRn},
750     {{al, r7, r7}, "al r7 r7", "RdIsRn_al_r7_r7", ARRAY_SIZE(kRdIsRn), kRdIsRn},
751     {{al, r8, r8}, "al r8 r8", "RdIsRn_al_r8_r8", ARRAY_SIZE(kRdIsRn), kRdIsRn},
752     {{al, r9, r9}, "al r9 r9", "RdIsRn_al_r9_r9", ARRAY_SIZE(kRdIsRn), kRdIsRn},
753     {{al, r10, r10},
754      "al r10 r10",
755      "RdIsRn_al_r10_r10",
756      ARRAY_SIZE(kRdIsRn),
757      kRdIsRn},
758     {{al, r11, r11},
759      "al r11 r11",
760      "RdIsRn_al_r11_r11",
761      ARRAY_SIZE(kRdIsRn),
762      kRdIsRn},
763     {{al, r12, r12},
764      "al r12 r12",
765      "RdIsRn_al_r12_r12",
766      ARRAY_SIZE(kRdIsRn),
767      kRdIsRn},
768     {{al, r14, r14},
769      "al r14 r14",
770      "RdIsRn_al_r14_r14",
771      ARRAY_SIZE(kRdIsRn),
772      kRdIsRn},
773     {{al, r12, r3},
774      "al r12 r3",
775      "RdIsNotRn_al_r12_r3",
776      ARRAY_SIZE(kRdIsNotRn),
777      kRdIsNotRn},
778     {{al, r5, r11},
779      "al r5 r11",
780      "RdIsNotRn_al_r5_r11",
781      ARRAY_SIZE(kRdIsNotRn),
782      kRdIsNotRn},
783     {{al, r3, r0},
784      "al r3 r0",
785      "RdIsNotRn_al_r3_r0",
786      ARRAY_SIZE(kRdIsNotRn),
787      kRdIsNotRn},
788     {{al, r0, r14},
789      "al r0 r14",
790      "RdIsNotRn_al_r0_r14",
791      ARRAY_SIZE(kRdIsNotRn),
792      kRdIsNotRn},
793     {{al, r8, r11},
794      "al r8 r11",
795      "RdIsNotRn_al_r8_r11",
796      ARRAY_SIZE(kRdIsNotRn),
797      kRdIsNotRn},
798     {{al, r5, r0},
799      "al r5 r0",
800      "RdIsNotRn_al_r5_r0",
801      ARRAY_SIZE(kRdIsNotRn),
802      kRdIsNotRn},
803     {{al, r2, r7},
804      "al r2 r7",
805      "RdIsNotRn_al_r2_r7",
806      ARRAY_SIZE(kRdIsNotRn),
807      kRdIsNotRn},
808     {{al, r12, r1},
809      "al r12 r1",
810      "RdIsNotRn_al_r12_r1",
811      ARRAY_SIZE(kRdIsNotRn),
812      kRdIsNotRn},
813     {{al, r4, r10},
814      "al r4 r10",
815      "RdIsNotRn_al_r4_r10",
816      ARRAY_SIZE(kRdIsNotRn),
817      kRdIsNotRn},
818     {{al, r6, r5},
819      "al r6 r5",
820      "RdIsNotRn_al_r6_r5",
821      ARRAY_SIZE(kRdIsNotRn),
822      kRdIsNotRn}};
823 
824 // We record all inputs to the instructions as outputs. This way, we also check
825 // that what shouldn't change didn't change.
826 struct TestResult {
827   size_t output_size;
828   const Inputs* outputs;
829 };
830 
831 // These headers each contain an array of `TestResult` with the reference output
832 // values. The reference arrays are names `kReference{mnemonic}`.
833 #include "aarch32/traces/simulator-cond-rd-rn-clz-t32.h"
834 #include "aarch32/traces/simulator-cond-rd-rn-rbit-t32.h"
835 #include "aarch32/traces/simulator-cond-rd-rn-rev-t32.h"
836 #include "aarch32/traces/simulator-cond-rd-rn-rev16-t32.h"
837 #include "aarch32/traces/simulator-cond-rd-rn-revsh-t32.h"
838 #include "aarch32/traces/simulator-cond-rd-rn-rrx-t32.h"
839 #include "aarch32/traces/simulator-cond-rd-rn-rrxs-t32.h"
840 
841 
842 // The maximum number of errors to report in detail for each test.
843 const unsigned kErrorReportLimit = 8;
844 
845 typedef void (MacroAssembler::*Fn)(Condition cond, Register rd, Register rn);
846 
TestHelper(Fn instruction,const char * mnemonic,const TestResult reference[])847 void TestHelper(Fn instruction,
848                 const char* mnemonic,
849                 const TestResult reference[]) {
850   SETUP();
851   masm.UseT32();
852   START();
853 
854   // Data to compare to `reference`.
855   TestResult* results[ARRAY_SIZE(kTests)];
856 
857   // Test cases for memory bound instructions may allocate a buffer and save its
858   // address in this array.
859   byte* scratch_memory_buffers[ARRAY_SIZE(kTests)];
860 
861   // Generate a loop for each element in `kTests`. Each loop tests one specific
862   // instruction.
863   for (unsigned i = 0; i < ARRAY_SIZE(kTests); i++) {
864     // Allocate results on the heap for this test.
865     results[i] = new TestResult;
866     results[i]->outputs = new Inputs[kTests[i].input_size];
867     results[i]->output_size = kTests[i].input_size;
868 
869     size_t input_stride = sizeof(kTests[i].inputs[0]) * kTests[i].input_size;
870     VIXL_ASSERT(IsUint32(input_stride));
871 
872     scratch_memory_buffers[i] = NULL;
873 
874     Label loop;
875     UseScratchRegisterScope scratch_registers(&masm);
876     // Include all registers from r0 ro r12.
877     scratch_registers.Include(RegisterList(0x1fff));
878 
879     // Values to pass to the macro-assembler.
880     Condition cond = kTests[i].operands.cond;
881     Register rd = kTests[i].operands.rd;
882     Register rn = kTests[i].operands.rn;
883     scratch_registers.Exclude(rd);
884     scratch_registers.Exclude(rn);
885 
886     // Allocate reserved registers for our own use.
887     Register input_ptr = scratch_registers.Acquire();
888     Register input_end = scratch_registers.Acquire();
889     Register result_ptr = scratch_registers.Acquire();
890 
891     // Initialize `input_ptr` to the first element and `input_end` the address
892     // after the array.
893     __ Mov(input_ptr, Operand::From(kTests[i].inputs));
894     __ Add(input_end, input_ptr, static_cast<uint32_t>(input_stride));
895     __ Mov(result_ptr, Operand::From(results[i]->outputs));
896     __ Bind(&loop);
897 
898     {
899       UseScratchRegisterScope temp_registers(&masm);
900       Register nzcv_bits = temp_registers.Acquire();
901       Register saved_q_bit = temp_registers.Acquire();
902       // Save the `Q` bit flag.
903       __ Mrs(saved_q_bit, APSR);
904       __ And(saved_q_bit, saved_q_bit, QFlag);
905       // Set the `NZCV` and `Q` flags together.
906       __ Ldr(nzcv_bits, MemOperand(input_ptr, offsetof(Inputs, apsr)));
907       __ Orr(nzcv_bits, nzcv_bits, saved_q_bit);
908       __ Msr(APSR_nzcvq, nzcv_bits);
909     }
910     __ Ldr(rd, MemOperand(input_ptr, offsetof(Inputs, rd)));
911     __ Ldr(rn, MemOperand(input_ptr, offsetof(Inputs, rn)));
912 
913     (masm.*instruction)(cond, rd, rn);
914 
915     {
916       UseScratchRegisterScope temp_registers(&masm);
917       Register nzcv_bits = temp_registers.Acquire();
918       __ Mrs(nzcv_bits, APSR);
919       // Only record the NZCV bits.
920       __ And(nzcv_bits, nzcv_bits, NZCVFlag);
921       __ Str(nzcv_bits, MemOperand(result_ptr, offsetof(Inputs, apsr)));
922     }
923     __ Str(rd, MemOperand(result_ptr, offsetof(Inputs, rd)));
924     __ Str(rn, MemOperand(result_ptr, offsetof(Inputs, rn)));
925 
926     // Advance the result pointer.
927     __ Add(result_ptr, result_ptr, Operand::From(sizeof(kTests[i].inputs[0])));
928     // Loop back until `input_ptr` is lower than `input_base`.
929     __ Add(input_ptr, input_ptr, Operand::From(sizeof(kTests[i].inputs[0])));
930     __ Cmp(input_ptr, input_end);
931     __ B(ne, &loop);
932   }
933 
934   END();
935 
936   RUN();
937 
938   if (Test::generate_test_trace()) {
939     // Print the results.
940     for (size_t i = 0; i < ARRAY_SIZE(kTests); i++) {
941       printf("const Inputs kOutputs_%s_%s[] = {\n",
942              mnemonic,
943              kTests[i].identifier);
944       for (size_t j = 0; j < results[i]->output_size; j++) {
945         printf("  { ");
946         printf("0x%08" PRIx32, results[i]->outputs[j].apsr);
947         printf(", ");
948         printf("0x%08" PRIx32, results[i]->outputs[j].rd);
949         printf(", ");
950         printf("0x%08" PRIx32, results[i]->outputs[j].rn);
951         printf(" },\n");
952       }
953       printf("};\n");
954     }
955     printf("const TestResult kReference%s[] = {\n", mnemonic);
956     for (size_t i = 0; i < ARRAY_SIZE(kTests); i++) {
957       printf("  {\n");
958       printf("    ARRAY_SIZE(kOutputs_%s_%s),\n",
959              mnemonic,
960              kTests[i].identifier);
961       printf("    kOutputs_%s_%s,\n", mnemonic, kTests[i].identifier);
962       printf("  },\n");
963     }
964     printf("};\n");
965   } else if (kCheckSimulatorTestResults) {
966     // Check the results.
967     unsigned total_error_count = 0;
968     for (size_t i = 0; i < ARRAY_SIZE(kTests); i++) {
969       bool instruction_has_errors = false;
970       for (size_t j = 0; j < kTests[i].input_size; j++) {
971         uint32_t apsr = results[i]->outputs[j].apsr;
972         uint32_t rd = results[i]->outputs[j].rd;
973         uint32_t rn = results[i]->outputs[j].rn;
974         uint32_t apsr_input = kTests[i].inputs[j].apsr;
975         uint32_t rd_input = kTests[i].inputs[j].rd;
976         uint32_t rn_input = kTests[i].inputs[j].rn;
977         uint32_t apsr_ref = reference[i].outputs[j].apsr;
978         uint32_t rd_ref = reference[i].outputs[j].rd;
979         uint32_t rn_ref = reference[i].outputs[j].rn;
980 
981         if (((apsr != apsr_ref) || (rd != rd_ref) || (rn != rn_ref)) &&
982             (++total_error_count <= kErrorReportLimit)) {
983           // Print the instruction once even if it triggered multiple failures.
984           if (!instruction_has_errors) {
985             printf("Error(s) when testing \"%s %s\":\n",
986                    mnemonic,
987                    kTests[i].operands_description);
988             instruction_has_errors = true;
989           }
990           // Print subsequent errors.
991           printf("  Input:    ");
992           printf("0x%08" PRIx32, apsr_input);
993           printf(", ");
994           printf("0x%08" PRIx32, rd_input);
995           printf(", ");
996           printf("0x%08" PRIx32, rn_input);
997           printf("\n");
998           printf("  Expected: ");
999           printf("0x%08" PRIx32, apsr_ref);
1000           printf(", ");
1001           printf("0x%08" PRIx32, rd_ref);
1002           printf(", ");
1003           printf("0x%08" PRIx32, rn_ref);
1004           printf("\n");
1005           printf("  Found:    ");
1006           printf("0x%08" PRIx32, apsr);
1007           printf(", ");
1008           printf("0x%08" PRIx32, rd);
1009           printf(", ");
1010           printf("0x%08" PRIx32, rn);
1011           printf("\n\n");
1012         }
1013       }
1014     }
1015 
1016     if (total_error_count > kErrorReportLimit) {
1017       printf("%u other errors follow.\n",
1018              total_error_count - kErrorReportLimit);
1019     }
1020     VIXL_CHECK(total_error_count == 0);
1021   } else {
1022     VIXL_WARNING("Assembled the code, but did not run anything.\n");
1023   }
1024 
1025   for (size_t i = 0; i < ARRAY_SIZE(kTests); i++) {
1026     delete[] results[i]->outputs;
1027     delete results[i];
1028     delete[] scratch_memory_buffers[i];
1029   }
1030 }
1031 
1032 // Instantiate tests for each instruction in the list.
1033 // TODO: Remove this limitation by having a sandboxing mechanism.
1034 #if defined(VIXL_HOST_POINTER_32)
1035 #define TEST(mnemonic)                                                      \
1036   void Test_##mnemonic() {                                                  \
1037     TestHelper(&MacroAssembler::mnemonic, #mnemonic, kReference##mnemonic); \
1038   }                                                                         \
1039   Test test_##mnemonic("AARCH32_SIMULATOR_COND_RD_RN_" #mnemonic "_T32",    \
1040                        &Test_##mnemonic);
1041 #else
1042 #define TEST(mnemonic)                                                   \
1043   void Test_##mnemonic() {                                               \
1044     VIXL_WARNING("This test can only run on a 32-bit host.\n");          \
1045     USE(TestHelper);                                                     \
1046   }                                                                      \
1047   Test test_##mnemonic("AARCH32_SIMULATOR_COND_RD_RN_" #mnemonic "_T32", \
1048                        &Test_##mnemonic);
1049 #endif
1050 
1051 FOREACH_INSTRUCTION(TEST)
1052 #undef TEST
1053 
1054 }  // namespace
1055 #endif
1056 
1057 }  // namespace aarch32
1058 }  // namespace vixl
1059