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