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