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(Adc)                       \
117   M(Adcs)                      \
118   M(Add)                       \
119   M(Adds)                      \
120   M(And)                       \
121   M(Ands)                      \
122   M(Bic)                       \
123   M(Bics)                      \
124   M(Eor)                       \
125   M(Eors)                      \
126   M(Orr)                       \
127   M(Orrs)                      \
128   M(Rsb)                       \
129   M(Rsbs)                      \
130   M(Rsc)                       \
131   M(Rscs)                      \
132   M(Sbc)                       \
133   M(Sbcs)                      \
134   M(Sub)                       \
135   M(Subs)
136 
137 
138 // The following definitions are defined again in each generated test, therefore
139 // we need to place them in an anomymous namespace. It expresses that they are
140 // local to this file only, and the compiler is not allowed to share these types
141 // across test files during template instantiation. Specifically, `Operands` and
142 // `Inputs` have various layouts across generated tests so they absolutely
143 // cannot be shared.
144 
145 #ifdef VIXL_INCLUDE_TARGET_A32
146 namespace {
147 
148 // Values to be passed to the assembler to produce the instruction under test.
149 struct Operands {
150   Condition cond;
151   Register rd;
152   Register rn;
153   uint32_t immediate;
154 };
155 
156 // Input data to feed to the instruction.
157 struct Inputs {
158   uint32_t apsr;
159   uint32_t rd;
160   uint32_t rn;
161 };
162 
163 // This structure contains all input data needed to test one specific encoding.
164 // It used to generate a loop over an instruction.
165 struct TestLoopData {
166   // The `operands` fields represents the values to pass to the assembler to
167   // produce the instruction.
168   Operands operands;
169   // Description of the operands, used for error reporting.
170   const char* operands_description;
171   // Unique identifier, used for generating traces.
172   const char* identifier;
173   // Array of values to be fed to the instruction.
174   size_t input_size;
175   const Inputs* inputs;
176 };
177 
178 static const Inputs kCondition[] = {{NFlag, 0xabababab, 0xabababab},
179                                     {ZFlag, 0xabababab, 0xabababab},
180                                     {CFlag, 0xabababab, 0xabababab},
181                                     {VFlag, 0xabababab, 0xabababab},
182                                     {NZFlag, 0xabababab, 0xabababab},
183                                     {NCFlag, 0xabababab, 0xabababab},
184                                     {NVFlag, 0xabababab, 0xabababab},
185                                     {ZCFlag, 0xabababab, 0xabababab},
186                                     {ZVFlag, 0xabababab, 0xabababab},
187                                     {CVFlag, 0xabababab, 0xabababab},
188                                     {NZCFlag, 0xabababab, 0xabababab},
189                                     {NZVFlag, 0xabababab, 0xabababab},
190                                     {NCVFlag, 0xabababab, 0xabababab},
191                                     {ZCVFlag, 0xabababab, 0xabababab},
192                                     {NZCVFlag, 0xabababab, 0xabababab}};
193 
194 static const Inputs kRdIsRn[] =
195     {{NoFlag, 0x00000000, 0x00000000}, {NoFlag, 0x00000001, 0x00000001},
196      {NoFlag, 0x00000002, 0x00000002}, {NoFlag, 0x00000020, 0x00000020},
197      {NoFlag, 0x0000007d, 0x0000007d}, {NoFlag, 0x0000007e, 0x0000007e},
198      {NoFlag, 0x0000007f, 0x0000007f}, {NoFlag, 0x00007ffd, 0x00007ffd},
199      {NoFlag, 0x00007ffe, 0x00007ffe}, {NoFlag, 0x00007fff, 0x00007fff},
200      {NoFlag, 0x33333333, 0x33333333}, {NoFlag, 0x55555555, 0x55555555},
201      {NoFlag, 0x7ffffffd, 0x7ffffffd}, {NoFlag, 0x7ffffffe, 0x7ffffffe},
202      {NoFlag, 0x7fffffff, 0x7fffffff}, {NoFlag, 0x80000000, 0x80000000},
203      {NoFlag, 0x80000001, 0x80000001}, {NoFlag, 0xaaaaaaaa, 0xaaaaaaaa},
204      {NoFlag, 0xcccccccc, 0xcccccccc}, {NoFlag, 0xffff8000, 0xffff8000},
205      {NoFlag, 0xffff8001, 0xffff8001}, {NoFlag, 0xffff8002, 0xffff8002},
206      {NoFlag, 0xffff8003, 0xffff8003}, {NoFlag, 0xffffff80, 0xffffff80},
207      {NoFlag, 0xffffff81, 0xffffff81}, {NoFlag, 0xffffff82, 0xffffff82},
208      {NoFlag, 0xffffff83, 0xffffff83}, {NoFlag, 0xffffffe0, 0xffffffe0},
209      {NoFlag, 0xfffffffd, 0xfffffffd}, {NoFlag, 0xfffffffe, 0xfffffffe},
210      {NoFlag, 0xffffffff, 0xffffffff}};
211 
212 static const Inputs kRdIsNotRn[] =
213     {{NoFlag, 0x00000000, 0x00000000}, {NoFlag, 0x00000000, 0x00000001},
214      {NoFlag, 0x00000000, 0x00000002}, {NoFlag, 0x00000000, 0x00000020},
215      {NoFlag, 0x00000000, 0x0000007d}, {NoFlag, 0x00000000, 0x0000007e},
216      {NoFlag, 0x00000000, 0x0000007f}, {NoFlag, 0x00000000, 0x00007ffd},
217      {NoFlag, 0x00000000, 0x00007ffe}, {NoFlag, 0x00000000, 0x00007fff},
218      {NoFlag, 0x00000000, 0x33333333}, {NoFlag, 0x00000000, 0x55555555},
219      {NoFlag, 0x00000000, 0x7ffffffd}, {NoFlag, 0x00000000, 0x7ffffffe},
220      {NoFlag, 0x00000000, 0x7fffffff}, {NoFlag, 0x00000000, 0x80000000},
221      {NoFlag, 0x00000000, 0x80000001}, {NoFlag, 0x00000000, 0xaaaaaaaa},
222      {NoFlag, 0x00000000, 0xcccccccc}, {NoFlag, 0x00000000, 0xffff8000},
223      {NoFlag, 0x00000000, 0xffff8001}, {NoFlag, 0x00000000, 0xffff8002},
224      {NoFlag, 0x00000000, 0xffff8003}, {NoFlag, 0x00000000, 0xffffff80},
225      {NoFlag, 0x00000000, 0xffffff81}, {NoFlag, 0x00000000, 0xffffff82},
226      {NoFlag, 0x00000000, 0xffffff83}, {NoFlag, 0x00000000, 0xffffffe0},
227      {NoFlag, 0x00000000, 0xfffffffd}, {NoFlag, 0x00000000, 0xfffffffe},
228      {NoFlag, 0x00000000, 0xffffffff}, {NoFlag, 0x00000001, 0x00000000},
229      {NoFlag, 0x00000001, 0x00000001}, {NoFlag, 0x00000001, 0x00000002},
230      {NoFlag, 0x00000001, 0x00000020}, {NoFlag, 0x00000001, 0x0000007d},
231      {NoFlag, 0x00000001, 0x0000007e}, {NoFlag, 0x00000001, 0x0000007f},
232      {NoFlag, 0x00000001, 0x00007ffd}, {NoFlag, 0x00000001, 0x00007ffe},
233      {NoFlag, 0x00000001, 0x00007fff}, {NoFlag, 0x00000001, 0x33333333},
234      {NoFlag, 0x00000001, 0x55555555}, {NoFlag, 0x00000001, 0x7ffffffd},
235      {NoFlag, 0x00000001, 0x7ffffffe}, {NoFlag, 0x00000001, 0x7fffffff},
236      {NoFlag, 0x00000001, 0x80000000}, {NoFlag, 0x00000001, 0x80000001},
237      {NoFlag, 0x00000001, 0xaaaaaaaa}, {NoFlag, 0x00000001, 0xcccccccc},
238      {NoFlag, 0x00000001, 0xffff8000}, {NoFlag, 0x00000001, 0xffff8001},
239      {NoFlag, 0x00000001, 0xffff8002}, {NoFlag, 0x00000001, 0xffff8003},
240      {NoFlag, 0x00000001, 0xffffff80}, {NoFlag, 0x00000001, 0xffffff81},
241      {NoFlag, 0x00000001, 0xffffff82}, {NoFlag, 0x00000001, 0xffffff83},
242      {NoFlag, 0x00000001, 0xffffffe0}, {NoFlag, 0x00000001, 0xfffffffd},
243      {NoFlag, 0x00000001, 0xfffffffe}, {NoFlag, 0x00000001, 0xffffffff},
244      {NoFlag, 0x00000002, 0x00000000}, {NoFlag, 0x00000002, 0x00000001},
245      {NoFlag, 0x00000002, 0x00000002}, {NoFlag, 0x00000002, 0x00000020},
246      {NoFlag, 0x00000002, 0x0000007d}, {NoFlag, 0x00000002, 0x0000007e},
247      {NoFlag, 0x00000002, 0x0000007f}, {NoFlag, 0x00000002, 0x00007ffd},
248      {NoFlag, 0x00000002, 0x00007ffe}, {NoFlag, 0x00000002, 0x00007fff},
249      {NoFlag, 0x00000002, 0x33333333}, {NoFlag, 0x00000002, 0x55555555},
250      {NoFlag, 0x00000002, 0x7ffffffd}, {NoFlag, 0x00000002, 0x7ffffffe},
251      {NoFlag, 0x00000002, 0x7fffffff}, {NoFlag, 0x00000002, 0x80000000},
252      {NoFlag, 0x00000002, 0x80000001}, {NoFlag, 0x00000002, 0xaaaaaaaa},
253      {NoFlag, 0x00000002, 0xcccccccc}, {NoFlag, 0x00000002, 0xffff8000},
254      {NoFlag, 0x00000002, 0xffff8001}, {NoFlag, 0x00000002, 0xffff8002},
255      {NoFlag, 0x00000002, 0xffff8003}, {NoFlag, 0x00000002, 0xffffff80},
256      {NoFlag, 0x00000002, 0xffffff81}, {NoFlag, 0x00000002, 0xffffff82},
257      {NoFlag, 0x00000002, 0xffffff83}, {NoFlag, 0x00000002, 0xffffffe0},
258      {NoFlag, 0x00000002, 0xfffffffd}, {NoFlag, 0x00000002, 0xfffffffe},
259      {NoFlag, 0x00000002, 0xffffffff}, {NoFlag, 0x00000020, 0x00000000},
260      {NoFlag, 0x00000020, 0x00000001}, {NoFlag, 0x00000020, 0x00000002},
261      {NoFlag, 0x00000020, 0x00000020}, {NoFlag, 0x00000020, 0x0000007d},
262      {NoFlag, 0x00000020, 0x0000007e}, {NoFlag, 0x00000020, 0x0000007f},
263      {NoFlag, 0x00000020, 0x00007ffd}, {NoFlag, 0x00000020, 0x00007ffe},
264      {NoFlag, 0x00000020, 0x00007fff}, {NoFlag, 0x00000020, 0x33333333},
265      {NoFlag, 0x00000020, 0x55555555}, {NoFlag, 0x00000020, 0x7ffffffd},
266      {NoFlag, 0x00000020, 0x7ffffffe}, {NoFlag, 0x00000020, 0x7fffffff},
267      {NoFlag, 0x00000020, 0x80000000}, {NoFlag, 0x00000020, 0x80000001},
268      {NoFlag, 0x00000020, 0xaaaaaaaa}, {NoFlag, 0x00000020, 0xcccccccc},
269      {NoFlag, 0x00000020, 0xffff8000}, {NoFlag, 0x00000020, 0xffff8001},
270      {NoFlag, 0x00000020, 0xffff8002}, {NoFlag, 0x00000020, 0xffff8003},
271      {NoFlag, 0x00000020, 0xffffff80}, {NoFlag, 0x00000020, 0xffffff81},
272      {NoFlag, 0x00000020, 0xffffff82}, {NoFlag, 0x00000020, 0xffffff83},
273      {NoFlag, 0x00000020, 0xffffffe0}, {NoFlag, 0x00000020, 0xfffffffd},
274      {NoFlag, 0x00000020, 0xfffffffe}, {NoFlag, 0x00000020, 0xffffffff},
275      {NoFlag, 0x0000007d, 0x00000000}, {NoFlag, 0x0000007d, 0x00000001},
276      {NoFlag, 0x0000007d, 0x00000002}, {NoFlag, 0x0000007d, 0x00000020},
277      {NoFlag, 0x0000007d, 0x0000007d}, {NoFlag, 0x0000007d, 0x0000007e},
278      {NoFlag, 0x0000007d, 0x0000007f}, {NoFlag, 0x0000007d, 0x00007ffd},
279      {NoFlag, 0x0000007d, 0x00007ffe}, {NoFlag, 0x0000007d, 0x00007fff},
280      {NoFlag, 0x0000007d, 0x33333333}, {NoFlag, 0x0000007d, 0x55555555},
281      {NoFlag, 0x0000007d, 0x7ffffffd}, {NoFlag, 0x0000007d, 0x7ffffffe},
282      {NoFlag, 0x0000007d, 0x7fffffff}, {NoFlag, 0x0000007d, 0x80000000},
283      {NoFlag, 0x0000007d, 0x80000001}, {NoFlag, 0x0000007d, 0xaaaaaaaa},
284      {NoFlag, 0x0000007d, 0xcccccccc}, {NoFlag, 0x0000007d, 0xffff8000},
285      {NoFlag, 0x0000007d, 0xffff8001}, {NoFlag, 0x0000007d, 0xffff8002},
286      {NoFlag, 0x0000007d, 0xffff8003}, {NoFlag, 0x0000007d, 0xffffff80},
287      {NoFlag, 0x0000007d, 0xffffff81}, {NoFlag, 0x0000007d, 0xffffff82},
288      {NoFlag, 0x0000007d, 0xffffff83}, {NoFlag, 0x0000007d, 0xffffffe0},
289      {NoFlag, 0x0000007d, 0xfffffffd}, {NoFlag, 0x0000007d, 0xfffffffe},
290      {NoFlag, 0x0000007d, 0xffffffff}, {NoFlag, 0x0000007e, 0x00000000},
291      {NoFlag, 0x0000007e, 0x00000001}, {NoFlag, 0x0000007e, 0x00000002},
292      {NoFlag, 0x0000007e, 0x00000020}, {NoFlag, 0x0000007e, 0x0000007d},
293      {NoFlag, 0x0000007e, 0x0000007e}, {NoFlag, 0x0000007e, 0x0000007f},
294      {NoFlag, 0x0000007e, 0x00007ffd}, {NoFlag, 0x0000007e, 0x00007ffe},
295      {NoFlag, 0x0000007e, 0x00007fff}, {NoFlag, 0x0000007e, 0x33333333},
296      {NoFlag, 0x0000007e, 0x55555555}, {NoFlag, 0x0000007e, 0x7ffffffd},
297      {NoFlag, 0x0000007e, 0x7ffffffe}, {NoFlag, 0x0000007e, 0x7fffffff},
298      {NoFlag, 0x0000007e, 0x80000000}, {NoFlag, 0x0000007e, 0x80000001},
299      {NoFlag, 0x0000007e, 0xaaaaaaaa}, {NoFlag, 0x0000007e, 0xcccccccc},
300      {NoFlag, 0x0000007e, 0xffff8000}, {NoFlag, 0x0000007e, 0xffff8001},
301      {NoFlag, 0x0000007e, 0xffff8002}, {NoFlag, 0x0000007e, 0xffff8003},
302      {NoFlag, 0x0000007e, 0xffffff80}, {NoFlag, 0x0000007e, 0xffffff81},
303      {NoFlag, 0x0000007e, 0xffffff82}, {NoFlag, 0x0000007e, 0xffffff83},
304      {NoFlag, 0x0000007e, 0xffffffe0}, {NoFlag, 0x0000007e, 0xfffffffd},
305      {NoFlag, 0x0000007e, 0xfffffffe}, {NoFlag, 0x0000007e, 0xffffffff},
306      {NoFlag, 0x0000007f, 0x00000000}, {NoFlag, 0x0000007f, 0x00000001},
307      {NoFlag, 0x0000007f, 0x00000002}, {NoFlag, 0x0000007f, 0x00000020},
308      {NoFlag, 0x0000007f, 0x0000007d}, {NoFlag, 0x0000007f, 0x0000007e},
309      {NoFlag, 0x0000007f, 0x0000007f}, {NoFlag, 0x0000007f, 0x00007ffd},
310      {NoFlag, 0x0000007f, 0x00007ffe}, {NoFlag, 0x0000007f, 0x00007fff},
311      {NoFlag, 0x0000007f, 0x33333333}, {NoFlag, 0x0000007f, 0x55555555},
312      {NoFlag, 0x0000007f, 0x7ffffffd}, {NoFlag, 0x0000007f, 0x7ffffffe},
313      {NoFlag, 0x0000007f, 0x7fffffff}, {NoFlag, 0x0000007f, 0x80000000},
314      {NoFlag, 0x0000007f, 0x80000001}, {NoFlag, 0x0000007f, 0xaaaaaaaa},
315      {NoFlag, 0x0000007f, 0xcccccccc}, {NoFlag, 0x0000007f, 0xffff8000},
316      {NoFlag, 0x0000007f, 0xffff8001}, {NoFlag, 0x0000007f, 0xffff8002},
317      {NoFlag, 0x0000007f, 0xffff8003}, {NoFlag, 0x0000007f, 0xffffff80},
318      {NoFlag, 0x0000007f, 0xffffff81}, {NoFlag, 0x0000007f, 0xffffff82},
319      {NoFlag, 0x0000007f, 0xffffff83}, {NoFlag, 0x0000007f, 0xffffffe0},
320      {NoFlag, 0x0000007f, 0xfffffffd}, {NoFlag, 0x0000007f, 0xfffffffe},
321      {NoFlag, 0x0000007f, 0xffffffff}, {NoFlag, 0x00007ffd, 0x00000000},
322      {NoFlag, 0x00007ffd, 0x00000001}, {NoFlag, 0x00007ffd, 0x00000002},
323      {NoFlag, 0x00007ffd, 0x00000020}, {NoFlag, 0x00007ffd, 0x0000007d},
324      {NoFlag, 0x00007ffd, 0x0000007e}, {NoFlag, 0x00007ffd, 0x0000007f},
325      {NoFlag, 0x00007ffd, 0x00007ffd}, {NoFlag, 0x00007ffd, 0x00007ffe},
326      {NoFlag, 0x00007ffd, 0x00007fff}, {NoFlag, 0x00007ffd, 0x33333333},
327      {NoFlag, 0x00007ffd, 0x55555555}, {NoFlag, 0x00007ffd, 0x7ffffffd},
328      {NoFlag, 0x00007ffd, 0x7ffffffe}, {NoFlag, 0x00007ffd, 0x7fffffff},
329      {NoFlag, 0x00007ffd, 0x80000000}, {NoFlag, 0x00007ffd, 0x80000001},
330      {NoFlag, 0x00007ffd, 0xaaaaaaaa}, {NoFlag, 0x00007ffd, 0xcccccccc},
331      {NoFlag, 0x00007ffd, 0xffff8000}, {NoFlag, 0x00007ffd, 0xffff8001},
332      {NoFlag, 0x00007ffd, 0xffff8002}, {NoFlag, 0x00007ffd, 0xffff8003},
333      {NoFlag, 0x00007ffd, 0xffffff80}, {NoFlag, 0x00007ffd, 0xffffff81},
334      {NoFlag, 0x00007ffd, 0xffffff82}, {NoFlag, 0x00007ffd, 0xffffff83},
335      {NoFlag, 0x00007ffd, 0xffffffe0}, {NoFlag, 0x00007ffd, 0xfffffffd},
336      {NoFlag, 0x00007ffd, 0xfffffffe}, {NoFlag, 0x00007ffd, 0xffffffff},
337      {NoFlag, 0x00007ffe, 0x00000000}, {NoFlag, 0x00007ffe, 0x00000001},
338      {NoFlag, 0x00007ffe, 0x00000002}, {NoFlag, 0x00007ffe, 0x00000020},
339      {NoFlag, 0x00007ffe, 0x0000007d}, {NoFlag, 0x00007ffe, 0x0000007e},
340      {NoFlag, 0x00007ffe, 0x0000007f}, {NoFlag, 0x00007ffe, 0x00007ffd},
341      {NoFlag, 0x00007ffe, 0x00007ffe}, {NoFlag, 0x00007ffe, 0x00007fff},
342      {NoFlag, 0x00007ffe, 0x33333333}, {NoFlag, 0x00007ffe, 0x55555555},
343      {NoFlag, 0x00007ffe, 0x7ffffffd}, {NoFlag, 0x00007ffe, 0x7ffffffe},
344      {NoFlag, 0x00007ffe, 0x7fffffff}, {NoFlag, 0x00007ffe, 0x80000000},
345      {NoFlag, 0x00007ffe, 0x80000001}, {NoFlag, 0x00007ffe, 0xaaaaaaaa},
346      {NoFlag, 0x00007ffe, 0xcccccccc}, {NoFlag, 0x00007ffe, 0xffff8000},
347      {NoFlag, 0x00007ffe, 0xffff8001}, {NoFlag, 0x00007ffe, 0xffff8002},
348      {NoFlag, 0x00007ffe, 0xffff8003}, {NoFlag, 0x00007ffe, 0xffffff80},
349      {NoFlag, 0x00007ffe, 0xffffff81}, {NoFlag, 0x00007ffe, 0xffffff82},
350      {NoFlag, 0x00007ffe, 0xffffff83}, {NoFlag, 0x00007ffe, 0xffffffe0},
351      {NoFlag, 0x00007ffe, 0xfffffffd}, {NoFlag, 0x00007ffe, 0xfffffffe},
352      {NoFlag, 0x00007ffe, 0xffffffff}, {NoFlag, 0x00007fff, 0x00000000},
353      {NoFlag, 0x00007fff, 0x00000001}, {NoFlag, 0x00007fff, 0x00000002},
354      {NoFlag, 0x00007fff, 0x00000020}, {NoFlag, 0x00007fff, 0x0000007d},
355      {NoFlag, 0x00007fff, 0x0000007e}, {NoFlag, 0x00007fff, 0x0000007f},
356      {NoFlag, 0x00007fff, 0x00007ffd}, {NoFlag, 0x00007fff, 0x00007ffe},
357      {NoFlag, 0x00007fff, 0x00007fff}, {NoFlag, 0x00007fff, 0x33333333},
358      {NoFlag, 0x00007fff, 0x55555555}, {NoFlag, 0x00007fff, 0x7ffffffd},
359      {NoFlag, 0x00007fff, 0x7ffffffe}, {NoFlag, 0x00007fff, 0x7fffffff},
360      {NoFlag, 0x00007fff, 0x80000000}, {NoFlag, 0x00007fff, 0x80000001},
361      {NoFlag, 0x00007fff, 0xaaaaaaaa}, {NoFlag, 0x00007fff, 0xcccccccc},
362      {NoFlag, 0x00007fff, 0xffff8000}, {NoFlag, 0x00007fff, 0xffff8001},
363      {NoFlag, 0x00007fff, 0xffff8002}, {NoFlag, 0x00007fff, 0xffff8003},
364      {NoFlag, 0x00007fff, 0xffffff80}, {NoFlag, 0x00007fff, 0xffffff81},
365      {NoFlag, 0x00007fff, 0xffffff82}, {NoFlag, 0x00007fff, 0xffffff83},
366      {NoFlag, 0x00007fff, 0xffffffe0}, {NoFlag, 0x00007fff, 0xfffffffd},
367      {NoFlag, 0x00007fff, 0xfffffffe}, {NoFlag, 0x00007fff, 0xffffffff},
368      {NoFlag, 0x33333333, 0x00000000}, {NoFlag, 0x33333333, 0x00000001},
369      {NoFlag, 0x33333333, 0x00000002}, {NoFlag, 0x33333333, 0x00000020},
370      {NoFlag, 0x33333333, 0x0000007d}, {NoFlag, 0x33333333, 0x0000007e},
371      {NoFlag, 0x33333333, 0x0000007f}, {NoFlag, 0x33333333, 0x00007ffd},
372      {NoFlag, 0x33333333, 0x00007ffe}, {NoFlag, 0x33333333, 0x00007fff},
373      {NoFlag, 0x33333333, 0x33333333}, {NoFlag, 0x33333333, 0x55555555},
374      {NoFlag, 0x33333333, 0x7ffffffd}, {NoFlag, 0x33333333, 0x7ffffffe},
375      {NoFlag, 0x33333333, 0x7fffffff}, {NoFlag, 0x33333333, 0x80000000},
376      {NoFlag, 0x33333333, 0x80000001}, {NoFlag, 0x33333333, 0xaaaaaaaa},
377      {NoFlag, 0x33333333, 0xcccccccc}, {NoFlag, 0x33333333, 0xffff8000},
378      {NoFlag, 0x33333333, 0xffff8001}, {NoFlag, 0x33333333, 0xffff8002},
379      {NoFlag, 0x33333333, 0xffff8003}, {NoFlag, 0x33333333, 0xffffff80},
380      {NoFlag, 0x33333333, 0xffffff81}, {NoFlag, 0x33333333, 0xffffff82},
381      {NoFlag, 0x33333333, 0xffffff83}, {NoFlag, 0x33333333, 0xffffffe0},
382      {NoFlag, 0x33333333, 0xfffffffd}, {NoFlag, 0x33333333, 0xfffffffe},
383      {NoFlag, 0x33333333, 0xffffffff}, {NoFlag, 0x55555555, 0x00000000},
384      {NoFlag, 0x55555555, 0x00000001}, {NoFlag, 0x55555555, 0x00000002},
385      {NoFlag, 0x55555555, 0x00000020}, {NoFlag, 0x55555555, 0x0000007d},
386      {NoFlag, 0x55555555, 0x0000007e}, {NoFlag, 0x55555555, 0x0000007f},
387      {NoFlag, 0x55555555, 0x00007ffd}, {NoFlag, 0x55555555, 0x00007ffe},
388      {NoFlag, 0x55555555, 0x00007fff}, {NoFlag, 0x55555555, 0x33333333},
389      {NoFlag, 0x55555555, 0x55555555}, {NoFlag, 0x55555555, 0x7ffffffd},
390      {NoFlag, 0x55555555, 0x7ffffffe}, {NoFlag, 0x55555555, 0x7fffffff},
391      {NoFlag, 0x55555555, 0x80000000}, {NoFlag, 0x55555555, 0x80000001},
392      {NoFlag, 0x55555555, 0xaaaaaaaa}, {NoFlag, 0x55555555, 0xcccccccc},
393      {NoFlag, 0x55555555, 0xffff8000}, {NoFlag, 0x55555555, 0xffff8001},
394      {NoFlag, 0x55555555, 0xffff8002}, {NoFlag, 0x55555555, 0xffff8003},
395      {NoFlag, 0x55555555, 0xffffff80}, {NoFlag, 0x55555555, 0xffffff81},
396      {NoFlag, 0x55555555, 0xffffff82}, {NoFlag, 0x55555555, 0xffffff83},
397      {NoFlag, 0x55555555, 0xffffffe0}, {NoFlag, 0x55555555, 0xfffffffd},
398      {NoFlag, 0x55555555, 0xfffffffe}, {NoFlag, 0x55555555, 0xffffffff},
399      {NoFlag, 0x7ffffffd, 0x00000000}, {NoFlag, 0x7ffffffd, 0x00000001},
400      {NoFlag, 0x7ffffffd, 0x00000002}, {NoFlag, 0x7ffffffd, 0x00000020},
401      {NoFlag, 0x7ffffffd, 0x0000007d}, {NoFlag, 0x7ffffffd, 0x0000007e},
402      {NoFlag, 0x7ffffffd, 0x0000007f}, {NoFlag, 0x7ffffffd, 0x00007ffd},
403      {NoFlag, 0x7ffffffd, 0x00007ffe}, {NoFlag, 0x7ffffffd, 0x00007fff},
404      {NoFlag, 0x7ffffffd, 0x33333333}, {NoFlag, 0x7ffffffd, 0x55555555},
405      {NoFlag, 0x7ffffffd, 0x7ffffffd}, {NoFlag, 0x7ffffffd, 0x7ffffffe},
406      {NoFlag, 0x7ffffffd, 0x7fffffff}, {NoFlag, 0x7ffffffd, 0x80000000},
407      {NoFlag, 0x7ffffffd, 0x80000001}, {NoFlag, 0x7ffffffd, 0xaaaaaaaa},
408      {NoFlag, 0x7ffffffd, 0xcccccccc}, {NoFlag, 0x7ffffffd, 0xffff8000},
409      {NoFlag, 0x7ffffffd, 0xffff8001}, {NoFlag, 0x7ffffffd, 0xffff8002},
410      {NoFlag, 0x7ffffffd, 0xffff8003}, {NoFlag, 0x7ffffffd, 0xffffff80},
411      {NoFlag, 0x7ffffffd, 0xffffff81}, {NoFlag, 0x7ffffffd, 0xffffff82},
412      {NoFlag, 0x7ffffffd, 0xffffff83}, {NoFlag, 0x7ffffffd, 0xffffffe0},
413      {NoFlag, 0x7ffffffd, 0xfffffffd}, {NoFlag, 0x7ffffffd, 0xfffffffe},
414      {NoFlag, 0x7ffffffd, 0xffffffff}, {NoFlag, 0x7ffffffe, 0x00000000},
415      {NoFlag, 0x7ffffffe, 0x00000001}, {NoFlag, 0x7ffffffe, 0x00000002},
416      {NoFlag, 0x7ffffffe, 0x00000020}, {NoFlag, 0x7ffffffe, 0x0000007d},
417      {NoFlag, 0x7ffffffe, 0x0000007e}, {NoFlag, 0x7ffffffe, 0x0000007f},
418      {NoFlag, 0x7ffffffe, 0x00007ffd}, {NoFlag, 0x7ffffffe, 0x00007ffe},
419      {NoFlag, 0x7ffffffe, 0x00007fff}, {NoFlag, 0x7ffffffe, 0x33333333},
420      {NoFlag, 0x7ffffffe, 0x55555555}, {NoFlag, 0x7ffffffe, 0x7ffffffd},
421      {NoFlag, 0x7ffffffe, 0x7ffffffe}, {NoFlag, 0x7ffffffe, 0x7fffffff},
422      {NoFlag, 0x7ffffffe, 0x80000000}, {NoFlag, 0x7ffffffe, 0x80000001},
423      {NoFlag, 0x7ffffffe, 0xaaaaaaaa}, {NoFlag, 0x7ffffffe, 0xcccccccc},
424      {NoFlag, 0x7ffffffe, 0xffff8000}, {NoFlag, 0x7ffffffe, 0xffff8001},
425      {NoFlag, 0x7ffffffe, 0xffff8002}, {NoFlag, 0x7ffffffe, 0xffff8003},
426      {NoFlag, 0x7ffffffe, 0xffffff80}, {NoFlag, 0x7ffffffe, 0xffffff81},
427      {NoFlag, 0x7ffffffe, 0xffffff82}, {NoFlag, 0x7ffffffe, 0xffffff83},
428      {NoFlag, 0x7ffffffe, 0xffffffe0}, {NoFlag, 0x7ffffffe, 0xfffffffd},
429      {NoFlag, 0x7ffffffe, 0xfffffffe}, {NoFlag, 0x7ffffffe, 0xffffffff},
430      {NoFlag, 0x7fffffff, 0x00000000}, {NoFlag, 0x7fffffff, 0x00000001},
431      {NoFlag, 0x7fffffff, 0x00000002}, {NoFlag, 0x7fffffff, 0x00000020},
432      {NoFlag, 0x7fffffff, 0x0000007d}, {NoFlag, 0x7fffffff, 0x0000007e},
433      {NoFlag, 0x7fffffff, 0x0000007f}, {NoFlag, 0x7fffffff, 0x00007ffd},
434      {NoFlag, 0x7fffffff, 0x00007ffe}, {NoFlag, 0x7fffffff, 0x00007fff},
435      {NoFlag, 0x7fffffff, 0x33333333}, {NoFlag, 0x7fffffff, 0x55555555},
436      {NoFlag, 0x7fffffff, 0x7ffffffd}, {NoFlag, 0x7fffffff, 0x7ffffffe},
437      {NoFlag, 0x7fffffff, 0x7fffffff}, {NoFlag, 0x7fffffff, 0x80000000},
438      {NoFlag, 0x7fffffff, 0x80000001}, {NoFlag, 0x7fffffff, 0xaaaaaaaa},
439      {NoFlag, 0x7fffffff, 0xcccccccc}, {NoFlag, 0x7fffffff, 0xffff8000},
440      {NoFlag, 0x7fffffff, 0xffff8001}, {NoFlag, 0x7fffffff, 0xffff8002},
441      {NoFlag, 0x7fffffff, 0xffff8003}, {NoFlag, 0x7fffffff, 0xffffff80},
442      {NoFlag, 0x7fffffff, 0xffffff81}, {NoFlag, 0x7fffffff, 0xffffff82},
443      {NoFlag, 0x7fffffff, 0xffffff83}, {NoFlag, 0x7fffffff, 0xffffffe0},
444      {NoFlag, 0x7fffffff, 0xfffffffd}, {NoFlag, 0x7fffffff, 0xfffffffe},
445      {NoFlag, 0x7fffffff, 0xffffffff}, {NoFlag, 0x80000000, 0x00000000},
446      {NoFlag, 0x80000000, 0x00000001}, {NoFlag, 0x80000000, 0x00000002},
447      {NoFlag, 0x80000000, 0x00000020}, {NoFlag, 0x80000000, 0x0000007d},
448      {NoFlag, 0x80000000, 0x0000007e}, {NoFlag, 0x80000000, 0x0000007f},
449      {NoFlag, 0x80000000, 0x00007ffd}, {NoFlag, 0x80000000, 0x00007ffe},
450      {NoFlag, 0x80000000, 0x00007fff}, {NoFlag, 0x80000000, 0x33333333},
451      {NoFlag, 0x80000000, 0x55555555}, {NoFlag, 0x80000000, 0x7ffffffd},
452      {NoFlag, 0x80000000, 0x7ffffffe}, {NoFlag, 0x80000000, 0x7fffffff},
453      {NoFlag, 0x80000000, 0x80000000}, {NoFlag, 0x80000000, 0x80000001},
454      {NoFlag, 0x80000000, 0xaaaaaaaa}, {NoFlag, 0x80000000, 0xcccccccc},
455      {NoFlag, 0x80000000, 0xffff8000}, {NoFlag, 0x80000000, 0xffff8001},
456      {NoFlag, 0x80000000, 0xffff8002}, {NoFlag, 0x80000000, 0xffff8003},
457      {NoFlag, 0x80000000, 0xffffff80}, {NoFlag, 0x80000000, 0xffffff81},
458      {NoFlag, 0x80000000, 0xffffff82}, {NoFlag, 0x80000000, 0xffffff83},
459      {NoFlag, 0x80000000, 0xffffffe0}, {NoFlag, 0x80000000, 0xfffffffd},
460      {NoFlag, 0x80000000, 0xfffffffe}, {NoFlag, 0x80000000, 0xffffffff},
461      {NoFlag, 0x80000001, 0x00000000}, {NoFlag, 0x80000001, 0x00000001},
462      {NoFlag, 0x80000001, 0x00000002}, {NoFlag, 0x80000001, 0x00000020},
463      {NoFlag, 0x80000001, 0x0000007d}, {NoFlag, 0x80000001, 0x0000007e},
464      {NoFlag, 0x80000001, 0x0000007f}, {NoFlag, 0x80000001, 0x00007ffd},
465      {NoFlag, 0x80000001, 0x00007ffe}, {NoFlag, 0x80000001, 0x00007fff},
466      {NoFlag, 0x80000001, 0x33333333}, {NoFlag, 0x80000001, 0x55555555},
467      {NoFlag, 0x80000001, 0x7ffffffd}, {NoFlag, 0x80000001, 0x7ffffffe},
468      {NoFlag, 0x80000001, 0x7fffffff}, {NoFlag, 0x80000001, 0x80000000},
469      {NoFlag, 0x80000001, 0x80000001}, {NoFlag, 0x80000001, 0xaaaaaaaa},
470      {NoFlag, 0x80000001, 0xcccccccc}, {NoFlag, 0x80000001, 0xffff8000},
471      {NoFlag, 0x80000001, 0xffff8001}, {NoFlag, 0x80000001, 0xffff8002},
472      {NoFlag, 0x80000001, 0xffff8003}, {NoFlag, 0x80000001, 0xffffff80},
473      {NoFlag, 0x80000001, 0xffffff81}, {NoFlag, 0x80000001, 0xffffff82},
474      {NoFlag, 0x80000001, 0xffffff83}, {NoFlag, 0x80000001, 0xffffffe0},
475      {NoFlag, 0x80000001, 0xfffffffd}, {NoFlag, 0x80000001, 0xfffffffe},
476      {NoFlag, 0x80000001, 0xffffffff}, {NoFlag, 0xaaaaaaaa, 0x00000000},
477      {NoFlag, 0xaaaaaaaa, 0x00000001}, {NoFlag, 0xaaaaaaaa, 0x00000002},
478      {NoFlag, 0xaaaaaaaa, 0x00000020}, {NoFlag, 0xaaaaaaaa, 0x0000007d},
479      {NoFlag, 0xaaaaaaaa, 0x0000007e}, {NoFlag, 0xaaaaaaaa, 0x0000007f},
480      {NoFlag, 0xaaaaaaaa, 0x00007ffd}, {NoFlag, 0xaaaaaaaa, 0x00007ffe},
481      {NoFlag, 0xaaaaaaaa, 0x00007fff}, {NoFlag, 0xaaaaaaaa, 0x33333333},
482      {NoFlag, 0xaaaaaaaa, 0x55555555}, {NoFlag, 0xaaaaaaaa, 0x7ffffffd},
483      {NoFlag, 0xaaaaaaaa, 0x7ffffffe}, {NoFlag, 0xaaaaaaaa, 0x7fffffff},
484      {NoFlag, 0xaaaaaaaa, 0x80000000}, {NoFlag, 0xaaaaaaaa, 0x80000001},
485      {NoFlag, 0xaaaaaaaa, 0xaaaaaaaa}, {NoFlag, 0xaaaaaaaa, 0xcccccccc},
486      {NoFlag, 0xaaaaaaaa, 0xffff8000}, {NoFlag, 0xaaaaaaaa, 0xffff8001},
487      {NoFlag, 0xaaaaaaaa, 0xffff8002}, {NoFlag, 0xaaaaaaaa, 0xffff8003},
488      {NoFlag, 0xaaaaaaaa, 0xffffff80}, {NoFlag, 0xaaaaaaaa, 0xffffff81},
489      {NoFlag, 0xaaaaaaaa, 0xffffff82}, {NoFlag, 0xaaaaaaaa, 0xffffff83},
490      {NoFlag, 0xaaaaaaaa, 0xffffffe0}, {NoFlag, 0xaaaaaaaa, 0xfffffffd},
491      {NoFlag, 0xaaaaaaaa, 0xfffffffe}, {NoFlag, 0xaaaaaaaa, 0xffffffff},
492      {NoFlag, 0xcccccccc, 0x00000000}, {NoFlag, 0xcccccccc, 0x00000001},
493      {NoFlag, 0xcccccccc, 0x00000002}, {NoFlag, 0xcccccccc, 0x00000020},
494      {NoFlag, 0xcccccccc, 0x0000007d}, {NoFlag, 0xcccccccc, 0x0000007e},
495      {NoFlag, 0xcccccccc, 0x0000007f}, {NoFlag, 0xcccccccc, 0x00007ffd},
496      {NoFlag, 0xcccccccc, 0x00007ffe}, {NoFlag, 0xcccccccc, 0x00007fff},
497      {NoFlag, 0xcccccccc, 0x33333333}, {NoFlag, 0xcccccccc, 0x55555555},
498      {NoFlag, 0xcccccccc, 0x7ffffffd}, {NoFlag, 0xcccccccc, 0x7ffffffe},
499      {NoFlag, 0xcccccccc, 0x7fffffff}, {NoFlag, 0xcccccccc, 0x80000000},
500      {NoFlag, 0xcccccccc, 0x80000001}, {NoFlag, 0xcccccccc, 0xaaaaaaaa},
501      {NoFlag, 0xcccccccc, 0xcccccccc}, {NoFlag, 0xcccccccc, 0xffff8000},
502      {NoFlag, 0xcccccccc, 0xffff8001}, {NoFlag, 0xcccccccc, 0xffff8002},
503      {NoFlag, 0xcccccccc, 0xffff8003}, {NoFlag, 0xcccccccc, 0xffffff80},
504      {NoFlag, 0xcccccccc, 0xffffff81}, {NoFlag, 0xcccccccc, 0xffffff82},
505      {NoFlag, 0xcccccccc, 0xffffff83}, {NoFlag, 0xcccccccc, 0xffffffe0},
506      {NoFlag, 0xcccccccc, 0xfffffffd}, {NoFlag, 0xcccccccc, 0xfffffffe},
507      {NoFlag, 0xcccccccc, 0xffffffff}, {NoFlag, 0xffff8000, 0x00000000},
508      {NoFlag, 0xffff8000, 0x00000001}, {NoFlag, 0xffff8000, 0x00000002},
509      {NoFlag, 0xffff8000, 0x00000020}, {NoFlag, 0xffff8000, 0x0000007d},
510      {NoFlag, 0xffff8000, 0x0000007e}, {NoFlag, 0xffff8000, 0x0000007f},
511      {NoFlag, 0xffff8000, 0x00007ffd}, {NoFlag, 0xffff8000, 0x00007ffe},
512      {NoFlag, 0xffff8000, 0x00007fff}, {NoFlag, 0xffff8000, 0x33333333},
513      {NoFlag, 0xffff8000, 0x55555555}, {NoFlag, 0xffff8000, 0x7ffffffd},
514      {NoFlag, 0xffff8000, 0x7ffffffe}, {NoFlag, 0xffff8000, 0x7fffffff},
515      {NoFlag, 0xffff8000, 0x80000000}, {NoFlag, 0xffff8000, 0x80000001},
516      {NoFlag, 0xffff8000, 0xaaaaaaaa}, {NoFlag, 0xffff8000, 0xcccccccc},
517      {NoFlag, 0xffff8000, 0xffff8000}, {NoFlag, 0xffff8000, 0xffff8001},
518      {NoFlag, 0xffff8000, 0xffff8002}, {NoFlag, 0xffff8000, 0xffff8003},
519      {NoFlag, 0xffff8000, 0xffffff80}, {NoFlag, 0xffff8000, 0xffffff81},
520      {NoFlag, 0xffff8000, 0xffffff82}, {NoFlag, 0xffff8000, 0xffffff83},
521      {NoFlag, 0xffff8000, 0xffffffe0}, {NoFlag, 0xffff8000, 0xfffffffd},
522      {NoFlag, 0xffff8000, 0xfffffffe}, {NoFlag, 0xffff8000, 0xffffffff},
523      {NoFlag, 0xffff8001, 0x00000000}, {NoFlag, 0xffff8001, 0x00000001},
524      {NoFlag, 0xffff8001, 0x00000002}, {NoFlag, 0xffff8001, 0x00000020},
525      {NoFlag, 0xffff8001, 0x0000007d}, {NoFlag, 0xffff8001, 0x0000007e},
526      {NoFlag, 0xffff8001, 0x0000007f}, {NoFlag, 0xffff8001, 0x00007ffd},
527      {NoFlag, 0xffff8001, 0x00007ffe}, {NoFlag, 0xffff8001, 0x00007fff},
528      {NoFlag, 0xffff8001, 0x33333333}, {NoFlag, 0xffff8001, 0x55555555},
529      {NoFlag, 0xffff8001, 0x7ffffffd}, {NoFlag, 0xffff8001, 0x7ffffffe},
530      {NoFlag, 0xffff8001, 0x7fffffff}, {NoFlag, 0xffff8001, 0x80000000},
531      {NoFlag, 0xffff8001, 0x80000001}, {NoFlag, 0xffff8001, 0xaaaaaaaa},
532      {NoFlag, 0xffff8001, 0xcccccccc}, {NoFlag, 0xffff8001, 0xffff8000},
533      {NoFlag, 0xffff8001, 0xffff8001}, {NoFlag, 0xffff8001, 0xffff8002},
534      {NoFlag, 0xffff8001, 0xffff8003}, {NoFlag, 0xffff8001, 0xffffff80},
535      {NoFlag, 0xffff8001, 0xffffff81}, {NoFlag, 0xffff8001, 0xffffff82},
536      {NoFlag, 0xffff8001, 0xffffff83}, {NoFlag, 0xffff8001, 0xffffffe0},
537      {NoFlag, 0xffff8001, 0xfffffffd}, {NoFlag, 0xffff8001, 0xfffffffe},
538      {NoFlag, 0xffff8001, 0xffffffff}, {NoFlag, 0xffff8002, 0x00000000},
539      {NoFlag, 0xffff8002, 0x00000001}, {NoFlag, 0xffff8002, 0x00000002},
540      {NoFlag, 0xffff8002, 0x00000020}, {NoFlag, 0xffff8002, 0x0000007d},
541      {NoFlag, 0xffff8002, 0x0000007e}, {NoFlag, 0xffff8002, 0x0000007f},
542      {NoFlag, 0xffff8002, 0x00007ffd}, {NoFlag, 0xffff8002, 0x00007ffe},
543      {NoFlag, 0xffff8002, 0x00007fff}, {NoFlag, 0xffff8002, 0x33333333},
544      {NoFlag, 0xffff8002, 0x55555555}, {NoFlag, 0xffff8002, 0x7ffffffd},
545      {NoFlag, 0xffff8002, 0x7ffffffe}, {NoFlag, 0xffff8002, 0x7fffffff},
546      {NoFlag, 0xffff8002, 0x80000000}, {NoFlag, 0xffff8002, 0x80000001},
547      {NoFlag, 0xffff8002, 0xaaaaaaaa}, {NoFlag, 0xffff8002, 0xcccccccc},
548      {NoFlag, 0xffff8002, 0xffff8000}, {NoFlag, 0xffff8002, 0xffff8001},
549      {NoFlag, 0xffff8002, 0xffff8002}, {NoFlag, 0xffff8002, 0xffff8003},
550      {NoFlag, 0xffff8002, 0xffffff80}, {NoFlag, 0xffff8002, 0xffffff81},
551      {NoFlag, 0xffff8002, 0xffffff82}, {NoFlag, 0xffff8002, 0xffffff83},
552      {NoFlag, 0xffff8002, 0xffffffe0}, {NoFlag, 0xffff8002, 0xfffffffd},
553      {NoFlag, 0xffff8002, 0xfffffffe}, {NoFlag, 0xffff8002, 0xffffffff},
554      {NoFlag, 0xffff8003, 0x00000000}, {NoFlag, 0xffff8003, 0x00000001},
555      {NoFlag, 0xffff8003, 0x00000002}, {NoFlag, 0xffff8003, 0x00000020},
556      {NoFlag, 0xffff8003, 0x0000007d}, {NoFlag, 0xffff8003, 0x0000007e},
557      {NoFlag, 0xffff8003, 0x0000007f}, {NoFlag, 0xffff8003, 0x00007ffd},
558      {NoFlag, 0xffff8003, 0x00007ffe}, {NoFlag, 0xffff8003, 0x00007fff},
559      {NoFlag, 0xffff8003, 0x33333333}, {NoFlag, 0xffff8003, 0x55555555},
560      {NoFlag, 0xffff8003, 0x7ffffffd}, {NoFlag, 0xffff8003, 0x7ffffffe},
561      {NoFlag, 0xffff8003, 0x7fffffff}, {NoFlag, 0xffff8003, 0x80000000},
562      {NoFlag, 0xffff8003, 0x80000001}, {NoFlag, 0xffff8003, 0xaaaaaaaa},
563      {NoFlag, 0xffff8003, 0xcccccccc}, {NoFlag, 0xffff8003, 0xffff8000},
564      {NoFlag, 0xffff8003, 0xffff8001}, {NoFlag, 0xffff8003, 0xffff8002},
565      {NoFlag, 0xffff8003, 0xffff8003}, {NoFlag, 0xffff8003, 0xffffff80},
566      {NoFlag, 0xffff8003, 0xffffff81}, {NoFlag, 0xffff8003, 0xffffff82},
567      {NoFlag, 0xffff8003, 0xffffff83}, {NoFlag, 0xffff8003, 0xffffffe0},
568      {NoFlag, 0xffff8003, 0xfffffffd}, {NoFlag, 0xffff8003, 0xfffffffe},
569      {NoFlag, 0xffff8003, 0xffffffff}, {NoFlag, 0xffffff80, 0x00000000},
570      {NoFlag, 0xffffff80, 0x00000001}, {NoFlag, 0xffffff80, 0x00000002},
571      {NoFlag, 0xffffff80, 0x00000020}, {NoFlag, 0xffffff80, 0x0000007d},
572      {NoFlag, 0xffffff80, 0x0000007e}, {NoFlag, 0xffffff80, 0x0000007f},
573      {NoFlag, 0xffffff80, 0x00007ffd}, {NoFlag, 0xffffff80, 0x00007ffe},
574      {NoFlag, 0xffffff80, 0x00007fff}, {NoFlag, 0xffffff80, 0x33333333},
575      {NoFlag, 0xffffff80, 0x55555555}, {NoFlag, 0xffffff80, 0x7ffffffd},
576      {NoFlag, 0xffffff80, 0x7ffffffe}, {NoFlag, 0xffffff80, 0x7fffffff},
577      {NoFlag, 0xffffff80, 0x80000000}, {NoFlag, 0xffffff80, 0x80000001},
578      {NoFlag, 0xffffff80, 0xaaaaaaaa}, {NoFlag, 0xffffff80, 0xcccccccc},
579      {NoFlag, 0xffffff80, 0xffff8000}, {NoFlag, 0xffffff80, 0xffff8001},
580      {NoFlag, 0xffffff80, 0xffff8002}, {NoFlag, 0xffffff80, 0xffff8003},
581      {NoFlag, 0xffffff80, 0xffffff80}, {NoFlag, 0xffffff80, 0xffffff81},
582      {NoFlag, 0xffffff80, 0xffffff82}, {NoFlag, 0xffffff80, 0xffffff83},
583      {NoFlag, 0xffffff80, 0xffffffe0}, {NoFlag, 0xffffff80, 0xfffffffd},
584      {NoFlag, 0xffffff80, 0xfffffffe}, {NoFlag, 0xffffff80, 0xffffffff},
585      {NoFlag, 0xffffff81, 0x00000000}, {NoFlag, 0xffffff81, 0x00000001},
586      {NoFlag, 0xffffff81, 0x00000002}, {NoFlag, 0xffffff81, 0x00000020},
587      {NoFlag, 0xffffff81, 0x0000007d}, {NoFlag, 0xffffff81, 0x0000007e},
588      {NoFlag, 0xffffff81, 0x0000007f}, {NoFlag, 0xffffff81, 0x00007ffd},
589      {NoFlag, 0xffffff81, 0x00007ffe}, {NoFlag, 0xffffff81, 0x00007fff},
590      {NoFlag, 0xffffff81, 0x33333333}, {NoFlag, 0xffffff81, 0x55555555},
591      {NoFlag, 0xffffff81, 0x7ffffffd}, {NoFlag, 0xffffff81, 0x7ffffffe},
592      {NoFlag, 0xffffff81, 0x7fffffff}, {NoFlag, 0xffffff81, 0x80000000},
593      {NoFlag, 0xffffff81, 0x80000001}, {NoFlag, 0xffffff81, 0xaaaaaaaa},
594      {NoFlag, 0xffffff81, 0xcccccccc}, {NoFlag, 0xffffff81, 0xffff8000},
595      {NoFlag, 0xffffff81, 0xffff8001}, {NoFlag, 0xffffff81, 0xffff8002},
596      {NoFlag, 0xffffff81, 0xffff8003}, {NoFlag, 0xffffff81, 0xffffff80},
597      {NoFlag, 0xffffff81, 0xffffff81}, {NoFlag, 0xffffff81, 0xffffff82},
598      {NoFlag, 0xffffff81, 0xffffff83}, {NoFlag, 0xffffff81, 0xffffffe0},
599      {NoFlag, 0xffffff81, 0xfffffffd}, {NoFlag, 0xffffff81, 0xfffffffe},
600      {NoFlag, 0xffffff81, 0xffffffff}, {NoFlag, 0xffffff82, 0x00000000},
601      {NoFlag, 0xffffff82, 0x00000001}, {NoFlag, 0xffffff82, 0x00000002},
602      {NoFlag, 0xffffff82, 0x00000020}, {NoFlag, 0xffffff82, 0x0000007d},
603      {NoFlag, 0xffffff82, 0x0000007e}, {NoFlag, 0xffffff82, 0x0000007f},
604      {NoFlag, 0xffffff82, 0x00007ffd}, {NoFlag, 0xffffff82, 0x00007ffe},
605      {NoFlag, 0xffffff82, 0x00007fff}, {NoFlag, 0xffffff82, 0x33333333},
606      {NoFlag, 0xffffff82, 0x55555555}, {NoFlag, 0xffffff82, 0x7ffffffd},
607      {NoFlag, 0xffffff82, 0x7ffffffe}, {NoFlag, 0xffffff82, 0x7fffffff},
608      {NoFlag, 0xffffff82, 0x80000000}, {NoFlag, 0xffffff82, 0x80000001},
609      {NoFlag, 0xffffff82, 0xaaaaaaaa}, {NoFlag, 0xffffff82, 0xcccccccc},
610      {NoFlag, 0xffffff82, 0xffff8000}, {NoFlag, 0xffffff82, 0xffff8001},
611      {NoFlag, 0xffffff82, 0xffff8002}, {NoFlag, 0xffffff82, 0xffff8003},
612      {NoFlag, 0xffffff82, 0xffffff80}, {NoFlag, 0xffffff82, 0xffffff81},
613      {NoFlag, 0xffffff82, 0xffffff82}, {NoFlag, 0xffffff82, 0xffffff83},
614      {NoFlag, 0xffffff82, 0xffffffe0}, {NoFlag, 0xffffff82, 0xfffffffd},
615      {NoFlag, 0xffffff82, 0xfffffffe}, {NoFlag, 0xffffff82, 0xffffffff},
616      {NoFlag, 0xffffff83, 0x00000000}, {NoFlag, 0xffffff83, 0x00000001},
617      {NoFlag, 0xffffff83, 0x00000002}, {NoFlag, 0xffffff83, 0x00000020},
618      {NoFlag, 0xffffff83, 0x0000007d}, {NoFlag, 0xffffff83, 0x0000007e},
619      {NoFlag, 0xffffff83, 0x0000007f}, {NoFlag, 0xffffff83, 0x00007ffd},
620      {NoFlag, 0xffffff83, 0x00007ffe}, {NoFlag, 0xffffff83, 0x00007fff},
621      {NoFlag, 0xffffff83, 0x33333333}, {NoFlag, 0xffffff83, 0x55555555},
622      {NoFlag, 0xffffff83, 0x7ffffffd}, {NoFlag, 0xffffff83, 0x7ffffffe},
623      {NoFlag, 0xffffff83, 0x7fffffff}, {NoFlag, 0xffffff83, 0x80000000},
624      {NoFlag, 0xffffff83, 0x80000001}, {NoFlag, 0xffffff83, 0xaaaaaaaa},
625      {NoFlag, 0xffffff83, 0xcccccccc}, {NoFlag, 0xffffff83, 0xffff8000},
626      {NoFlag, 0xffffff83, 0xffff8001}, {NoFlag, 0xffffff83, 0xffff8002},
627      {NoFlag, 0xffffff83, 0xffff8003}, {NoFlag, 0xffffff83, 0xffffff80},
628      {NoFlag, 0xffffff83, 0xffffff81}, {NoFlag, 0xffffff83, 0xffffff82},
629      {NoFlag, 0xffffff83, 0xffffff83}, {NoFlag, 0xffffff83, 0xffffffe0},
630      {NoFlag, 0xffffff83, 0xfffffffd}, {NoFlag, 0xffffff83, 0xfffffffe},
631      {NoFlag, 0xffffff83, 0xffffffff}, {NoFlag, 0xffffffe0, 0x00000000},
632      {NoFlag, 0xffffffe0, 0x00000001}, {NoFlag, 0xffffffe0, 0x00000002},
633      {NoFlag, 0xffffffe0, 0x00000020}, {NoFlag, 0xffffffe0, 0x0000007d},
634      {NoFlag, 0xffffffe0, 0x0000007e}, {NoFlag, 0xffffffe0, 0x0000007f},
635      {NoFlag, 0xffffffe0, 0x00007ffd}, {NoFlag, 0xffffffe0, 0x00007ffe},
636      {NoFlag, 0xffffffe0, 0x00007fff}, {NoFlag, 0xffffffe0, 0x33333333},
637      {NoFlag, 0xffffffe0, 0x55555555}, {NoFlag, 0xffffffe0, 0x7ffffffd},
638      {NoFlag, 0xffffffe0, 0x7ffffffe}, {NoFlag, 0xffffffe0, 0x7fffffff},
639      {NoFlag, 0xffffffe0, 0x80000000}, {NoFlag, 0xffffffe0, 0x80000001},
640      {NoFlag, 0xffffffe0, 0xaaaaaaaa}, {NoFlag, 0xffffffe0, 0xcccccccc},
641      {NoFlag, 0xffffffe0, 0xffff8000}, {NoFlag, 0xffffffe0, 0xffff8001},
642      {NoFlag, 0xffffffe0, 0xffff8002}, {NoFlag, 0xffffffe0, 0xffff8003},
643      {NoFlag, 0xffffffe0, 0xffffff80}, {NoFlag, 0xffffffe0, 0xffffff81},
644      {NoFlag, 0xffffffe0, 0xffffff82}, {NoFlag, 0xffffffe0, 0xffffff83},
645      {NoFlag, 0xffffffe0, 0xffffffe0}, {NoFlag, 0xffffffe0, 0xfffffffd},
646      {NoFlag, 0xffffffe0, 0xfffffffe}, {NoFlag, 0xffffffe0, 0xffffffff},
647      {NoFlag, 0xfffffffd, 0x00000000}, {NoFlag, 0xfffffffd, 0x00000001},
648      {NoFlag, 0xfffffffd, 0x00000002}, {NoFlag, 0xfffffffd, 0x00000020},
649      {NoFlag, 0xfffffffd, 0x0000007d}, {NoFlag, 0xfffffffd, 0x0000007e},
650      {NoFlag, 0xfffffffd, 0x0000007f}, {NoFlag, 0xfffffffd, 0x00007ffd},
651      {NoFlag, 0xfffffffd, 0x00007ffe}, {NoFlag, 0xfffffffd, 0x00007fff},
652      {NoFlag, 0xfffffffd, 0x33333333}, {NoFlag, 0xfffffffd, 0x55555555},
653      {NoFlag, 0xfffffffd, 0x7ffffffd}, {NoFlag, 0xfffffffd, 0x7ffffffe},
654      {NoFlag, 0xfffffffd, 0x7fffffff}, {NoFlag, 0xfffffffd, 0x80000000},
655      {NoFlag, 0xfffffffd, 0x80000001}, {NoFlag, 0xfffffffd, 0xaaaaaaaa},
656      {NoFlag, 0xfffffffd, 0xcccccccc}, {NoFlag, 0xfffffffd, 0xffff8000},
657      {NoFlag, 0xfffffffd, 0xffff8001}, {NoFlag, 0xfffffffd, 0xffff8002},
658      {NoFlag, 0xfffffffd, 0xffff8003}, {NoFlag, 0xfffffffd, 0xffffff80},
659      {NoFlag, 0xfffffffd, 0xffffff81}, {NoFlag, 0xfffffffd, 0xffffff82},
660      {NoFlag, 0xfffffffd, 0xffffff83}, {NoFlag, 0xfffffffd, 0xffffffe0},
661      {NoFlag, 0xfffffffd, 0xfffffffd}, {NoFlag, 0xfffffffd, 0xfffffffe},
662      {NoFlag, 0xfffffffd, 0xffffffff}, {NoFlag, 0xfffffffe, 0x00000000},
663      {NoFlag, 0xfffffffe, 0x00000001}, {NoFlag, 0xfffffffe, 0x00000002},
664      {NoFlag, 0xfffffffe, 0x00000020}, {NoFlag, 0xfffffffe, 0x0000007d},
665      {NoFlag, 0xfffffffe, 0x0000007e}, {NoFlag, 0xfffffffe, 0x0000007f},
666      {NoFlag, 0xfffffffe, 0x00007ffd}, {NoFlag, 0xfffffffe, 0x00007ffe},
667      {NoFlag, 0xfffffffe, 0x00007fff}, {NoFlag, 0xfffffffe, 0x33333333},
668      {NoFlag, 0xfffffffe, 0x55555555}, {NoFlag, 0xfffffffe, 0x7ffffffd},
669      {NoFlag, 0xfffffffe, 0x7ffffffe}, {NoFlag, 0xfffffffe, 0x7fffffff},
670      {NoFlag, 0xfffffffe, 0x80000000}, {NoFlag, 0xfffffffe, 0x80000001},
671      {NoFlag, 0xfffffffe, 0xaaaaaaaa}, {NoFlag, 0xfffffffe, 0xcccccccc},
672      {NoFlag, 0xfffffffe, 0xffff8000}, {NoFlag, 0xfffffffe, 0xffff8001},
673      {NoFlag, 0xfffffffe, 0xffff8002}, {NoFlag, 0xfffffffe, 0xffff8003},
674      {NoFlag, 0xfffffffe, 0xffffff80}, {NoFlag, 0xfffffffe, 0xffffff81},
675      {NoFlag, 0xfffffffe, 0xffffff82}, {NoFlag, 0xfffffffe, 0xffffff83},
676      {NoFlag, 0xfffffffe, 0xffffffe0}, {NoFlag, 0xfffffffe, 0xfffffffd},
677      {NoFlag, 0xfffffffe, 0xfffffffe}, {NoFlag, 0xfffffffe, 0xffffffff},
678      {NoFlag, 0xffffffff, 0x00000000}, {NoFlag, 0xffffffff, 0x00000001},
679      {NoFlag, 0xffffffff, 0x00000002}, {NoFlag, 0xffffffff, 0x00000020},
680      {NoFlag, 0xffffffff, 0x0000007d}, {NoFlag, 0xffffffff, 0x0000007e},
681      {NoFlag, 0xffffffff, 0x0000007f}, {NoFlag, 0xffffffff, 0x00007ffd},
682      {NoFlag, 0xffffffff, 0x00007ffe}, {NoFlag, 0xffffffff, 0x00007fff},
683      {NoFlag, 0xffffffff, 0x33333333}, {NoFlag, 0xffffffff, 0x55555555},
684      {NoFlag, 0xffffffff, 0x7ffffffd}, {NoFlag, 0xffffffff, 0x7ffffffe},
685      {NoFlag, 0xffffffff, 0x7fffffff}, {NoFlag, 0xffffffff, 0x80000000},
686      {NoFlag, 0xffffffff, 0x80000001}, {NoFlag, 0xffffffff, 0xaaaaaaaa},
687      {NoFlag, 0xffffffff, 0xcccccccc}, {NoFlag, 0xffffffff, 0xffff8000},
688      {NoFlag, 0xffffffff, 0xffff8001}, {NoFlag, 0xffffffff, 0xffff8002},
689      {NoFlag, 0xffffffff, 0xffff8003}, {NoFlag, 0xffffffff, 0xffffff80},
690      {NoFlag, 0xffffffff, 0xffffff81}, {NoFlag, 0xffffffff, 0xffffff82},
691      {NoFlag, 0xffffffff, 0xffffff83}, {NoFlag, 0xffffffff, 0xffffffe0},
692      {NoFlag, 0xffffffff, 0xfffffffd}, {NoFlag, 0xffffffff, 0xfffffffe},
693      {NoFlag, 0xffffffff, 0xffffffff}};
694 
695 static const Inputs kModifiedImmediate[] =
696     {{NoFlag, 0xabababab, 0x00000000}, {NoFlag, 0xabababab, 0x00000001},
697      {NoFlag, 0xabababab, 0x00000002}, {NoFlag, 0xabababab, 0x00000020},
698      {NoFlag, 0xabababab, 0x0000007d}, {NoFlag, 0xabababab, 0x0000007e},
699      {NoFlag, 0xabababab, 0x0000007f}, {NoFlag, 0xabababab, 0x00007ffd},
700      {NoFlag, 0xabababab, 0x00007ffe}, {NoFlag, 0xabababab, 0x00007fff},
701      {NoFlag, 0xabababab, 0x33333333}, {NoFlag, 0xabababab, 0x55555555},
702      {NoFlag, 0xabababab, 0x7ffffffd}, {NoFlag, 0xabababab, 0x7ffffffe},
703      {NoFlag, 0xabababab, 0x7fffffff}, {NoFlag, 0xabababab, 0x80000000},
704      {NoFlag, 0xabababab, 0x80000001}, {NoFlag, 0xabababab, 0xaaaaaaaa},
705      {NoFlag, 0xabababab, 0xcccccccc}, {NoFlag, 0xabababab, 0xffff8000},
706      {NoFlag, 0xabababab, 0xffff8001}, {NoFlag, 0xabababab, 0xffff8002},
707      {NoFlag, 0xabababab, 0xffff8003}, {NoFlag, 0xabababab, 0xffffff80},
708      {NoFlag, 0xabababab, 0xffffff81}, {NoFlag, 0xabababab, 0xffffff82},
709      {NoFlag, 0xabababab, 0xffffff83}, {NoFlag, 0xabababab, 0xffffffe0},
710      {NoFlag, 0xabababab, 0xfffffffd}, {NoFlag, 0xabababab, 0xfffffffe},
711      {NoFlag, 0xabababab, 0xffffffff}};
712 
713 
714 // A loop will be generated for each element of this array.
715 const TestLoopData kTests[] = {{{eq, r0, r0, 0x000000ab},
716                                 "eq r0 r0 0x000000ab",
717                                 "Condition_eq_r0_r0_0x000000ab",
718                                 ARRAY_SIZE(kCondition),
719                                 kCondition},
720                                {{ne, r0, r0, 0x000000ab},
721                                 "ne r0 r0 0x000000ab",
722                                 "Condition_ne_r0_r0_0x000000ab",
723                                 ARRAY_SIZE(kCondition),
724                                 kCondition},
725                                {{cs, r0, r0, 0x000000ab},
726                                 "cs r0 r0 0x000000ab",
727                                 "Condition_cs_r0_r0_0x000000ab",
728                                 ARRAY_SIZE(kCondition),
729                                 kCondition},
730                                {{cc, r0, r0, 0x000000ab},
731                                 "cc r0 r0 0x000000ab",
732                                 "Condition_cc_r0_r0_0x000000ab",
733                                 ARRAY_SIZE(kCondition),
734                                 kCondition},
735                                {{mi, r0, r0, 0x000000ab},
736                                 "mi r0 r0 0x000000ab",
737                                 "Condition_mi_r0_r0_0x000000ab",
738                                 ARRAY_SIZE(kCondition),
739                                 kCondition},
740                                {{pl, r0, r0, 0x000000ab},
741                                 "pl r0 r0 0x000000ab",
742                                 "Condition_pl_r0_r0_0x000000ab",
743                                 ARRAY_SIZE(kCondition),
744                                 kCondition},
745                                {{vs, r0, r0, 0x000000ab},
746                                 "vs r0 r0 0x000000ab",
747                                 "Condition_vs_r0_r0_0x000000ab",
748                                 ARRAY_SIZE(kCondition),
749                                 kCondition},
750                                {{vc, r0, r0, 0x000000ab},
751                                 "vc r0 r0 0x000000ab",
752                                 "Condition_vc_r0_r0_0x000000ab",
753                                 ARRAY_SIZE(kCondition),
754                                 kCondition},
755                                {{hi, r0, r0, 0x000000ab},
756                                 "hi r0 r0 0x000000ab",
757                                 "Condition_hi_r0_r0_0x000000ab",
758                                 ARRAY_SIZE(kCondition),
759                                 kCondition},
760                                {{ls, r0, r0, 0x000000ab},
761                                 "ls r0 r0 0x000000ab",
762                                 "Condition_ls_r0_r0_0x000000ab",
763                                 ARRAY_SIZE(kCondition),
764                                 kCondition},
765                                {{ge, r0, r0, 0x000000ab},
766                                 "ge r0 r0 0x000000ab",
767                                 "Condition_ge_r0_r0_0x000000ab",
768                                 ARRAY_SIZE(kCondition),
769                                 kCondition},
770                                {{lt, r0, r0, 0x000000ab},
771                                 "lt r0 r0 0x000000ab",
772                                 "Condition_lt_r0_r0_0x000000ab",
773                                 ARRAY_SIZE(kCondition),
774                                 kCondition},
775                                {{gt, r0, r0, 0x000000ab},
776                                 "gt r0 r0 0x000000ab",
777                                 "Condition_gt_r0_r0_0x000000ab",
778                                 ARRAY_SIZE(kCondition),
779                                 kCondition},
780                                {{le, r0, r0, 0x000000ab},
781                                 "le r0 r0 0x000000ab",
782                                 "Condition_le_r0_r0_0x000000ab",
783                                 ARRAY_SIZE(kCondition),
784                                 kCondition},
785                                {{al, r0, r0, 0x000000ab},
786                                 "al r0 r0 0x000000ab",
787                                 "Condition_al_r0_r0_0x000000ab",
788                                 ARRAY_SIZE(kCondition),
789                                 kCondition},
790                                {{al, r4, r4, 0x02ac0000},
791                                 "al r4 r4 0x02ac0000",
792                                 "RdIsRn_al_r4_r4_0x02ac0000",
793                                 ARRAY_SIZE(kRdIsRn),
794                                 kRdIsRn},
795                                {{al, r0, r0, 0xf000000f},
796                                 "al r0 r0 0xf000000f",
797                                 "RdIsRn_al_r0_r0_0xf000000f",
798                                 ARRAY_SIZE(kRdIsRn),
799                                 kRdIsRn},
800                                {{al, r1, r1, 0x00000ff0},
801                                 "al r1 r1 0x00000ff0",
802                                 "RdIsRn_al_r1_r1_0x00000ff0",
803                                 ARRAY_SIZE(kRdIsRn),
804                                 kRdIsRn},
805                                {{al, r9, r9, 0x0ff00000},
806                                 "al r9 r9 0x0ff00000",
807                                 "RdIsRn_al_r9_r9_0x0ff00000",
808                                 ARRAY_SIZE(kRdIsRn),
809                                 kRdIsRn},
810                                {{al, r14, r14, 0xf000000f},
811                                 "al r14 r14 0xf000000f",
812                                 "RdIsRn_al_r14_r14_0xf000000f",
813                                 ARRAY_SIZE(kRdIsRn),
814                                 kRdIsRn},
815                                {{al, r1, r1, 0x00ab0000},
816                                 "al r1 r1 0x00ab0000",
817                                 "RdIsRn_al_r1_r1_0x00ab0000",
818                                 ARRAY_SIZE(kRdIsRn),
819                                 kRdIsRn},
820                                {{al, r10, r10, 0x00002ac0},
821                                 "al r10 r10 0x00002ac0",
822                                 "RdIsRn_al_r10_r10_0x00002ac0",
823                                 ARRAY_SIZE(kRdIsRn),
824                                 kRdIsRn},
825                                {{al, r6, r6, 0x0002ac00},
826                                 "al r6 r6 0x0002ac00",
827                                 "RdIsRn_al_r6_r6_0x0002ac00",
828                                 ARRAY_SIZE(kRdIsRn),
829                                 kRdIsRn},
830                                {{al, r3, r3, 0xac000002},
831                                 "al r3 r3 0xac000002",
832                                 "RdIsRn_al_r3_r3_0xac000002",
833                                 ARRAY_SIZE(kRdIsRn),
834                                 kRdIsRn},
835                                {{al, r6, r6, 0x00000ab0},
836                                 "al r6 r6 0x00000ab0",
837                                 "RdIsRn_al_r6_r6_0x00000ab0",
838                                 ARRAY_SIZE(kRdIsRn),
839                                 kRdIsRn},
840                                {{al, r4, r10, 0xac000002},
841                                 "al r4 r10 0xac000002",
842                                 "RdIsNotRn_al_r4_r10_0xac000002",
843                                 ARRAY_SIZE(kRdIsNotRn),
844                                 kRdIsNotRn},
845                                {{al, r0, r4, 0xc000003f},
846                                 "al r0 r4 0xc000003f",
847                                 "RdIsNotRn_al_r0_r4_0xc000003f",
848                                 ARRAY_SIZE(kRdIsNotRn),
849                                 kRdIsNotRn},
850                                {{al, r8, r0, 0xc000003f},
851                                 "al r8 r0 0xc000003f",
852                                 "RdIsNotRn_al_r8_r0_0xc000003f",
853                                 ARRAY_SIZE(kRdIsNotRn),
854                                 kRdIsNotRn},
855                                {{al, r5, r0, 0x00ab0000},
856                                 "al r5 r0 0x00ab0000",
857                                 "RdIsNotRn_al_r5_r0_0x00ab0000",
858                                 ARRAY_SIZE(kRdIsNotRn),
859                                 kRdIsNotRn},
860                                {{al, r8, r14, 0x002ac000},
861                                 "al r8 r14 0x002ac000",
862                                 "RdIsNotRn_al_r8_r14_0x002ac000",
863                                 ARRAY_SIZE(kRdIsNotRn),
864                                 kRdIsNotRn},
865                                {{al, r2, r11, 0x0002ac00},
866                                 "al r2 r11 0x0002ac00",
867                                 "RdIsNotRn_al_r2_r11_0x0002ac00",
868                                 ARRAY_SIZE(kRdIsNotRn),
869                                 kRdIsNotRn},
870                                {{al, r1, r0, 0x0000ff00},
871                                 "al r1 r0 0x0000ff00",
872                                 "RdIsNotRn_al_r1_r0_0x0000ff00",
873                                 ARRAY_SIZE(kRdIsNotRn),
874                                 kRdIsNotRn},
875                                {{al, r1, r7, 0x003fc000},
876                                 "al r1 r7 0x003fc000",
877                                 "RdIsNotRn_al_r1_r7_0x003fc000",
878                                 ARRAY_SIZE(kRdIsNotRn),
879                                 kRdIsNotRn},
880                                {{al, r11, r8, 0x0ab00000},
881                                 "al r11 r8 0x0ab00000",
882                                 "RdIsNotRn_al_r11_r8_0x0ab00000",
883                                 ARRAY_SIZE(kRdIsNotRn),
884                                 kRdIsNotRn},
885                                {{al, r14, r12, 0x3fc00000},
886                                 "al r14 r12 0x3fc00000",
887                                 "RdIsNotRn_al_r14_r12_0x3fc00000",
888                                 ARRAY_SIZE(kRdIsNotRn),
889                                 kRdIsNotRn},
890                                {{al, r0, r0, 0x00000000},
891                                 "al r0 r0 0x00000000",
892                                 "ModifiedImmediate_al_r0_r0_0x00000000",
893                                 ARRAY_SIZE(kModifiedImmediate),
894                                 kModifiedImmediate},
895                                {{al, r0, r0, 0x000000ff},
896                                 "al r0 r0 0x000000ff",
897                                 "ModifiedImmediate_al_r0_r0_0x000000ff",
898                                 ARRAY_SIZE(kModifiedImmediate),
899                                 kModifiedImmediate},
900                                {{al, r0, r0, 0xc000003f},
901                                 "al r0 r0 0xc000003f",
902                                 "ModifiedImmediate_al_r0_r0_0xc000003f",
903                                 ARRAY_SIZE(kModifiedImmediate),
904                                 kModifiedImmediate},
905                                {{al, r0, r0, 0xf000000f},
906                                 "al r0 r0 0xf000000f",
907                                 "ModifiedImmediate_al_r0_r0_0xf000000f",
908                                 ARRAY_SIZE(kModifiedImmediate),
909                                 kModifiedImmediate},
910                                {{al, r0, r0, 0xfc000003},
911                                 "al r0 r0 0xfc000003",
912                                 "ModifiedImmediate_al_r0_r0_0xfc000003",
913                                 ARRAY_SIZE(kModifiedImmediate),
914                                 kModifiedImmediate},
915                                {{al, r0, r0, 0xff000000},
916                                 "al r0 r0 0xff000000",
917                                 "ModifiedImmediate_al_r0_r0_0xff000000",
918                                 ARRAY_SIZE(kModifiedImmediate),
919                                 kModifiedImmediate},
920                                {{al, r0, r0, 0x3fc00000},
921                                 "al r0 r0 0x3fc00000",
922                                 "ModifiedImmediate_al_r0_r0_0x3fc00000",
923                                 ARRAY_SIZE(kModifiedImmediate),
924                                 kModifiedImmediate},
925                                {{al, r0, r0, 0x0ff00000},
926                                 "al r0 r0 0x0ff00000",
927                                 "ModifiedImmediate_al_r0_r0_0x0ff00000",
928                                 ARRAY_SIZE(kModifiedImmediate),
929                                 kModifiedImmediate},
930                                {{al, r0, r0, 0x03fc0000},
931                                 "al r0 r0 0x03fc0000",
932                                 "ModifiedImmediate_al_r0_r0_0x03fc0000",
933                                 ARRAY_SIZE(kModifiedImmediate),
934                                 kModifiedImmediate},
935                                {{al, r0, r0, 0x00ff0000},
936                                 "al r0 r0 0x00ff0000",
937                                 "ModifiedImmediate_al_r0_r0_0x00ff0000",
938                                 ARRAY_SIZE(kModifiedImmediate),
939                                 kModifiedImmediate},
940                                {{al, r0, r0, 0x003fc000},
941                                 "al r0 r0 0x003fc000",
942                                 "ModifiedImmediate_al_r0_r0_0x003fc000",
943                                 ARRAY_SIZE(kModifiedImmediate),
944                                 kModifiedImmediate},
945                                {{al, r0, r0, 0x000ff000},
946                                 "al r0 r0 0x000ff000",
947                                 "ModifiedImmediate_al_r0_r0_0x000ff000",
948                                 ARRAY_SIZE(kModifiedImmediate),
949                                 kModifiedImmediate},
950                                {{al, r0, r0, 0x0003fc00},
951                                 "al r0 r0 0x0003fc00",
952                                 "ModifiedImmediate_al_r0_r0_0x0003fc00",
953                                 ARRAY_SIZE(kModifiedImmediate),
954                                 kModifiedImmediate},
955                                {{al, r0, r0, 0x0000ff00},
956                                 "al r0 r0 0x0000ff00",
957                                 "ModifiedImmediate_al_r0_r0_0x0000ff00",
958                                 ARRAY_SIZE(kModifiedImmediate),
959                                 kModifiedImmediate},
960                                {{al, r0, r0, 0x00003fc0},
961                                 "al r0 r0 0x00003fc0",
962                                 "ModifiedImmediate_al_r0_r0_0x00003fc0",
963                                 ARRAY_SIZE(kModifiedImmediate),
964                                 kModifiedImmediate},
965                                {{al, r0, r0, 0x00000ff0},
966                                 "al r0 r0 0x00000ff0",
967                                 "ModifiedImmediate_al_r0_r0_0x00000ff0",
968                                 ARRAY_SIZE(kModifiedImmediate),
969                                 kModifiedImmediate},
970                                {{al, r0, r0, 0x000003fc},
971                                 "al r0 r0 0x000003fc",
972                                 "ModifiedImmediate_al_r0_r0_0x000003fc",
973                                 ARRAY_SIZE(kModifiedImmediate),
974                                 kModifiedImmediate},
975                                {{al, r0, r0, 0x000000ab},
976                                 "al r0 r0 0x000000ab",
977                                 "ModifiedImmediate_al_r0_r0_0x000000ab",
978                                 ARRAY_SIZE(kModifiedImmediate),
979                                 kModifiedImmediate},
980                                {{al, r0, r0, 0xc000002a},
981                                 "al r0 r0 0xc000002a",
982                                 "ModifiedImmediate_al_r0_r0_0xc000002a",
983                                 ARRAY_SIZE(kModifiedImmediate),
984                                 kModifiedImmediate},
985                                {{al, r0, r0, 0xb000000a},
986                                 "al r0 r0 0xb000000a",
987                                 "ModifiedImmediate_al_r0_r0_0xb000000a",
988                                 ARRAY_SIZE(kModifiedImmediate),
989                                 kModifiedImmediate},
990                                {{al, r0, r0, 0xac000002},
991                                 "al r0 r0 0xac000002",
992                                 "ModifiedImmediate_al_r0_r0_0xac000002",
993                                 ARRAY_SIZE(kModifiedImmediate),
994                                 kModifiedImmediate},
995                                {{al, r0, r0, 0xab000000},
996                                 "al r0 r0 0xab000000",
997                                 "ModifiedImmediate_al_r0_r0_0xab000000",
998                                 ARRAY_SIZE(kModifiedImmediate),
999                                 kModifiedImmediate},
1000                                {{al, r0, r0, 0x2ac00000},
1001                                 "al r0 r0 0x2ac00000",
1002                                 "ModifiedImmediate_al_r0_r0_0x2ac00000",
1003                                 ARRAY_SIZE(kModifiedImmediate),
1004                                 kModifiedImmediate},
1005                                {{al, r0, r0, 0x0ab00000},
1006                                 "al r0 r0 0x0ab00000",
1007                                 "ModifiedImmediate_al_r0_r0_0x0ab00000",
1008                                 ARRAY_SIZE(kModifiedImmediate),
1009                                 kModifiedImmediate},
1010                                {{al, r0, r0, 0x02ac0000},
1011                                 "al r0 r0 0x02ac0000",
1012                                 "ModifiedImmediate_al_r0_r0_0x02ac0000",
1013                                 ARRAY_SIZE(kModifiedImmediate),
1014                                 kModifiedImmediate},
1015                                {{al, r0, r0, 0x00ab0000},
1016                                 "al r0 r0 0x00ab0000",
1017                                 "ModifiedImmediate_al_r0_r0_0x00ab0000",
1018                                 ARRAY_SIZE(kModifiedImmediate),
1019                                 kModifiedImmediate},
1020                                {{al, r0, r0, 0x002ac000},
1021                                 "al r0 r0 0x002ac000",
1022                                 "ModifiedImmediate_al_r0_r0_0x002ac000",
1023                                 ARRAY_SIZE(kModifiedImmediate),
1024                                 kModifiedImmediate},
1025                                {{al, r0, r0, 0x000ab000},
1026                                 "al r0 r0 0x000ab000",
1027                                 "ModifiedImmediate_al_r0_r0_0x000ab000",
1028                                 ARRAY_SIZE(kModifiedImmediate),
1029                                 kModifiedImmediate},
1030                                {{al, r0, r0, 0x0002ac00},
1031                                 "al r0 r0 0x0002ac00",
1032                                 "ModifiedImmediate_al_r0_r0_0x0002ac00",
1033                                 ARRAY_SIZE(kModifiedImmediate),
1034                                 kModifiedImmediate},
1035                                {{al, r0, r0, 0x0000ab00},
1036                                 "al r0 r0 0x0000ab00",
1037                                 "ModifiedImmediate_al_r0_r0_0x0000ab00",
1038                                 ARRAY_SIZE(kModifiedImmediate),
1039                                 kModifiedImmediate},
1040                                {{al, r0, r0, 0x00002ac0},
1041                                 "al r0 r0 0x00002ac0",
1042                                 "ModifiedImmediate_al_r0_r0_0x00002ac0",
1043                                 ARRAY_SIZE(kModifiedImmediate),
1044                                 kModifiedImmediate},
1045                                {{al, r0, r0, 0x00000ab0},
1046                                 "al r0 r0 0x00000ab0",
1047                                 "ModifiedImmediate_al_r0_r0_0x00000ab0",
1048                                 ARRAY_SIZE(kModifiedImmediate),
1049                                 kModifiedImmediate},
1050                                {{al, r0, r0, 0x000002ac},
1051                                 "al r0 r0 0x000002ac",
1052                                 "ModifiedImmediate_al_r0_r0_0x000002ac",
1053                                 ARRAY_SIZE(kModifiedImmediate),
1054                                 kModifiedImmediate}};
1055 
1056 // We record all inputs to the instructions as outputs. This way, we also check
1057 // that what shouldn't change didn't change.
1058 struct TestResult {
1059   size_t output_size;
1060   const Inputs* outputs;
1061 };
1062 
1063 // These headers each contain an array of `TestResult` with the reference output
1064 // values. The reference arrays are names `kReference{mnemonic}`.
1065 #include "aarch32/traces/simulator-cond-rd-rn-operand-const-adc-a32.h"
1066 #include "aarch32/traces/simulator-cond-rd-rn-operand-const-adcs-a32.h"
1067 #include "aarch32/traces/simulator-cond-rd-rn-operand-const-add-a32.h"
1068 #include "aarch32/traces/simulator-cond-rd-rn-operand-const-adds-a32.h"
1069 #include "aarch32/traces/simulator-cond-rd-rn-operand-const-and-a32.h"
1070 #include "aarch32/traces/simulator-cond-rd-rn-operand-const-ands-a32.h"
1071 #include "aarch32/traces/simulator-cond-rd-rn-operand-const-bic-a32.h"
1072 #include "aarch32/traces/simulator-cond-rd-rn-operand-const-bics-a32.h"
1073 #include "aarch32/traces/simulator-cond-rd-rn-operand-const-eor-a32.h"
1074 #include "aarch32/traces/simulator-cond-rd-rn-operand-const-eors-a32.h"
1075 #include "aarch32/traces/simulator-cond-rd-rn-operand-const-orr-a32.h"
1076 #include "aarch32/traces/simulator-cond-rd-rn-operand-const-orrs-a32.h"
1077 #include "aarch32/traces/simulator-cond-rd-rn-operand-const-rsb-a32.h"
1078 #include "aarch32/traces/simulator-cond-rd-rn-operand-const-rsbs-a32.h"
1079 #include "aarch32/traces/simulator-cond-rd-rn-operand-const-rsc-a32.h"
1080 #include "aarch32/traces/simulator-cond-rd-rn-operand-const-rscs-a32.h"
1081 #include "aarch32/traces/simulator-cond-rd-rn-operand-const-sbc-a32.h"
1082 #include "aarch32/traces/simulator-cond-rd-rn-operand-const-sbcs-a32.h"
1083 #include "aarch32/traces/simulator-cond-rd-rn-operand-const-sub-a32.h"
1084 #include "aarch32/traces/simulator-cond-rd-rn-operand-const-subs-a32.h"
1085 
1086 
1087 // The maximum number of errors to report in detail for each test.
1088 const unsigned kErrorReportLimit = 8;
1089 
1090 typedef void (MacroAssembler::*Fn)(Condition cond,
1091                                    Register rd,
1092                                    Register rn,
1093                                    const Operand& op);
1094 
TestHelper(Fn instruction,const char * mnemonic,const TestResult reference[])1095 void TestHelper(Fn instruction,
1096                 const char* mnemonic,
1097                 const TestResult reference[]) {
1098   SETUP();
1099   masm.UseA32();
1100   START();
1101 
1102   // Data to compare to `reference`.
1103   TestResult* results[ARRAY_SIZE(kTests)];
1104 
1105   // Test cases for memory bound instructions may allocate a buffer and save its
1106   // address in this array.
1107   byte* scratch_memory_buffers[ARRAY_SIZE(kTests)];
1108 
1109   // Generate a loop for each element in `kTests`. Each loop tests one specific
1110   // instruction.
1111   for (unsigned i = 0; i < ARRAY_SIZE(kTests); i++) {
1112     // Allocate results on the heap for this test.
1113     results[i] = new TestResult;
1114     results[i]->outputs = new Inputs[kTests[i].input_size];
1115     results[i]->output_size = kTests[i].input_size;
1116 
1117     size_t input_stride = sizeof(kTests[i].inputs[0]) * kTests[i].input_size;
1118     VIXL_ASSERT(IsUint32(input_stride));
1119 
1120     scratch_memory_buffers[i] = NULL;
1121 
1122     Label loop;
1123     UseScratchRegisterScope scratch_registers(&masm);
1124     // Include all registers from r0 ro r12.
1125     scratch_registers.Include(RegisterList(0x1fff));
1126 
1127     // Values to pass to the macro-assembler.
1128     Condition cond = kTests[i].operands.cond;
1129     Register rd = kTests[i].operands.rd;
1130     Register rn = kTests[i].operands.rn;
1131     uint32_t immediate = kTests[i].operands.immediate;
1132     Operand op(immediate);
1133     scratch_registers.Exclude(rd);
1134     scratch_registers.Exclude(rn);
1135 
1136     // Allocate reserved registers for our own use.
1137     Register input_ptr = scratch_registers.Acquire();
1138     Register input_end = scratch_registers.Acquire();
1139     Register result_ptr = scratch_registers.Acquire();
1140 
1141     // Initialize `input_ptr` to the first element and `input_end` the address
1142     // after the array.
1143     __ Mov(input_ptr, Operand::From(kTests[i].inputs));
1144     __ Add(input_end, input_ptr, static_cast<uint32_t>(input_stride));
1145     __ Mov(result_ptr, Operand::From(results[i]->outputs));
1146     __ Bind(&loop);
1147 
1148     {
1149       UseScratchRegisterScope temp_registers(&masm);
1150       Register nzcv_bits = temp_registers.Acquire();
1151       Register saved_q_bit = temp_registers.Acquire();
1152       // Save the `Q` bit flag.
1153       __ Mrs(saved_q_bit, APSR);
1154       __ And(saved_q_bit, saved_q_bit, QFlag);
1155       // Set the `NZCV` and `Q` flags together.
1156       __ Ldr(nzcv_bits, MemOperand(input_ptr, offsetof(Inputs, apsr)));
1157       __ Orr(nzcv_bits, nzcv_bits, saved_q_bit);
1158       __ Msr(APSR_nzcvq, nzcv_bits);
1159     }
1160     __ Ldr(rd, MemOperand(input_ptr, offsetof(Inputs, rd)));
1161     __ Ldr(rn, MemOperand(input_ptr, offsetof(Inputs, rn)));
1162 
1163     (masm.*instruction)(cond, rd, rn, op);
1164 
1165     {
1166       UseScratchRegisterScope temp_registers(&masm);
1167       Register nzcv_bits = temp_registers.Acquire();
1168       __ Mrs(nzcv_bits, APSR);
1169       // Only record the NZCV bits.
1170       __ And(nzcv_bits, nzcv_bits, NZCVFlag);
1171       __ Str(nzcv_bits, MemOperand(result_ptr, offsetof(Inputs, apsr)));
1172     }
1173     __ Str(rd, MemOperand(result_ptr, offsetof(Inputs, rd)));
1174     __ Str(rn, MemOperand(result_ptr, offsetof(Inputs, rn)));
1175 
1176     // Advance the result pointer.
1177     __ Add(result_ptr, result_ptr, Operand::From(sizeof(kTests[i].inputs[0])));
1178     // Loop back until `input_ptr` is lower than `input_base`.
1179     __ Add(input_ptr, input_ptr, Operand::From(sizeof(kTests[i].inputs[0])));
1180     __ Cmp(input_ptr, input_end);
1181     __ B(ne, &loop);
1182   }
1183 
1184   END();
1185 
1186   RUN();
1187 
1188   if (Test::generate_test_trace()) {
1189     // Print the results.
1190     for (size_t i = 0; i < ARRAY_SIZE(kTests); i++) {
1191       printf("const Inputs kOutputs_%s_%s[] = {\n",
1192              mnemonic,
1193              kTests[i].identifier);
1194       for (size_t j = 0; j < results[i]->output_size; j++) {
1195         printf("  { ");
1196         printf("0x%08" PRIx32, results[i]->outputs[j].apsr);
1197         printf(", ");
1198         printf("0x%08" PRIx32, results[i]->outputs[j].rd);
1199         printf(", ");
1200         printf("0x%08" PRIx32, results[i]->outputs[j].rn);
1201         printf(" },\n");
1202       }
1203       printf("};\n");
1204     }
1205     printf("const TestResult kReference%s[] = {\n", mnemonic);
1206     for (size_t i = 0; i < ARRAY_SIZE(kTests); i++) {
1207       printf("  {\n");
1208       printf("    ARRAY_SIZE(kOutputs_%s_%s),\n",
1209              mnemonic,
1210              kTests[i].identifier);
1211       printf("    kOutputs_%s_%s,\n", mnemonic, kTests[i].identifier);
1212       printf("  },\n");
1213     }
1214     printf("};\n");
1215   } else if (kCheckSimulatorTestResults) {
1216     // Check the results.
1217     unsigned total_error_count = 0;
1218     for (size_t i = 0; i < ARRAY_SIZE(kTests); i++) {
1219       bool instruction_has_errors = false;
1220       for (size_t j = 0; j < kTests[i].input_size; j++) {
1221         uint32_t apsr = results[i]->outputs[j].apsr;
1222         uint32_t rd = results[i]->outputs[j].rd;
1223         uint32_t rn = results[i]->outputs[j].rn;
1224         uint32_t apsr_input = kTests[i].inputs[j].apsr;
1225         uint32_t rd_input = kTests[i].inputs[j].rd;
1226         uint32_t rn_input = kTests[i].inputs[j].rn;
1227         uint32_t apsr_ref = reference[i].outputs[j].apsr;
1228         uint32_t rd_ref = reference[i].outputs[j].rd;
1229         uint32_t rn_ref = reference[i].outputs[j].rn;
1230 
1231         if (((apsr != apsr_ref) || (rd != rd_ref) || (rn != rn_ref)) &&
1232             (++total_error_count <= kErrorReportLimit)) {
1233           // Print the instruction once even if it triggered multiple failures.
1234           if (!instruction_has_errors) {
1235             printf("Error(s) when testing \"%s %s\":\n",
1236                    mnemonic,
1237                    kTests[i].operands_description);
1238             instruction_has_errors = true;
1239           }
1240           // Print subsequent errors.
1241           printf("  Input:    ");
1242           printf("0x%08" PRIx32, apsr_input);
1243           printf(", ");
1244           printf("0x%08" PRIx32, rd_input);
1245           printf(", ");
1246           printf("0x%08" PRIx32, rn_input);
1247           printf("\n");
1248           printf("  Expected: ");
1249           printf("0x%08" PRIx32, apsr_ref);
1250           printf(", ");
1251           printf("0x%08" PRIx32, rd_ref);
1252           printf(", ");
1253           printf("0x%08" PRIx32, rn_ref);
1254           printf("\n");
1255           printf("  Found:    ");
1256           printf("0x%08" PRIx32, apsr);
1257           printf(", ");
1258           printf("0x%08" PRIx32, rd);
1259           printf(", ");
1260           printf("0x%08" PRIx32, rn);
1261           printf("\n\n");
1262         }
1263       }
1264     }
1265 
1266     if (total_error_count > kErrorReportLimit) {
1267       printf("%u other errors follow.\n",
1268              total_error_count - kErrorReportLimit);
1269     }
1270     VIXL_CHECK(total_error_count == 0);
1271   } else {
1272     VIXL_WARNING("Assembled the code, but did not run anything.\n");
1273   }
1274 
1275   for (size_t i = 0; i < ARRAY_SIZE(kTests); i++) {
1276     delete[] results[i]->outputs;
1277     delete results[i];
1278     delete[] scratch_memory_buffers[i];
1279   }
1280 }
1281 
1282 // Instantiate tests for each instruction in the list.
1283 // TODO: Remove this limitation by having a sandboxing mechanism.
1284 #if defined(VIXL_HOST_POINTER_32)
1285 #define TEST(mnemonic)                                                         \
1286   void Test_##mnemonic() {                                                     \
1287     TestHelper(&MacroAssembler::mnemonic, #mnemonic, kReference##mnemonic);    \
1288   }                                                                            \
1289   Test test_##mnemonic("AARCH32_SIMULATOR_COND_RD_RN_OPERAND_CONST_" #mnemonic \
1290                        "_A32",                                                 \
1291                        &Test_##mnemonic);
1292 #else
1293 #define TEST(mnemonic)                                                         \
1294   void Test_##mnemonic() {                                                     \
1295     VIXL_WARNING("This test can only run on a 32-bit host.\n");                \
1296     USE(TestHelper);                                                           \
1297   }                                                                            \
1298   Test test_##mnemonic("AARCH32_SIMULATOR_COND_RD_RN_OPERAND_CONST_" #mnemonic \
1299                        "_A32",                                                 \
1300                        &Test_##mnemonic);
1301 #endif
1302 
1303 FOREACH_INSTRUCTION(TEST)
1304 #undef TEST
1305 
1306 }  // namespace
1307 #endif
1308 
1309 }  // namespace aarch32
1310 }  // namespace vixl
1311