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