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