1b8021494Sopenharmony_ci// Copyright 2016, VIXL authors
2b8021494Sopenharmony_ci// All rights reserved.
3b8021494Sopenharmony_ci//
4b8021494Sopenharmony_ci// Redistribution and use in source and binary forms, with or without
5b8021494Sopenharmony_ci// modification, are permitted provided that the following conditions are met:
6b8021494Sopenharmony_ci//
7b8021494Sopenharmony_ci//   * Redistributions of source code must retain the above copyright notice,
8b8021494Sopenharmony_ci//     this list of conditions and the following disclaimer.
9b8021494Sopenharmony_ci//   * Redistributions in binary form must reproduce the above copyright notice,
10b8021494Sopenharmony_ci//     this list of conditions and the following disclaimer in the documentation
11b8021494Sopenharmony_ci//     and/or other materials provided with the distribution.
12b8021494Sopenharmony_ci//   * Neither the name of ARM Limited nor the names of its contributors may be
13b8021494Sopenharmony_ci//     used to endorse or promote products derived from this software without
14b8021494Sopenharmony_ci//     specific prior written permission.
15b8021494Sopenharmony_ci//
16b8021494Sopenharmony_ci// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS CONTRIBUTORS "AS IS" AND
17b8021494Sopenharmony_ci// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18b8021494Sopenharmony_ci// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19b8021494Sopenharmony_ci// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
20b8021494Sopenharmony_ci// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21b8021494Sopenharmony_ci// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22b8021494Sopenharmony_ci// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23b8021494Sopenharmony_ci// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24b8021494Sopenharmony_ci// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25b8021494Sopenharmony_ci// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26b8021494Sopenharmony_ci
27b8021494Sopenharmony_ci
28b8021494Sopenharmony_ci// -----------------------------------------------------------------------------
29b8021494Sopenharmony_ci// This file is auto generated from the
30b8021494Sopenharmony_ci// test/aarch32/config/template-assembler-aarch32.cc.in template file using
31b8021494Sopenharmony_ci// tools/generate_tests.py.
32b8021494Sopenharmony_ci//
33b8021494Sopenharmony_ci// PLEASE DO NOT EDIT.
34b8021494Sopenharmony_ci// -----------------------------------------------------------------------------
35b8021494Sopenharmony_ci
36b8021494Sopenharmony_ci
37b8021494Sopenharmony_ci#include "test-runner.h"
38b8021494Sopenharmony_ci
39b8021494Sopenharmony_ci#include "test-utils.h"
40b8021494Sopenharmony_ci#include "test-utils-aarch32.h"
41b8021494Sopenharmony_ci
42b8021494Sopenharmony_ci#include "aarch32/assembler-aarch32.h"
43b8021494Sopenharmony_ci#include "aarch32/macro-assembler-aarch32.h"
44b8021494Sopenharmony_ci
45b8021494Sopenharmony_ci#define BUF_SIZE (4096)
46b8021494Sopenharmony_ci
47b8021494Sopenharmony_cinamespace vixl {
48b8021494Sopenharmony_cinamespace aarch32 {
49b8021494Sopenharmony_ci
50b8021494Sopenharmony_ci// List of instruction mnemonics.
51b8021494Sopenharmony_ci#define FOREACH_INSTRUCTION(M) M(muls)
52b8021494Sopenharmony_ci
53b8021494Sopenharmony_ci
54b8021494Sopenharmony_ci// The following definitions are defined again in each generated test, therefore
55b8021494Sopenharmony_ci// we need to place them in an anonymous namespace. It expresses that they are
56b8021494Sopenharmony_ci// local to this file only, and the compiler is not allowed to share these types
57b8021494Sopenharmony_ci// across test files during template instantiation. Specifically, `Operands` has
58b8021494Sopenharmony_ci// various layouts across generated tests so it absolutely cannot be shared.
59b8021494Sopenharmony_ci
60b8021494Sopenharmony_ci#ifdef VIXL_INCLUDE_TARGET_T32
61b8021494Sopenharmony_cinamespace {
62b8021494Sopenharmony_ci
63b8021494Sopenharmony_ci// Values to be passed to the assembler to produce the instruction under test.
64b8021494Sopenharmony_cistruct Operands {
65b8021494Sopenharmony_ci  Condition cond;
66b8021494Sopenharmony_ci  Register rd;
67b8021494Sopenharmony_ci  Register rn;
68b8021494Sopenharmony_ci  Register rm;
69b8021494Sopenharmony_ci};
70b8021494Sopenharmony_ci
71b8021494Sopenharmony_ci// This structure contains all data needed to test one specific
72b8021494Sopenharmony_ci// instruction.
73b8021494Sopenharmony_cistruct TestData {
74b8021494Sopenharmony_ci  // The `operands` field represents what to pass to the assembler to
75b8021494Sopenharmony_ci  // produce the instruction.
76b8021494Sopenharmony_ci  Operands operands;
77b8021494Sopenharmony_ci  // True if we need to generate an IT instruction for this test to be valid.
78b8021494Sopenharmony_ci  bool in_it_block;
79b8021494Sopenharmony_ci  // The condition to give the IT instruction, this will be set to "al" by
80b8021494Sopenharmony_ci  // default.
81b8021494Sopenharmony_ci  Condition it_condition;
82b8021494Sopenharmony_ci  // Description of the operands, used for error reporting.
83b8021494Sopenharmony_ci  const char* operands_description;
84b8021494Sopenharmony_ci  // Unique identifier, used for generating traces.
85b8021494Sopenharmony_ci  const char* identifier;
86b8021494Sopenharmony_ci};
87b8021494Sopenharmony_ci
88b8021494Sopenharmony_cistruct TestResult {
89b8021494Sopenharmony_ci  size_t size;
90b8021494Sopenharmony_ci  const byte* encoding;
91b8021494Sopenharmony_ci};
92b8021494Sopenharmony_ci
93b8021494Sopenharmony_ci// Each element of this array produce one instruction encoding.
94b8021494Sopenharmony_ciconst TestData kTests[] =
95b8021494Sopenharmony_ci    {{{al, r0, r0, r0}, false, al, "al r0 r0 r0", "al_r0_r0_r0"},
96b8021494Sopenharmony_ci     {{al, r0, r1, r0}, false, al, "al r0 r1 r0", "al_r0_r1_r0"},
97b8021494Sopenharmony_ci     {{al, r0, r2, r0}, false, al, "al r0 r2 r0", "al_r0_r2_r0"},
98b8021494Sopenharmony_ci     {{al, r0, r3, r0}, false, al, "al r0 r3 r0", "al_r0_r3_r0"},
99b8021494Sopenharmony_ci     {{al, r0, r4, r0}, false, al, "al r0 r4 r0", "al_r0_r4_r0"},
100b8021494Sopenharmony_ci     {{al, r0, r5, r0}, false, al, "al r0 r5 r0", "al_r0_r5_r0"},
101b8021494Sopenharmony_ci     {{al, r0, r6, r0}, false, al, "al r0 r6 r0", "al_r0_r6_r0"},
102b8021494Sopenharmony_ci     {{al, r0, r7, r0}, false, al, "al r0 r7 r0", "al_r0_r7_r0"},
103b8021494Sopenharmony_ci     {{al, r1, r0, r1}, false, al, "al r1 r0 r1", "al_r1_r0_r1"},
104b8021494Sopenharmony_ci     {{al, r1, r1, r1}, false, al, "al r1 r1 r1", "al_r1_r1_r1"},
105b8021494Sopenharmony_ci     {{al, r1, r2, r1}, false, al, "al r1 r2 r1", "al_r1_r2_r1"},
106b8021494Sopenharmony_ci     {{al, r1, r3, r1}, false, al, "al r1 r3 r1", "al_r1_r3_r1"},
107b8021494Sopenharmony_ci     {{al, r1, r4, r1}, false, al, "al r1 r4 r1", "al_r1_r4_r1"},
108b8021494Sopenharmony_ci     {{al, r1, r5, r1}, false, al, "al r1 r5 r1", "al_r1_r5_r1"},
109b8021494Sopenharmony_ci     {{al, r1, r6, r1}, false, al, "al r1 r6 r1", "al_r1_r6_r1"},
110b8021494Sopenharmony_ci     {{al, r1, r7, r1}, false, al, "al r1 r7 r1", "al_r1_r7_r1"},
111b8021494Sopenharmony_ci     {{al, r2, r0, r2}, false, al, "al r2 r0 r2", "al_r2_r0_r2"},
112b8021494Sopenharmony_ci     {{al, r2, r1, r2}, false, al, "al r2 r1 r2", "al_r2_r1_r2"},
113b8021494Sopenharmony_ci     {{al, r2, r2, r2}, false, al, "al r2 r2 r2", "al_r2_r2_r2"},
114b8021494Sopenharmony_ci     {{al, r2, r3, r2}, false, al, "al r2 r3 r2", "al_r2_r3_r2"},
115b8021494Sopenharmony_ci     {{al, r2, r4, r2}, false, al, "al r2 r4 r2", "al_r2_r4_r2"},
116b8021494Sopenharmony_ci     {{al, r2, r5, r2}, false, al, "al r2 r5 r2", "al_r2_r5_r2"},
117b8021494Sopenharmony_ci     {{al, r2, r6, r2}, false, al, "al r2 r6 r2", "al_r2_r6_r2"},
118b8021494Sopenharmony_ci     {{al, r2, r7, r2}, false, al, "al r2 r7 r2", "al_r2_r7_r2"},
119b8021494Sopenharmony_ci     {{al, r3, r0, r3}, false, al, "al r3 r0 r3", "al_r3_r0_r3"},
120b8021494Sopenharmony_ci     {{al, r3, r1, r3}, false, al, "al r3 r1 r3", "al_r3_r1_r3"},
121b8021494Sopenharmony_ci     {{al, r3, r2, r3}, false, al, "al r3 r2 r3", "al_r3_r2_r3"},
122b8021494Sopenharmony_ci     {{al, r3, r3, r3}, false, al, "al r3 r3 r3", "al_r3_r3_r3"},
123b8021494Sopenharmony_ci     {{al, r3, r4, r3}, false, al, "al r3 r4 r3", "al_r3_r4_r3"},
124b8021494Sopenharmony_ci     {{al, r3, r5, r3}, false, al, "al r3 r5 r3", "al_r3_r5_r3"},
125b8021494Sopenharmony_ci     {{al, r3, r6, r3}, false, al, "al r3 r6 r3", "al_r3_r6_r3"},
126b8021494Sopenharmony_ci     {{al, r3, r7, r3}, false, al, "al r3 r7 r3", "al_r3_r7_r3"},
127b8021494Sopenharmony_ci     {{al, r4, r0, r4}, false, al, "al r4 r0 r4", "al_r4_r0_r4"},
128b8021494Sopenharmony_ci     {{al, r4, r1, r4}, false, al, "al r4 r1 r4", "al_r4_r1_r4"},
129b8021494Sopenharmony_ci     {{al, r4, r2, r4}, false, al, "al r4 r2 r4", "al_r4_r2_r4"},
130b8021494Sopenharmony_ci     {{al, r4, r3, r4}, false, al, "al r4 r3 r4", "al_r4_r3_r4"},
131b8021494Sopenharmony_ci     {{al, r4, r4, r4}, false, al, "al r4 r4 r4", "al_r4_r4_r4"},
132b8021494Sopenharmony_ci     {{al, r4, r5, r4}, false, al, "al r4 r5 r4", "al_r4_r5_r4"},
133b8021494Sopenharmony_ci     {{al, r4, r6, r4}, false, al, "al r4 r6 r4", "al_r4_r6_r4"},
134b8021494Sopenharmony_ci     {{al, r4, r7, r4}, false, al, "al r4 r7 r4", "al_r4_r7_r4"},
135b8021494Sopenharmony_ci     {{al, r5, r0, r5}, false, al, "al r5 r0 r5", "al_r5_r0_r5"},
136b8021494Sopenharmony_ci     {{al, r5, r1, r5}, false, al, "al r5 r1 r5", "al_r5_r1_r5"},
137b8021494Sopenharmony_ci     {{al, r5, r2, r5}, false, al, "al r5 r2 r5", "al_r5_r2_r5"},
138b8021494Sopenharmony_ci     {{al, r5, r3, r5}, false, al, "al r5 r3 r5", "al_r5_r3_r5"},
139b8021494Sopenharmony_ci     {{al, r5, r4, r5}, false, al, "al r5 r4 r5", "al_r5_r4_r5"},
140b8021494Sopenharmony_ci     {{al, r5, r5, r5}, false, al, "al r5 r5 r5", "al_r5_r5_r5"},
141b8021494Sopenharmony_ci     {{al, r5, r6, r5}, false, al, "al r5 r6 r5", "al_r5_r6_r5"},
142b8021494Sopenharmony_ci     {{al, r5, r7, r5}, false, al, "al r5 r7 r5", "al_r5_r7_r5"},
143b8021494Sopenharmony_ci     {{al, r6, r0, r6}, false, al, "al r6 r0 r6", "al_r6_r0_r6"},
144b8021494Sopenharmony_ci     {{al, r6, r1, r6}, false, al, "al r6 r1 r6", "al_r6_r1_r6"},
145b8021494Sopenharmony_ci     {{al, r6, r2, r6}, false, al, "al r6 r2 r6", "al_r6_r2_r6"},
146b8021494Sopenharmony_ci     {{al, r6, r3, r6}, false, al, "al r6 r3 r6", "al_r6_r3_r6"},
147b8021494Sopenharmony_ci     {{al, r6, r4, r6}, false, al, "al r6 r4 r6", "al_r6_r4_r6"},
148b8021494Sopenharmony_ci     {{al, r6, r5, r6}, false, al, "al r6 r5 r6", "al_r6_r5_r6"},
149b8021494Sopenharmony_ci     {{al, r6, r6, r6}, false, al, "al r6 r6 r6", "al_r6_r6_r6"},
150b8021494Sopenharmony_ci     {{al, r6, r7, r6}, false, al, "al r6 r7 r6", "al_r6_r7_r6"},
151b8021494Sopenharmony_ci     {{al, r7, r0, r7}, false, al, "al r7 r0 r7", "al_r7_r0_r7"},
152b8021494Sopenharmony_ci     {{al, r7, r1, r7}, false, al, "al r7 r1 r7", "al_r7_r1_r7"},
153b8021494Sopenharmony_ci     {{al, r7, r2, r7}, false, al, "al r7 r2 r7", "al_r7_r2_r7"},
154b8021494Sopenharmony_ci     {{al, r7, r3, r7}, false, al, "al r7 r3 r7", "al_r7_r3_r7"},
155b8021494Sopenharmony_ci     {{al, r7, r4, r7}, false, al, "al r7 r4 r7", "al_r7_r4_r7"},
156b8021494Sopenharmony_ci     {{al, r7, r5, r7}, false, al, "al r7 r5 r7", "al_r7_r5_r7"},
157b8021494Sopenharmony_ci     {{al, r7, r6, r7}, false, al, "al r7 r6 r7", "al_r7_r6_r7"},
158b8021494Sopenharmony_ci     {{al, r7, r7, r7}, false, al, "al r7 r7 r7", "al_r7_r7_r7"}};
159b8021494Sopenharmony_ci
160b8021494Sopenharmony_ci// These headers each contain an array of `TestResult` with the reference output
161b8021494Sopenharmony_ci// values. The reference arrays are names `kReference{mnemonic}`.
162b8021494Sopenharmony_ci#include "aarch32/traces/assembler-cond-rdlow-rnlow-rmlow-muls-t32.h"
163b8021494Sopenharmony_ci
164b8021494Sopenharmony_ci
165b8021494Sopenharmony_ci// The maximum number of errors to report in detail for each test.
166b8021494Sopenharmony_ciconst unsigned kErrorReportLimit = 8;
167b8021494Sopenharmony_ci
168b8021494Sopenharmony_citypedef void (MacroAssembler::*Fn)(Condition cond,
169b8021494Sopenharmony_ci                                   Register rd,
170b8021494Sopenharmony_ci                                   Register rn,
171b8021494Sopenharmony_ci                                   Register rm);
172b8021494Sopenharmony_ci
173b8021494Sopenharmony_civoid TestHelper(Fn instruction,
174b8021494Sopenharmony_ci                const char* mnemonic,
175b8021494Sopenharmony_ci                const TestResult reference[]) {
176b8021494Sopenharmony_ci  unsigned total_error_count = 0;
177b8021494Sopenharmony_ci  MacroAssembler masm(BUF_SIZE);
178b8021494Sopenharmony_ci
179b8021494Sopenharmony_ci  masm.UseT32();
180b8021494Sopenharmony_ci
181b8021494Sopenharmony_ci  for (unsigned i = 0; i < ARRAY_SIZE(kTests); i++) {
182b8021494Sopenharmony_ci    // Values to pass to the macro-assembler.
183b8021494Sopenharmony_ci    Condition cond = kTests[i].operands.cond;
184b8021494Sopenharmony_ci    Register rd = kTests[i].operands.rd;
185b8021494Sopenharmony_ci    Register rn = kTests[i].operands.rn;
186b8021494Sopenharmony_ci    Register rm = kTests[i].operands.rm;
187b8021494Sopenharmony_ci
188b8021494Sopenharmony_ci    int32_t start = masm.GetCursorOffset();
189b8021494Sopenharmony_ci    {
190b8021494Sopenharmony_ci      // We never generate more that 4 bytes, as IT instructions are only
191b8021494Sopenharmony_ci      // allowed for narrow encodings.
192b8021494Sopenharmony_ci      ExactAssemblyScope scope(&masm, 4, ExactAssemblyScope::kMaximumSize);
193b8021494Sopenharmony_ci      if (kTests[i].in_it_block) {
194b8021494Sopenharmony_ci        masm.it(kTests[i].it_condition);
195b8021494Sopenharmony_ci      }
196b8021494Sopenharmony_ci      (masm.*instruction)(cond, rd, rn, rm);
197b8021494Sopenharmony_ci    }
198b8021494Sopenharmony_ci    int32_t end = masm.GetCursorOffset();
199b8021494Sopenharmony_ci
200b8021494Sopenharmony_ci    const byte* result_ptr =
201b8021494Sopenharmony_ci        masm.GetBuffer()->GetOffsetAddress<const byte*>(start);
202b8021494Sopenharmony_ci    VIXL_ASSERT(start < end);
203b8021494Sopenharmony_ci    uint32_t result_size = end - start;
204b8021494Sopenharmony_ci
205b8021494Sopenharmony_ci    if (Test::generate_test_trace()) {
206b8021494Sopenharmony_ci      // Print the result bytes.
207b8021494Sopenharmony_ci      printf("const byte kInstruction_%s_%s[] = {\n",
208b8021494Sopenharmony_ci             mnemonic,
209b8021494Sopenharmony_ci             kTests[i].identifier);
210b8021494Sopenharmony_ci      for (uint32_t j = 0; j < result_size; j++) {
211b8021494Sopenharmony_ci        if (j == 0) {
212b8021494Sopenharmony_ci          printf("  0x%02" PRIx8, result_ptr[j]);
213b8021494Sopenharmony_ci        } else {
214b8021494Sopenharmony_ci          printf(", 0x%02" PRIx8, result_ptr[j]);
215b8021494Sopenharmony_ci        }
216b8021494Sopenharmony_ci      }
217b8021494Sopenharmony_ci      // This comment is meant to be used by external tools to validate
218b8021494Sopenharmony_ci      // the encoding. We can parse the comment to figure out what
219b8021494Sopenharmony_ci      // instruction this corresponds to.
220b8021494Sopenharmony_ci      if (kTests[i].in_it_block) {
221b8021494Sopenharmony_ci        printf(" // It %s; %s %s\n};\n",
222b8021494Sopenharmony_ci               kTests[i].it_condition.GetName(),
223b8021494Sopenharmony_ci               mnemonic,
224b8021494Sopenharmony_ci               kTests[i].operands_description);
225b8021494Sopenharmony_ci      } else {
226b8021494Sopenharmony_ci        printf(" // %s %s\n};\n", mnemonic, kTests[i].operands_description);
227b8021494Sopenharmony_ci      }
228b8021494Sopenharmony_ci    } else {
229b8021494Sopenharmony_ci      // Check we've emitted the exact same encoding as present in the
230b8021494Sopenharmony_ci      // trace file. Only print up to `kErrorReportLimit` errors.
231b8021494Sopenharmony_ci      if (((result_size != reference[i].size) ||
232b8021494Sopenharmony_ci           (memcmp(result_ptr, reference[i].encoding, reference[i].size) !=
233b8021494Sopenharmony_ci            0)) &&
234b8021494Sopenharmony_ci          (++total_error_count <= kErrorReportLimit)) {
235b8021494Sopenharmony_ci        printf("Error when testing \"%s\" with operands \"%s\":\n",
236b8021494Sopenharmony_ci               mnemonic,
237b8021494Sopenharmony_ci               kTests[i].operands_description);
238b8021494Sopenharmony_ci        printf("  Expected: ");
239b8021494Sopenharmony_ci        for (uint32_t j = 0; j < reference[i].size; j++) {
240b8021494Sopenharmony_ci          if (j == 0) {
241b8021494Sopenharmony_ci            printf("0x%02" PRIx8, reference[i].encoding[j]);
242b8021494Sopenharmony_ci          } else {
243b8021494Sopenharmony_ci            printf(", 0x%02" PRIx8, reference[i].encoding[j]);
244b8021494Sopenharmony_ci          }
245b8021494Sopenharmony_ci        }
246b8021494Sopenharmony_ci        printf("\n");
247b8021494Sopenharmony_ci        printf("  Found:    ");
248b8021494Sopenharmony_ci        for (uint32_t j = 0; j < result_size; j++) {
249b8021494Sopenharmony_ci          if (j == 0) {
250b8021494Sopenharmony_ci            printf("0x%02" PRIx8, result_ptr[j]);
251b8021494Sopenharmony_ci          } else {
252b8021494Sopenharmony_ci            printf(", 0x%02" PRIx8, result_ptr[j]);
253b8021494Sopenharmony_ci          }
254b8021494Sopenharmony_ci        }
255b8021494Sopenharmony_ci        printf("\n");
256b8021494Sopenharmony_ci      }
257b8021494Sopenharmony_ci    }
258b8021494Sopenharmony_ci  }
259b8021494Sopenharmony_ci
260b8021494Sopenharmony_ci  masm.FinalizeCode();
261b8021494Sopenharmony_ci
262b8021494Sopenharmony_ci  if (Test::generate_test_trace()) {
263b8021494Sopenharmony_ci    // Finalize the trace file by writing the final `TestResult` array
264b8021494Sopenharmony_ci    // which links all generated instruction encodings.
265b8021494Sopenharmony_ci    printf("const TestResult kReference%s[] = {\n", mnemonic);
266b8021494Sopenharmony_ci    for (unsigned i = 0; i < ARRAY_SIZE(kTests); i++) {
267b8021494Sopenharmony_ci      printf("  {\n");
268b8021494Sopenharmony_ci      printf("    ARRAY_SIZE(kInstruction_%s_%s),\n",
269b8021494Sopenharmony_ci             mnemonic,
270b8021494Sopenharmony_ci             kTests[i].identifier);
271b8021494Sopenharmony_ci      printf("    kInstruction_%s_%s,\n", mnemonic, kTests[i].identifier);
272b8021494Sopenharmony_ci      printf("  },\n");
273b8021494Sopenharmony_ci    }
274b8021494Sopenharmony_ci    printf("};\n");
275b8021494Sopenharmony_ci  } else {
276b8021494Sopenharmony_ci    if (total_error_count > kErrorReportLimit) {
277b8021494Sopenharmony_ci      printf("%u other errors follow.\n",
278b8021494Sopenharmony_ci             total_error_count - kErrorReportLimit);
279b8021494Sopenharmony_ci    }
280b8021494Sopenharmony_ci    // Crash if the test failed.
281b8021494Sopenharmony_ci    VIXL_CHECK(total_error_count == 0);
282b8021494Sopenharmony_ci  }
283b8021494Sopenharmony_ci}
284b8021494Sopenharmony_ci
285b8021494Sopenharmony_ci// Instantiate tests for each instruction in the list.
286b8021494Sopenharmony_ci#define TEST(mnemonic)                                                       \
287b8021494Sopenharmony_ci  void Test_##mnemonic() {                                                   \
288b8021494Sopenharmony_ci    TestHelper(&MacroAssembler::mnemonic, #mnemonic, kReference##mnemonic);  \
289b8021494Sopenharmony_ci  }                                                                          \
290b8021494Sopenharmony_ci  Test test_##mnemonic("AARCH32_ASSEMBLER_COND_RDLOW_RNLOW_RMLOW_" #mnemonic \
291b8021494Sopenharmony_ci                       "_T32",                                               \
292b8021494Sopenharmony_ci                       &Test_##mnemonic);
293b8021494Sopenharmony_ciFOREACH_INSTRUCTION(TEST)
294b8021494Sopenharmony_ci#undef TEST
295b8021494Sopenharmony_ci
296b8021494Sopenharmony_ci}  // namespace
297b8021494Sopenharmony_ci#endif
298b8021494Sopenharmony_ci
299b8021494Sopenharmony_ci}  // namespace aarch32
300b8021494Sopenharmony_ci}  // namespace vixl
301