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-assembler-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
45 #define BUF_SIZE (4096)
46
47 namespace vixl {
48 namespace aarch32 {
49
50 // List of instruction mnemonics.
51 #define FOREACH_INSTRUCTION(M) \
52 M(mov) \
53 M(movt) \
54 M(movw)
55
56
57 // The following definitions are defined again in each generated test, therefore
58 // we need to place them in an anomymous namespace. It expresses that they are
59 // local to this file only, and the compiler is not allowed to share these types
60 // across test files during template instantiation. Specifically, `Operands` has
61 // various layouts across generated tests so it absolutely cannot be shared.
62
63 #ifdef VIXL_INCLUDE_TARGET_T32
64 namespace {
65
66 // Values to be passed to the assembler to produce the instruction under test.
67 struct Operands {
68 Condition cond;
69 Register rd;
70 uint32_t immediate;
71 };
72
73 // This structure contains all data needed to test one specific
74 // instruction.
75 struct TestData {
76 // The `operands` field represents what to pass to the assembler to
77 // produce the instruction.
78 Operands operands;
79 // True if we need to generate an IT instruction for this test to be valid.
80 bool in_it_block;
81 // The condition to give the IT instruction, this will be set to "al" by
82 // default.
83 Condition it_condition;
84 // Description of the operands, used for error reporting.
85 const char* operands_description;
86 // Unique identifier, used for generating traces.
87 const char* identifier;
88 };
89
90 struct TestResult {
91 size_t size;
92 const byte* encoding;
93 };
94
95 // Each element of this array produce one instruction encoding.
96 const TestData kTests[] =
97 {{{al, r0, 0x0000}, false, al, "al r0 0x0000", "al_r0_0x0000"},
98 {{al, r0, 0x0001}, false, al, "al r0 0x0001", "al_r0_0x0001"},
99 {{al, r0, 0x0002}, false, al, "al r0 0x0002", "al_r0_0x0002"},
100 {{al, r0, 0x0020}, false, al, "al r0 0x0020", "al_r0_0x0020"},
101 {{al, r0, 0x007d}, false, al, "al r0 0x007d", "al_r0_0x007d"},
102 {{al, r0, 0x007e}, false, al, "al r0 0x007e", "al_r0_0x007e"},
103 {{al, r0, 0x007f}, false, al, "al r0 0x007f", "al_r0_0x007f"},
104 {{al, r0, 0x7ffd}, false, al, "al r0 0x7ffd", "al_r0_0x7ffd"},
105 {{al, r0, 0x7ffe}, false, al, "al r0 0x7ffe", "al_r0_0x7ffe"},
106 {{al, r0, 0x7fff}, false, al, "al r0 0x7fff", "al_r0_0x7fff"},
107 {{al, r0, 0x3333}, false, al, "al r0 0x3333", "al_r0_0x3333"},
108 {{al, r0, 0x5555}, false, al, "al r0 0x5555", "al_r0_0x5555"},
109 {{al, r0, 0xaaaa}, false, al, "al r0 0xaaaa", "al_r0_0xaaaa"},
110 {{al, r0, 0xcccc}, false, al, "al r0 0xcccc", "al_r0_0xcccc"},
111 {{al, r0, 0x8000}, false, al, "al r0 0x8000", "al_r0_0x8000"},
112 {{al, r0, 0x8001}, false, al, "al r0 0x8001", "al_r0_0x8001"},
113 {{al, r0, 0x8002}, false, al, "al r0 0x8002", "al_r0_0x8002"},
114 {{al, r0, 0x8003}, false, al, "al r0 0x8003", "al_r0_0x8003"},
115 {{al, r0, 0xff80}, false, al, "al r0 0xff80", "al_r0_0xff80"},
116 {{al, r0, 0xff81}, false, al, "al r0 0xff81", "al_r0_0xff81"},
117 {{al, r0, 0xff82}, false, al, "al r0 0xff82", "al_r0_0xff82"},
118 {{al, r0, 0xff83}, false, al, "al r0 0xff83", "al_r0_0xff83"},
119 {{al, r0, 0xffe0}, false, al, "al r0 0xffe0", "al_r0_0xffe0"},
120 {{al, r0, 0xfffd}, false, al, "al r0 0xfffd", "al_r0_0xfffd"},
121 {{al, r0, 0xfffe}, false, al, "al r0 0xfffe", "al_r0_0xfffe"},
122 {{al, r0, 0xffff}, false, al, "al r0 0xffff", "al_r0_0xffff"},
123 {{al, r1, 0x0000}, false, al, "al r1 0x0000", "al_r1_0x0000"},
124 {{al, r1, 0x0001}, false, al, "al r1 0x0001", "al_r1_0x0001"},
125 {{al, r1, 0x0002}, false, al, "al r1 0x0002", "al_r1_0x0002"},
126 {{al, r1, 0x0020}, false, al, "al r1 0x0020", "al_r1_0x0020"},
127 {{al, r1, 0x007d}, false, al, "al r1 0x007d", "al_r1_0x007d"},
128 {{al, r1, 0x007e}, false, al, "al r1 0x007e", "al_r1_0x007e"},
129 {{al, r1, 0x007f}, false, al, "al r1 0x007f", "al_r1_0x007f"},
130 {{al, r1, 0x7ffd}, false, al, "al r1 0x7ffd", "al_r1_0x7ffd"},
131 {{al, r1, 0x7ffe}, false, al, "al r1 0x7ffe", "al_r1_0x7ffe"},
132 {{al, r1, 0x7fff}, false, al, "al r1 0x7fff", "al_r1_0x7fff"},
133 {{al, r1, 0x3333}, false, al, "al r1 0x3333", "al_r1_0x3333"},
134 {{al, r1, 0x5555}, false, al, "al r1 0x5555", "al_r1_0x5555"},
135 {{al, r1, 0xaaaa}, false, al, "al r1 0xaaaa", "al_r1_0xaaaa"},
136 {{al, r1, 0xcccc}, false, al, "al r1 0xcccc", "al_r1_0xcccc"},
137 {{al, r1, 0x8000}, false, al, "al r1 0x8000", "al_r1_0x8000"},
138 {{al, r1, 0x8001}, false, al, "al r1 0x8001", "al_r1_0x8001"},
139 {{al, r1, 0x8002}, false, al, "al r1 0x8002", "al_r1_0x8002"},
140 {{al, r1, 0x8003}, false, al, "al r1 0x8003", "al_r1_0x8003"},
141 {{al, r1, 0xff80}, false, al, "al r1 0xff80", "al_r1_0xff80"},
142 {{al, r1, 0xff81}, false, al, "al r1 0xff81", "al_r1_0xff81"},
143 {{al, r1, 0xff82}, false, al, "al r1 0xff82", "al_r1_0xff82"},
144 {{al, r1, 0xff83}, false, al, "al r1 0xff83", "al_r1_0xff83"},
145 {{al, r1, 0xffe0}, false, al, "al r1 0xffe0", "al_r1_0xffe0"},
146 {{al, r1, 0xfffd}, false, al, "al r1 0xfffd", "al_r1_0xfffd"},
147 {{al, r1, 0xfffe}, false, al, "al r1 0xfffe", "al_r1_0xfffe"},
148 {{al, r1, 0xffff}, false, al, "al r1 0xffff", "al_r1_0xffff"},
149 {{al, r2, 0x0000}, false, al, "al r2 0x0000", "al_r2_0x0000"},
150 {{al, r2, 0x0001}, false, al, "al r2 0x0001", "al_r2_0x0001"},
151 {{al, r2, 0x0002}, false, al, "al r2 0x0002", "al_r2_0x0002"},
152 {{al, r2, 0x0020}, false, al, "al r2 0x0020", "al_r2_0x0020"},
153 {{al, r2, 0x007d}, false, al, "al r2 0x007d", "al_r2_0x007d"},
154 {{al, r2, 0x007e}, false, al, "al r2 0x007e", "al_r2_0x007e"},
155 {{al, r2, 0x007f}, false, al, "al r2 0x007f", "al_r2_0x007f"},
156 {{al, r2, 0x7ffd}, false, al, "al r2 0x7ffd", "al_r2_0x7ffd"},
157 {{al, r2, 0x7ffe}, false, al, "al r2 0x7ffe", "al_r2_0x7ffe"},
158 {{al, r2, 0x7fff}, false, al, "al r2 0x7fff", "al_r2_0x7fff"},
159 {{al, r2, 0x3333}, false, al, "al r2 0x3333", "al_r2_0x3333"},
160 {{al, r2, 0x5555}, false, al, "al r2 0x5555", "al_r2_0x5555"},
161 {{al, r2, 0xaaaa}, false, al, "al r2 0xaaaa", "al_r2_0xaaaa"},
162 {{al, r2, 0xcccc}, false, al, "al r2 0xcccc", "al_r2_0xcccc"},
163 {{al, r2, 0x8000}, false, al, "al r2 0x8000", "al_r2_0x8000"},
164 {{al, r2, 0x8001}, false, al, "al r2 0x8001", "al_r2_0x8001"},
165 {{al, r2, 0x8002}, false, al, "al r2 0x8002", "al_r2_0x8002"},
166 {{al, r2, 0x8003}, false, al, "al r2 0x8003", "al_r2_0x8003"},
167 {{al, r2, 0xff80}, false, al, "al r2 0xff80", "al_r2_0xff80"},
168 {{al, r2, 0xff81}, false, al, "al r2 0xff81", "al_r2_0xff81"},
169 {{al, r2, 0xff82}, false, al, "al r2 0xff82", "al_r2_0xff82"},
170 {{al, r2, 0xff83}, false, al, "al r2 0xff83", "al_r2_0xff83"},
171 {{al, r2, 0xffe0}, false, al, "al r2 0xffe0", "al_r2_0xffe0"},
172 {{al, r2, 0xfffd}, false, al, "al r2 0xfffd", "al_r2_0xfffd"},
173 {{al, r2, 0xfffe}, false, al, "al r2 0xfffe", "al_r2_0xfffe"},
174 {{al, r2, 0xffff}, false, al, "al r2 0xffff", "al_r2_0xffff"},
175 {{al, r3, 0x0000}, false, al, "al r3 0x0000", "al_r3_0x0000"},
176 {{al, r3, 0x0001}, false, al, "al r3 0x0001", "al_r3_0x0001"},
177 {{al, r3, 0x0002}, false, al, "al r3 0x0002", "al_r3_0x0002"},
178 {{al, r3, 0x0020}, false, al, "al r3 0x0020", "al_r3_0x0020"},
179 {{al, r3, 0x007d}, false, al, "al r3 0x007d", "al_r3_0x007d"},
180 {{al, r3, 0x007e}, false, al, "al r3 0x007e", "al_r3_0x007e"},
181 {{al, r3, 0x007f}, false, al, "al r3 0x007f", "al_r3_0x007f"},
182 {{al, r3, 0x7ffd}, false, al, "al r3 0x7ffd", "al_r3_0x7ffd"},
183 {{al, r3, 0x7ffe}, false, al, "al r3 0x7ffe", "al_r3_0x7ffe"},
184 {{al, r3, 0x7fff}, false, al, "al r3 0x7fff", "al_r3_0x7fff"},
185 {{al, r3, 0x3333}, false, al, "al r3 0x3333", "al_r3_0x3333"},
186 {{al, r3, 0x5555}, false, al, "al r3 0x5555", "al_r3_0x5555"},
187 {{al, r3, 0xaaaa}, false, al, "al r3 0xaaaa", "al_r3_0xaaaa"},
188 {{al, r3, 0xcccc}, false, al, "al r3 0xcccc", "al_r3_0xcccc"},
189 {{al, r3, 0x8000}, false, al, "al r3 0x8000", "al_r3_0x8000"},
190 {{al, r3, 0x8001}, false, al, "al r3 0x8001", "al_r3_0x8001"},
191 {{al, r3, 0x8002}, false, al, "al r3 0x8002", "al_r3_0x8002"},
192 {{al, r3, 0x8003}, false, al, "al r3 0x8003", "al_r3_0x8003"},
193 {{al, r3, 0xff80}, false, al, "al r3 0xff80", "al_r3_0xff80"},
194 {{al, r3, 0xff81}, false, al, "al r3 0xff81", "al_r3_0xff81"},
195 {{al, r3, 0xff82}, false, al, "al r3 0xff82", "al_r3_0xff82"},
196 {{al, r3, 0xff83}, false, al, "al r3 0xff83", "al_r3_0xff83"},
197 {{al, r3, 0xffe0}, false, al, "al r3 0xffe0", "al_r3_0xffe0"},
198 {{al, r3, 0xfffd}, false, al, "al r3 0xfffd", "al_r3_0xfffd"},
199 {{al, r3, 0xfffe}, false, al, "al r3 0xfffe", "al_r3_0xfffe"},
200 {{al, r3, 0xffff}, false, al, "al r3 0xffff", "al_r3_0xffff"},
201 {{al, r4, 0x0000}, false, al, "al r4 0x0000", "al_r4_0x0000"},
202 {{al, r4, 0x0001}, false, al, "al r4 0x0001", "al_r4_0x0001"},
203 {{al, r4, 0x0002}, false, al, "al r4 0x0002", "al_r4_0x0002"},
204 {{al, r4, 0x0020}, false, al, "al r4 0x0020", "al_r4_0x0020"},
205 {{al, r4, 0x007d}, false, al, "al r4 0x007d", "al_r4_0x007d"},
206 {{al, r4, 0x007e}, false, al, "al r4 0x007e", "al_r4_0x007e"},
207 {{al, r4, 0x007f}, false, al, "al r4 0x007f", "al_r4_0x007f"},
208 {{al, r4, 0x7ffd}, false, al, "al r4 0x7ffd", "al_r4_0x7ffd"},
209 {{al, r4, 0x7ffe}, false, al, "al r4 0x7ffe", "al_r4_0x7ffe"},
210 {{al, r4, 0x7fff}, false, al, "al r4 0x7fff", "al_r4_0x7fff"},
211 {{al, r4, 0x3333}, false, al, "al r4 0x3333", "al_r4_0x3333"},
212 {{al, r4, 0x5555}, false, al, "al r4 0x5555", "al_r4_0x5555"},
213 {{al, r4, 0xaaaa}, false, al, "al r4 0xaaaa", "al_r4_0xaaaa"},
214 {{al, r4, 0xcccc}, false, al, "al r4 0xcccc", "al_r4_0xcccc"},
215 {{al, r4, 0x8000}, false, al, "al r4 0x8000", "al_r4_0x8000"},
216 {{al, r4, 0x8001}, false, al, "al r4 0x8001", "al_r4_0x8001"},
217 {{al, r4, 0x8002}, false, al, "al r4 0x8002", "al_r4_0x8002"},
218 {{al, r4, 0x8003}, false, al, "al r4 0x8003", "al_r4_0x8003"},
219 {{al, r4, 0xff80}, false, al, "al r4 0xff80", "al_r4_0xff80"},
220 {{al, r4, 0xff81}, false, al, "al r4 0xff81", "al_r4_0xff81"},
221 {{al, r4, 0xff82}, false, al, "al r4 0xff82", "al_r4_0xff82"},
222 {{al, r4, 0xff83}, false, al, "al r4 0xff83", "al_r4_0xff83"},
223 {{al, r4, 0xffe0}, false, al, "al r4 0xffe0", "al_r4_0xffe0"},
224 {{al, r4, 0xfffd}, false, al, "al r4 0xfffd", "al_r4_0xfffd"},
225 {{al, r4, 0xfffe}, false, al, "al r4 0xfffe", "al_r4_0xfffe"},
226 {{al, r4, 0xffff}, false, al, "al r4 0xffff", "al_r4_0xffff"},
227 {{al, r5, 0x0000}, false, al, "al r5 0x0000", "al_r5_0x0000"},
228 {{al, r5, 0x0001}, false, al, "al r5 0x0001", "al_r5_0x0001"},
229 {{al, r5, 0x0002}, false, al, "al r5 0x0002", "al_r5_0x0002"},
230 {{al, r5, 0x0020}, false, al, "al r5 0x0020", "al_r5_0x0020"},
231 {{al, r5, 0x007d}, false, al, "al r5 0x007d", "al_r5_0x007d"},
232 {{al, r5, 0x007e}, false, al, "al r5 0x007e", "al_r5_0x007e"},
233 {{al, r5, 0x007f}, false, al, "al r5 0x007f", "al_r5_0x007f"},
234 {{al, r5, 0x7ffd}, false, al, "al r5 0x7ffd", "al_r5_0x7ffd"},
235 {{al, r5, 0x7ffe}, false, al, "al r5 0x7ffe", "al_r5_0x7ffe"},
236 {{al, r5, 0x7fff}, false, al, "al r5 0x7fff", "al_r5_0x7fff"},
237 {{al, r5, 0x3333}, false, al, "al r5 0x3333", "al_r5_0x3333"},
238 {{al, r5, 0x5555}, false, al, "al r5 0x5555", "al_r5_0x5555"},
239 {{al, r5, 0xaaaa}, false, al, "al r5 0xaaaa", "al_r5_0xaaaa"},
240 {{al, r5, 0xcccc}, false, al, "al r5 0xcccc", "al_r5_0xcccc"},
241 {{al, r5, 0x8000}, false, al, "al r5 0x8000", "al_r5_0x8000"},
242 {{al, r5, 0x8001}, false, al, "al r5 0x8001", "al_r5_0x8001"},
243 {{al, r5, 0x8002}, false, al, "al r5 0x8002", "al_r5_0x8002"},
244 {{al, r5, 0x8003}, false, al, "al r5 0x8003", "al_r5_0x8003"},
245 {{al, r5, 0xff80}, false, al, "al r5 0xff80", "al_r5_0xff80"},
246 {{al, r5, 0xff81}, false, al, "al r5 0xff81", "al_r5_0xff81"},
247 {{al, r5, 0xff82}, false, al, "al r5 0xff82", "al_r5_0xff82"},
248 {{al, r5, 0xff83}, false, al, "al r5 0xff83", "al_r5_0xff83"},
249 {{al, r5, 0xffe0}, false, al, "al r5 0xffe0", "al_r5_0xffe0"},
250 {{al, r5, 0xfffd}, false, al, "al r5 0xfffd", "al_r5_0xfffd"},
251 {{al, r5, 0xfffe}, false, al, "al r5 0xfffe", "al_r5_0xfffe"},
252 {{al, r5, 0xffff}, false, al, "al r5 0xffff", "al_r5_0xffff"},
253 {{al, r6, 0x0000}, false, al, "al r6 0x0000", "al_r6_0x0000"},
254 {{al, r6, 0x0001}, false, al, "al r6 0x0001", "al_r6_0x0001"},
255 {{al, r6, 0x0002}, false, al, "al r6 0x0002", "al_r6_0x0002"},
256 {{al, r6, 0x0020}, false, al, "al r6 0x0020", "al_r6_0x0020"},
257 {{al, r6, 0x007d}, false, al, "al r6 0x007d", "al_r6_0x007d"},
258 {{al, r6, 0x007e}, false, al, "al r6 0x007e", "al_r6_0x007e"},
259 {{al, r6, 0x007f}, false, al, "al r6 0x007f", "al_r6_0x007f"},
260 {{al, r6, 0x7ffd}, false, al, "al r6 0x7ffd", "al_r6_0x7ffd"},
261 {{al, r6, 0x7ffe}, false, al, "al r6 0x7ffe", "al_r6_0x7ffe"},
262 {{al, r6, 0x7fff}, false, al, "al r6 0x7fff", "al_r6_0x7fff"},
263 {{al, r6, 0x3333}, false, al, "al r6 0x3333", "al_r6_0x3333"},
264 {{al, r6, 0x5555}, false, al, "al r6 0x5555", "al_r6_0x5555"},
265 {{al, r6, 0xaaaa}, false, al, "al r6 0xaaaa", "al_r6_0xaaaa"},
266 {{al, r6, 0xcccc}, false, al, "al r6 0xcccc", "al_r6_0xcccc"},
267 {{al, r6, 0x8000}, false, al, "al r6 0x8000", "al_r6_0x8000"},
268 {{al, r6, 0x8001}, false, al, "al r6 0x8001", "al_r6_0x8001"},
269 {{al, r6, 0x8002}, false, al, "al r6 0x8002", "al_r6_0x8002"},
270 {{al, r6, 0x8003}, false, al, "al r6 0x8003", "al_r6_0x8003"},
271 {{al, r6, 0xff80}, false, al, "al r6 0xff80", "al_r6_0xff80"},
272 {{al, r6, 0xff81}, false, al, "al r6 0xff81", "al_r6_0xff81"},
273 {{al, r6, 0xff82}, false, al, "al r6 0xff82", "al_r6_0xff82"},
274 {{al, r6, 0xff83}, false, al, "al r6 0xff83", "al_r6_0xff83"},
275 {{al, r6, 0xffe0}, false, al, "al r6 0xffe0", "al_r6_0xffe0"},
276 {{al, r6, 0xfffd}, false, al, "al r6 0xfffd", "al_r6_0xfffd"},
277 {{al, r6, 0xfffe}, false, al, "al r6 0xfffe", "al_r6_0xfffe"},
278 {{al, r6, 0xffff}, false, al, "al r6 0xffff", "al_r6_0xffff"},
279 {{al, r7, 0x0000}, false, al, "al r7 0x0000", "al_r7_0x0000"},
280 {{al, r7, 0x0001}, false, al, "al r7 0x0001", "al_r7_0x0001"},
281 {{al, r7, 0x0002}, false, al, "al r7 0x0002", "al_r7_0x0002"},
282 {{al, r7, 0x0020}, false, al, "al r7 0x0020", "al_r7_0x0020"},
283 {{al, r7, 0x007d}, false, al, "al r7 0x007d", "al_r7_0x007d"},
284 {{al, r7, 0x007e}, false, al, "al r7 0x007e", "al_r7_0x007e"},
285 {{al, r7, 0x007f}, false, al, "al r7 0x007f", "al_r7_0x007f"},
286 {{al, r7, 0x7ffd}, false, al, "al r7 0x7ffd", "al_r7_0x7ffd"},
287 {{al, r7, 0x7ffe}, false, al, "al r7 0x7ffe", "al_r7_0x7ffe"},
288 {{al, r7, 0x7fff}, false, al, "al r7 0x7fff", "al_r7_0x7fff"},
289 {{al, r7, 0x3333}, false, al, "al r7 0x3333", "al_r7_0x3333"},
290 {{al, r7, 0x5555}, false, al, "al r7 0x5555", "al_r7_0x5555"},
291 {{al, r7, 0xaaaa}, false, al, "al r7 0xaaaa", "al_r7_0xaaaa"},
292 {{al, r7, 0xcccc}, false, al, "al r7 0xcccc", "al_r7_0xcccc"},
293 {{al, r7, 0x8000}, false, al, "al r7 0x8000", "al_r7_0x8000"},
294 {{al, r7, 0x8001}, false, al, "al r7 0x8001", "al_r7_0x8001"},
295 {{al, r7, 0x8002}, false, al, "al r7 0x8002", "al_r7_0x8002"},
296 {{al, r7, 0x8003}, false, al, "al r7 0x8003", "al_r7_0x8003"},
297 {{al, r7, 0xff80}, false, al, "al r7 0xff80", "al_r7_0xff80"},
298 {{al, r7, 0xff81}, false, al, "al r7 0xff81", "al_r7_0xff81"},
299 {{al, r7, 0xff82}, false, al, "al r7 0xff82", "al_r7_0xff82"},
300 {{al, r7, 0xff83}, false, al, "al r7 0xff83", "al_r7_0xff83"},
301 {{al, r7, 0xffe0}, false, al, "al r7 0xffe0", "al_r7_0xffe0"},
302 {{al, r7, 0xfffd}, false, al, "al r7 0xfffd", "al_r7_0xfffd"},
303 {{al, r7, 0xfffe}, false, al, "al r7 0xfffe", "al_r7_0xfffe"},
304 {{al, r7, 0xffff}, false, al, "al r7 0xffff", "al_r7_0xffff"},
305 {{al, r8, 0x0000}, false, al, "al r8 0x0000", "al_r8_0x0000"},
306 {{al, r8, 0x0001}, false, al, "al r8 0x0001", "al_r8_0x0001"},
307 {{al, r8, 0x0002}, false, al, "al r8 0x0002", "al_r8_0x0002"},
308 {{al, r8, 0x0020}, false, al, "al r8 0x0020", "al_r8_0x0020"},
309 {{al, r8, 0x007d}, false, al, "al r8 0x007d", "al_r8_0x007d"},
310 {{al, r8, 0x007e}, false, al, "al r8 0x007e", "al_r8_0x007e"},
311 {{al, r8, 0x007f}, false, al, "al r8 0x007f", "al_r8_0x007f"},
312 {{al, r8, 0x7ffd}, false, al, "al r8 0x7ffd", "al_r8_0x7ffd"},
313 {{al, r8, 0x7ffe}, false, al, "al r8 0x7ffe", "al_r8_0x7ffe"},
314 {{al, r8, 0x7fff}, false, al, "al r8 0x7fff", "al_r8_0x7fff"},
315 {{al, r8, 0x3333}, false, al, "al r8 0x3333", "al_r8_0x3333"},
316 {{al, r8, 0x5555}, false, al, "al r8 0x5555", "al_r8_0x5555"},
317 {{al, r8, 0xaaaa}, false, al, "al r8 0xaaaa", "al_r8_0xaaaa"},
318 {{al, r8, 0xcccc}, false, al, "al r8 0xcccc", "al_r8_0xcccc"},
319 {{al, r8, 0x8000}, false, al, "al r8 0x8000", "al_r8_0x8000"},
320 {{al, r8, 0x8001}, false, al, "al r8 0x8001", "al_r8_0x8001"},
321 {{al, r8, 0x8002}, false, al, "al r8 0x8002", "al_r8_0x8002"},
322 {{al, r8, 0x8003}, false, al, "al r8 0x8003", "al_r8_0x8003"},
323 {{al, r8, 0xff80}, false, al, "al r8 0xff80", "al_r8_0xff80"},
324 {{al, r8, 0xff81}, false, al, "al r8 0xff81", "al_r8_0xff81"},
325 {{al, r8, 0xff82}, false, al, "al r8 0xff82", "al_r8_0xff82"},
326 {{al, r8, 0xff83}, false, al, "al r8 0xff83", "al_r8_0xff83"},
327 {{al, r8, 0xffe0}, false, al, "al r8 0xffe0", "al_r8_0xffe0"},
328 {{al, r8, 0xfffd}, false, al, "al r8 0xfffd", "al_r8_0xfffd"},
329 {{al, r8, 0xfffe}, false, al, "al r8 0xfffe", "al_r8_0xfffe"},
330 {{al, r8, 0xffff}, false, al, "al r8 0xffff", "al_r8_0xffff"},
331 {{al, r9, 0x0000}, false, al, "al r9 0x0000", "al_r9_0x0000"},
332 {{al, r9, 0x0001}, false, al, "al r9 0x0001", "al_r9_0x0001"},
333 {{al, r9, 0x0002}, false, al, "al r9 0x0002", "al_r9_0x0002"},
334 {{al, r9, 0x0020}, false, al, "al r9 0x0020", "al_r9_0x0020"},
335 {{al, r9, 0x007d}, false, al, "al r9 0x007d", "al_r9_0x007d"},
336 {{al, r9, 0x007e}, false, al, "al r9 0x007e", "al_r9_0x007e"},
337 {{al, r9, 0x007f}, false, al, "al r9 0x007f", "al_r9_0x007f"},
338 {{al, r9, 0x7ffd}, false, al, "al r9 0x7ffd", "al_r9_0x7ffd"},
339 {{al, r9, 0x7ffe}, false, al, "al r9 0x7ffe", "al_r9_0x7ffe"},
340 {{al, r9, 0x7fff}, false, al, "al r9 0x7fff", "al_r9_0x7fff"},
341 {{al, r9, 0x3333}, false, al, "al r9 0x3333", "al_r9_0x3333"},
342 {{al, r9, 0x5555}, false, al, "al r9 0x5555", "al_r9_0x5555"},
343 {{al, r9, 0xaaaa}, false, al, "al r9 0xaaaa", "al_r9_0xaaaa"},
344 {{al, r9, 0xcccc}, false, al, "al r9 0xcccc", "al_r9_0xcccc"},
345 {{al, r9, 0x8000}, false, al, "al r9 0x8000", "al_r9_0x8000"},
346 {{al, r9, 0x8001}, false, al, "al r9 0x8001", "al_r9_0x8001"},
347 {{al, r9, 0x8002}, false, al, "al r9 0x8002", "al_r9_0x8002"},
348 {{al, r9, 0x8003}, false, al, "al r9 0x8003", "al_r9_0x8003"},
349 {{al, r9, 0xff80}, false, al, "al r9 0xff80", "al_r9_0xff80"},
350 {{al, r9, 0xff81}, false, al, "al r9 0xff81", "al_r9_0xff81"},
351 {{al, r9, 0xff82}, false, al, "al r9 0xff82", "al_r9_0xff82"},
352 {{al, r9, 0xff83}, false, al, "al r9 0xff83", "al_r9_0xff83"},
353 {{al, r9, 0xffe0}, false, al, "al r9 0xffe0", "al_r9_0xffe0"},
354 {{al, r9, 0xfffd}, false, al, "al r9 0xfffd", "al_r9_0xfffd"},
355 {{al, r9, 0xfffe}, false, al, "al r9 0xfffe", "al_r9_0xfffe"},
356 {{al, r9, 0xffff}, false, al, "al r9 0xffff", "al_r9_0xffff"},
357 {{al, r10, 0x0000}, false, al, "al r10 0x0000", "al_r10_0x0000"},
358 {{al, r10, 0x0001}, false, al, "al r10 0x0001", "al_r10_0x0001"},
359 {{al, r10, 0x0002}, false, al, "al r10 0x0002", "al_r10_0x0002"},
360 {{al, r10, 0x0020}, false, al, "al r10 0x0020", "al_r10_0x0020"},
361 {{al, r10, 0x007d}, false, al, "al r10 0x007d", "al_r10_0x007d"},
362 {{al, r10, 0x007e}, false, al, "al r10 0x007e", "al_r10_0x007e"},
363 {{al, r10, 0x007f}, false, al, "al r10 0x007f", "al_r10_0x007f"},
364 {{al, r10, 0x7ffd}, false, al, "al r10 0x7ffd", "al_r10_0x7ffd"},
365 {{al, r10, 0x7ffe}, false, al, "al r10 0x7ffe", "al_r10_0x7ffe"},
366 {{al, r10, 0x7fff}, false, al, "al r10 0x7fff", "al_r10_0x7fff"},
367 {{al, r10, 0x3333}, false, al, "al r10 0x3333", "al_r10_0x3333"},
368 {{al, r10, 0x5555}, false, al, "al r10 0x5555", "al_r10_0x5555"},
369 {{al, r10, 0xaaaa}, false, al, "al r10 0xaaaa", "al_r10_0xaaaa"},
370 {{al, r10, 0xcccc}, false, al, "al r10 0xcccc", "al_r10_0xcccc"},
371 {{al, r10, 0x8000}, false, al, "al r10 0x8000", "al_r10_0x8000"},
372 {{al, r10, 0x8001}, false, al, "al r10 0x8001", "al_r10_0x8001"},
373 {{al, r10, 0x8002}, false, al, "al r10 0x8002", "al_r10_0x8002"},
374 {{al, r10, 0x8003}, false, al, "al r10 0x8003", "al_r10_0x8003"},
375 {{al, r10, 0xff80}, false, al, "al r10 0xff80", "al_r10_0xff80"},
376 {{al, r10, 0xff81}, false, al, "al r10 0xff81", "al_r10_0xff81"},
377 {{al, r10, 0xff82}, false, al, "al r10 0xff82", "al_r10_0xff82"},
378 {{al, r10, 0xff83}, false, al, "al r10 0xff83", "al_r10_0xff83"},
379 {{al, r10, 0xffe0}, false, al, "al r10 0xffe0", "al_r10_0xffe0"},
380 {{al, r10, 0xfffd}, false, al, "al r10 0xfffd", "al_r10_0xfffd"},
381 {{al, r10, 0xfffe}, false, al, "al r10 0xfffe", "al_r10_0xfffe"},
382 {{al, r10, 0xffff}, false, al, "al r10 0xffff", "al_r10_0xffff"},
383 {{al, r11, 0x0000}, false, al, "al r11 0x0000", "al_r11_0x0000"},
384 {{al, r11, 0x0001}, false, al, "al r11 0x0001", "al_r11_0x0001"},
385 {{al, r11, 0x0002}, false, al, "al r11 0x0002", "al_r11_0x0002"},
386 {{al, r11, 0x0020}, false, al, "al r11 0x0020", "al_r11_0x0020"},
387 {{al, r11, 0x007d}, false, al, "al r11 0x007d", "al_r11_0x007d"},
388 {{al, r11, 0x007e}, false, al, "al r11 0x007e", "al_r11_0x007e"},
389 {{al, r11, 0x007f}, false, al, "al r11 0x007f", "al_r11_0x007f"},
390 {{al, r11, 0x7ffd}, false, al, "al r11 0x7ffd", "al_r11_0x7ffd"},
391 {{al, r11, 0x7ffe}, false, al, "al r11 0x7ffe", "al_r11_0x7ffe"},
392 {{al, r11, 0x7fff}, false, al, "al r11 0x7fff", "al_r11_0x7fff"},
393 {{al, r11, 0x3333}, false, al, "al r11 0x3333", "al_r11_0x3333"},
394 {{al, r11, 0x5555}, false, al, "al r11 0x5555", "al_r11_0x5555"},
395 {{al, r11, 0xaaaa}, false, al, "al r11 0xaaaa", "al_r11_0xaaaa"},
396 {{al, r11, 0xcccc}, false, al, "al r11 0xcccc", "al_r11_0xcccc"},
397 {{al, r11, 0x8000}, false, al, "al r11 0x8000", "al_r11_0x8000"},
398 {{al, r11, 0x8001}, false, al, "al r11 0x8001", "al_r11_0x8001"},
399 {{al, r11, 0x8002}, false, al, "al r11 0x8002", "al_r11_0x8002"},
400 {{al, r11, 0x8003}, false, al, "al r11 0x8003", "al_r11_0x8003"},
401 {{al, r11, 0xff80}, false, al, "al r11 0xff80", "al_r11_0xff80"},
402 {{al, r11, 0xff81}, false, al, "al r11 0xff81", "al_r11_0xff81"},
403 {{al, r11, 0xff82}, false, al, "al r11 0xff82", "al_r11_0xff82"},
404 {{al, r11, 0xff83}, false, al, "al r11 0xff83", "al_r11_0xff83"},
405 {{al, r11, 0xffe0}, false, al, "al r11 0xffe0", "al_r11_0xffe0"},
406 {{al, r11, 0xfffd}, false, al, "al r11 0xfffd", "al_r11_0xfffd"},
407 {{al, r11, 0xfffe}, false, al, "al r11 0xfffe", "al_r11_0xfffe"},
408 {{al, r11, 0xffff}, false, al, "al r11 0xffff", "al_r11_0xffff"},
409 {{al, r12, 0x0000}, false, al, "al r12 0x0000", "al_r12_0x0000"},
410 {{al, r12, 0x0001}, false, al, "al r12 0x0001", "al_r12_0x0001"},
411 {{al, r12, 0x0002}, false, al, "al r12 0x0002", "al_r12_0x0002"},
412 {{al, r12, 0x0020}, false, al, "al r12 0x0020", "al_r12_0x0020"},
413 {{al, r12, 0x007d}, false, al, "al r12 0x007d", "al_r12_0x007d"},
414 {{al, r12, 0x007e}, false, al, "al r12 0x007e", "al_r12_0x007e"},
415 {{al, r12, 0x007f}, false, al, "al r12 0x007f", "al_r12_0x007f"},
416 {{al, r12, 0x7ffd}, false, al, "al r12 0x7ffd", "al_r12_0x7ffd"},
417 {{al, r12, 0x7ffe}, false, al, "al r12 0x7ffe", "al_r12_0x7ffe"},
418 {{al, r12, 0x7fff}, false, al, "al r12 0x7fff", "al_r12_0x7fff"},
419 {{al, r12, 0x3333}, false, al, "al r12 0x3333", "al_r12_0x3333"},
420 {{al, r12, 0x5555}, false, al, "al r12 0x5555", "al_r12_0x5555"},
421 {{al, r12, 0xaaaa}, false, al, "al r12 0xaaaa", "al_r12_0xaaaa"},
422 {{al, r12, 0xcccc}, false, al, "al r12 0xcccc", "al_r12_0xcccc"},
423 {{al, r12, 0x8000}, false, al, "al r12 0x8000", "al_r12_0x8000"},
424 {{al, r12, 0x8001}, false, al, "al r12 0x8001", "al_r12_0x8001"},
425 {{al, r12, 0x8002}, false, al, "al r12 0x8002", "al_r12_0x8002"},
426 {{al, r12, 0x8003}, false, al, "al r12 0x8003", "al_r12_0x8003"},
427 {{al, r12, 0xff80}, false, al, "al r12 0xff80", "al_r12_0xff80"},
428 {{al, r12, 0xff81}, false, al, "al r12 0xff81", "al_r12_0xff81"},
429 {{al, r12, 0xff82}, false, al, "al r12 0xff82", "al_r12_0xff82"},
430 {{al, r12, 0xff83}, false, al, "al r12 0xff83", "al_r12_0xff83"},
431 {{al, r12, 0xffe0}, false, al, "al r12 0xffe0", "al_r12_0xffe0"},
432 {{al, r12, 0xfffd}, false, al, "al r12 0xfffd", "al_r12_0xfffd"},
433 {{al, r12, 0xfffe}, false, al, "al r12 0xfffe", "al_r12_0xfffe"},
434 {{al, r12, 0xffff}, false, al, "al r12 0xffff", "al_r12_0xffff"},
435 {{al, r13, 0x0000}, false, al, "al r13 0x0000", "al_r13_0x0000"},
436 {{al, r13, 0x0001}, false, al, "al r13 0x0001", "al_r13_0x0001"},
437 {{al, r13, 0x0002}, false, al, "al r13 0x0002", "al_r13_0x0002"},
438 {{al, r13, 0x0020}, false, al, "al r13 0x0020", "al_r13_0x0020"},
439 {{al, r13, 0x007d}, false, al, "al r13 0x007d", "al_r13_0x007d"},
440 {{al, r13, 0x007e}, false, al, "al r13 0x007e", "al_r13_0x007e"},
441 {{al, r13, 0x007f}, false, al, "al r13 0x007f", "al_r13_0x007f"},
442 {{al, r13, 0x7ffd}, false, al, "al r13 0x7ffd", "al_r13_0x7ffd"},
443 {{al, r13, 0x7ffe}, false, al, "al r13 0x7ffe", "al_r13_0x7ffe"},
444 {{al, r13, 0x7fff}, false, al, "al r13 0x7fff", "al_r13_0x7fff"},
445 {{al, r13, 0x3333}, false, al, "al r13 0x3333", "al_r13_0x3333"},
446 {{al, r13, 0x5555}, false, al, "al r13 0x5555", "al_r13_0x5555"},
447 {{al, r13, 0xaaaa}, false, al, "al r13 0xaaaa", "al_r13_0xaaaa"},
448 {{al, r13, 0xcccc}, false, al, "al r13 0xcccc", "al_r13_0xcccc"},
449 {{al, r13, 0x8000}, false, al, "al r13 0x8000", "al_r13_0x8000"},
450 {{al, r13, 0x8001}, false, al, "al r13 0x8001", "al_r13_0x8001"},
451 {{al, r13, 0x8002}, false, al, "al r13 0x8002", "al_r13_0x8002"},
452 {{al, r13, 0x8003}, false, al, "al r13 0x8003", "al_r13_0x8003"},
453 {{al, r13, 0xff80}, false, al, "al r13 0xff80", "al_r13_0xff80"},
454 {{al, r13, 0xff81}, false, al, "al r13 0xff81", "al_r13_0xff81"},
455 {{al, r13, 0xff82}, false, al, "al r13 0xff82", "al_r13_0xff82"},
456 {{al, r13, 0xff83}, false, al, "al r13 0xff83", "al_r13_0xff83"},
457 {{al, r13, 0xffe0}, false, al, "al r13 0xffe0", "al_r13_0xffe0"},
458 {{al, r13, 0xfffd}, false, al, "al r13 0xfffd", "al_r13_0xfffd"},
459 {{al, r13, 0xfffe}, false, al, "al r13 0xfffe", "al_r13_0xfffe"},
460 {{al, r13, 0xffff}, false, al, "al r13 0xffff", "al_r13_0xffff"},
461 {{al, r14, 0x0000}, false, al, "al r14 0x0000", "al_r14_0x0000"},
462 {{al, r14, 0x0001}, false, al, "al r14 0x0001", "al_r14_0x0001"},
463 {{al, r14, 0x0002}, false, al, "al r14 0x0002", "al_r14_0x0002"},
464 {{al, r14, 0x0020}, false, al, "al r14 0x0020", "al_r14_0x0020"},
465 {{al, r14, 0x007d}, false, al, "al r14 0x007d", "al_r14_0x007d"},
466 {{al, r14, 0x007e}, false, al, "al r14 0x007e", "al_r14_0x007e"},
467 {{al, r14, 0x007f}, false, al, "al r14 0x007f", "al_r14_0x007f"},
468 {{al, r14, 0x7ffd}, false, al, "al r14 0x7ffd", "al_r14_0x7ffd"},
469 {{al, r14, 0x7ffe}, false, al, "al r14 0x7ffe", "al_r14_0x7ffe"},
470 {{al, r14, 0x7fff}, false, al, "al r14 0x7fff", "al_r14_0x7fff"},
471 {{al, r14, 0x3333}, false, al, "al r14 0x3333", "al_r14_0x3333"},
472 {{al, r14, 0x5555}, false, al, "al r14 0x5555", "al_r14_0x5555"},
473 {{al, r14, 0xaaaa}, false, al, "al r14 0xaaaa", "al_r14_0xaaaa"},
474 {{al, r14, 0xcccc}, false, al, "al r14 0xcccc", "al_r14_0xcccc"},
475 {{al, r14, 0x8000}, false, al, "al r14 0x8000", "al_r14_0x8000"},
476 {{al, r14, 0x8001}, false, al, "al r14 0x8001", "al_r14_0x8001"},
477 {{al, r14, 0x8002}, false, al, "al r14 0x8002", "al_r14_0x8002"},
478 {{al, r14, 0x8003}, false, al, "al r14 0x8003", "al_r14_0x8003"},
479 {{al, r14, 0xff80}, false, al, "al r14 0xff80", "al_r14_0xff80"},
480 {{al, r14, 0xff81}, false, al, "al r14 0xff81", "al_r14_0xff81"},
481 {{al, r14, 0xff82}, false, al, "al r14 0xff82", "al_r14_0xff82"},
482 {{al, r14, 0xff83}, false, al, "al r14 0xff83", "al_r14_0xff83"},
483 {{al, r14, 0xffe0}, false, al, "al r14 0xffe0", "al_r14_0xffe0"},
484 {{al, r14, 0xfffd}, false, al, "al r14 0xfffd", "al_r14_0xfffd"},
485 {{al, r14, 0xfffe}, false, al, "al r14 0xfffe", "al_r14_0xfffe"},
486 {{al, r14, 0xffff}, false, al, "al r14 0xffff", "al_r14_0xffff"}};
487
488 // These headers each contain an array of `TestResult` with the reference output
489 // values. The reference arrays are names `kReference{mnemonic}`.
490 #include "aarch32/traces/assembler-cond-rd-operand-imm16-mov-t32.h"
491 #include "aarch32/traces/assembler-cond-rd-operand-imm16-movt-t32.h"
492 #include "aarch32/traces/assembler-cond-rd-operand-imm16-movw-t32.h"
493
494
495 // The maximum number of errors to report in detail for each test.
496 const unsigned kErrorReportLimit = 8;
497
498 typedef void (MacroAssembler::*Fn)(Condition cond,
499 Register rd,
500 const Operand& op);
501
TestHelper(Fn instruction,const char * mnemonic,const TestResult reference[])502 void TestHelper(Fn instruction,
503 const char* mnemonic,
504 const TestResult reference[]) {
505 unsigned total_error_count = 0;
506 MacroAssembler masm(BUF_SIZE);
507
508 masm.UseT32();
509
510 for (unsigned i = 0; i < ARRAY_SIZE(kTests); i++) {
511 // Values to pass to the macro-assembler.
512 Condition cond = kTests[i].operands.cond;
513 Register rd = kTests[i].operands.rd;
514 uint32_t immediate = kTests[i].operands.immediate;
515 Operand op(immediate);
516
517 int32_t start = masm.GetCursorOffset();
518 {
519 // We never generate more that 4 bytes, as IT instructions are only
520 // allowed for narrow encodings.
521 ExactAssemblyScope scope(&masm, 4, ExactAssemblyScope::kMaximumSize);
522 if (kTests[i].in_it_block) {
523 masm.it(kTests[i].it_condition);
524 }
525 (masm.*instruction)(cond, rd, op);
526 }
527 int32_t end = masm.GetCursorOffset();
528
529 const byte* result_ptr =
530 masm.GetBuffer()->GetOffsetAddress<const byte*>(start);
531 VIXL_ASSERT(start < end);
532 uint32_t result_size = end - start;
533
534 if (Test::generate_test_trace()) {
535 // Print the result bytes.
536 printf("const byte kInstruction_%s_%s[] = {\n",
537 mnemonic,
538 kTests[i].identifier);
539 for (uint32_t j = 0; j < result_size; j++) {
540 if (j == 0) {
541 printf(" 0x%02" PRIx8, result_ptr[j]);
542 } else {
543 printf(", 0x%02" PRIx8, result_ptr[j]);
544 }
545 }
546 // This comment is meant to be used by external tools to validate
547 // the encoding. We can parse the comment to figure out what
548 // instruction this corresponds to.
549 if (kTests[i].in_it_block) {
550 printf(" // It %s; %s %s\n};\n",
551 kTests[i].it_condition.GetName(),
552 mnemonic,
553 kTests[i].operands_description);
554 } else {
555 printf(" // %s %s\n};\n", mnemonic, kTests[i].operands_description);
556 }
557 } else {
558 // Check we've emitted the exact same encoding as present in the
559 // trace file. Only print up to `kErrorReportLimit` errors.
560 if (((result_size != reference[i].size) ||
561 (memcmp(result_ptr, reference[i].encoding, reference[i].size) !=
562 0)) &&
563 (++total_error_count <= kErrorReportLimit)) {
564 printf("Error when testing \"%s\" with operands \"%s\":\n",
565 mnemonic,
566 kTests[i].operands_description);
567 printf(" Expected: ");
568 for (uint32_t j = 0; j < reference[i].size; j++) {
569 if (j == 0) {
570 printf("0x%02" PRIx8, reference[i].encoding[j]);
571 } else {
572 printf(", 0x%02" PRIx8, reference[i].encoding[j]);
573 }
574 }
575 printf("\n");
576 printf(" Found: ");
577 for (uint32_t j = 0; j < result_size; j++) {
578 if (j == 0) {
579 printf("0x%02" PRIx8, result_ptr[j]);
580 } else {
581 printf(", 0x%02" PRIx8, result_ptr[j]);
582 }
583 }
584 printf("\n");
585 }
586 }
587 }
588
589 masm.FinalizeCode();
590
591 if (Test::generate_test_trace()) {
592 // Finalize the trace file by writing the final `TestResult` array
593 // which links all generated instruction encodings.
594 printf("const TestResult kReference%s[] = {\n", mnemonic);
595 for (unsigned i = 0; i < ARRAY_SIZE(kTests); i++) {
596 printf(" {\n");
597 printf(" ARRAY_SIZE(kInstruction_%s_%s),\n",
598 mnemonic,
599 kTests[i].identifier);
600 printf(" kInstruction_%s_%s,\n", mnemonic, kTests[i].identifier);
601 printf(" },\n");
602 }
603 printf("};\n");
604 } else {
605 if (total_error_count > kErrorReportLimit) {
606 printf("%u other errors follow.\n",
607 total_error_count - kErrorReportLimit);
608 }
609 // Crash if the test failed.
610 VIXL_CHECK(total_error_count == 0);
611 }
612 }
613
614 // Instantiate tests for each instruction in the list.
615 #define TEST(mnemonic) \
616 void Test_##mnemonic() { \
617 TestHelper(&MacroAssembler::mnemonic, #mnemonic, kReference##mnemonic); \
618 } \
619 Test test_##mnemonic("AARCH32_ASSEMBLER_COND_RD_OPERAND_IMM16_" #mnemonic \
620 "_T32", \
621 &Test_##mnemonic);
622 FOREACH_INSTRUCTION(TEST)
623 #undef TEST
624
625 } // namespace
626 #endif
627
628 } // namespace aarch32
629 } // namespace vixl
630