1 // Copyright 2016, VIXL authors
2 // All rights reserved.
3 //
4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions are met:
6 //
7 //   * Redistributions of source code must retain the above copyright notice,
8 //     this list of conditions and the following disclaimer.
9 //   * Redistributions in binary form must reproduce the above copyright notice,
10 //     this list of conditions and the following disclaimer in the documentation
11 //     and/or other materials provided with the distribution.
12 //   * Neither the name of ARM Limited nor the names of its contributors may be
13 //     used to endorse or promote products derived from this software without
14 //     specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS CONTRIBUTORS "AS IS" AND
17 // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 // DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
20 // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22 // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23 // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 // OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 
27 
28 // -----------------------------------------------------------------------------
29 // This file is auto generated from the
30 // test/aarch32/config/template-simulator-aarch32.cc.in template file using
31 // tools/generate_tests.py.
32 //
33 // PLEASE DO NOT EDIT.
34 // -----------------------------------------------------------------------------
35 
36 
37 #include "test-runner.h"
38 
39 #include "test-utils.h"
40 #include "test-utils-aarch32.h"
41 
42 #include "aarch32/assembler-aarch32.h"
43 #include "aarch32/macro-assembler-aarch32.h"
44 #include "aarch32/disasm-aarch32.h"
45 
46 #define __ masm.
47 #define BUF_SIZE (4096)
48 
49 #ifdef VIXL_INCLUDE_SIMULATOR_AARCH32
50 // Run tests with the simulator.
51 
52 #define SETUP() MacroAssembler masm(BUF_SIZE)
53 
54 #define START() masm.GetBuffer()->Reset()
55 
56 #define END() \
57   __ Hlt(0);  \
58   __ FinalizeCode();
59 
60 // TODO: Run the tests in the simulator.
61 #define RUN()
62 
63 #define TEARDOWN()
64 
65 #else  // ifdef VIXL_INCLUDE_SIMULATOR_AARCH32.
66 
67 #define SETUP()                                   \
68   MacroAssembler masm(BUF_SIZE);                  \
69   UseScratchRegisterScope harness_scratch(&masm); \
70   harness_scratch.ExcludeAll();
71 
72 #define START()              \
73   masm.GetBuffer()->Reset(); \
74   __ Push(r4);               \
75   __ Push(r5);               \
76   __ Push(r6);               \
77   __ Push(r7);               \
78   __ Push(r8);               \
79   __ Push(r9);               \
80   __ Push(r10);              \
81   __ Push(r11);              \
82   __ Push(lr);               \
83   harness_scratch.Include(ip);
84 
85 #define END()                  \
86   harness_scratch.Exclude(ip); \
87   __ Pop(lr);                  \
88   __ Pop(r11);                 \
89   __ Pop(r10);                 \
90   __ Pop(r9);                  \
91   __ Pop(r8);                  \
92   __ Pop(r7);                  \
93   __ Pop(r6);                  \
94   __ Pop(r5);                  \
95   __ Pop(r4);                  \
96   __ Bx(lr);                   \
97   __ FinalizeCode();
98 
99 #define RUN()                                                 \
100   {                                                           \
101     int pcs_offset = masm.IsUsingT32() ? 1 : 0;               \
102     masm.GetBuffer()->SetExecutable();                        \
103     ExecuteMemory(masm.GetBuffer()->GetStartAddress<byte*>(), \
104                   masm.GetSizeOfCodeGenerated(),              \
105                   pcs_offset);                                \
106     masm.GetBuffer()->SetWritable();                          \
107   }
108 
109 #define TEARDOWN() harness_scratch.Close();
110 
111 #endif  // ifdef VIXL_INCLUDE_SIMULATOR_AARCH32
112 
113 namespace vixl {
114 namespace aarch32 {
115 
116 // List of instruction encodings:
117 #define FOREACH_INSTRUCTION(M) \
118   M(Mul)                       \
119   M(Qadd16)                    \
120   M(Qadd8)                     \
121   M(Qasx)                      \
122   M(Qsax)                      \
123   M(Qsub16)                    \
124   M(Qsub8)                     \
125   M(Sdiv)                      \
126   M(Shadd16)                   \
127   M(Shadd8)                    \
128   M(Shasx)                     \
129   M(Shsax)                     \
130   M(Shsub16)                   \
131   M(Shsub8)                    \
132   M(Smmul)                     \
133   M(Smmulr)                    \
134   M(Smuad)                     \
135   M(Smuadx)                    \
136   M(Smulbb)                    \
137   M(Smulbt)                    \
138   M(Smultb)                    \
139   M(Smultt)                    \
140   M(Smulwb)                    \
141   M(Smulwt)                    \
142   M(Smusd)                     \
143   M(Smusdx)                    \
144   M(Udiv)                      \
145   M(Uhadd16)                   \
146   M(Uhadd8)                    \
147   M(Uhasx)                     \
148   M(Uhsax)                     \
149   M(Uhsub16)                   \
150   M(Uhsub8)                    \
151   M(Uqadd16)                   \
152   M(Uqadd8)                    \
153   M(Uqasx)                     \
154   M(Uqsax)                     \
155   M(Uqsub16)                   \
156   M(Uqsub8)                    \
157   M(Usad8)                     \
158   M(Sadd16)                    \
159   M(Sadd8)                     \
160   M(Sasx)                      \
161   M(Sel)                       \
162   M(Ssax)                      \
163   M(Ssub16)                    \
164   M(Ssub8)                     \
165   M(Uadd16)                    \
166   M(Uadd8)                     \
167   M(Uasx)                      \
168   M(Usax)                      \
169   M(Usub16)                    \
170   M(Usub8)                     \
171   M(Qadd)                      \
172   M(Qdadd)                     \
173   M(Qdsub)                     \
174   M(Qsub)
175 
176 
177 // The following definitions are defined again in each generated test, therefore
178 // we need to place them in an anomymous namespace. It expresses that they are
179 // local to this file only, and the compiler is not allowed to share these types
180 // across test files during template instantiation. Specifically, `Operands` and
181 // `Inputs` have various layouts across generated tests so they absolutely
182 // cannot be shared.
183 
184 #ifdef VIXL_INCLUDE_TARGET_T32
185 namespace {
186 
187 // Values to be passed to the assembler to produce the instruction under test.
188 struct Operands {
189   Condition cond;
190   Register rd;
191   Register rn;
192   Register rm;
193 };
194 
195 // Input data to feed to the instruction.
196 struct Inputs {
197   uint32_t apsr;
198   uint32_t qbit;
199   uint32_t ge;
200   uint32_t rd;
201   uint32_t rn;
202   uint32_t rm;
203 };
204 
205 // This structure contains all input data needed to test one specific encoding.
206 // It used to generate a loop over an instruction.
207 struct TestLoopData {
208   // The `operands` fields represents the values to pass to the assembler to
209   // produce the instruction.
210   Operands operands;
211   // Description of the operands, used for error reporting.
212   const char* operands_description;
213   // Unique identifier, used for generating traces.
214   const char* identifier;
215   // Array of values to be fed to the instruction.
216   size_t input_size;
217   const Inputs* inputs;
218 };
219 
220 static const Inputs kCondition[] =
221     {{NFlag, NoFlag, NoFlag, 0xabababab, 0xabababab, 0xabababab},
222      {ZFlag, NoFlag, NoFlag, 0xabababab, 0xabababab, 0xabababab},
223      {CFlag, NoFlag, NoFlag, 0xabababab, 0xabababab, 0xabababab},
224      {VFlag, NoFlag, NoFlag, 0xabababab, 0xabababab, 0xabababab},
225      {NZFlag, NoFlag, NoFlag, 0xabababab, 0xabababab, 0xabababab},
226      {NCFlag, NoFlag, NoFlag, 0xabababab, 0xabababab, 0xabababab},
227      {NVFlag, NoFlag, NoFlag, 0xabababab, 0xabababab, 0xabababab},
228      {ZCFlag, NoFlag, NoFlag, 0xabababab, 0xabababab, 0xabababab},
229      {ZVFlag, NoFlag, NoFlag, 0xabababab, 0xabababab, 0xabababab},
230      {CVFlag, NoFlag, NoFlag, 0xabababab, 0xabababab, 0xabababab},
231      {NZCFlag, NoFlag, NoFlag, 0xabababab, 0xabababab, 0xabababab},
232      {NZVFlag, NoFlag, NoFlag, 0xabababab, 0xabababab, 0xabababab},
233      {NCVFlag, NoFlag, NoFlag, 0xabababab, 0xabababab, 0xabababab},
234      {ZCVFlag, NoFlag, NoFlag, 0xabababab, 0xabababab, 0xabababab},
235      {NZCVFlag, NoFlag, NoFlag, 0xabababab, 0xabababab, 0xabababab}};
236 
237 static const Inputs kRdIsRnIsRm[] =
238     {{NoFlag, NoFlag, NoFlag, 0x00000000, 0x00000000, 0x00000000},
239      {NoFlag, NoFlag, NoFlag, 0x00000001, 0x00000001, 0x00000001},
240      {NoFlag, NoFlag, NoFlag, 0x00000002, 0x00000002, 0x00000002},
241      {NoFlag, NoFlag, NoFlag, 0x00000020, 0x00000020, 0x00000020},
242      {NoFlag, NoFlag, NoFlag, 0x0000007d, 0x0000007d, 0x0000007d},
243      {NoFlag, NoFlag, NoFlag, 0x0000007e, 0x0000007e, 0x0000007e},
244      {NoFlag, NoFlag, NoFlag, 0x0000007f, 0x0000007f, 0x0000007f},
245      {NoFlag, NoFlag, NoFlag, 0x00007ffd, 0x00007ffd, 0x00007ffd},
246      {NoFlag, NoFlag, NoFlag, 0x00007ffe, 0x00007ffe, 0x00007ffe},
247      {NoFlag, NoFlag, NoFlag, 0x00007fff, 0x00007fff, 0x00007fff},
248      {NoFlag, NoFlag, NoFlag, 0x33333333, 0x33333333, 0x33333333},
249      {NoFlag, NoFlag, NoFlag, 0x55555555, 0x55555555, 0x55555555},
250      {NoFlag, NoFlag, NoFlag, 0x7ffffffd, 0x7ffffffd, 0x7ffffffd},
251      {NoFlag, NoFlag, NoFlag, 0x7ffffffe, 0x7ffffffe, 0x7ffffffe},
252      {NoFlag, NoFlag, NoFlag, 0x7fffffff, 0x7fffffff, 0x7fffffff},
253      {NoFlag, NoFlag, NoFlag, 0x80000000, 0x80000000, 0x80000000},
254      {NoFlag, NoFlag, NoFlag, 0x80000001, 0x80000001, 0x80000001},
255      {NoFlag, NoFlag, NoFlag, 0xaaaaaaaa, 0xaaaaaaaa, 0xaaaaaaaa},
256      {NoFlag, NoFlag, NoFlag, 0xcccccccc, 0xcccccccc, 0xcccccccc},
257      {NoFlag, NoFlag, NoFlag, 0xffff8000, 0xffff8000, 0xffff8000},
258      {NoFlag, NoFlag, NoFlag, 0xffff8001, 0xffff8001, 0xffff8001},
259      {NoFlag, NoFlag, NoFlag, 0xffff8002, 0xffff8002, 0xffff8002},
260      {NoFlag, NoFlag, NoFlag, 0xffff8003, 0xffff8003, 0xffff8003},
261      {NoFlag, NoFlag, NoFlag, 0xffffff80, 0xffffff80, 0xffffff80},
262      {NoFlag, NoFlag, NoFlag, 0xffffff81, 0xffffff81, 0xffffff81},
263      {NoFlag, NoFlag, NoFlag, 0xffffff82, 0xffffff82, 0xffffff82},
264      {NoFlag, NoFlag, NoFlag, 0xffffff83, 0xffffff83, 0xffffff83},
265      {NoFlag, NoFlag, NoFlag, 0xffffffe0, 0xffffffe0, 0xffffffe0},
266      {NoFlag, NoFlag, NoFlag, 0xfffffffd, 0xfffffffd, 0xfffffffd},
267      {NoFlag, NoFlag, NoFlag, 0xfffffffe, 0xfffffffe, 0xfffffffe},
268      {NoFlag, NoFlag, NoFlag, 0xffffffff, 0xffffffff, 0xffffffff}};
269 
270 static const Inputs kRdIsRn[] =
271     {{NoFlag, NoFlag, NoFlag, 0xffff8003, 0xffff8003, 0x0000007f},
272      {NoFlag, NoFlag, NoFlag, 0x00000001, 0x00000001, 0xffffff82},
273      {NoFlag, NoFlag, NoFlag, 0xffff8002, 0xffff8002, 0x0000007d},
274      {NoFlag, NoFlag, NoFlag, 0xfffffffe, 0xfffffffe, 0x80000000},
275      {NoFlag, NoFlag, NoFlag, 0xaaaaaaaa, 0xaaaaaaaa, 0xffff8000},
276      {NoFlag, NoFlag, NoFlag, 0x00007ffd, 0x00007ffd, 0xffffff82},
277      {NoFlag, NoFlag, NoFlag, 0x00007fff, 0x00007fff, 0x0000007d},
278      {NoFlag, NoFlag, NoFlag, 0x00000020, 0x00000020, 0xffffff82},
279      {NoFlag, NoFlag, NoFlag, 0x7ffffffe, 0x7ffffffe, 0x00000020},
280      {NoFlag, NoFlag, NoFlag, 0x7ffffffe, 0x7ffffffe, 0x0000007f},
281      {NoFlag, NoFlag, NoFlag, 0xffffff82, 0xffffff82, 0xffffff80},
282      {NoFlag, NoFlag, NoFlag, 0x0000007d, 0x0000007d, 0xffff8000},
283      {NoFlag, NoFlag, NoFlag, 0x7ffffffe, 0x7ffffffe, 0x00007ffd},
284      {NoFlag, NoFlag, NoFlag, 0x00000020, 0x00000020, 0x7fffffff},
285      {NoFlag, NoFlag, NoFlag, 0xffffff82, 0xffffff82, 0xffffffe0},
286      {NoFlag, NoFlag, NoFlag, 0x0000007d, 0x0000007d, 0x00007ffd},
287      {NoFlag, NoFlag, NoFlag, 0xffffff83, 0xffffff83, 0xaaaaaaaa},
288      {NoFlag, NoFlag, NoFlag, 0xffffffe0, 0xffffffe0, 0xfffffffe},
289      {NoFlag, NoFlag, NoFlag, 0xffffff82, 0xffffff82, 0x00000000},
290      {NoFlag, NoFlag, NoFlag, 0x55555555, 0x55555555, 0x00007ffe},
291      {NoFlag, NoFlag, NoFlag, 0xffff8000, 0xffff8000, 0x33333333},
292      {NoFlag, NoFlag, NoFlag, 0x00000001, 0x00000001, 0x00000002},
293      {NoFlag, NoFlag, NoFlag, 0x00000020, 0x00000020, 0x0000007d},
294      {NoFlag, NoFlag, NoFlag, 0x80000000, 0x80000000, 0xfffffffd},
295      {NoFlag, NoFlag, NoFlag, 0xffff8003, 0xffff8003, 0xffff8002},
296      {NoFlag, NoFlag, NoFlag, 0x80000000, 0x80000000, 0x00007ffd},
297      {NoFlag, NoFlag, NoFlag, 0x00000020, 0x00000020, 0x00000001},
298      {NoFlag, NoFlag, NoFlag, 0x00000001, 0x00000001, 0x0000007e},
299      {NoFlag, NoFlag, NoFlag, 0x7ffffffe, 0x7ffffffe, 0x0000007d},
300      {NoFlag, NoFlag, NoFlag, 0x7ffffffd, 0x7ffffffd, 0xffffff80},
301      {NoFlag, NoFlag, NoFlag, 0x00000020, 0x00000020, 0x80000001},
302      {NoFlag, NoFlag, NoFlag, 0xffff8003, 0xffff8003, 0xffffff80},
303      {NoFlag, NoFlag, NoFlag, 0xaaaaaaaa, 0xaaaaaaaa, 0x7fffffff},
304      {NoFlag, NoFlag, NoFlag, 0x00007ffd, 0x00007ffd, 0x00000000},
305      {NoFlag, NoFlag, NoFlag, 0x80000000, 0x80000000, 0xffffffff},
306      {NoFlag, NoFlag, NoFlag, 0x00007fff, 0x00007fff, 0xffff8001},
307      {NoFlag, NoFlag, NoFlag, 0xffffff80, 0xffffff80, 0x80000000},
308      {NoFlag, NoFlag, NoFlag, 0x00000001, 0x00000001, 0xffff8000},
309      {NoFlag, NoFlag, NoFlag, 0x7ffffffd, 0x7ffffffd, 0xfffffffe},
310      {NoFlag, NoFlag, NoFlag, 0xffff8003, 0xffff8003, 0xffff8001},
311      {NoFlag, NoFlag, NoFlag, 0x00007fff, 0x00007fff, 0xffffff82},
312      {NoFlag, NoFlag, NoFlag, 0x80000000, 0x80000000, 0x0000007f},
313      {NoFlag, NoFlag, NoFlag, 0xfffffffe, 0xfffffffe, 0x00000002},
314      {NoFlag, NoFlag, NoFlag, 0xfffffffe, 0xfffffffe, 0x00000001},
315      {NoFlag, NoFlag, NoFlag, 0xffffff82, 0xffffff82, 0x80000001},
316      {NoFlag, NoFlag, NoFlag, 0x00007fff, 0x00007fff, 0x80000001},
317      {NoFlag, NoFlag, NoFlag, 0x80000000, 0x80000000, 0x7ffffffd},
318      {NoFlag, NoFlag, NoFlag, 0x0000007f, 0x0000007f, 0xffffff82},
319      {NoFlag, NoFlag, NoFlag, 0xffffffe0, 0xffffffe0, 0xffff8002},
320      {NoFlag, NoFlag, NoFlag, 0x00007ffd, 0x00007ffd, 0x80000000},
321      {NoFlag, NoFlag, NoFlag, 0xffff8002, 0xffff8002, 0xffff8002},
322      {NoFlag, NoFlag, NoFlag, 0x80000001, 0x80000001, 0x55555555},
323      {NoFlag, NoFlag, NoFlag, 0xffffff81, 0xffffff81, 0x00007ffe},
324      {NoFlag, NoFlag, NoFlag, 0x00000002, 0x00000002, 0x0000007f},
325      {NoFlag, NoFlag, NoFlag, 0xaaaaaaaa, 0xaaaaaaaa, 0x00007ffd},
326      {NoFlag, NoFlag, NoFlag, 0x00007ffe, 0x00007ffe, 0xffffff83},
327      {NoFlag, NoFlag, NoFlag, 0xffffff82, 0xffffff82, 0x00007fff},
328      {NoFlag, NoFlag, NoFlag, 0x7ffffffd, 0x7ffffffd, 0x80000000},
329      {NoFlag, NoFlag, NoFlag, 0xffffff80, 0xffffff80, 0x00007fff},
330      {NoFlag, NoFlag, NoFlag, 0xffffff80, 0xffffff80, 0xaaaaaaaa},
331      {NoFlag, NoFlag, NoFlag, 0xaaaaaaaa, 0xaaaaaaaa, 0x00000020},
332      {NoFlag, NoFlag, NoFlag, 0xffffff82, 0xffffff82, 0xffff8002},
333      {NoFlag, NoFlag, NoFlag, 0x0000007f, 0x0000007f, 0x7fffffff},
334      {NoFlag, NoFlag, NoFlag, 0x33333333, 0x33333333, 0x00007ffe},
335      {NoFlag, NoFlag, NoFlag, 0xaaaaaaaa, 0xaaaaaaaa, 0x0000007d},
336      {NoFlag, NoFlag, NoFlag, 0xffff8000, 0xffff8000, 0xffffff80},
337      {NoFlag, NoFlag, NoFlag, 0xfffffffd, 0xfffffffd, 0xffff8001},
338      {NoFlag, NoFlag, NoFlag, 0x80000001, 0x80000001, 0x0000007e},
339      {NoFlag, NoFlag, NoFlag, 0x00007ffd, 0x00007ffd, 0x00000020},
340      {NoFlag, NoFlag, NoFlag, 0x7ffffffd, 0x7ffffffd, 0x80000001},
341      {NoFlag, NoFlag, NoFlag, 0x80000000, 0x80000000, 0xffffff80},
342      {NoFlag, NoFlag, NoFlag, 0xffff8000, 0xffff8000, 0xffffff81},
343      {NoFlag, NoFlag, NoFlag, 0x33333333, 0x33333333, 0xffffffff},
344      {NoFlag, NoFlag, NoFlag, 0xffffffff, 0xffffffff, 0xffffff80},
345      {NoFlag, NoFlag, NoFlag, 0x55555555, 0x55555555, 0xaaaaaaaa},
346      {NoFlag, NoFlag, NoFlag, 0x00000000, 0x00000000, 0xfffffffd},
347      {NoFlag, NoFlag, NoFlag, 0x00000020, 0x00000020, 0xffffffe0},
348      {NoFlag, NoFlag, NoFlag, 0x00007fff, 0x00007fff, 0x00000001},
349      {NoFlag, NoFlag, NoFlag, 0x7fffffff, 0x7fffffff, 0x0000007e},
350      {NoFlag, NoFlag, NoFlag, 0xffffff82, 0xffffff82, 0xffff8003},
351      {NoFlag, NoFlag, NoFlag, 0xffffff81, 0xffffff81, 0x00000000},
352      {NoFlag, NoFlag, NoFlag, 0xfffffffd, 0xfffffffd, 0xcccccccc},
353      {NoFlag, NoFlag, NoFlag, 0x7ffffffe, 0x7ffffffe, 0x00000002},
354      {NoFlag, NoFlag, NoFlag, 0x00000002, 0x00000002, 0x00000001},
355      {NoFlag, NoFlag, NoFlag, 0xffff8000, 0xffff8000, 0xfffffffd},
356      {NoFlag, NoFlag, NoFlag, 0x00007ffe, 0x00007ffe, 0x00000000},
357      {NoFlag, NoFlag, NoFlag, 0x0000007d, 0x0000007d, 0xcccccccc},
358      {NoFlag, NoFlag, NoFlag, 0x55555555, 0x55555555, 0x00000002},
359      {NoFlag, NoFlag, NoFlag, 0xffffffff, 0xffffffff, 0x7ffffffd},
360      {NoFlag, NoFlag, NoFlag, 0x0000007e, 0x0000007e, 0xaaaaaaaa},
361      {NoFlag, NoFlag, NoFlag, 0x00000000, 0x00000000, 0x00007ffd},
362      {NoFlag, NoFlag, NoFlag, 0xffff8002, 0xffff8002, 0xffff8001},
363      {NoFlag, NoFlag, NoFlag, 0x7ffffffe, 0x7ffffffe, 0x00007ffe},
364      {NoFlag, NoFlag, NoFlag, 0xffffff83, 0xffffff83, 0x00007ffd},
365      {NoFlag, NoFlag, NoFlag, 0x00007ffe, 0x00007ffe, 0x00007ffe},
366      {NoFlag, NoFlag, NoFlag, 0x33333333, 0x33333333, 0xfffffffd},
367      {NoFlag, NoFlag, NoFlag, 0x0000007e, 0x0000007e, 0x80000000},
368      {NoFlag, NoFlag, NoFlag, 0xcccccccc, 0xcccccccc, 0x80000001},
369      {NoFlag, NoFlag, NoFlag, 0x55555555, 0x55555555, 0x80000000},
370      {NoFlag, NoFlag, NoFlag, 0x0000007f, 0x0000007f, 0x7ffffffd},
371      {NoFlag, NoFlag, NoFlag, 0x7ffffffe, 0x7ffffffe, 0xcccccccc},
372      {NoFlag, NoFlag, NoFlag, 0xfffffffe, 0xfffffffe, 0x0000007f},
373      {NoFlag, NoFlag, NoFlag, 0x33333333, 0x33333333, 0x00000002},
374      {NoFlag, NoFlag, NoFlag, 0x00000001, 0x00000001, 0xffffff83},
375      {NoFlag, NoFlag, NoFlag, 0x0000007d, 0x0000007d, 0xffffff81},
376      {NoFlag, NoFlag, NoFlag, 0xffff8000, 0xffff8000, 0xffffff82},
377      {NoFlag, NoFlag, NoFlag, 0xfffffffd, 0xfffffffd, 0x00000002},
378      {NoFlag, NoFlag, NoFlag, 0xffffffff, 0xffffffff, 0x7ffffffe},
379      {NoFlag, NoFlag, NoFlag, 0xfffffffe, 0xfffffffe, 0xffffff82},
380      {NoFlag, NoFlag, NoFlag, 0xffffffe0, 0xffffffe0, 0x80000001},
381      {NoFlag, NoFlag, NoFlag, 0x00007ffe, 0x00007ffe, 0xcccccccc},
382      {NoFlag, NoFlag, NoFlag, 0xffffff81, 0xffffff81, 0xffffff83},
383      {NoFlag, NoFlag, NoFlag, 0xfffffffe, 0xfffffffe, 0x0000007e},
384      {NoFlag, NoFlag, NoFlag, 0xcccccccc, 0xcccccccc, 0x00000000},
385      {NoFlag, NoFlag, NoFlag, 0x80000001, 0x80000001, 0x00007fff},
386      {NoFlag, NoFlag, NoFlag, 0xffffff82, 0xffffff82, 0xffff8001},
387      {NoFlag, NoFlag, NoFlag, 0xfffffffe, 0xfffffffe, 0xcccccccc},
388      {NoFlag, NoFlag, NoFlag, 0x7fffffff, 0x7fffffff, 0x00000001},
389      {NoFlag, NoFlag, NoFlag, 0x7fffffff, 0x7fffffff, 0x33333333},
390      {NoFlag, NoFlag, NoFlag, 0xffff8001, 0xffff8001, 0xffff8003},
391      {NoFlag, NoFlag, NoFlag, 0xffffff83, 0xffffff83, 0x00000000},
392      {NoFlag, NoFlag, NoFlag, 0x00000000, 0x00000000, 0x7ffffffe},
393      {NoFlag, NoFlag, NoFlag, 0x7ffffffe, 0x7ffffffe, 0xaaaaaaaa},
394      {NoFlag, NoFlag, NoFlag, 0x00000000, 0x00000000, 0xffff8002},
395      {NoFlag, NoFlag, NoFlag, 0x7ffffffd, 0x7ffffffd, 0xffff8001},
396      {NoFlag, NoFlag, NoFlag, 0x00000001, 0x00000001, 0x80000001},
397      {NoFlag, NoFlag, NoFlag, 0xffffff81, 0xffffff81, 0xffff8001},
398      {NoFlag, NoFlag, NoFlag, 0x80000001, 0x80000001, 0xffffffff},
399      {NoFlag, NoFlag, NoFlag, 0x7fffffff, 0x7fffffff, 0x00000020},
400      {NoFlag, NoFlag, NoFlag, 0xffffffff, 0xffffffff, 0x00000001},
401      {NoFlag, NoFlag, NoFlag, 0xffff8000, 0xffff8000, 0x00000001},
402      {NoFlag, NoFlag, NoFlag, 0x80000001, 0x80000001, 0xffffffe0},
403      {NoFlag, NoFlag, NoFlag, 0xffffff83, 0xffffff83, 0xffff8002},
404      {NoFlag, NoFlag, NoFlag, 0xffffff81, 0xffffff81, 0xfffffffd},
405      {NoFlag, NoFlag, NoFlag, 0xffffff80, 0xffffff80, 0x55555555},
406      {NoFlag, NoFlag, NoFlag, 0x33333333, 0x33333333, 0xffffff82},
407      {NoFlag, NoFlag, NoFlag, 0x7ffffffd, 0x7ffffffd, 0x0000007f},
408      {NoFlag, NoFlag, NoFlag, 0xffff8001, 0xffff8001, 0xffff8000},
409      {NoFlag, NoFlag, NoFlag, 0x80000001, 0x80000001, 0x7ffffffd},
410      {NoFlag, NoFlag, NoFlag, 0x0000007d, 0x0000007d, 0xfffffffe},
411      {NoFlag, NoFlag, NoFlag, 0x55555555, 0x55555555, 0x0000007d},
412      {NoFlag, NoFlag, NoFlag, 0x0000007f, 0x0000007f, 0x33333333},
413      {NoFlag, NoFlag, NoFlag, 0xffff8001, 0xffff8001, 0x00000001},
414      {NoFlag, NoFlag, NoFlag, 0xffff8001, 0xffff8001, 0xffffff80},
415      {NoFlag, NoFlag, NoFlag, 0xffffffff, 0xffffffff, 0x00007ffe},
416      {NoFlag, NoFlag, NoFlag, 0x00007fff, 0x00007fff, 0x00000000},
417      {NoFlag, NoFlag, NoFlag, 0xffff8001, 0xffff8001, 0x55555555},
418      {NoFlag, NoFlag, NoFlag, 0x00000020, 0x00000020, 0x00000002},
419      {NoFlag, NoFlag, NoFlag, 0x7fffffff, 0x7fffffff, 0x7ffffffd},
420      {NoFlag, NoFlag, NoFlag, 0x7ffffffd, 0x7ffffffd, 0xaaaaaaaa},
421      {NoFlag, NoFlag, NoFlag, 0x80000000, 0x80000000, 0x00007ffe},
422      {NoFlag, NoFlag, NoFlag, 0x55555555, 0x55555555, 0x0000007e},
423      {NoFlag, NoFlag, NoFlag, 0xffff8001, 0xffff8001, 0xfffffffe},
424      {NoFlag, NoFlag, NoFlag, 0x80000000, 0x80000000, 0x0000007e},
425      {NoFlag, NoFlag, NoFlag, 0xffffff82, 0xffffff82, 0x55555555},
426      {NoFlag, NoFlag, NoFlag, 0x00000002, 0x00000002, 0x7fffffff},
427      {NoFlag, NoFlag, NoFlag, 0xffffff80, 0xffffff80, 0x33333333},
428      {NoFlag, NoFlag, NoFlag, 0xffffffff, 0xffffffff, 0xffffff81},
429      {NoFlag, NoFlag, NoFlag, 0x00000002, 0x00000002, 0x00000020},
430      {NoFlag, NoFlag, NoFlag, 0xcccccccc, 0xcccccccc, 0x00007ffe},
431      {NoFlag, NoFlag, NoFlag, 0xffff8002, 0xffff8002, 0xfffffffd},
432      {NoFlag, NoFlag, NoFlag, 0xffff8000, 0xffff8000, 0xffff8001},
433      {NoFlag, NoFlag, NoFlag, 0x00000001, 0x00000001, 0x7fffffff},
434      {NoFlag, NoFlag, NoFlag, 0xffffffe0, 0xffffffe0, 0x80000000},
435      {NoFlag, NoFlag, NoFlag, 0x00007ffe, 0x00007ffe, 0x7ffffffd},
436      {NoFlag, NoFlag, NoFlag, 0x00007ffd, 0x00007ffd, 0x33333333},
437      {NoFlag, NoFlag, NoFlag, 0x0000007f, 0x0000007f, 0x00007ffd},
438      {NoFlag, NoFlag, NoFlag, 0x00000000, 0x00000000, 0x0000007e},
439      {NoFlag, NoFlag, NoFlag, 0xfffffffe, 0xfffffffe, 0xaaaaaaaa},
440      {NoFlag, NoFlag, NoFlag, 0x00000000, 0x00000000, 0xffff8001},
441      {NoFlag, NoFlag, NoFlag, 0x33333333, 0x33333333, 0x33333333},
442      {NoFlag, NoFlag, NoFlag, 0xffffffe0, 0xffffffe0, 0x00000001},
443      {NoFlag, NoFlag, NoFlag, 0xfffffffd, 0xfffffffd, 0xffff8003},
444      {NoFlag, NoFlag, NoFlag, 0xffffffe0, 0xffffffe0, 0x33333333},
445      {NoFlag, NoFlag, NoFlag, 0xffffff83, 0xffffff83, 0xffff8001},
446      {NoFlag, NoFlag, NoFlag, 0x55555555, 0x55555555, 0xffff8001},
447      {NoFlag, NoFlag, NoFlag, 0xfffffffd, 0xfffffffd, 0x55555555},
448      {NoFlag, NoFlag, NoFlag, 0x00007ffe, 0x00007ffe, 0x00000002},
449      {NoFlag, NoFlag, NoFlag, 0xffffff82, 0xffffff82, 0x33333333},
450      {NoFlag, NoFlag, NoFlag, 0x80000000, 0x80000000, 0xfffffffe},
451      {NoFlag, NoFlag, NoFlag, 0x00000020, 0x00000020, 0xffff8001},
452      {NoFlag, NoFlag, NoFlag, 0x0000007d, 0x0000007d, 0x55555555},
453      {NoFlag, NoFlag, NoFlag, 0x00007fff, 0x00007fff, 0x00000002},
454      {NoFlag, NoFlag, NoFlag, 0x80000001, 0x80000001, 0x00000000},
455      {NoFlag, NoFlag, NoFlag, 0x00007ffd, 0x00007ffd, 0x00000002},
456      {NoFlag, NoFlag, NoFlag, 0xffffff80, 0xffffff80, 0xffffff83},
457      {NoFlag, NoFlag, NoFlag, 0x0000007d, 0x0000007d, 0xffff8001},
458      {NoFlag, NoFlag, NoFlag, 0xffffff83, 0xffffff83, 0x00000001},
459      {NoFlag, NoFlag, NoFlag, 0x00007ffd, 0x00007ffd, 0xffffff83},
460      {NoFlag, NoFlag, NoFlag, 0xffffff82, 0xffffff82, 0xfffffffe},
461      {NoFlag, NoFlag, NoFlag, 0x33333333, 0x33333333, 0xffffff81},
462      {NoFlag, NoFlag, NoFlag, 0x0000007d, 0x0000007d, 0xfffffffd},
463      {NoFlag, NoFlag, NoFlag, 0x80000001, 0x80000001, 0xffffff80},
464      {NoFlag, NoFlag, NoFlag, 0xaaaaaaaa, 0xaaaaaaaa, 0xffffff83},
465      {NoFlag, NoFlag, NoFlag, 0xffff8003, 0xffff8003, 0x7ffffffe},
466      {NoFlag, NoFlag, NoFlag, 0xffffffe0, 0xffffffe0, 0xaaaaaaaa},
467      {NoFlag, NoFlag, NoFlag, 0x80000000, 0x80000000, 0xffffffe0},
468      {NoFlag, NoFlag, NoFlag, 0x0000007e, 0x0000007e, 0x7fffffff},
469      {NoFlag, NoFlag, NoFlag, 0x00000000, 0x00000000, 0x0000007f},
470      {NoFlag, NoFlag, NoFlag, 0xffff8002, 0xffff8002, 0xffffff81}};
471 
472 static const Inputs kRdIsRm[] =
473     {{NoFlag, NoFlag, NoFlag, 0x00000020, 0x0000007f, 0x00000020},
474      {NoFlag, NoFlag, NoFlag, 0x00007ffd, 0x00000020, 0x00007ffd},
475      {NoFlag, NoFlag, NoFlag, 0x00000000, 0x00007ffd, 0x00000000},
476      {NoFlag, NoFlag, NoFlag, 0xaaaaaaaa, 0x7ffffffd, 0xaaaaaaaa},
477      {NoFlag, NoFlag, NoFlag, 0x00007ffd, 0xffff8000, 0x00007ffd},
478      {NoFlag, NoFlag, NoFlag, 0x0000007f, 0xfffffffd, 0x0000007f},
479      {NoFlag, NoFlag, NoFlag, 0xffffffff, 0x80000000, 0xffffffff},
480      {NoFlag, NoFlag, NoFlag, 0x7fffffff, 0xffffff82, 0x7fffffff},
481      {NoFlag, NoFlag, NoFlag, 0x00000002, 0xfffffffe, 0x00000002},
482      {NoFlag, NoFlag, NoFlag, 0x00000020, 0x55555555, 0x00000020},
483      {NoFlag, NoFlag, NoFlag, 0x33333333, 0xfffffffe, 0x33333333},
484      {NoFlag, NoFlag, NoFlag, 0xfffffffd, 0x80000000, 0xfffffffd},
485      {NoFlag, NoFlag, NoFlag, 0xffffff82, 0xffff8003, 0xffffff82},
486      {NoFlag, NoFlag, NoFlag, 0x0000007e, 0x7ffffffe, 0x0000007e},
487      {NoFlag, NoFlag, NoFlag, 0x00007fff, 0x00007fff, 0x00007fff},
488      {NoFlag, NoFlag, NoFlag, 0x0000007d, 0xffffff80, 0x0000007d},
489      {NoFlag, NoFlag, NoFlag, 0xffffff80, 0x00000020, 0xffffff80},
490      {NoFlag, NoFlag, NoFlag, 0x33333333, 0xffff8002, 0x33333333},
491      {NoFlag, NoFlag, NoFlag, 0x0000007e, 0xffffff80, 0x0000007e},
492      {NoFlag, NoFlag, NoFlag, 0x80000000, 0x00000020, 0x80000000},
493      {NoFlag, NoFlag, NoFlag, 0x00000002, 0xffffff81, 0x00000002},
494      {NoFlag, NoFlag, NoFlag, 0x0000007d, 0xffffff82, 0x0000007d},
495      {NoFlag, NoFlag, NoFlag, 0x00000000, 0xffffff82, 0x00000000},
496      {NoFlag, NoFlag, NoFlag, 0xffffff81, 0xffffff83, 0xffffff81},
497      {NoFlag, NoFlag, NoFlag, 0x80000001, 0x55555555, 0x80000001},
498      {NoFlag, NoFlag, NoFlag, 0xffff8001, 0x00000001, 0xffff8001},
499      {NoFlag, NoFlag, NoFlag, 0x00000000, 0x7ffffffe, 0x00000000},
500      {NoFlag, NoFlag, NoFlag, 0x33333333, 0xffff8001, 0x33333333},
501      {NoFlag, NoFlag, NoFlag, 0x80000000, 0x00000002, 0x80000000},
502      {NoFlag, NoFlag, NoFlag, 0x80000000, 0xaaaaaaaa, 0x80000000},
503      {NoFlag, NoFlag, NoFlag, 0xfffffffe, 0x00000020, 0xfffffffe},
504      {NoFlag, NoFlag, NoFlag, 0x00007fff, 0xfffffffe, 0x00007fff},
505      {NoFlag, NoFlag, NoFlag, 0x00007fff, 0xfffffffd, 0x00007fff},
506      {NoFlag, NoFlag, NoFlag, 0x7ffffffd, 0x00007ffe, 0x7ffffffd},
507      {NoFlag, NoFlag, NoFlag, 0xffff8002, 0xcccccccc, 0xffff8002},
508      {NoFlag, NoFlag, NoFlag, 0xfffffffe, 0x7ffffffe, 0xfffffffe},
509      {NoFlag, NoFlag, NoFlag, 0x7ffffffd, 0xffffffff, 0x7ffffffd},
510      {NoFlag, NoFlag, NoFlag, 0x0000007f, 0xaaaaaaaa, 0x0000007f},
511      {NoFlag, NoFlag, NoFlag, 0x00000000, 0x0000007d, 0x00000000},
512      {NoFlag, NoFlag, NoFlag, 0x00007fff, 0xaaaaaaaa, 0x00007fff},
513      {NoFlag, NoFlag, NoFlag, 0x7ffffffd, 0xaaaaaaaa, 0x7ffffffd},
514      {NoFlag, NoFlag, NoFlag, 0xffffffe0, 0x55555555, 0xffffffe0},
515      {NoFlag, NoFlag, NoFlag, 0xffff8002, 0x0000007e, 0xffff8002},
516      {NoFlag, NoFlag, NoFlag, 0x80000000, 0x33333333, 0x80000000},
517      {NoFlag, NoFlag, NoFlag, 0xcccccccc, 0xffffff80, 0xcccccccc},
518      {NoFlag, NoFlag, NoFlag, 0x00000000, 0x00007ffe, 0x00000000},
519      {NoFlag, NoFlag, NoFlag, 0x80000000, 0x55555555, 0x80000000},
520      {NoFlag, NoFlag, NoFlag, 0xffffffe0, 0xffff8001, 0xffffffe0},
521      {NoFlag, NoFlag, NoFlag, 0xaaaaaaaa, 0x00000002, 0xaaaaaaaa},
522      {NoFlag, NoFlag, NoFlag, 0x7ffffffe, 0xaaaaaaaa, 0x7ffffffe},
523      {NoFlag, NoFlag, NoFlag, 0xffffff83, 0x0000007f, 0xffffff83},
524      {NoFlag, NoFlag, NoFlag, 0xffffff81, 0x7fffffff, 0xffffff81},
525      {NoFlag, NoFlag, NoFlag, 0xffffff81, 0xffff8001, 0xffffff81},
526      {NoFlag, NoFlag, NoFlag, 0x80000000, 0xffff8003, 0x80000000},
527      {NoFlag, NoFlag, NoFlag, 0x33333333, 0xaaaaaaaa, 0x33333333},
528      {NoFlag, NoFlag, NoFlag, 0x00007ffe, 0xaaaaaaaa, 0x00007ffe},
529      {NoFlag, NoFlag, NoFlag, 0xffff8001, 0xcccccccc, 0xffff8001},
530      {NoFlag, NoFlag, NoFlag, 0xfffffffd, 0xffffff81, 0xfffffffd},
531      {NoFlag, NoFlag, NoFlag, 0xffffffe0, 0xfffffffe, 0xffffffe0},
532      {NoFlag, NoFlag, NoFlag, 0x00007ffe, 0xcccccccc, 0x00007ffe},
533      {NoFlag, NoFlag, NoFlag, 0x00007fff, 0x00000020, 0x00007fff},
534      {NoFlag, NoFlag, NoFlag, 0xffffff81, 0x00007ffe, 0xffffff81},
535      {NoFlag, NoFlag, NoFlag, 0xaaaaaaaa, 0x0000007d, 0xaaaaaaaa},
536      {NoFlag, NoFlag, NoFlag, 0xffff8002, 0xfffffffe, 0xffff8002},
537      {NoFlag, NoFlag, NoFlag, 0xcccccccc, 0xaaaaaaaa, 0xcccccccc},
538      {NoFlag, NoFlag, NoFlag, 0x33333333, 0x0000007f, 0x33333333},
539      {NoFlag, NoFlag, NoFlag, 0x00007ffd, 0x00000001, 0x00007ffd},
540      {NoFlag, NoFlag, NoFlag, 0x80000000, 0xffff8000, 0x80000000},
541      {NoFlag, NoFlag, NoFlag, 0xaaaaaaaa, 0xffffffff, 0xaaaaaaaa},
542      {NoFlag, NoFlag, NoFlag, 0x00000001, 0xffffff83, 0x00000001},
543      {NoFlag, NoFlag, NoFlag, 0x80000001, 0xffff8000, 0x80000001},
544      {NoFlag, NoFlag, NoFlag, 0x0000007e, 0xffff8000, 0x0000007e},
545      {NoFlag, NoFlag, NoFlag, 0x00000020, 0xffffffff, 0x00000020},
546      {NoFlag, NoFlag, NoFlag, 0xffff8001, 0xffff8000, 0xffff8001},
547      {NoFlag, NoFlag, NoFlag, 0x7ffffffe, 0xffffffe0, 0x7ffffffe},
548      {NoFlag, NoFlag, NoFlag, 0xffffff83, 0x7ffffffe, 0xffffff83},
549      {NoFlag, NoFlag, NoFlag, 0x7fffffff, 0xfffffffe, 0x7fffffff},
550      {NoFlag, NoFlag, NoFlag, 0x0000007f, 0x00000000, 0x0000007f},
551      {NoFlag, NoFlag, NoFlag, 0x0000007e, 0x0000007f, 0x0000007e},
552      {NoFlag, NoFlag, NoFlag, 0xffffff83, 0x7ffffffd, 0xffffff83},
553      {NoFlag, NoFlag, NoFlag, 0x00000001, 0x80000001, 0x00000001},
554      {NoFlag, NoFlag, NoFlag, 0x00000001, 0x00007ffd, 0x00000001},
555      {NoFlag, NoFlag, NoFlag, 0xffffff80, 0xaaaaaaaa, 0xffffff80},
556      {NoFlag, NoFlag, NoFlag, 0xffffffff, 0x00000000, 0xffffffff},
557      {NoFlag, NoFlag, NoFlag, 0xffffff80, 0xffffff82, 0xffffff80},
558      {NoFlag, NoFlag, NoFlag, 0xffff8001, 0xaaaaaaaa, 0xffff8001},
559      {NoFlag, NoFlag, NoFlag, 0xffffff80, 0xffff8000, 0xffffff80},
560      {NoFlag, NoFlag, NoFlag, 0xaaaaaaaa, 0xffffffe0, 0xaaaaaaaa},
561      {NoFlag, NoFlag, NoFlag, 0x33333333, 0x00007ffd, 0x33333333},
562      {NoFlag, NoFlag, NoFlag, 0x33333333, 0x00007fff, 0x33333333},
563      {NoFlag, NoFlag, NoFlag, 0xffffff82, 0xfffffffd, 0xffffff82},
564      {NoFlag, NoFlag, NoFlag, 0x0000007d, 0x7ffffffd, 0x0000007d},
565      {NoFlag, NoFlag, NoFlag, 0x00000001, 0x00000001, 0x00000001},
566      {NoFlag, NoFlag, NoFlag, 0xffffff83, 0xfffffffe, 0xffffff83},
567      {NoFlag, NoFlag, NoFlag, 0xffff8001, 0x00007fff, 0xffff8001},
568      {NoFlag, NoFlag, NoFlag, 0xfffffffd, 0x00000020, 0xfffffffd},
569      {NoFlag, NoFlag, NoFlag, 0x00007fff, 0x0000007d, 0x00007fff},
570      {NoFlag, NoFlag, NoFlag, 0x0000007d, 0xffff8002, 0x0000007d},
571      {NoFlag, NoFlag, NoFlag, 0xffff8001, 0x00000000, 0xffff8001},
572      {NoFlag, NoFlag, NoFlag, 0xffffff82, 0x0000007f, 0xffffff82},
573      {NoFlag, NoFlag, NoFlag, 0xffffff83, 0x00007ffe, 0xffffff83},
574      {NoFlag, NoFlag, NoFlag, 0xffffff83, 0xffff8003, 0xffffff83},
575      {NoFlag, NoFlag, NoFlag, 0x00007ffe, 0x80000001, 0x00007ffe},
576      {NoFlag, NoFlag, NoFlag, 0xffff8000, 0x00007ffd, 0xffff8000},
577      {NoFlag, NoFlag, NoFlag, 0xffff8003, 0x00007ffe, 0xffff8003},
578      {NoFlag, NoFlag, NoFlag, 0xfffffffe, 0x80000001, 0xfffffffe},
579      {NoFlag, NoFlag, NoFlag, 0x00000002, 0x00007ffe, 0x00000002},
580      {NoFlag, NoFlag, NoFlag, 0x00000001, 0x7ffffffd, 0x00000001},
581      {NoFlag, NoFlag, NoFlag, 0xffff8002, 0xfffffffd, 0xffff8002},
582      {NoFlag, NoFlag, NoFlag, 0x7fffffff, 0x7ffffffd, 0x7fffffff},
583      {NoFlag, NoFlag, NoFlag, 0xcccccccc, 0xffffff82, 0xcccccccc},
584      {NoFlag, NoFlag, NoFlag, 0x7ffffffd, 0x80000000, 0x7ffffffd},
585      {NoFlag, NoFlag, NoFlag, 0xcccccccc, 0xffffffff, 0xcccccccc},
586      {NoFlag, NoFlag, NoFlag, 0xffffffff, 0xffffff81, 0xffffffff},
587      {NoFlag, NoFlag, NoFlag, 0x00007ffe, 0x00000020, 0x00007ffe},
588      {NoFlag, NoFlag, NoFlag, 0xffff8001, 0x00000002, 0xffff8001},
589      {NoFlag, NoFlag, NoFlag, 0xffff8003, 0xffffffe0, 0xffff8003},
590      {NoFlag, NoFlag, NoFlag, 0x55555555, 0xffffff83, 0x55555555},
591      {NoFlag, NoFlag, NoFlag, 0x55555555, 0x33333333, 0x55555555},
592      {NoFlag, NoFlag, NoFlag, 0xffff8000, 0xffffff82, 0xffff8000},
593      {NoFlag, NoFlag, NoFlag, 0xffff8001, 0x55555555, 0xffff8001},
594      {NoFlag, NoFlag, NoFlag, 0x00000002, 0x00007ffd, 0x00000002},
595      {NoFlag, NoFlag, NoFlag, 0xffffff80, 0x00007ffd, 0xffffff80},
596      {NoFlag, NoFlag, NoFlag, 0x00007fff, 0xffffff80, 0x00007fff},
597      {NoFlag, NoFlag, NoFlag, 0x00000002, 0x00000001, 0x00000002},
598      {NoFlag, NoFlag, NoFlag, 0x00000020, 0x00007ffe, 0x00000020},
599      {NoFlag, NoFlag, NoFlag, 0xfffffffe, 0xffffffff, 0xfffffffe},
600      {NoFlag, NoFlag, NoFlag, 0xffffff81, 0x00000002, 0xffffff81},
601      {NoFlag, NoFlag, NoFlag, 0x0000007d, 0x7fffffff, 0x0000007d},
602      {NoFlag, NoFlag, NoFlag, 0x00007fff, 0x00007ffd, 0x00007fff},
603      {NoFlag, NoFlag, NoFlag, 0xffff8002, 0x80000001, 0xffff8002},
604      {NoFlag, NoFlag, NoFlag, 0x00000020, 0xffffff82, 0x00000020},
605      {NoFlag, NoFlag, NoFlag, 0x55555555, 0x00000020, 0x55555555},
606      {NoFlag, NoFlag, NoFlag, 0x80000000, 0x00007fff, 0x80000000},
607      {NoFlag, NoFlag, NoFlag, 0x55555555, 0xffffff81, 0x55555555},
608      {NoFlag, NoFlag, NoFlag, 0x00007fff, 0x7ffffffe, 0x00007fff},
609      {NoFlag, NoFlag, NoFlag, 0x00007ffd, 0xaaaaaaaa, 0x00007ffd},
610      {NoFlag, NoFlag, NoFlag, 0xcccccccc, 0x00000001, 0xcccccccc},
611      {NoFlag, NoFlag, NoFlag, 0x00000000, 0x00000001, 0x00000000},
612      {NoFlag, NoFlag, NoFlag, 0xcccccccc, 0xfffffffd, 0xcccccccc},
613      {NoFlag, NoFlag, NoFlag, 0xaaaaaaaa, 0xffff8002, 0xaaaaaaaa},
614      {NoFlag, NoFlag, NoFlag, 0x7ffffffd, 0x00000020, 0x7ffffffd},
615      {NoFlag, NoFlag, NoFlag, 0x55555555, 0x0000007f, 0x55555555},
616      {NoFlag, NoFlag, NoFlag, 0x7ffffffe, 0x0000007f, 0x7ffffffe},
617      {NoFlag, NoFlag, NoFlag, 0xffff8003, 0xffffff83, 0xffff8003},
618      {NoFlag, NoFlag, NoFlag, 0xfffffffd, 0xcccccccc, 0xfffffffd},
619      {NoFlag, NoFlag, NoFlag, 0x00007fff, 0xffffffff, 0x00007fff},
620      {NoFlag, NoFlag, NoFlag, 0xaaaaaaaa, 0xcccccccc, 0xaaaaaaaa},
621      {NoFlag, NoFlag, NoFlag, 0x7fffffff, 0xffffff83, 0x7fffffff},
622      {NoFlag, NoFlag, NoFlag, 0xffff8000, 0x00007ffe, 0xffff8000},
623      {NoFlag, NoFlag, NoFlag, 0x7ffffffe, 0x00007ffe, 0x7ffffffe},
624      {NoFlag, NoFlag, NoFlag, 0x80000000, 0x0000007f, 0x80000000},
625      {NoFlag, NoFlag, NoFlag, 0x00000020, 0x00007ffd, 0x00000020},
626      {NoFlag, NoFlag, NoFlag, 0x80000001, 0x00000001, 0x80000001},
627      {NoFlag, NoFlag, NoFlag, 0xffffffe0, 0xffff8003, 0xffffffe0},
628      {NoFlag, NoFlag, NoFlag, 0x7fffffff, 0xffff8003, 0x7fffffff},
629      {NoFlag, NoFlag, NoFlag, 0x80000001, 0xffffff82, 0x80000001},
630      {NoFlag, NoFlag, NoFlag, 0x80000001, 0x7ffffffe, 0x80000001},
631      {NoFlag, NoFlag, NoFlag, 0xffffff80, 0x7ffffffd, 0xffffff80},
632      {NoFlag, NoFlag, NoFlag, 0xfffffffd, 0xffff8001, 0xfffffffd},
633      {NoFlag, NoFlag, NoFlag, 0xfffffffe, 0x7fffffff, 0xfffffffe},
634      {NoFlag, NoFlag, NoFlag, 0x33333333, 0x80000001, 0x33333333},
635      {NoFlag, NoFlag, NoFlag, 0x00007ffd, 0xffffffff, 0x00007ffd},
636      {NoFlag, NoFlag, NoFlag, 0xffffffe0, 0x0000007e, 0xffffffe0},
637      {NoFlag, NoFlag, NoFlag, 0xfffffffe, 0xffffff80, 0xfffffffe},
638      {NoFlag, NoFlag, NoFlag, 0xcccccccc, 0x7ffffffd, 0xcccccccc},
639      {NoFlag, NoFlag, NoFlag, 0xffffff82, 0xffffffe0, 0xffffff82},
640      {NoFlag, NoFlag, NoFlag, 0xffffff81, 0xaaaaaaaa, 0xffffff81},
641      {NoFlag, NoFlag, NoFlag, 0xffffff83, 0x0000007e, 0xffffff83},
642      {NoFlag, NoFlag, NoFlag, 0xffffff81, 0x0000007f, 0xffffff81},
643      {NoFlag, NoFlag, NoFlag, 0x0000007f, 0x0000007f, 0x0000007f},
644      {NoFlag, NoFlag, NoFlag, 0x00000002, 0x80000000, 0x00000002},
645      {NoFlag, NoFlag, NoFlag, 0x0000007d, 0x00000000, 0x0000007d},
646      {NoFlag, NoFlag, NoFlag, 0x7ffffffe, 0xffffff80, 0x7ffffffe},
647      {NoFlag, NoFlag, NoFlag, 0xffffff82, 0x33333333, 0xffffff82},
648      {NoFlag, NoFlag, NoFlag, 0xffffff81, 0xffffff81, 0xffffff81},
649      {NoFlag, NoFlag, NoFlag, 0xffffff82, 0xaaaaaaaa, 0xffffff82},
650      {NoFlag, NoFlag, NoFlag, 0xffffffe0, 0x0000007f, 0xffffffe0},
651      {NoFlag, NoFlag, NoFlag, 0x00000000, 0x7ffffffd, 0x00000000},
652      {NoFlag, NoFlag, NoFlag, 0x0000007e, 0x33333333, 0x0000007e},
653      {NoFlag, NoFlag, NoFlag, 0x55555555, 0xfffffffe, 0x55555555},
654      {NoFlag, NoFlag, NoFlag, 0xffff8003, 0x0000007d, 0xffff8003},
655      {NoFlag, NoFlag, NoFlag, 0xcccccccc, 0x80000000, 0xcccccccc},
656      {NoFlag, NoFlag, NoFlag, 0x7ffffffe, 0xffffff81, 0x7ffffffe},
657      {NoFlag, NoFlag, NoFlag, 0x80000000, 0x7ffffffe, 0x80000000},
658      {NoFlag, NoFlag, NoFlag, 0x7fffffff, 0xffffff80, 0x7fffffff},
659      {NoFlag, NoFlag, NoFlag, 0x7fffffff, 0x00000001, 0x7fffffff},
660      {NoFlag, NoFlag, NoFlag, 0x00000000, 0x00000000, 0x00000000},
661      {NoFlag, NoFlag, NoFlag, 0xffff8001, 0xffffff82, 0xffff8001},
662      {NoFlag, NoFlag, NoFlag, 0x0000007d, 0xffff8001, 0x0000007d},
663      {NoFlag, NoFlag, NoFlag, 0x00007fff, 0x00007ffe, 0x00007fff},
664      {NoFlag, NoFlag, NoFlag, 0xfffffffd, 0x00007fff, 0xfffffffd},
665      {NoFlag, NoFlag, NoFlag, 0x7ffffffd, 0xffff8003, 0x7ffffffd},
666      {NoFlag, NoFlag, NoFlag, 0x7ffffffe, 0x80000001, 0x7ffffffe},
667      {NoFlag, NoFlag, NoFlag, 0xfffffffd, 0x7fffffff, 0xfffffffd},
668      {NoFlag, NoFlag, NoFlag, 0xffffff82, 0xffff8000, 0xffffff82},
669      {NoFlag, NoFlag, NoFlag, 0x7ffffffd, 0xffffff82, 0x7ffffffd},
670      {NoFlag, NoFlag, NoFlag, 0xffff8000, 0xcccccccc, 0xffff8000},
671      {NoFlag, NoFlag, NoFlag, 0xffffff83, 0x7fffffff, 0xffffff83},
672      {NoFlag, NoFlag, NoFlag, 0xffff8003, 0x00007fff, 0xffff8003}};
673 
674 static const Inputs kRnIsRm[] =
675     {{NoFlag, NoFlag, NoFlag, 0xffffff82, 0x00000002, 0x00000002},
676      {NoFlag, NoFlag, NoFlag, 0x00000020, 0x0000007f, 0x0000007f},
677      {NoFlag, NoFlag, NoFlag, 0x55555555, 0x0000007d, 0x0000007d},
678      {NoFlag, NoFlag, NoFlag, 0xffff8002, 0x00000020, 0x00000020},
679      {NoFlag, NoFlag, NoFlag, 0xffff8000, 0xcccccccc, 0xcccccccc},
680      {NoFlag, NoFlag, NoFlag, 0xffff8002, 0xffffffe0, 0xffffffe0},
681      {NoFlag, NoFlag, NoFlag, 0x7fffffff, 0x00000000, 0x00000000},
682      {NoFlag, NoFlag, NoFlag, 0x00000000, 0xffffffff, 0xffffffff},
683      {NoFlag, NoFlag, NoFlag, 0x00007ffe, 0xffffffe0, 0xffffffe0},
684      {NoFlag, NoFlag, NoFlag, 0x7fffffff, 0x00000002, 0x00000002},
685      {NoFlag, NoFlag, NoFlag, 0x00007fff, 0xcccccccc, 0xcccccccc},
686      {NoFlag, NoFlag, NoFlag, 0x80000000, 0x80000000, 0x80000000},
687      {NoFlag, NoFlag, NoFlag, 0xffff8001, 0x33333333, 0x33333333},
688      {NoFlag, NoFlag, NoFlag, 0x00000000, 0x00007ffd, 0x00007ffd},
689      {NoFlag, NoFlag, NoFlag, 0x00007fff, 0xaaaaaaaa, 0xaaaaaaaa},
690      {NoFlag, NoFlag, NoFlag, 0xffff8003, 0x7ffffffd, 0x7ffffffd},
691      {NoFlag, NoFlag, NoFlag, 0x7ffffffd, 0xfffffffd, 0xfffffffd},
692      {NoFlag, NoFlag, NoFlag, 0xfffffffe, 0x00000001, 0x00000001},
693      {NoFlag, NoFlag, NoFlag, 0x00000000, 0x00000002, 0x00000002},
694      {NoFlag, NoFlag, NoFlag, 0x00000002, 0xffff8001, 0xffff8001},
695      {NoFlag, NoFlag, NoFlag, 0xffff8002, 0xfffffffd, 0xfffffffd},
696      {NoFlag, NoFlag, NoFlag, 0x00007fff, 0xffff8000, 0xffff8000},
697      {NoFlag, NoFlag, NoFlag, 0x00000002, 0x7fffffff, 0x7fffffff},
698      {NoFlag, NoFlag, NoFlag, 0x0000007d, 0xffffff83, 0xffffff83},
699      {NoFlag, NoFlag, NoFlag, 0x7ffffffe, 0x00000002, 0x00000002},
700      {NoFlag, NoFlag, NoFlag, 0x7ffffffe, 0x0000007f, 0x0000007f},
701      {NoFlag, NoFlag, NoFlag, 0xffff8000, 0x00000020, 0x00000020},
702      {NoFlag, NoFlag, NoFlag, 0xffffff82, 0xffff8001, 0xffff8001},
703      {NoFlag, NoFlag, NoFlag, 0x7ffffffd, 0xffffff83, 0xffffff83},
704      {NoFlag, NoFlag, NoFlag, 0x00000020, 0xffffff81, 0xffffff81},
705      {NoFlag, NoFlag, NoFlag, 0x00007ffd, 0x00000002, 0x00000002},
706      {NoFlag, NoFlag, NoFlag, 0xcccccccc, 0xffff8000, 0xffff8000},
707      {NoFlag, NoFlag, NoFlag, 0x80000000, 0x00000001, 0x00000001},
708      {NoFlag, NoFlag, NoFlag, 0xffff8001, 0x7ffffffe, 0x7ffffffe},
709      {NoFlag, NoFlag, NoFlag, 0x7fffffff, 0x00000001, 0x00000001},
710      {NoFlag, NoFlag, NoFlag, 0x80000000, 0x7ffffffd, 0x7ffffffd},
711      {NoFlag, NoFlag, NoFlag, 0xffffffe0, 0x00000001, 0x00000001},
712      {NoFlag, NoFlag, NoFlag, 0x7ffffffd, 0x55555555, 0x55555555},
713      {NoFlag, NoFlag, NoFlag, 0xffff8002, 0x80000001, 0x80000001},
714      {NoFlag, NoFlag, NoFlag, 0xffffff82, 0xffffff82, 0xffffff82},
715      {NoFlag, NoFlag, NoFlag, 0xaaaaaaaa, 0xffff8001, 0xffff8001},
716      {NoFlag, NoFlag, NoFlag, 0xffff8002, 0xffffff80, 0xffffff80},
717      {NoFlag, NoFlag, NoFlag, 0x33333333, 0x7ffffffe, 0x7ffffffe},
718      {NoFlag, NoFlag, NoFlag, 0xffffff80, 0xffffff83, 0xffffff83},
719      {NoFlag, NoFlag, NoFlag, 0x0000007e, 0x7ffffffe, 0x7ffffffe},
720      {NoFlag, NoFlag, NoFlag, 0xfffffffe, 0xffff8002, 0xffff8002},
721      {NoFlag, NoFlag, NoFlag, 0x00007ffd, 0x80000000, 0x80000000},
722      {NoFlag, NoFlag, NoFlag, 0xffffff80, 0x00007ffe, 0x00007ffe},
723      {NoFlag, NoFlag, NoFlag, 0x00000020, 0xaaaaaaaa, 0xaaaaaaaa},
724      {NoFlag, NoFlag, NoFlag, 0x33333333, 0x00000020, 0x00000020},
725      {NoFlag, NoFlag, NoFlag, 0x0000007d, 0x7ffffffe, 0x7ffffffe},
726      {NoFlag, NoFlag, NoFlag, 0x7ffffffd, 0x7ffffffe, 0x7ffffffe},
727      {NoFlag, NoFlag, NoFlag, 0xffff8002, 0xffff8000, 0xffff8000},
728      {NoFlag, NoFlag, NoFlag, 0x80000001, 0x7fffffff, 0x7fffffff},
729      {NoFlag, NoFlag, NoFlag, 0xffffff82, 0x00000020, 0x00000020},
730      {NoFlag, NoFlag, NoFlag, 0xffffffff, 0xffffffe0, 0xffffffe0},
731      {NoFlag, NoFlag, NoFlag, 0x0000007d, 0xcccccccc, 0xcccccccc},
732      {NoFlag, NoFlag, NoFlag, 0x80000001, 0xaaaaaaaa, 0xaaaaaaaa},
733      {NoFlag, NoFlag, NoFlag, 0x00007ffe, 0x33333333, 0x33333333},
734      {NoFlag, NoFlag, NoFlag, 0x0000007e, 0xffff8002, 0xffff8002},
735      {NoFlag, NoFlag, NoFlag, 0x00000002, 0xffffffe0, 0xffffffe0},
736      {NoFlag, NoFlag, NoFlag, 0x80000000, 0xffff8000, 0xffff8000},
737      {NoFlag, NoFlag, NoFlag, 0xfffffffd, 0xffffff80, 0xffffff80},
738      {NoFlag, NoFlag, NoFlag, 0x33333333, 0x00000001, 0x00000001},
739      {NoFlag, NoFlag, NoFlag, 0x00007ffe, 0x80000001, 0x80000001},
740      {NoFlag, NoFlag, NoFlag, 0x00007fff, 0x00000002, 0x00000002},
741      {NoFlag, NoFlag, NoFlag, 0x7ffffffd, 0x0000007d, 0x0000007d},
742      {NoFlag, NoFlag, NoFlag, 0x33333333, 0xfffffffd, 0xfffffffd},
743      {NoFlag, NoFlag, NoFlag, 0xffffffe0, 0xaaaaaaaa, 0xaaaaaaaa},
744      {NoFlag, NoFlag, NoFlag, 0x0000007e, 0xffffff83, 0xffffff83},
745      {NoFlag, NoFlag, NoFlag, 0x0000007f, 0x00000002, 0x00000002},
746      {NoFlag, NoFlag, NoFlag, 0x0000007e, 0x0000007f, 0x0000007f},
747      {NoFlag, NoFlag, NoFlag, 0x00007fff, 0xfffffffe, 0xfffffffe},
748      {NoFlag, NoFlag, NoFlag, 0x00007ffd, 0xffffffff, 0xffffffff},
749      {NoFlag, NoFlag, NoFlag, 0x00000020, 0xffff8002, 0xffff8002},
750      {NoFlag, NoFlag, NoFlag, 0x00007fff, 0x55555555, 0x55555555},
751      {NoFlag, NoFlag, NoFlag, 0x7ffffffe, 0xcccccccc, 0xcccccccc},
752      {NoFlag, NoFlag, NoFlag, 0xffffff83, 0x00000020, 0x00000020},
753      {NoFlag, NoFlag, NoFlag, 0x55555555, 0x0000007e, 0x0000007e},
754      {NoFlag, NoFlag, NoFlag, 0x00000000, 0xfffffffe, 0xfffffffe},
755      {NoFlag, NoFlag, NoFlag, 0x00000001, 0x55555555, 0x55555555},
756      {NoFlag, NoFlag, NoFlag, 0xffffff80, 0x0000007f, 0x0000007f},
757      {NoFlag, NoFlag, NoFlag, 0xfffffffd, 0x7fffffff, 0x7fffffff},
758      {NoFlag, NoFlag, NoFlag, 0xaaaaaaaa, 0x7ffffffe, 0x7ffffffe},
759      {NoFlag, NoFlag, NoFlag, 0xffffff82, 0x7fffffff, 0x7fffffff},
760      {NoFlag, NoFlag, NoFlag, 0x0000007d, 0x7ffffffd, 0x7ffffffd},
761      {NoFlag, NoFlag, NoFlag, 0x00007ffd, 0x33333333, 0x33333333},
762      {NoFlag, NoFlag, NoFlag, 0xfffffffd, 0xfffffffd, 0xfffffffd},
763      {NoFlag, NoFlag, NoFlag, 0x0000007d, 0x0000007e, 0x0000007e},
764      {NoFlag, NoFlag, NoFlag, 0xffffffe0, 0xffffff82, 0xffffff82},
765      {NoFlag, NoFlag, NoFlag, 0x33333333, 0x0000007f, 0x0000007f},
766      {NoFlag, NoFlag, NoFlag, 0x00007ffe, 0x7ffffffd, 0x7ffffffd},
767      {NoFlag, NoFlag, NoFlag, 0xffffff82, 0xffffffe0, 0xffffffe0},
768      {NoFlag, NoFlag, NoFlag, 0x0000007e, 0xffff8001, 0xffff8001},
769      {NoFlag, NoFlag, NoFlag, 0x7ffffffe, 0xffffff82, 0xffffff82},
770      {NoFlag, NoFlag, NoFlag, 0xffffff83, 0x0000007f, 0x0000007f},
771      {NoFlag, NoFlag, NoFlag, 0x80000001, 0x00000020, 0x00000020},
772      {NoFlag, NoFlag, NoFlag, 0xcccccccc, 0xffff8002, 0xffff8002},
773      {NoFlag, NoFlag, NoFlag, 0xffff8000, 0x00007fff, 0x00007fff},
774      {NoFlag, NoFlag, NoFlag, 0xffff8002, 0x7ffffffe, 0x7ffffffe},
775      {NoFlag, NoFlag, NoFlag, 0xffff8003, 0x00007ffe, 0x00007ffe},
776      {NoFlag, NoFlag, NoFlag, 0x00000000, 0xffffff82, 0xffffff82},
777      {NoFlag, NoFlag, NoFlag, 0xffff8001, 0xffff8002, 0xffff8002},
778      {NoFlag, NoFlag, NoFlag, 0x7ffffffe, 0x00007ffd, 0x00007ffd},
779      {NoFlag, NoFlag, NoFlag, 0x0000007d, 0xffff8003, 0xffff8003},
780      {NoFlag, NoFlag, NoFlag, 0xaaaaaaaa, 0xffff8003, 0xffff8003},
781      {NoFlag, NoFlag, NoFlag, 0x00007fff, 0xffffff83, 0xffffff83},
782      {NoFlag, NoFlag, NoFlag, 0x55555555, 0x33333333, 0x33333333},
783      {NoFlag, NoFlag, NoFlag, 0x00007fff, 0x00007ffe, 0x00007ffe},
784      {NoFlag, NoFlag, NoFlag, 0xffffff83, 0x00007ffd, 0x00007ffd},
785      {NoFlag, NoFlag, NoFlag, 0x33333333, 0xffffff80, 0xffffff80},
786      {NoFlag, NoFlag, NoFlag, 0x00007ffd, 0xffffffe0, 0xffffffe0},
787      {NoFlag, NoFlag, NoFlag, 0xffffffe0, 0x7ffffffd, 0x7ffffffd},
788      {NoFlag, NoFlag, NoFlag, 0xffffff83, 0x00000000, 0x00000000},
789      {NoFlag, NoFlag, NoFlag, 0x00007fff, 0x00007fff, 0x00007fff},
790      {NoFlag, NoFlag, NoFlag, 0x33333333, 0x00000002, 0x00000002},
791      {NoFlag, NoFlag, NoFlag, 0x80000001, 0x00007ffe, 0x00007ffe},
792      {NoFlag, NoFlag, NoFlag, 0x00000000, 0x00000001, 0x00000001},
793      {NoFlag, NoFlag, NoFlag, 0x55555555, 0xfffffffe, 0xfffffffe},
794      {NoFlag, NoFlag, NoFlag, 0xffff8002, 0xffffff83, 0xffffff83},
795      {NoFlag, NoFlag, NoFlag, 0x0000007f, 0xffffff80, 0xffffff80},
796      {NoFlag, NoFlag, NoFlag, 0xffffff83, 0xffff8002, 0xffff8002},
797      {NoFlag, NoFlag, NoFlag, 0x0000007e, 0xffffffe0, 0xffffffe0},
798      {NoFlag, NoFlag, NoFlag, 0xffff8000, 0x0000007f, 0x0000007f},
799      {NoFlag, NoFlag, NoFlag, 0x00000002, 0x80000001, 0x80000001},
800      {NoFlag, NoFlag, NoFlag, 0x80000001, 0x00000000, 0x00000000},
801      {NoFlag, NoFlag, NoFlag, 0xffffff82, 0x7ffffffe, 0x7ffffffe},
802      {NoFlag, NoFlag, NoFlag, 0x00007ffe, 0xffff8002, 0xffff8002},
803      {NoFlag, NoFlag, NoFlag, 0xffff8003, 0x7fffffff, 0x7fffffff},
804      {NoFlag, NoFlag, NoFlag, 0xffffff81, 0x0000007e, 0x0000007e},
805      {NoFlag, NoFlag, NoFlag, 0xfffffffe, 0x00007fff, 0x00007fff},
806      {NoFlag, NoFlag, NoFlag, 0xfffffffe, 0x33333333, 0x33333333},
807      {NoFlag, NoFlag, NoFlag, 0xcccccccc, 0xaaaaaaaa, 0xaaaaaaaa},
808      {NoFlag, NoFlag, NoFlag, 0xffff8001, 0xaaaaaaaa, 0xaaaaaaaa},
809      {NoFlag, NoFlag, NoFlag, 0x0000007e, 0x7ffffffd, 0x7ffffffd},
810      {NoFlag, NoFlag, NoFlag, 0xffffffe0, 0x0000007f, 0x0000007f},
811      {NoFlag, NoFlag, NoFlag, 0x00007fff, 0xffff8001, 0xffff8001},
812      {NoFlag, NoFlag, NoFlag, 0x00007ffe, 0xfffffffd, 0xfffffffd},
813      {NoFlag, NoFlag, NoFlag, 0xfffffffd, 0x0000007d, 0x0000007d},
814      {NoFlag, NoFlag, NoFlag, 0x0000007f, 0x0000007d, 0x0000007d},
815      {NoFlag, NoFlag, NoFlag, 0x00000001, 0xaaaaaaaa, 0xaaaaaaaa},
816      {NoFlag, NoFlag, NoFlag, 0xffff8001, 0x0000007d, 0x0000007d},
817      {NoFlag, NoFlag, NoFlag, 0xffff8003, 0x00000020, 0x00000020},
818      {NoFlag, NoFlag, NoFlag, 0x00007ffe, 0x00000000, 0x00000000},
819      {NoFlag, NoFlag, NoFlag, 0xfffffffe, 0x0000007d, 0x0000007d},
820      {NoFlag, NoFlag, NoFlag, 0xffffff80, 0xfffffffe, 0xfffffffe},
821      {NoFlag, NoFlag, NoFlag, 0x0000007f, 0xffff8001, 0xffff8001},
822      {NoFlag, NoFlag, NoFlag, 0x7ffffffd, 0xffffff80, 0xffffff80},
823      {NoFlag, NoFlag, NoFlag, 0xffffffe0, 0x80000001, 0x80000001},
824      {NoFlag, NoFlag, NoFlag, 0xfffffffe, 0x0000007f, 0x0000007f},
825      {NoFlag, NoFlag, NoFlag, 0x00000000, 0xffffff81, 0xffffff81},
826      {NoFlag, NoFlag, NoFlag, 0x00007ffe, 0xfffffffe, 0xfffffffe},
827      {NoFlag, NoFlag, NoFlag, 0x80000001, 0xcccccccc, 0xcccccccc},
828      {NoFlag, NoFlag, NoFlag, 0xffff8001, 0x80000001, 0x80000001},
829      {NoFlag, NoFlag, NoFlag, 0x80000000, 0xffff8002, 0xffff8002},
830      {NoFlag, NoFlag, NoFlag, 0x00000001, 0x7fffffff, 0x7fffffff},
831      {NoFlag, NoFlag, NoFlag, 0xffffff80, 0xffff8003, 0xffff8003},
832      {NoFlag, NoFlag, NoFlag, 0xffff8002, 0x00007ffe, 0x00007ffe},
833      {NoFlag, NoFlag, NoFlag, 0x00007fff, 0x80000001, 0x80000001},
834      {NoFlag, NoFlag, NoFlag, 0xffff8000, 0x00007ffe, 0x00007ffe},
835      {NoFlag, NoFlag, NoFlag, 0xffffff80, 0xfffffffd, 0xfffffffd},
836      {NoFlag, NoFlag, NoFlag, 0xcccccccc, 0xffff8003, 0xffff8003},
837      {NoFlag, NoFlag, NoFlag, 0x0000007f, 0x00000001, 0x00000001},
838      {NoFlag, NoFlag, NoFlag, 0x80000001, 0x33333333, 0x33333333},
839      {NoFlag, NoFlag, NoFlag, 0x00007fff, 0xffffff81, 0xffffff81},
840      {NoFlag, NoFlag, NoFlag, 0xffffff81, 0x00007fff, 0x00007fff},
841      {NoFlag, NoFlag, NoFlag, 0x00007ffd, 0xfffffffe, 0xfffffffe},
842      {NoFlag, NoFlag, NoFlag, 0xaaaaaaaa, 0x80000001, 0x80000001},
843      {NoFlag, NoFlag, NoFlag, 0xffff8003, 0xaaaaaaaa, 0xaaaaaaaa},
844      {NoFlag, NoFlag, NoFlag, 0x0000007d, 0x55555555, 0x55555555},
845      {NoFlag, NoFlag, NoFlag, 0x00000020, 0xffffff83, 0xffffff83},
846      {NoFlag, NoFlag, NoFlag, 0xffff8003, 0x00000001, 0x00000001},
847      {NoFlag, NoFlag, NoFlag, 0xffffffe0, 0x00000000, 0x00000000},
848      {NoFlag, NoFlag, NoFlag, 0x0000007e, 0x0000007d, 0x0000007d},
849      {NoFlag, NoFlag, NoFlag, 0xcccccccc, 0xffffff83, 0xffffff83},
850      {NoFlag, NoFlag, NoFlag, 0xffffffff, 0x00007ffd, 0x00007ffd},
851      {NoFlag, NoFlag, NoFlag, 0x7ffffffd, 0xffffff81, 0xffffff81},
852      {NoFlag, NoFlag, NoFlag, 0x7ffffffd, 0xffff8000, 0xffff8000},
853      {NoFlag, NoFlag, NoFlag, 0x00000020, 0xffffffff, 0xffffffff},
854      {NoFlag, NoFlag, NoFlag, 0x00007ffe, 0x80000000, 0x80000000},
855      {NoFlag, NoFlag, NoFlag, 0xffffff80, 0xffff8001, 0xffff8001},
856      {NoFlag, NoFlag, NoFlag, 0xcccccccc, 0x00007fff, 0x00007fff},
857      {NoFlag, NoFlag, NoFlag, 0x55555555, 0xffffff81, 0xffffff81},
858      {NoFlag, NoFlag, NoFlag, 0x00007fff, 0xfffffffd, 0xfffffffd},
859      {NoFlag, NoFlag, NoFlag, 0x7ffffffd, 0x33333333, 0x33333333},
860      {NoFlag, NoFlag, NoFlag, 0x00007ffd, 0xffff8002, 0xffff8002},
861      {NoFlag, NoFlag, NoFlag, 0xffff8000, 0x0000007e, 0x0000007e},
862      {NoFlag, NoFlag, NoFlag, 0x0000007d, 0xffffff80, 0xffffff80},
863      {NoFlag, NoFlag, NoFlag, 0x7ffffffe, 0xffffff80, 0xffffff80},
864      {NoFlag, NoFlag, NoFlag, 0x80000000, 0x00000020, 0x00000020},
865      {NoFlag, NoFlag, NoFlag, 0x7ffffffe, 0xffffff81, 0xffffff81},
866      {NoFlag, NoFlag, NoFlag, 0x7fffffff, 0x80000001, 0x80000001},
867      {NoFlag, NoFlag, NoFlag, 0x7ffffffd, 0x7fffffff, 0x7fffffff},
868      {NoFlag, NoFlag, NoFlag, 0x00000020, 0x00000002, 0x00000002},
869      {NoFlag, NoFlag, NoFlag, 0x00000020, 0x80000001, 0x80000001},
870      {NoFlag, NoFlag, NoFlag, 0x00000001, 0xfffffffd, 0xfffffffd},
871      {NoFlag, NoFlag, NoFlag, 0x0000007f, 0x80000000, 0x80000000},
872      {NoFlag, NoFlag, NoFlag, 0x55555555, 0x00000020, 0x00000020},
873      {NoFlag, NoFlag, NoFlag, 0xffffff80, 0xffff8002, 0xffff8002},
874      {NoFlag, NoFlag, NoFlag, 0x7fffffff, 0x0000007e, 0x0000007e}};
875 
876 static const Inputs kRdIsNotRnIsNotRm[] =
877     {{NoFlag, NoFlag, NoFlag, 0xcccccccc, 0xffff8001, 0x00007ffd},
878      {NoFlag, NoFlag, NoFlag, 0xfffffffe, 0xffff8003, 0x7ffffffe},
879      {NoFlag, NoFlag, NoFlag, 0x0000007e, 0x00007fff, 0xffff8001},
880      {NoFlag, NoFlag, NoFlag, 0x80000000, 0xffffff80, 0x00000000},
881      {NoFlag, NoFlag, NoFlag, 0xcccccccc, 0x33333333, 0x33333333},
882      {NoFlag, NoFlag, NoFlag, 0x80000001, 0x0000007f, 0xfffffffe},
883      {NoFlag, NoFlag, NoFlag, 0x7fffffff, 0xffffffff, 0x00007ffd},
884      {NoFlag, NoFlag, NoFlag, 0x0000007e, 0xfffffffe, 0xffffff82},
885      {NoFlag, NoFlag, NoFlag, 0xffffff80, 0xffff8001, 0xffffff81},
886      {NoFlag, NoFlag, NoFlag, 0xcccccccc, 0x0000007e, 0xaaaaaaaa},
887      {NoFlag, NoFlag, NoFlag, 0x7ffffffe, 0x0000007e, 0x80000001},
888      {NoFlag, NoFlag, NoFlag, 0xcccccccc, 0xffffff81, 0x00000001},
889      {NoFlag, NoFlag, NoFlag, 0xffff8000, 0x00007ffd, 0x00007fff},
890      {NoFlag, NoFlag, NoFlag, 0x00000020, 0xcccccccc, 0x00000020},
891      {NoFlag, NoFlag, NoFlag, 0x7ffffffe, 0x00000020, 0xaaaaaaaa},
892      {NoFlag, NoFlag, NoFlag, 0x7ffffffe, 0x00000002, 0x33333333},
893      {NoFlag, NoFlag, NoFlag, 0xffffff81, 0x0000007f, 0xffffffe0},
894      {NoFlag, NoFlag, NoFlag, 0x00007ffe, 0x00007ffd, 0xcccccccc},
895      {NoFlag, NoFlag, NoFlag, 0x00007ffe, 0x00007ffd, 0xffffff81},
896      {NoFlag, NoFlag, NoFlag, 0x80000000, 0xfffffffe, 0xffffff80},
897      {NoFlag, NoFlag, NoFlag, 0xffff8002, 0x00007fff, 0xfffffffd},
898      {NoFlag, NoFlag, NoFlag, 0x33333333, 0x00007fff, 0x55555555},
899      {NoFlag, NoFlag, NoFlag, 0x00000002, 0x80000000, 0xcccccccc},
900      {NoFlag, NoFlag, NoFlag, 0xffffff81, 0x00000001, 0x0000007d},
901      {NoFlag, NoFlag, NoFlag, 0x80000001, 0x55555555, 0xffffffff},
902      {NoFlag, NoFlag, NoFlag, 0x55555555, 0xffffffff, 0xffffff80},
903      {NoFlag, NoFlag, NoFlag, 0x00007ffd, 0xffff8003, 0x0000007e},
904      {NoFlag, NoFlag, NoFlag, 0x80000001, 0xffffff82, 0xaaaaaaaa},
905      {NoFlag, NoFlag, NoFlag, 0x33333333, 0x00000002, 0xffffff82},
906      {NoFlag, NoFlag, NoFlag, 0x55555555, 0xffffff80, 0xfffffffe},
907      {NoFlag, NoFlag, NoFlag, 0xffff8001, 0x00007ffd, 0xffffff82},
908      {NoFlag, NoFlag, NoFlag, 0xffff8003, 0xffff8002, 0x0000007e},
909      {NoFlag, NoFlag, NoFlag, 0x0000007f, 0x00000000, 0xcccccccc},
910      {NoFlag, NoFlag, NoFlag, 0x00000020, 0x7ffffffe, 0xcccccccc},
911      {NoFlag, NoFlag, NoFlag, 0x55555555, 0x00007ffd, 0xffffff81},
912      {NoFlag, NoFlag, NoFlag, 0x0000007e, 0x80000001, 0x00000001},
913      {NoFlag, NoFlag, NoFlag, 0xfffffffd, 0x00000001, 0x00000001},
914      {NoFlag, NoFlag, NoFlag, 0xffffff80, 0xffff8001, 0x7ffffffe},
915      {NoFlag, NoFlag, NoFlag, 0x55555555, 0x33333333, 0x00000020},
916      {NoFlag, NoFlag, NoFlag, 0x00007ffe, 0xffffffe0, 0x00000002},
917      {NoFlag, NoFlag, NoFlag, 0xffff8000, 0x7ffffffe, 0x55555555},
918      {NoFlag, NoFlag, NoFlag, 0x00007ffd, 0xcccccccc, 0xffffff82},
919      {NoFlag, NoFlag, NoFlag, 0xffffff82, 0x33333333, 0xffffffe0},
920      {NoFlag, NoFlag, NoFlag, 0x80000001, 0x7ffffffe, 0xfffffffe},
921      {NoFlag, NoFlag, NoFlag, 0xffffffe0, 0xffffff80, 0x80000001},
922      {NoFlag, NoFlag, NoFlag, 0x7ffffffd, 0x0000007e, 0x00000020},
923      {NoFlag, NoFlag, NoFlag, 0x55555555, 0x00000020, 0x7ffffffd},
924      {NoFlag, NoFlag, NoFlag, 0x00000000, 0x00000001, 0x7ffffffd},
925      {NoFlag, NoFlag, NoFlag, 0x00007ffd, 0xcccccccc, 0xcccccccc},
926      {NoFlag, NoFlag, NoFlag, 0xffff8003, 0xaaaaaaaa, 0x00007fff},
927      {NoFlag, NoFlag, NoFlag, 0xffffff80, 0x0000007f, 0x80000001},
928      {NoFlag, NoFlag, NoFlag, 0xffffff83, 0xffffffff, 0xffffff80},
929      {NoFlag, NoFlag, NoFlag, 0xffffff81, 0xffffff81, 0x0000007f},
930      {NoFlag, NoFlag, NoFlag, 0xffff8000, 0x0000007d, 0xffff8000},
931      {NoFlag, NoFlag, NoFlag, 0xffff8001, 0xaaaaaaaa, 0x7fffffff},
932      {NoFlag, NoFlag, NoFlag, 0x00007ffd, 0x00000002, 0x00007fff},
933      {NoFlag, NoFlag, NoFlag, 0xffffff83, 0x00000001, 0xfffffffd},
934      {NoFlag, NoFlag, NoFlag, 0x00000020, 0x00000000, 0x55555555},
935      {NoFlag, NoFlag, NoFlag, 0xffff8001, 0xffffff80, 0x55555555},
936      {NoFlag, NoFlag, NoFlag, 0x00000000, 0x0000007e, 0xffff8001},
937      {NoFlag, NoFlag, NoFlag, 0x00000020, 0xaaaaaaaa, 0x0000007f},
938      {NoFlag, NoFlag, NoFlag, 0xffff8001, 0x80000000, 0xffffff81},
939      {NoFlag, NoFlag, NoFlag, 0xffffffe0, 0x00007ffd, 0x00000000},
940      {NoFlag, NoFlag, NoFlag, 0x80000000, 0xffffff80, 0x00000020},
941      {NoFlag, NoFlag, NoFlag, 0xffff8003, 0xffff8000, 0x00000020},
942      {NoFlag, NoFlag, NoFlag, 0xffff8001, 0xaaaaaaaa, 0xaaaaaaaa},
943      {NoFlag, NoFlag, NoFlag, 0xffffffe0, 0x7ffffffe, 0xffffff82},
944      {NoFlag, NoFlag, NoFlag, 0xffff8002, 0x00000002, 0x00000020},
945      {NoFlag, NoFlag, NoFlag, 0x00007fff, 0xfffffffd, 0x00000000},
946      {NoFlag, NoFlag, NoFlag, 0x00000000, 0xffffff83, 0x55555555},
947      {NoFlag, NoFlag, NoFlag, 0x0000007e, 0xffff8001, 0x00000001},
948      {NoFlag, NoFlag, NoFlag, 0x00007ffe, 0x00007fff, 0x00007fff},
949      {NoFlag, NoFlag, NoFlag, 0xcccccccc, 0xfffffffe, 0xffffff82},
950      {NoFlag, NoFlag, NoFlag, 0xffff8002, 0x80000000, 0xffffffff},
951      {NoFlag, NoFlag, NoFlag, 0x55555555, 0xfffffffd, 0x7ffffffd},
952      {NoFlag, NoFlag, NoFlag, 0xffffffe0, 0x7fffffff, 0x0000007d},
953      {NoFlag, NoFlag, NoFlag, 0xffffff83, 0xffffffe0, 0x0000007e},
954      {NoFlag, NoFlag, NoFlag, 0x00000002, 0x00000001, 0xffffff81},
955      {NoFlag, NoFlag, NoFlag, 0x7ffffffd, 0xffffff82, 0x80000000},
956      {NoFlag, NoFlag, NoFlag, 0x00000002, 0xffff8003, 0x33333333},
957      {NoFlag, NoFlag, NoFlag, 0xffffff82, 0x33333333, 0x7ffffffd},
958      {NoFlag, NoFlag, NoFlag, 0xffff8000, 0xffffffff, 0x0000007d},
959      {NoFlag, NoFlag, NoFlag, 0xffffffe0, 0x0000007f, 0x00000020},
960      {NoFlag, NoFlag, NoFlag, 0xffffff81, 0xffff8003, 0x55555555},
961      {NoFlag, NoFlag, NoFlag, 0x00000002, 0xfffffffd, 0xffffff80},
962      {NoFlag, NoFlag, NoFlag, 0x00007ffe, 0xfffffffe, 0xfffffffe},
963      {NoFlag, NoFlag, NoFlag, 0x00000000, 0xffffffe0, 0xffff8001},
964      {NoFlag, NoFlag, NoFlag, 0xfffffffd, 0xffffff82, 0xffff8001},
965      {NoFlag, NoFlag, NoFlag, 0xffffff81, 0x00007ffd, 0x80000001},
966      {NoFlag, NoFlag, NoFlag, 0xffffff82, 0x00000002, 0x0000007d},
967      {NoFlag, NoFlag, NoFlag, 0x0000007e, 0x00007ffd, 0x0000007d},
968      {NoFlag, NoFlag, NoFlag, 0x7ffffffd, 0x7fffffff, 0xaaaaaaaa},
969      {NoFlag, NoFlag, NoFlag, 0xcccccccc, 0xfffffffe, 0xaaaaaaaa},
970      {NoFlag, NoFlag, NoFlag, 0xcccccccc, 0xffff8003, 0xffff8003},
971      {NoFlag, NoFlag, NoFlag, 0x33333333, 0xaaaaaaaa, 0xfffffffd},
972      {NoFlag, NoFlag, NoFlag, 0x7ffffffd, 0x00000020, 0xffffffe0},
973      {NoFlag, NoFlag, NoFlag, 0xffffff82, 0x0000007d, 0xfffffffe},
974      {NoFlag, NoFlag, NoFlag, 0x55555555, 0x80000001, 0xffff8003},
975      {NoFlag, NoFlag, NoFlag, 0x7ffffffe, 0xffffffff, 0x00000001},
976      {NoFlag, NoFlag, NoFlag, 0xffffffe0, 0x00000000, 0x33333333},
977      {NoFlag, NoFlag, NoFlag, 0x33333333, 0x80000000, 0xffff8001},
978      {NoFlag, NoFlag, NoFlag, 0xfffffffe, 0x55555555, 0x0000007f},
979      {NoFlag, NoFlag, NoFlag, 0xffff8003, 0xffff8003, 0x0000007e},
980      {NoFlag, NoFlag, NoFlag, 0xffffff80, 0x80000001, 0x00000020},
981      {NoFlag, NoFlag, NoFlag, 0xaaaaaaaa, 0xffffff82, 0x0000007f},
982      {NoFlag, NoFlag, NoFlag, 0xffffff80, 0x00000000, 0xffff8000},
983      {NoFlag, NoFlag, NoFlag, 0x33333333, 0x0000007e, 0x7ffffffd},
984      {NoFlag, NoFlag, NoFlag, 0xffff8001, 0x7fffffff, 0xffff8003},
985      {NoFlag, NoFlag, NoFlag, 0xaaaaaaaa, 0xaaaaaaaa, 0x80000001},
986      {NoFlag, NoFlag, NoFlag, 0x00007ffd, 0xffffff80, 0x33333333},
987      {NoFlag, NoFlag, NoFlag, 0x80000000, 0x00000001, 0xffff8001},
988      {NoFlag, NoFlag, NoFlag, 0xffff8002, 0x00007ffe, 0x00000002},
989      {NoFlag, NoFlag, NoFlag, 0xffffff80, 0x00000000, 0xffff8001},
990      {NoFlag, NoFlag, NoFlag, 0xfffffffd, 0xffffff82, 0xffffff81},
991      {NoFlag, NoFlag, NoFlag, 0x33333333, 0xaaaaaaaa, 0xffffff81},
992      {NoFlag, NoFlag, NoFlag, 0x80000001, 0x80000000, 0x00007ffd},
993      {NoFlag, NoFlag, NoFlag, 0xffff8002, 0x55555555, 0xfffffffe},
994      {NoFlag, NoFlag, NoFlag, 0x00000000, 0xffffff81, 0x33333333},
995      {NoFlag, NoFlag, NoFlag, 0xffffff82, 0xffffffe0, 0x80000000},
996      {NoFlag, NoFlag, NoFlag, 0xffffff82, 0x00000001, 0xffff8001},
997      {NoFlag, NoFlag, NoFlag, 0xffffff80, 0xffffff80, 0x00000020},
998      {NoFlag, NoFlag, NoFlag, 0xffff8002, 0xcccccccc, 0x00000000},
999      {NoFlag, NoFlag, NoFlag, 0xffffffe0, 0xffff8001, 0x7ffffffe},
1000      {NoFlag, NoFlag, NoFlag, 0x00007ffd, 0xffff8001, 0xaaaaaaaa},
1001      {NoFlag, NoFlag, NoFlag, 0x00007fff, 0xfffffffe, 0xcccccccc},
1002      {NoFlag, NoFlag, NoFlag, 0x80000001, 0xcccccccc, 0xffff8001},
1003      {NoFlag, NoFlag, NoFlag, 0xffffff82, 0x00007ffd, 0x00000020},
1004      {NoFlag, NoFlag, NoFlag, 0xcccccccc, 0xfffffffd, 0x00007fff},
1005      {NoFlag, NoFlag, NoFlag, 0xffff8003, 0x00000001, 0xfffffffd},
1006      {NoFlag, NoFlag, NoFlag, 0xffffff82, 0x7ffffffd, 0x00000020},
1007      {NoFlag, NoFlag, NoFlag, 0x00000000, 0xffff8001, 0xffffff82},
1008      {NoFlag, NoFlag, NoFlag, 0x55555555, 0x00007ffe, 0x00000002},
1009      {NoFlag, NoFlag, NoFlag, 0x80000001, 0x00000001, 0x00000002},
1010      {NoFlag, NoFlag, NoFlag, 0xaaaaaaaa, 0x33333333, 0x33333333},
1011      {NoFlag, NoFlag, NoFlag, 0xffffff80, 0xffff8002, 0xffffff82},
1012      {NoFlag, NoFlag, NoFlag, 0x0000007d, 0xffffff82, 0x80000000},
1013      {NoFlag, NoFlag, NoFlag, 0xffff8003, 0x0000007f, 0x0000007d},
1014      {NoFlag, NoFlag, NoFlag, 0xffffffe0, 0x00000001, 0x00000002},
1015      {NoFlag, NoFlag, NoFlag, 0x00000020, 0x00007fff, 0x0000007f},
1016      {NoFlag, NoFlag, NoFlag, 0x00000000, 0xffff8000, 0x0000007e},
1017      {NoFlag, NoFlag, NoFlag, 0xcccccccc, 0xffffff81, 0x7ffffffd},
1018      {NoFlag, NoFlag, NoFlag, 0xaaaaaaaa, 0xffff8003, 0x00007ffe},
1019      {NoFlag, NoFlag, NoFlag, 0x80000001, 0x7fffffff, 0x0000007f},
1020      {NoFlag, NoFlag, NoFlag, 0x00000020, 0x80000000, 0xffffff83},
1021      {NoFlag, NoFlag, NoFlag, 0xffff8002, 0x7ffffffe, 0x00000020},
1022      {NoFlag, NoFlag, NoFlag, 0xffff8002, 0x00000020, 0xffffff83},
1023      {NoFlag, NoFlag, NoFlag, 0xfffffffe, 0xffffff81, 0x80000000},
1024      {NoFlag, NoFlag, NoFlag, 0xffffffff, 0xffff8001, 0xffff8003},
1025      {NoFlag, NoFlag, NoFlag, 0x00000001, 0x7ffffffe, 0xffff8000},
1026      {NoFlag, NoFlag, NoFlag, 0x00000002, 0x80000000, 0xfffffffe},
1027      {NoFlag, NoFlag, NoFlag, 0xffffff80, 0xaaaaaaaa, 0xffffff82},
1028      {NoFlag, NoFlag, NoFlag, 0x00007ffd, 0xffffffff, 0xffffff81},
1029      {NoFlag, NoFlag, NoFlag, 0x7ffffffe, 0xffff8001, 0xfffffffe},
1030      {NoFlag, NoFlag, NoFlag, 0x7ffffffd, 0x0000007f, 0x7fffffff},
1031      {NoFlag, NoFlag, NoFlag, 0x00000000, 0x0000007f, 0x00007ffe},
1032      {NoFlag, NoFlag, NoFlag, 0xaaaaaaaa, 0xffff8000, 0x7fffffff},
1033      {NoFlag, NoFlag, NoFlag, 0xffff8002, 0xfffffffe, 0xfffffffd},
1034      {NoFlag, NoFlag, NoFlag, 0x7fffffff, 0xfffffffd, 0x0000007f},
1035      {NoFlag, NoFlag, NoFlag, 0x0000007e, 0xffffffff, 0x00007fff},
1036      {NoFlag, NoFlag, NoFlag, 0x0000007d, 0xcccccccc, 0x00000002},
1037      {NoFlag, NoFlag, NoFlag, 0xffffff83, 0xffffff80, 0xffffff80},
1038      {NoFlag, NoFlag, NoFlag, 0x00000002, 0x0000007e, 0x55555555},
1039      {NoFlag, NoFlag, NoFlag, 0xffffff82, 0xffffff80, 0xffff8000},
1040      {NoFlag, NoFlag, NoFlag, 0xffff8002, 0x0000007d, 0xfffffffe},
1041      {NoFlag, NoFlag, NoFlag, 0xfffffffe, 0xffffff82, 0x00000000},
1042      {NoFlag, NoFlag, NoFlag, 0x0000007f, 0x55555555, 0xffffff81},
1043      {NoFlag, NoFlag, NoFlag, 0x33333333, 0xffff8001, 0x00000002},
1044      {NoFlag, NoFlag, NoFlag, 0x7ffffffe, 0xffffffe0, 0x33333333},
1045      {NoFlag, NoFlag, NoFlag, 0x55555555, 0x00000001, 0x55555555},
1046      {NoFlag, NoFlag, NoFlag, 0xffffff80, 0xffffffff, 0x0000007d},
1047      {NoFlag, NoFlag, NoFlag, 0x00007fff, 0x00000000, 0x7fffffff},
1048      {NoFlag, NoFlag, NoFlag, 0xffff8002, 0x0000007d, 0x7ffffffe},
1049      {NoFlag, NoFlag, NoFlag, 0xffffffff, 0x0000007e, 0xffff8001},
1050      {NoFlag, NoFlag, NoFlag, 0xffffffff, 0x00007fff, 0xffffff83},
1051      {NoFlag, NoFlag, NoFlag, 0x0000007e, 0x0000007d, 0x00000020},
1052      {NoFlag, NoFlag, NoFlag, 0x80000000, 0xffffff81, 0x0000007d},
1053      {NoFlag, NoFlag, NoFlag, 0xffffffff, 0xffff8002, 0x00007ffd},
1054      {NoFlag, NoFlag, NoFlag, 0x0000007f, 0x55555555, 0x0000007f},
1055      {NoFlag, NoFlag, NoFlag, 0xffffffe0, 0x00000020, 0x00007ffd},
1056      {NoFlag, NoFlag, NoFlag, 0xffff8001, 0xffffff80, 0x00000001},
1057      {NoFlag, NoFlag, NoFlag, 0x7ffffffe, 0x00007ffd, 0x0000007e},
1058      {NoFlag, NoFlag, NoFlag, 0xffffff83, 0x7ffffffe, 0x00000001},
1059      {NoFlag, NoFlag, NoFlag, 0x00007ffd, 0xffff8001, 0x80000001},
1060      {NoFlag, NoFlag, NoFlag, 0x00000001, 0xffff8003, 0x0000007e},
1061      {NoFlag, NoFlag, NoFlag, 0x80000001, 0xffff8003, 0xffffff81},
1062      {NoFlag, NoFlag, NoFlag, 0xffff8000, 0x0000007d, 0x00000001},
1063      {NoFlag, NoFlag, NoFlag, 0x00007ffd, 0x0000007f, 0xffff8003},
1064      {NoFlag, NoFlag, NoFlag, 0xfffffffd, 0xffffffff, 0x00000000},
1065      {NoFlag, NoFlag, NoFlag, 0xffff8000, 0x00007fff, 0x55555555},
1066      {NoFlag, NoFlag, NoFlag, 0x33333333, 0xffffff82, 0x00007ffe},
1067      {NoFlag, NoFlag, NoFlag, 0xffffff80, 0x7ffffffe, 0x0000007e},
1068      {NoFlag, NoFlag, NoFlag, 0xffff8002, 0xffffffff, 0x00000002},
1069      {NoFlag, NoFlag, NoFlag, 0xffff8003, 0x00007ffd, 0xffffff80},
1070      {NoFlag, NoFlag, NoFlag, 0x00007ffe, 0x00000002, 0xcccccccc},
1071      {NoFlag, NoFlag, NoFlag, 0x00000002, 0xffffff81, 0xfffffffd},
1072      {NoFlag, NoFlag, NoFlag, 0xffffffe0, 0x0000007d, 0x00000001},
1073      {NoFlag, NoFlag, NoFlag, 0x00000000, 0xffffff82, 0xffffff82},
1074      {NoFlag, NoFlag, NoFlag, 0xfffffffd, 0x00000020, 0xffff8002},
1075      {NoFlag, NoFlag, NoFlag, 0xffff8003, 0xffffff81, 0x0000007d},
1076      {NoFlag, NoFlag, NoFlag, 0x00000001, 0x7fffffff, 0x55555555}};
1077 
1078 
1079 // A loop will be generated for each element of this array.
1080 const TestLoopData kTests[] = {{{eq, r0, r0, r0},
1081                                 "eq r0 r0 r0",
1082                                 "Condition_eq_r0_r0_r0",
1083                                 ARRAY_SIZE(kCondition),
1084                                 kCondition},
1085                                {{ne, r0, r0, r0},
1086                                 "ne r0 r0 r0",
1087                                 "Condition_ne_r0_r0_r0",
1088                                 ARRAY_SIZE(kCondition),
1089                                 kCondition},
1090                                {{cs, r0, r0, r0},
1091                                 "cs r0 r0 r0",
1092                                 "Condition_cs_r0_r0_r0",
1093                                 ARRAY_SIZE(kCondition),
1094                                 kCondition},
1095                                {{cc, r0, r0, r0},
1096                                 "cc r0 r0 r0",
1097                                 "Condition_cc_r0_r0_r0",
1098                                 ARRAY_SIZE(kCondition),
1099                                 kCondition},
1100                                {{mi, r0, r0, r0},
1101                                 "mi r0 r0 r0",
1102                                 "Condition_mi_r0_r0_r0",
1103                                 ARRAY_SIZE(kCondition),
1104                                 kCondition},
1105                                {{pl, r0, r0, r0},
1106                                 "pl r0 r0 r0",
1107                                 "Condition_pl_r0_r0_r0",
1108                                 ARRAY_SIZE(kCondition),
1109                                 kCondition},
1110                                {{vs, r0, r0, r0},
1111                                 "vs r0 r0 r0",
1112                                 "Condition_vs_r0_r0_r0",
1113                                 ARRAY_SIZE(kCondition),
1114                                 kCondition},
1115                                {{vc, r0, r0, r0},
1116                                 "vc r0 r0 r0",
1117                                 "Condition_vc_r0_r0_r0",
1118                                 ARRAY_SIZE(kCondition),
1119                                 kCondition},
1120                                {{hi, r0, r0, r0},
1121                                 "hi r0 r0 r0",
1122                                 "Condition_hi_r0_r0_r0",
1123                                 ARRAY_SIZE(kCondition),
1124                                 kCondition},
1125                                {{ls, r0, r0, r0},
1126                                 "ls r0 r0 r0",
1127                                 "Condition_ls_r0_r0_r0",
1128                                 ARRAY_SIZE(kCondition),
1129                                 kCondition},
1130                                {{ge, r0, r0, r0},
1131                                 "ge r0 r0 r0",
1132                                 "Condition_ge_r0_r0_r0",
1133                                 ARRAY_SIZE(kCondition),
1134                                 kCondition},
1135                                {{lt, r0, r0, r0},
1136                                 "lt r0 r0 r0",
1137                                 "Condition_lt_r0_r0_r0",
1138                                 ARRAY_SIZE(kCondition),
1139                                 kCondition},
1140                                {{gt, r0, r0, r0},
1141                                 "gt r0 r0 r0",
1142                                 "Condition_gt_r0_r0_r0",
1143                                 ARRAY_SIZE(kCondition),
1144                                 kCondition},
1145                                {{le, r0, r0, r0},
1146                                 "le r0 r0 r0",
1147                                 "Condition_le_r0_r0_r0",
1148                                 ARRAY_SIZE(kCondition),
1149                                 kCondition},
1150                                {{al, r0, r0, r0},
1151                                 "al r0 r0 r0",
1152                                 "Condition_al_r0_r0_r0",
1153                                 ARRAY_SIZE(kCondition),
1154                                 kCondition},
1155                                {{al, r0, r0, r0},
1156                                 "al r0 r0 r0",
1157                                 "RdIsRnIsRm_al_r0_r0_r0",
1158                                 ARRAY_SIZE(kRdIsRnIsRm),
1159                                 kRdIsRnIsRm},
1160                                {{al, r1, r1, r1},
1161                                 "al r1 r1 r1",
1162                                 "RdIsRnIsRm_al_r1_r1_r1",
1163                                 ARRAY_SIZE(kRdIsRnIsRm),
1164                                 kRdIsRnIsRm},
1165                                {{al, r2, r2, r2},
1166                                 "al r2 r2 r2",
1167                                 "RdIsRnIsRm_al_r2_r2_r2",
1168                                 ARRAY_SIZE(kRdIsRnIsRm),
1169                                 kRdIsRnIsRm},
1170                                {{al, r3, r3, r3},
1171                                 "al r3 r3 r3",
1172                                 "RdIsRnIsRm_al_r3_r3_r3",
1173                                 ARRAY_SIZE(kRdIsRnIsRm),
1174                                 kRdIsRnIsRm},
1175                                {{al, r4, r4, r4},
1176                                 "al r4 r4 r4",
1177                                 "RdIsRnIsRm_al_r4_r4_r4",
1178                                 ARRAY_SIZE(kRdIsRnIsRm),
1179                                 kRdIsRnIsRm},
1180                                {{al, r5, r5, r5},
1181                                 "al r5 r5 r5",
1182                                 "RdIsRnIsRm_al_r5_r5_r5",
1183                                 ARRAY_SIZE(kRdIsRnIsRm),
1184                                 kRdIsRnIsRm},
1185                                {{al, r6, r6, r6},
1186                                 "al r6 r6 r6",
1187                                 "RdIsRnIsRm_al_r6_r6_r6",
1188                                 ARRAY_SIZE(kRdIsRnIsRm),
1189                                 kRdIsRnIsRm},
1190                                {{al, r7, r7, r7},
1191                                 "al r7 r7 r7",
1192                                 "RdIsRnIsRm_al_r7_r7_r7",
1193                                 ARRAY_SIZE(kRdIsRnIsRm),
1194                                 kRdIsRnIsRm},
1195                                {{al, r8, r8, r8},
1196                                 "al r8 r8 r8",
1197                                 "RdIsRnIsRm_al_r8_r8_r8",
1198                                 ARRAY_SIZE(kRdIsRnIsRm),
1199                                 kRdIsRnIsRm},
1200                                {{al, r9, r9, r9},
1201                                 "al r9 r9 r9",
1202                                 "RdIsRnIsRm_al_r9_r9_r9",
1203                                 ARRAY_SIZE(kRdIsRnIsRm),
1204                                 kRdIsRnIsRm},
1205                                {{al, r10, r10, r10},
1206                                 "al r10 r10 r10",
1207                                 "RdIsRnIsRm_al_r10_r10_r10",
1208                                 ARRAY_SIZE(kRdIsRnIsRm),
1209                                 kRdIsRnIsRm},
1210                                {{al, r11, r11, r11},
1211                                 "al r11 r11 r11",
1212                                 "RdIsRnIsRm_al_r11_r11_r11",
1213                                 ARRAY_SIZE(kRdIsRnIsRm),
1214                                 kRdIsRnIsRm},
1215                                {{al, r12, r12, r12},
1216                                 "al r12 r12 r12",
1217                                 "RdIsRnIsRm_al_r12_r12_r12",
1218                                 ARRAY_SIZE(kRdIsRnIsRm),
1219                                 kRdIsRnIsRm},
1220                                {{al, r14, r14, r14},
1221                                 "al r14 r14 r14",
1222                                 "RdIsRnIsRm_al_r14_r14_r14",
1223                                 ARRAY_SIZE(kRdIsRnIsRm),
1224                                 kRdIsRnIsRm},
1225                                {{al, r14, r14, r3},
1226                                 "al r14 r14 r3",
1227                                 "RdIsRn_al_r14_r14_r3",
1228                                 ARRAY_SIZE(kRdIsRn),
1229                                 kRdIsRn},
1230                                {{al, r1, r1, r2},
1231                                 "al r1 r1 r2",
1232                                 "RdIsRn_al_r1_r1_r2",
1233                                 ARRAY_SIZE(kRdIsRn),
1234                                 kRdIsRn},
1235                                {{al, r12, r12, r7},
1236                                 "al r12 r12 r7",
1237                                 "RdIsRn_al_r12_r12_r7",
1238                                 ARRAY_SIZE(kRdIsRn),
1239                                 kRdIsRn},
1240                                {{al, r10, r10, r6},
1241                                 "al r10 r10 r6",
1242                                 "RdIsRn_al_r10_r10_r6",
1243                                 ARRAY_SIZE(kRdIsRn),
1244                                 kRdIsRn},
1245                                {{al, r4, r4, r9},
1246                                 "al r4 r4 r9",
1247                                 "RdIsRn_al_r4_r4_r9",
1248                                 ARRAY_SIZE(kRdIsRn),
1249                                 kRdIsRn},
1250                                {{al, r5, r5, r6},
1251                                 "al r5 r5 r6",
1252                                 "RdIsRn_al_r5_r5_r6",
1253                                 ARRAY_SIZE(kRdIsRn),
1254                                 kRdIsRn},
1255                                {{al, r2, r2, r4},
1256                                 "al r2 r2 r4",
1257                                 "RdIsRn_al_r2_r2_r4",
1258                                 ARRAY_SIZE(kRdIsRn),
1259                                 kRdIsRn},
1260                                {{al, r7, r7, r11},
1261                                 "al r7 r7 r11",
1262                                 "RdIsRn_al_r7_r7_r11",
1263                                 ARRAY_SIZE(kRdIsRn),
1264                                 kRdIsRn},
1265                                {{al, r7, r7, r12},
1266                                 "al r7 r7 r12",
1267                                 "RdIsRn_al_r7_r7_r12",
1268                                 ARRAY_SIZE(kRdIsRn),
1269                                 kRdIsRn},
1270                                {{al, r2, r2, r10},
1271                                 "al r2 r2 r10",
1272                                 "RdIsRn_al_r2_r2_r10",
1273                                 ARRAY_SIZE(kRdIsRn),
1274                                 kRdIsRn},
1275                                {{al, r1, r12, r1},
1276                                 "al r1 r12 r1",
1277                                 "RdIsRm_al_r1_r12_r1",
1278                                 ARRAY_SIZE(kRdIsRm),
1279                                 kRdIsRm},
1280                                {{al, r4, r3, r4},
1281                                 "al r4 r3 r4",
1282                                 "RdIsRm_al_r4_r3_r4",
1283                                 ARRAY_SIZE(kRdIsRm),
1284                                 kRdIsRm},
1285                                {{al, r0, r2, r0},
1286                                 "al r0 r2 r0",
1287                                 "RdIsRm_al_r0_r2_r0",
1288                                 ARRAY_SIZE(kRdIsRm),
1289                                 kRdIsRm},
1290                                {{al, r10, r4, r10},
1291                                 "al r10 r4 r10",
1292                                 "RdIsRm_al_r10_r4_r10",
1293                                 ARRAY_SIZE(kRdIsRm),
1294                                 kRdIsRm},
1295                                {{al, r4, r8, r4},
1296                                 "al r4 r8 r4",
1297                                 "RdIsRm_al_r4_r8_r4",
1298                                 ARRAY_SIZE(kRdIsRm),
1299                                 kRdIsRm},
1300                                {{al, r4, r1, r4},
1301                                 "al r4 r1 r4",
1302                                 "RdIsRm_al_r4_r1_r4",
1303                                 ARRAY_SIZE(kRdIsRm),
1304                                 kRdIsRm},
1305                                {{al, r8, r11, r8},
1306                                 "al r8 r11 r8",
1307                                 "RdIsRm_al_r8_r11_r8",
1308                                 ARRAY_SIZE(kRdIsRm),
1309                                 kRdIsRm},
1310                                {{al, r1, r10, r1},
1311                                 "al r1 r10 r1",
1312                                 "RdIsRm_al_r1_r10_r1",
1313                                 ARRAY_SIZE(kRdIsRm),
1314                                 kRdIsRm},
1315                                {{al, r2, r0, r2},
1316                                 "al r2 r0 r2",
1317                                 "RdIsRm_al_r2_r0_r2",
1318                                 ARRAY_SIZE(kRdIsRm),
1319                                 kRdIsRm},
1320                                {{al, r6, r7, r6},
1321                                 "al r6 r7 r6",
1322                                 "RdIsRm_al_r6_r7_r6",
1323                                 ARRAY_SIZE(kRdIsRm),
1324                                 kRdIsRm},
1325                                {{al, r1, r12, r12},
1326                                 "al r1 r12 r12",
1327                                 "RnIsRm_al_r1_r12_r12",
1328                                 ARRAY_SIZE(kRnIsRm),
1329                                 kRnIsRm},
1330                                {{al, r6, r9, r9},
1331                                 "al r6 r9 r9",
1332                                 "RnIsRm_al_r6_r9_r9",
1333                                 ARRAY_SIZE(kRnIsRm),
1334                                 kRnIsRm},
1335                                {{al, r12, r7, r7},
1336                                 "al r12 r7 r7",
1337                                 "RnIsRm_al_r12_r7_r7",
1338                                 ARRAY_SIZE(kRnIsRm),
1339                                 kRnIsRm},
1340                                {{al, r11, r8, r8},
1341                                 "al r11 r8 r8",
1342                                 "RnIsRm_al_r11_r8_r8",
1343                                 ARRAY_SIZE(kRnIsRm),
1344                                 kRnIsRm},
1345                                {{al, r14, r0, r0},
1346                                 "al r14 r0 r0",
1347                                 "RnIsRm_al_r14_r0_r0",
1348                                 ARRAY_SIZE(kRnIsRm),
1349                                 kRnIsRm},
1350                                {{al, r8, r4, r4},
1351                                 "al r8 r4 r4",
1352                                 "RnIsRm_al_r8_r4_r4",
1353                                 ARRAY_SIZE(kRnIsRm),
1354                                 kRnIsRm},
1355                                {{al, r0, r8, r8},
1356                                 "al r0 r8 r8",
1357                                 "RnIsRm_al_r0_r8_r8",
1358                                 ARRAY_SIZE(kRnIsRm),
1359                                 kRnIsRm},
1360                                {{al, r5, r3, r3},
1361                                 "al r5 r3 r3",
1362                                 "RnIsRm_al_r5_r3_r3",
1363                                 ARRAY_SIZE(kRnIsRm),
1364                                 kRnIsRm},
1365                                {{al, r8, r5, r5},
1366                                 "al r8 r5 r5",
1367                                 "RnIsRm_al_r8_r5_r5",
1368                                 ARRAY_SIZE(kRnIsRm),
1369                                 kRnIsRm},
1370                                {{al, r5, r10, r10},
1371                                 "al r5 r10 r10",
1372                                 "RnIsRm_al_r5_r10_r10",
1373                                 ARRAY_SIZE(kRnIsRm),
1374                                 kRnIsRm},
1375                                {{al, r14, r3, r4},
1376                                 "al r14 r3 r4",
1377                                 "RdIsNotRnIsNotRm_al_r14_r3_r4",
1378                                 ARRAY_SIZE(kRdIsNotRnIsNotRm),
1379                                 kRdIsNotRnIsNotRm},
1380                                {{al, r3, r11, r1},
1381                                 "al r3 r11 r1",
1382                                 "RdIsNotRnIsNotRm_al_r3_r11_r1",
1383                                 ARRAY_SIZE(kRdIsNotRnIsNotRm),
1384                                 kRdIsNotRnIsNotRm},
1385                                {{al, r11, r2, r6},
1386                                 "al r11 r2 r6",
1387                                 "RdIsNotRnIsNotRm_al_r11_r2_r6",
1388                                 ARRAY_SIZE(kRdIsNotRnIsNotRm),
1389                                 kRdIsNotRnIsNotRm},
1390                                {{al, r14, r0, r5},
1391                                 "al r14 r0 r5",
1392                                 "RdIsNotRnIsNotRm_al_r14_r0_r5",
1393                                 ARRAY_SIZE(kRdIsNotRnIsNotRm),
1394                                 kRdIsNotRnIsNotRm},
1395                                {{al, r11, r6, r12},
1396                                 "al r11 r6 r12",
1397                                 "RdIsNotRnIsNotRm_al_r11_r6_r12",
1398                                 ARRAY_SIZE(kRdIsNotRnIsNotRm),
1399                                 kRdIsNotRnIsNotRm},
1400                                {{al, r10, r8, r4},
1401                                 "al r10 r8 r4",
1402                                 "RdIsNotRnIsNotRm_al_r10_r8_r4",
1403                                 ARRAY_SIZE(kRdIsNotRnIsNotRm),
1404                                 kRdIsNotRnIsNotRm},
1405                                {{al, r4, r3, r1},
1406                                 "al r4 r3 r1",
1407                                 "RdIsNotRnIsNotRm_al_r4_r3_r1",
1408                                 ARRAY_SIZE(kRdIsNotRnIsNotRm),
1409                                 kRdIsNotRnIsNotRm},
1410                                {{al, r12, r11, r14},
1411                                 "al r12 r11 r14",
1412                                 "RdIsNotRnIsNotRm_al_r12_r11_r14",
1413                                 ARRAY_SIZE(kRdIsNotRnIsNotRm),
1414                                 kRdIsNotRnIsNotRm},
1415                                {{al, r9, r4, r11},
1416                                 "al r9 r4 r11",
1417                                 "RdIsNotRnIsNotRm_al_r9_r4_r11",
1418                                 ARRAY_SIZE(kRdIsNotRnIsNotRm),
1419                                 kRdIsNotRnIsNotRm},
1420                                {{al, r14, r4, r6},
1421                                 "al r14 r4 r6",
1422                                 "RdIsNotRnIsNotRm_al_r14_r4_r6",
1423                                 ARRAY_SIZE(kRdIsNotRnIsNotRm),
1424                                 kRdIsNotRnIsNotRm}};
1425 
1426 // We record all inputs to the instructions as outputs. This way, we also check
1427 // that what shouldn't change didn't change.
1428 struct TestResult {
1429   size_t output_size;
1430   const Inputs* outputs;
1431 };
1432 
1433 // These headers each contain an array of `TestResult` with the reference output
1434 // values. The reference arrays are names `kReference{mnemonic}`.
1435 #include "aarch32/traces/simulator-cond-rd-rn-rm-t32-mul.h"
1436 #include "aarch32/traces/simulator-cond-rd-rn-rm-t32-qadd16.h"
1437 #include "aarch32/traces/simulator-cond-rd-rn-rm-t32-qadd8.h"
1438 #include "aarch32/traces/simulator-cond-rd-rn-rm-t32-qasx.h"
1439 #include "aarch32/traces/simulator-cond-rd-rn-rm-t32-qsax.h"
1440 #include "aarch32/traces/simulator-cond-rd-rn-rm-t32-qsub16.h"
1441 #include "aarch32/traces/simulator-cond-rd-rn-rm-t32-qsub8.h"
1442 #include "aarch32/traces/simulator-cond-rd-rn-rm-t32-sdiv.h"
1443 #include "aarch32/traces/simulator-cond-rd-rn-rm-t32-shadd16.h"
1444 #include "aarch32/traces/simulator-cond-rd-rn-rm-t32-shadd8.h"
1445 #include "aarch32/traces/simulator-cond-rd-rn-rm-t32-shasx.h"
1446 #include "aarch32/traces/simulator-cond-rd-rn-rm-t32-shsax.h"
1447 #include "aarch32/traces/simulator-cond-rd-rn-rm-t32-shsub16.h"
1448 #include "aarch32/traces/simulator-cond-rd-rn-rm-t32-shsub8.h"
1449 #include "aarch32/traces/simulator-cond-rd-rn-rm-t32-smmul.h"
1450 #include "aarch32/traces/simulator-cond-rd-rn-rm-t32-smmulr.h"
1451 #include "aarch32/traces/simulator-cond-rd-rn-rm-t32-smuad.h"
1452 #include "aarch32/traces/simulator-cond-rd-rn-rm-t32-smuadx.h"
1453 #include "aarch32/traces/simulator-cond-rd-rn-rm-t32-smulbb.h"
1454 #include "aarch32/traces/simulator-cond-rd-rn-rm-t32-smulbt.h"
1455 #include "aarch32/traces/simulator-cond-rd-rn-rm-t32-smultb.h"
1456 #include "aarch32/traces/simulator-cond-rd-rn-rm-t32-smultt.h"
1457 #include "aarch32/traces/simulator-cond-rd-rn-rm-t32-smulwb.h"
1458 #include "aarch32/traces/simulator-cond-rd-rn-rm-t32-smulwt.h"
1459 #include "aarch32/traces/simulator-cond-rd-rn-rm-t32-smusd.h"
1460 #include "aarch32/traces/simulator-cond-rd-rn-rm-t32-smusdx.h"
1461 #include "aarch32/traces/simulator-cond-rd-rn-rm-t32-udiv.h"
1462 #include "aarch32/traces/simulator-cond-rd-rn-rm-t32-uhadd16.h"
1463 #include "aarch32/traces/simulator-cond-rd-rn-rm-t32-uhadd8.h"
1464 #include "aarch32/traces/simulator-cond-rd-rn-rm-t32-uhasx.h"
1465 #include "aarch32/traces/simulator-cond-rd-rn-rm-t32-uhsax.h"
1466 #include "aarch32/traces/simulator-cond-rd-rn-rm-t32-uhsub16.h"
1467 #include "aarch32/traces/simulator-cond-rd-rn-rm-t32-uhsub8.h"
1468 #include "aarch32/traces/simulator-cond-rd-rn-rm-t32-uqadd16.h"
1469 #include "aarch32/traces/simulator-cond-rd-rn-rm-t32-uqadd8.h"
1470 #include "aarch32/traces/simulator-cond-rd-rn-rm-t32-uqasx.h"
1471 #include "aarch32/traces/simulator-cond-rd-rn-rm-t32-uqsax.h"
1472 #include "aarch32/traces/simulator-cond-rd-rn-rm-t32-uqsub16.h"
1473 #include "aarch32/traces/simulator-cond-rd-rn-rm-t32-uqsub8.h"
1474 #include "aarch32/traces/simulator-cond-rd-rn-rm-t32-usad8.h"
1475 #include "aarch32/traces/simulator-cond-rd-rn-rm-t32-sadd16.h"
1476 #include "aarch32/traces/simulator-cond-rd-rn-rm-t32-sadd8.h"
1477 #include "aarch32/traces/simulator-cond-rd-rn-rm-t32-sasx.h"
1478 #include "aarch32/traces/simulator-cond-rd-rn-rm-t32-sel.h"
1479 #include "aarch32/traces/simulator-cond-rd-rn-rm-t32-ssax.h"
1480 #include "aarch32/traces/simulator-cond-rd-rn-rm-t32-ssub16.h"
1481 #include "aarch32/traces/simulator-cond-rd-rn-rm-t32-ssub8.h"
1482 #include "aarch32/traces/simulator-cond-rd-rn-rm-t32-uadd16.h"
1483 #include "aarch32/traces/simulator-cond-rd-rn-rm-t32-uadd8.h"
1484 #include "aarch32/traces/simulator-cond-rd-rn-rm-t32-uasx.h"
1485 #include "aarch32/traces/simulator-cond-rd-rn-rm-t32-usax.h"
1486 #include "aarch32/traces/simulator-cond-rd-rn-rm-t32-usub16.h"
1487 #include "aarch32/traces/simulator-cond-rd-rn-rm-t32-usub8.h"
1488 #include "aarch32/traces/simulator-cond-rd-rn-rm-t32-qadd.h"
1489 #include "aarch32/traces/simulator-cond-rd-rn-rm-t32-qdadd.h"
1490 #include "aarch32/traces/simulator-cond-rd-rn-rm-t32-qdsub.h"
1491 #include "aarch32/traces/simulator-cond-rd-rn-rm-t32-qsub.h"
1492 
1493 
1494 // The maximum number of errors to report in detail for each test.
1495 const unsigned kErrorReportLimit = 8;
1496 
1497 typedef void (MacroAssembler::*Fn)(Condition cond,
1498                                    Register rd,
1499                                    Register rn,
1500                                    Register rm);
1501 
TestHelper(Fn instruction,const char * mnemonic,const TestResult reference[])1502 void TestHelper(Fn instruction,
1503                 const char* mnemonic,
1504                 const TestResult reference[]) {
1505   SETUP();
1506   masm.UseT32();
1507   START();
1508 
1509   // Data to compare to `reference`.
1510   TestResult* results[ARRAY_SIZE(kTests)];
1511 
1512   // Test cases for memory bound instructions may allocate a buffer and save its
1513   // address in this array.
1514   byte* scratch_memory_buffers[ARRAY_SIZE(kTests)];
1515 
1516   // Generate a loop for each element in `kTests`. Each loop tests one specific
1517   // instruction.
1518   for (unsigned i = 0; i < ARRAY_SIZE(kTests); i++) {
1519     // Allocate results on the heap for this test.
1520     results[i] = new TestResult;
1521     results[i]->outputs = new Inputs[kTests[i].input_size];
1522     results[i]->output_size = kTests[i].input_size;
1523 
1524     size_t input_stride = sizeof(kTests[i].inputs[0]) * kTests[i].input_size;
1525     VIXL_ASSERT(IsUint32(input_stride));
1526 
1527     scratch_memory_buffers[i] = NULL;
1528 
1529     Label loop;
1530     UseScratchRegisterScope scratch_registers(&masm);
1531     // Include all registers from r0 ro r12.
1532     scratch_registers.Include(RegisterList(0x1fff));
1533 
1534     // Values to pass to the macro-assembler.
1535     Condition cond = kTests[i].operands.cond;
1536     Register rd = kTests[i].operands.rd;
1537     Register rn = kTests[i].operands.rn;
1538     Register rm = kTests[i].operands.rm;
1539     scratch_registers.Exclude(rd);
1540     scratch_registers.Exclude(rn);
1541     scratch_registers.Exclude(rm);
1542 
1543     // Allocate reserved registers for our own use.
1544     Register input_ptr = scratch_registers.Acquire();
1545     Register input_end = scratch_registers.Acquire();
1546     Register result_ptr = scratch_registers.Acquire();
1547 
1548     // Initialize `input_ptr` to the first element and `input_end` the address
1549     // after the array.
1550     __ Mov(input_ptr, Operand::From(kTests[i].inputs));
1551     __ Add(input_end, input_ptr, static_cast<uint32_t>(input_stride));
1552     __ Mov(result_ptr, Operand::From(results[i]->outputs));
1553     __ Bind(&loop);
1554 
1555     {
1556       UseScratchRegisterScope temp_registers(&masm);
1557       Register nzcv_bits = temp_registers.Acquire();
1558       Register saved_q_bit = temp_registers.Acquire();
1559       // Save the `Q` bit flag.
1560       __ Mrs(saved_q_bit, APSR);
1561       __ And(saved_q_bit, saved_q_bit, QFlag);
1562       // Set the `NZCV` and `Q` flags together.
1563       __ Ldr(nzcv_bits, MemOperand(input_ptr, offsetof(Inputs, apsr)));
1564       __ Orr(nzcv_bits, nzcv_bits, saved_q_bit);
1565       __ Msr(APSR_nzcvq, nzcv_bits);
1566     }
1567     {
1568       UseScratchRegisterScope temp_registers(&masm);
1569       Register q_bit = temp_registers.Acquire();
1570       Register saved_nzcv_bits = temp_registers.Acquire();
1571       // Save the `NZCV` flags.
1572       __ Mrs(saved_nzcv_bits, APSR);
1573       __ And(saved_nzcv_bits, saved_nzcv_bits, NZCVFlag);
1574       // Set the `NZCV` and `Q` flags together.
1575       __ Ldr(q_bit, MemOperand(input_ptr, offsetof(Inputs, qbit)));
1576       __ Orr(q_bit, q_bit, saved_nzcv_bits);
1577       __ Msr(APSR_nzcvq, q_bit);
1578     }
1579     {
1580       UseScratchRegisterScope temp_registers(&masm);
1581       Register ge_bits = temp_registers.Acquire();
1582       __ Ldr(ge_bits, MemOperand(input_ptr, offsetof(Inputs, ge)));
1583       __ Msr(APSR_g, ge_bits);
1584     }
1585     __ Ldr(rd, MemOperand(input_ptr, offsetof(Inputs, rd)));
1586     __ Ldr(rn, MemOperand(input_ptr, offsetof(Inputs, rn)));
1587     __ Ldr(rm, MemOperand(input_ptr, offsetof(Inputs, rm)));
1588 
1589     (masm.*instruction)(cond, rd, rn, rm);
1590 
1591     {
1592       UseScratchRegisterScope temp_registers(&masm);
1593       Register nzcv_bits = temp_registers.Acquire();
1594       __ Mrs(nzcv_bits, APSR);
1595       // Only record the NZCV bits.
1596       __ And(nzcv_bits, nzcv_bits, NZCVFlag);
1597       __ Str(nzcv_bits, MemOperand(result_ptr, offsetof(Inputs, apsr)));
1598     }
1599     {
1600       UseScratchRegisterScope temp_registers(&masm);
1601       Register q_bit = temp_registers.Acquire();
1602       __ Mrs(q_bit, APSR);
1603       // Only record the Q bit.
1604       __ And(q_bit, q_bit, QFlag);
1605       __ Str(q_bit, MemOperand(result_ptr, offsetof(Inputs, qbit)));
1606     }
1607     {
1608       UseScratchRegisterScope temp_registers(&masm);
1609       Register ge_bits = temp_registers.Acquire();
1610       __ Mrs(ge_bits, APSR);
1611       // Only record the GE bits.
1612       __ And(ge_bits, ge_bits, GEFlags);
1613       __ Str(ge_bits, MemOperand(result_ptr, offsetof(Inputs, ge)));
1614     }
1615     __ Str(rd, MemOperand(result_ptr, offsetof(Inputs, rd)));
1616     __ Str(rn, MemOperand(result_ptr, offsetof(Inputs, rn)));
1617     __ Str(rm, MemOperand(result_ptr, offsetof(Inputs, rm)));
1618 
1619     // Advance the result pointer.
1620     __ Add(result_ptr, result_ptr, Operand::From(sizeof(kTests[i].inputs[0])));
1621     // Loop back until `input_ptr` is lower than `input_base`.
1622     __ Add(input_ptr, input_ptr, Operand::From(sizeof(kTests[i].inputs[0])));
1623     __ Cmp(input_ptr, input_end);
1624     __ B(ne, &loop);
1625   }
1626 
1627   END();
1628 
1629   RUN();
1630 
1631   if (Test::generate_test_trace()) {
1632     // Print the results.
1633     for (size_t i = 0; i < ARRAY_SIZE(kTests); i++) {
1634       printf("const Inputs kOutputs_%s_%s[] = {\n",
1635              mnemonic,
1636              kTests[i].identifier);
1637       for (size_t j = 0; j < results[i]->output_size; j++) {
1638         printf("  { ");
1639         printf("0x%08" PRIx32, results[i]->outputs[j].apsr);
1640         printf(", ");
1641         printf("0x%08" PRIx32, results[i]->outputs[j].qbit);
1642         printf(", ");
1643         printf("0x%08" PRIx32, results[i]->outputs[j].ge);
1644         printf(", ");
1645         printf("0x%08" PRIx32, results[i]->outputs[j].rd);
1646         printf(", ");
1647         printf("0x%08" PRIx32, results[i]->outputs[j].rn);
1648         printf(", ");
1649         printf("0x%08" PRIx32, results[i]->outputs[j].rm);
1650         printf(" },\n");
1651       }
1652       printf("};\n");
1653     }
1654     printf("const TestResult kReference%s[] = {\n", mnemonic);
1655     for (size_t i = 0; i < ARRAY_SIZE(kTests); i++) {
1656       printf("  {\n");
1657       printf("    ARRAY_SIZE(kOutputs_%s_%s),\n",
1658              mnemonic,
1659              kTests[i].identifier);
1660       printf("    kOutputs_%s_%s,\n", mnemonic, kTests[i].identifier);
1661       printf("  },\n");
1662     }
1663     printf("};\n");
1664   } else if (kCheckSimulatorTestResults) {
1665     // Check the results.
1666     unsigned total_error_count = 0;
1667     for (size_t i = 0; i < ARRAY_SIZE(kTests); i++) {
1668       bool instruction_has_errors = false;
1669       for (size_t j = 0; j < kTests[i].input_size; j++) {
1670         uint32_t apsr = results[i]->outputs[j].apsr;
1671         uint32_t qbit = results[i]->outputs[j].qbit;
1672         uint32_t ge = results[i]->outputs[j].ge;
1673         uint32_t rd = results[i]->outputs[j].rd;
1674         uint32_t rn = results[i]->outputs[j].rn;
1675         uint32_t rm = results[i]->outputs[j].rm;
1676         uint32_t apsr_input = kTests[i].inputs[j].apsr;
1677         uint32_t qbit_input = kTests[i].inputs[j].qbit;
1678         uint32_t ge_input = kTests[i].inputs[j].ge;
1679         uint32_t rd_input = kTests[i].inputs[j].rd;
1680         uint32_t rn_input = kTests[i].inputs[j].rn;
1681         uint32_t rm_input = kTests[i].inputs[j].rm;
1682         uint32_t apsr_ref = reference[i].outputs[j].apsr;
1683         uint32_t qbit_ref = reference[i].outputs[j].qbit;
1684         uint32_t ge_ref = reference[i].outputs[j].ge;
1685         uint32_t rd_ref = reference[i].outputs[j].rd;
1686         uint32_t rn_ref = reference[i].outputs[j].rn;
1687         uint32_t rm_ref = reference[i].outputs[j].rm;
1688 
1689         if (((apsr != apsr_ref) || (qbit != qbit_ref) || (ge != ge_ref) ||
1690              (rd != rd_ref) || (rn != rn_ref) || (rm != rm_ref)) &&
1691             (++total_error_count <= kErrorReportLimit)) {
1692           // Print the instruction once even if it triggered multiple failures.
1693           if (!instruction_has_errors) {
1694             printf("Error(s) when testing \"%s %s\":\n",
1695                    mnemonic,
1696                    kTests[i].operands_description);
1697             instruction_has_errors = true;
1698           }
1699           // Print subsequent errors.
1700           printf("  Input:    ");
1701           printf("0x%08" PRIx32, apsr_input);
1702           printf(", ");
1703           printf("0x%08" PRIx32, qbit_input);
1704           printf(", ");
1705           printf("0x%08" PRIx32, ge_input);
1706           printf(", ");
1707           printf("0x%08" PRIx32, rd_input);
1708           printf(", ");
1709           printf("0x%08" PRIx32, rn_input);
1710           printf(", ");
1711           printf("0x%08" PRIx32, rm_input);
1712           printf("\n");
1713           printf("  Expected: ");
1714           printf("0x%08" PRIx32, apsr_ref);
1715           printf(", ");
1716           printf("0x%08" PRIx32, qbit_ref);
1717           printf(", ");
1718           printf("0x%08" PRIx32, ge_ref);
1719           printf(", ");
1720           printf("0x%08" PRIx32, rd_ref);
1721           printf(", ");
1722           printf("0x%08" PRIx32, rn_ref);
1723           printf(", ");
1724           printf("0x%08" PRIx32, rm_ref);
1725           printf("\n");
1726           printf("  Found:    ");
1727           printf("0x%08" PRIx32, apsr);
1728           printf(", ");
1729           printf("0x%08" PRIx32, qbit);
1730           printf(", ");
1731           printf("0x%08" PRIx32, ge);
1732           printf(", ");
1733           printf("0x%08" PRIx32, rd);
1734           printf(", ");
1735           printf("0x%08" PRIx32, rn);
1736           printf(", ");
1737           printf("0x%08" PRIx32, rm);
1738           printf("\n\n");
1739         }
1740       }
1741     }
1742 
1743     if (total_error_count > kErrorReportLimit) {
1744       printf("%u other errors follow.\n",
1745              total_error_count - kErrorReportLimit);
1746     }
1747     VIXL_CHECK(total_error_count == 0);
1748   } else {
1749     VIXL_WARNING("Assembled the code, but did not run anything.\n");
1750   }
1751 
1752   for (size_t i = 0; i < ARRAY_SIZE(kTests); i++) {
1753     delete[] results[i]->outputs;
1754     delete results[i];
1755     delete[] scratch_memory_buffers[i];
1756   }
1757 
1758   TEARDOWN();
1759 }
1760 
1761 // Instantiate tests for each instruction in the list.
1762 // TODO: Remove this limitation by having a sandboxing mechanism.
1763 #if defined(VIXL_HOST_POINTER_32)
1764 #define TEST(mnemonic)                                                      \
1765   void Test_##mnemonic() {                                                  \
1766     TestHelper(&MacroAssembler::mnemonic, #mnemonic, kReference##mnemonic); \
1767   }                                                                         \
1768   Test test_##mnemonic("AARCH32_SIMULATOR_COND_RD_RN_RM_T32_" #mnemonic,    \
1769                        &Test_##mnemonic);
1770 #else
1771 #define TEST(mnemonic)                                                   \
1772   void Test_##mnemonic() {                                               \
1773     VIXL_WARNING("This test can only run on a 32-bit host.\n");          \
1774     USE(TestHelper);                                                     \
1775   }                                                                      \
1776   Test test_##mnemonic("AARCH32_SIMULATOR_COND_RD_RN_RM_T32_" #mnemonic, \
1777                        &Test_##mnemonic);
1778 #endif
1779 
1780 FOREACH_INSTRUCTION(TEST)
1781 #undef TEST
1782 
1783 }  // namespace
1784 #endif
1785 
1786 }  // namespace aarch32
1787 }  // namespace vixl
1788