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-macro-assembler-aarch32.cc.in template file
31 // using tools/generate_tests.py.
32 //
33 // PLEASE DO NOT EDIT.
34 // -----------------------------------------------------------------------------
35
36
37 #include <iostream>
38 #include <map>
39
40 #include "test-runner.h"
41
42 #include "test-utils.h"
43 #include "test-utils-aarch32.h"
44
45 #include "aarch32/assembler-aarch32.h"
46 #include "aarch32/disasm-aarch32.h"
47 #include "aarch32/macro-assembler-aarch32.h"
48
49 #define BUF_SIZE (4096)
50
51 namespace vixl {
52 namespace aarch32 {
53
54 // List of instruction mnemonics.
55 #define FOREACH_INSTRUCTION(M) \
56 M(Clz) \
57 M(Rbit) \
58 M(Rev) \
59 M(Rev16) \
60 M(Revsh) \
61 M(Rrx) \
62 M(Rrxs)
63
64
65 // The following definitions are defined again in each generated test, therefore
66 // we need to place them in an anomymous namespace. It expresses that they are
67 // local to this file only, and the compiler is not allowed to share these types
68 // across test files during template instantiation. Specifically, `Operands` has
69 // various layouts across generated tests so it absolutely cannot be shared.
70
71 #ifdef VIXL_INCLUDE_TARGET_A32
72 namespace {
73
74 // Values to be passed to the assembler to produce the instruction under test.
75 struct Operands {
76 Condition cond;
77 Register rd;
78 Register rn;
79 };
80
81 // This structure contains all data needed to test one specific
82 // instruction.
83 struct TestData {
84 // The `operands` field represents what to pass to the assembler to
85 // produce the instruction.
86 Operands operands;
87 // Description of the operands, used for error reporting.
88 const char* operands_description;
89 // Unique identifier, used for generating traces.
90 const char* identifier;
91 };
92
93 // Each element of this array produce one instruction encoding.
94 const TestData kTests[] = {{{cs, r12, r1}, "cs, r12, r1", "cs_r12_r1"},
95 {{hi, r6, r12}, "hi, r6, r12", "hi_r6_r12"},
96 {{lt, r11, r10}, "lt, r11, r10", "lt_r11_r10"},
97 {{vs, r10, r8}, "vs, r10, r8", "vs_r10_r8"},
98 {{pl, r5, r8}, "pl, r5, r8", "pl_r5_r8"},
99 {{ls, r14, r14}, "ls, r14, r14", "ls_r14_r14"},
100 {{gt, r8, r6}, "gt, r8, r6", "gt_r8_r6"},
101 {{vc, r7, r11}, "vc, r7, r11", "vc_r7_r11"},
102 {{pl, r4, r12}, "pl, r4, r12", "pl_r4_r12"},
103 {{gt, r12, r12}, "gt, r12, r12", "gt_r12_r12"},
104 {{ne, r8, r4}, "ne, r8, r4", "ne_r8_r4"},
105 {{le, r1, r11}, "le, r1, r11", "le_r1_r11"},
106 {{cc, r4, r10}, "cc, r4, r10", "cc_r4_r10"},
107 {{gt, r14, r0}, "gt, r14, r0", "gt_r14_r0"},
108 {{cs, r2, r11}, "cs, r2, r11", "cs_r2_r11"},
109 {{al, r3, r12}, "al, r3, r12", "al_r3_r12"},
110 {{hi, r6, r0}, "hi, r6, r0", "hi_r6_r0"},
111 {{ls, r10, r10}, "ls, r10, r10", "ls_r10_r10"},
112 {{ls, r4, r8}, "ls, r4, r8", "ls_r4_r8"},
113 {{le, r8, r0}, "le, r8, r0", "le_r8_r0"},
114 {{pl, r5, r3}, "pl, r5, r3", "pl_r5_r3"},
115 {{ls, r8, r5}, "ls, r8, r5", "ls_r8_r5"},
116 {{ge, r0, r10}, "ge, r0, r10", "ge_r0_r10"},
117 {{lt, r10, r6}, "lt, r10, r6", "lt_r10_r6"},
118 {{ne, r9, r9}, "ne, r9, r9", "ne_r9_r9"},
119 {{hi, r5, r0}, "hi, r5, r0", "hi_r5_r0"},
120 {{pl, r10, r6}, "pl, r10, r6", "pl_r10_r6"},
121 {{vs, r1, r3}, "vs, r1, r3", "vs_r1_r3"},
122 {{vs, r9, r8}, "vs, r9, r8", "vs_r9_r8"},
123 {{cc, r2, r10}, "cc, r2, r10", "cc_r2_r10"},
124 {{cs, r11, r3}, "cs, r11, r3", "cs_r11_r3"},
125 {{hi, r8, r2}, "hi, r8, r2", "hi_r8_r2"},
126 {{pl, r6, r0}, "pl, r6, r0", "pl_r6_r0"},
127 {{hi, r9, r2}, "hi, r9, r2", "hi_r9_r2"},
128 {{al, r14, r11}, "al, r14, r11", "al_r14_r11"},
129 {{eq, r8, r13}, "eq, r8, r13", "eq_r8_r13"},
130 {{ge, r12, r2}, "ge, r12, r2", "ge_r12_r2"},
131 {{cc, r2, r6}, "cc, r2, r6", "cc_r2_r6"},
132 {{ne, r13, r9}, "ne, r13, r9", "ne_r13_r9"},
133 {{ne, r13, r10}, "ne, r13, r10", "ne_r13_r10"},
134 {{mi, r10, r9}, "mi, r10, r9", "mi_r10_r9"},
135 {{lt, r13, r12}, "lt, r13, r12", "lt_r13_r12"},
136 {{lt, r14, r3}, "lt, r14, r3", "lt_r14_r3"},
137 {{mi, r12, r14}, "mi, r12, r14", "mi_r12_r14"},
138 {{vs, r11, r2}, "vs, r11, r2", "vs_r11_r2"},
139 {{ls, r11, r0}, "ls, r11, r0", "ls_r11_r0"},
140 {{gt, r10, r9}, "gt, r10, r9", "gt_r10_r9"},
141 {{le, r10, r12}, "le, r10, r12", "le_r10_r12"},
142 {{ge, r0, r14}, "ge, r0, r14", "ge_r0_r14"},
143 {{mi, r5, r8}, "mi, r5, r8", "mi_r5_r8"},
144 {{vs, r4, r11}, "vs, r4, r11", "vs_r4_r11"},
145 {{lt, r7, r12}, "lt, r7, r12", "lt_r7_r12"},
146 {{gt, r2, r8}, "gt, r2, r8", "gt_r2_r8"},
147 {{gt, r5, r7}, "gt, r5, r7", "gt_r5_r7"},
148 {{pl, r6, r3}, "pl, r6, r3", "pl_r6_r3"},
149 {{ne, r2, r12}, "ne, r2, r12", "ne_r2_r12"},
150 {{hi, r11, r11}, "hi, r11, r11", "hi_r11_r11"},
151 {{vs, r4, r14}, "vs, r4, r14", "vs_r4_r14"},
152 {{vs, r13, r1}, "vs, r13, r1", "vs_r13_r1"},
153 {{cs, r4, r3}, "cs, r4, r3", "cs_r4_r3"},
154 {{eq, r13, r6}, "eq, r13, r6", "eq_r13_r6"},
155 {{gt, r11, r14}, "gt, r11, r14", "gt_r11_r14"},
156 {{vc, r14, r4}, "vc, r14, r4", "vc_r14_r4"},
157 {{vc, r1, r10}, "vc, r1, r10", "vc_r1_r10"},
158 {{mi, r10, r3}, "mi, r10, r3", "mi_r10_r3"},
159 {{vs, r9, r3}, "vs, r9, r3", "vs_r9_r3"},
160 {{vc, r14, r5}, "vc, r14, r5", "vc_r14_r5"},
161 {{ne, r9, r1}, "ne, r9, r1", "ne_r9_r1"},
162 {{al, r9, r6}, "al, r9, r6", "al_r9_r6"},
163 {{vc, r7, r8}, "vc, r7, r8", "vc_r7_r8"},
164 {{ls, r6, r9}, "ls, r6, r9", "ls_r6_r9"},
165 {{le, r14, r2}, "le, r14, r2", "le_r14_r2"},
166 {{ls, r9, r13}, "ls, r9, r13", "ls_r9_r13"},
167 {{eq, r1, r5}, "eq, r1, r5", "eq_r1_r5"},
168 {{le, r9, r2}, "le, r9, r2", "le_r9_r2"},
169 {{eq, r2, r1}, "eq, r2, r1", "eq_r2_r1"},
170 {{ls, r9, r11}, "ls, r9, r11", "ls_r9_r11"},
171 {{lt, r7, r13}, "lt, r7, r13", "lt_r7_r13"},
172 {{cc, r8, r7}, "cc, r8, r7", "cc_r8_r7"},
173 {{ls, r5, r1}, "ls, r5, r1", "ls_r5_r1"},
174 {{le, r1, r9}, "le, r1, r9", "le_r1_r9"},
175 {{ls, r8, r14}, "ls, r8, r14", "ls_r8_r14"},
176 {{le, r9, r1}, "le, r9, r1", "le_r9_r1"},
177 {{gt, r1, r6}, "gt, r1, r6", "gt_r1_r6"},
178 {{gt, r11, r10}, "gt, r11, r10", "gt_r11_r10"},
179 {{hi, r0, r12}, "hi, r0, r12", "hi_r0_r12"},
180 {{gt, r1, r7}, "gt, r1, r7", "gt_r1_r7"},
181 {{mi, r7, r1}, "mi, r7, r1", "mi_r7_r1"},
182 {{mi, r7, r0}, "mi, r7, r0", "mi_r7_r0"},
183 {{ls, r1, r3}, "ls, r1, r3", "ls_r1_r3"},
184 {{mi, r13, r3}, "mi, r13, r3", "mi_r13_r3"},
185 {{eq, r4, r3}, "eq, r4, r3", "eq_r4_r3"},
186 {{vc, r14, r9}, "vc, r14, r9", "vc_r14_r9"},
187 {{pl, r3, r1}, "pl, r3, r1", "pl_r3_r1"},
188 {{mi, r0, r2}, "mi, r0, r2", "mi_r0_r2"},
189 {{hi, r2, r7}, "hi, r2, r7", "hi_r2_r7"},
190 {{hi, r13, r12}, "hi, r13, r12", "hi_r13_r12"},
191 {{ls, r12, r8}, "ls, r12, r8", "ls_r12_r8"},
192 {{ne, r5, r6}, "ne, r5, r6", "ne_r5_r6"},
193 {{pl, r5, r4}, "pl, r5, r4", "pl_r5_r4"},
194 {{ge, r1, r6}, "ge, r1, r6", "ge_r1_r6"},
195 {{eq, r8, r10}, "eq, r8, r10", "eq_r8_r10"},
196 {{cs, r5, r4}, "cs, r5, r4", "cs_r5_r4"},
197 {{eq, r11, r6}, "eq, r11, r6", "eq_r11_r6"},
198 {{cs, r13, r3}, "cs, r13, r3", "cs_r13_r3"},
199 {{pl, r2, r8}, "pl, r2, r8", "pl_r2_r8"},
200 {{gt, r10, r0}, "gt, r10, r0", "gt_r10_r0"},
201 {{lt, r4, r10}, "lt, r4, r10", "lt_r4_r10"},
202 {{vs, r14, r14}, "vs, r14, r14", "vs_r14_r14"},
203 {{hi, r0, r7}, "hi, r0, r7", "hi_r0_r7"},
204 {{cc, r9, r6}, "cc, r9, r6", "cc_r9_r6"},
205 {{ne, r7, r13}, "ne, r7, r13", "ne_r7_r13"},
206 {{eq, r2, r6}, "eq, r2, r6", "eq_r2_r6"},
207 {{cs, r12, r12}, "cs, r12, r12", "cs_r12_r12"},
208 {{mi, r3, r10}, "mi, r3, r10", "mi_r3_r10"},
209 {{le, r6, r13}, "le, r6, r13", "le_r6_r13"},
210 {{al, r2, r1}, "al, r2, r1", "al_r2_r1"},
211 {{le, r3, r4}, "le, r3, r4", "le_r3_r4"},
212 {{pl, r4, r4}, "pl, r4, r4", "pl_r4_r4"},
213 {{lt, r12, r3}, "lt, r12, r3", "lt_r12_r3"},
214 {{ls, r7, r4}, "ls, r7, r4", "ls_r7_r4"},
215 {{le, r9, r4}, "le, r9, r4", "le_r9_r4"},
216 {{vc, r13, r3}, "vc, r13, r3", "vc_r13_r3"},
217 {{vc, r8, r8}, "vc, r8, r8", "vc_r8_r8"},
218 {{ge, r2, r8}, "ge, r2, r8", "ge_r2_r8"},
219 {{le, r11, r13}, "le, r11, r13", "le_r11_r13"},
220 {{le, r1, r5}, "le, r1, r5", "le_r1_r5"},
221 {{ge, r9, r12}, "ge, r9, r12", "ge_r9_r12"},
222 {{cs, r14, r14}, "cs, r14, r14", "cs_r14_r14"},
223 {{cc, r1, r0}, "cc, r1, r0", "cc_r1_r0"},
224 {{ge, r3, r0}, "ge, r3, r0", "ge_r3_r0"},
225 {{al, r10, r0}, "al, r10, r0", "al_r10_r0"},
226 {{cc, r11, r10}, "cc, r11, r10", "cc_r11_r10"},
227 {{mi, r11, r11}, "mi, r11, r11", "mi_r11_r11"},
228 {{ne, r12, r7}, "ne, r12, r7", "ne_r12_r7"},
229 {{lt, r4, r12}, "lt, r4, r12", "lt_r4_r12"},
230 {{gt, r14, r5}, "gt, r14, r5", "gt_r14_r5"},
231 {{ge, r1, r7}, "ge, r1, r7", "ge_r1_r7"},
232 {{al, r7, r0}, "al, r7, r0", "al_r7_r0"},
233 {{ls, r2, r0}, "ls, r2, r0", "ls_r2_r0"},
234 {{pl, r6, r11}, "pl, r6, r11", "pl_r6_r11"},
235 {{vc, r0, r6}, "vc, r0, r6", "vc_r0_r6"},
236 {{pl, r6, r9}, "pl, r6, r9", "pl_r6_r9"},
237 {{vs, r8, r1}, "vs, r8, r1", "vs_r8_r1"},
238 {{cs, r1, r6}, "cs, r1, r6", "cs_r1_r6"},
239 {{hi, r4, r11}, "hi, r4, r11", "hi_r4_r11"},
240 {{gt, r5, r5}, "gt, r5, r5", "gt_r5_r5"},
241 {{al, r3, r4}, "al, r3, r4", "al_r3_r4"},
242 {{ge, r11, r12}, "ge, r11, r12", "ge_r11_r12"},
243 {{cc, r14, r2}, "cc, r14, r2", "cc_r14_r2"},
244 {{ge, r2, r4}, "ge, r2, r4", "ge_r2_r4"},
245 {{lt, r5, r11}, "lt, r5, r11", "lt_r5_r11"},
246 {{mi, r11, r14}, "mi, r11, r14", "mi_r11_r14"},
247 {{ne, r3, r3}, "ne, r3, r3", "ne_r3_r3"},
248 {{pl, r14, r0}, "pl, r14, r0", "pl_r14_r0"},
249 {{vc, r4, r10}, "vc, r4, r10", "vc_r4_r10"},
250 {{vs, r6, r8}, "vs, r6, r8", "vs_r6_r8"},
251 {{vc, r4, r7}, "vc, r4, r7", "vc_r4_r7"},
252 {{cs, r11, r10}, "cs, r11, r10", "cs_r11_r10"},
253 {{eq, r11, r8}, "eq, r11, r8", "eq_r11_r8"},
254 {{ne, r9, r2}, "ne, r9, r2", "ne_r9_r2"},
255 {{hi, r9, r7}, "hi, r9, r7", "hi_r9_r7"},
256 {{lt, r0, r6}, "lt, r0, r6", "lt_r0_r6"},
257 {{vc, r5, r8}, "vc, r5, r8", "vc_r5_r8"},
258 {{gt, r3, r1}, "gt, r3, r1", "gt_r3_r1"},
259 {{pl, r3, r5}, "pl, r3, r5", "pl_r3_r5"},
260 {{al, r11, r5}, "al, r11, r5", "al_r11_r5"},
261 {{hi, r8, r14}, "hi, r8, r14", "hi_r8_r14"},
262 {{le, r5, r4}, "le, r5, r4", "le_r5_r4"},
263 {{ge, r13, r3}, "ge, r13, r3", "ge_r13_r3"},
264 {{pl, r7, r14}, "pl, r7, r14", "pl_r7_r14"},
265 {{cs, r6, r9}, "cs, r6, r9", "cs_r6_r9"},
266 {{lt, r8, r12}, "lt, r8, r12", "lt_r8_r12"},
267 {{cc, r12, r0}, "cc, r12, r0", "cc_r12_r0"},
268 {{mi, r14, r13}, "mi, r14, r13", "mi_r14_r13"},
269 {{pl, r12, r13}, "pl, r12, r13", "pl_r12_r13"},
270 {{al, r4, r8}, "al, r4, r8", "al_r4_r8"},
271 {{ls, r5, r11}, "ls, r5, r11", "ls_r5_r11"},
272 {{ge, r11, r3}, "ge, r11, r3", "ge_r11_r3"},
273 {{le, r1, r0}, "le, r1, r0", "le_r1_r0"},
274 {{gt, r14, r4}, "gt, r14, r4", "gt_r14_r4"},
275 {{ne, r3, r14}, "ne, r3, r14", "ne_r3_r14"},
276 {{cc, r3, r8}, "cc, r3, r8", "cc_r3_r8"},
277 {{eq, r7, r10}, "eq, r7, r10", "eq_r7_r10"},
278 {{pl, r0, r10}, "pl, r0, r10", "pl_r0_r10"},
279 {{mi, r6, r13}, "mi, r6, r13", "mi_r6_r13"},
280 {{gt, r10, r5}, "gt, r10, r5", "gt_r10_r5"},
281 {{ne, r0, r1}, "ne, r0, r1", "ne_r0_r1"},
282 {{ge, r4, r8}, "ge, r4, r8", "ge_r4_r8"},
283 {{cs, r3, r7}, "cs, r3, r7", "cs_r3_r7"},
284 {{pl, r2, r12}, "pl, r2, r12", "pl_r2_r12"},
285 {{ls, r9, r12}, "ls, r9, r12", "ls_r9_r12"},
286 {{ge, r4, r9}, "ge, r4, r9", "ge_r4_r9"},
287 {{lt, r7, r2}, "lt, r7, r2", "lt_r7_r2"},
288 {{hi, r10, r10}, "hi, r10, r10", "hi_r10_r10"},
289 {{ls, r1, r7}, "ls, r1, r7", "ls_r1_r7"},
290 {{vs, r1, r12}, "vs, r1, r12", "vs_r1_r12"},
291 {{ge, r9, r14}, "ge, r9, r14", "ge_r9_r14"},
292 {{pl, r6, r4}, "pl, r6, r4", "pl_r6_r4"},
293 {{ls, r3, r2}, "ls, r3, r2", "ls_r3_r2"},
294 {{cs, r4, r4}, "cs, r4, r4", "cs_r4_r4"},
295 {{eq, r6, r2}, "eq, r6, r2", "eq_r6_r2"},
296 {{ge, r14, r0}, "ge, r14, r0", "ge_r14_r0"},
297 {{le, r11, r6}, "le, r11, r6", "le_r11_r6"},
298 {{vs, r0, r0}, "vs, r0, r0", "vs_r0_r0"},
299 {{vs, r4, r6}, "vs, r4, r6", "vs_r4_r6"},
300 {{gt, r6, r10}, "gt, r6, r10", "gt_r6_r10"},
301 {{vc, r12, r7}, "vc, r12, r7", "vc_r12_r7"},
302 {{gt, r8, r3}, "gt, r8, r3", "gt_r8_r3"},
303 {{hi, r14, r4}, "hi, r14, r4", "hi_r14_r4"},
304 {{hi, r9, r14}, "hi, r9, r14", "hi_r9_r14"},
305 {{vs, r6, r1}, "vs, r6, r1", "vs_r6_r1"},
306 {{hi, r5, r4}, "hi, r5, r4", "hi_r5_r4"},
307 {{lt, r10, r14}, "lt, r10, r14", "lt_r10_r14"},
308 {{cc, r8, r10}, "cc, r8, r10", "cc_r8_r10"},
309 {{lt, r11, r0}, "lt, r11, r0", "lt_r11_r0"},
310 {{ge, r4, r12}, "ge, r4, r12", "ge_r4_r12"},
311 {{cc, r5, r7}, "cc, r5, r7", "cc_r5_r7"},
312 {{gt, r3, r9}, "gt, r3, r9", "gt_r3_r9"},
313 {{vc, r11, r5}, "vc, r11, r5", "vc_r11_r5"},
314 {{lt, r7, r1}, "lt, r7, r1", "lt_r7_r1"},
315 {{lt, r1, r8}, "lt, r1, r8", "lt_r1_r8"},
316 {{hi, r11, r13}, "hi, r11, r13", "hi_r11_r13"},
317 {{vs, r10, r2}, "vs, r10, r2", "vs_r10_r2"},
318 {{ne, r1, r10}, "ne, r1, r10", "ne_r1_r10"},
319 {{vc, r10, r0}, "vc, r10, r0", "vc_r10_r0"},
320 {{al, r2, r2}, "al, r2, r2", "al_r2_r2"},
321 {{ne, r7, r8}, "ne, r7, r8", "ne_r7_r8"},
322 {{hi, r11, r14}, "hi, r11, r14", "hi_r11_r14"},
323 {{ne, r6, r14}, "ne, r6, r14", "ne_r6_r14"},
324 {{ge, r8, r5}, "ge, r8, r5", "ge_r8_r5"},
325 {{vs, r7, r3}, "vs, r7, r3", "vs_r7_r3"},
326 {{ne, r14, r13}, "ne, r14, r13", "ne_r14_r13"},
327 {{hi, r12, r11}, "hi, r12, r11", "hi_r12_r11"},
328 {{ls, r11, r9}, "ls, r11, r9", "ls_r11_r9"},
329 {{mi, r12, r7}, "mi, r12, r7", "mi_r12_r7"},
330 {{cc, r8, r8}, "cc, r8, r8", "cc_r8_r8"},
331 {{ls, r14, r12}, "ls, r14, r12", "ls_r14_r12"},
332 {{ls, r3, r6}, "ls, r3, r6", "ls_r3_r6"},
333 {{hi, r7, r8}, "hi, r7, r8", "hi_r7_r8"},
334 {{vs, r4, r10}, "vs, r4, r10", "vs_r4_r10"},
335 {{ne, r12, r1}, "ne, r12, r1", "ne_r12_r1"},
336 {{vs, r12, r4}, "vs, r12, r4", "vs_r12_r4"},
337 {{hi, r5, r5}, "hi, r5, r5", "hi_r5_r5"},
338 {{gt, r8, r8}, "gt, r8, r8", "gt_r8_r8"},
339 {{lt, r10, r10}, "lt, r10, r10", "lt_r10_r10"},
340 {{vs, r13, r4}, "vs, r13, r4", "vs_r13_r4"},
341 {{mi, r8, r3}, "mi, r8, r3", "mi_r8_r3"},
342 {{eq, r6, r13}, "eq, r6, r13", "eq_r6_r13"},
343 {{al, r2, r0}, "al, r2, r0", "al_r2_r0"},
344 {{ls, r6, r12}, "ls, r6, r12", "ls_r6_r12"},
345 {{vs, r1, r4}, "vs, r1, r4", "vs_r1_r4"},
346 {{vc, r11, r1}, "vc, r11, r1", "vc_r11_r1"},
347 {{ne, r9, r10}, "ne, r9, r10", "ne_r9_r10"},
348 {{ne, r3, r10}, "ne, r3, r10", "ne_r3_r10"},
349 {{hi, r7, r10}, "hi, r7, r10", "hi_r7_r10"},
350 {{pl, r4, r10}, "pl, r4, r10", "pl_r4_r10"},
351 {{le, r7, r1}, "le, r7, r1", "le_r7_r1"},
352 {{gt, r13, r10}, "gt, r13, r10", "gt_r13_r10"},
353 {{lt, r4, r14}, "lt, r4, r14", "lt_r4_r14"},
354 {{al, r10, r1}, "al, r10, r1", "al_r10_r1"},
355 {{mi, r6, r12}, "mi, r6, r12", "mi_r6_r12"},
356 {{eq, r13, r9}, "eq, r13, r9", "eq_r13_r9"},
357 {{ge, r11, r4}, "ge, r11, r4", "ge_r11_r4"},
358 {{hi, r1, r12}, "hi, r1, r12", "hi_r1_r12"},
359 {{ge, r0, r1}, "ge, r0, r1", "ge_r0_r1"},
360 {{lt, r2, r3}, "lt, r2, r3", "lt_r2_r3"},
361 {{al, r12, r9}, "al, r12, r9", "al_r12_r9"},
362 {{hi, r2, r10}, "hi, r2, r10", "hi_r2_r10"},
363 {{mi, r14, r11}, "mi, r14, r11", "mi_r14_r11"},
364 {{pl, r3, r10}, "pl, r3, r10", "pl_r3_r10"},
365 {{vs, r1, r6}, "vs, r1, r6", "vs_r1_r6"},
366 {{al, r7, r6}, "al, r7, r6", "al_r7_r6"},
367 {{ge, r6, r8}, "ge, r6, r8", "ge_r6_r8"},
368 {{eq, r3, r3}, "eq, r3, r3", "eq_r3_r3"},
369 {{ne, r14, r4}, "ne, r14, r4", "ne_r14_r4"},
370 {{vc, r13, r10}, "vc, r13, r10", "vc_r13_r10"},
371 {{mi, r3, r12}, "mi, r3, r12", "mi_r3_r12"},
372 {{pl, r9, r1}, "pl, r9, r1", "pl_r9_r1"},
373 {{hi, r14, r14}, "hi, r14, r14", "hi_r14_r14"},
374 {{ne, r0, r9}, "ne, r0, r9", "ne_r0_r9"},
375 {{mi, r1, r1}, "mi, r1, r1", "mi_r1_r1"},
376 {{hi, r7, r2}, "hi, r7, r2", "hi_r7_r2"},
377 {{gt, r2, r3}, "gt, r2, r3", "gt_r2_r3"},
378 {{eq, r2, r0}, "eq, r2, r0", "eq_r2_r0"},
379 {{vs, r10, r12}, "vs, r10, r12", "vs_r10_r12"},
380 {{gt, r11, r7}, "gt, r11, r7", "gt_r11_r7"},
381 {{vs, r13, r2}, "vs, r13, r2", "vs_r13_r2"},
382 {{ls, r11, r12}, "ls, r11, r12", "ls_r11_r12"},
383 {{al, r8, r8}, "al, r8, r8", "al_r8_r8"},
384 {{hi, r6, r10}, "hi, r6, r10", "hi_r6_r10"},
385 {{vs, r5, r1}, "vs, r5, r1", "vs_r5_r1"},
386 {{ls, r0, r10}, "ls, r0, r10", "ls_r0_r10"},
387 {{gt, r0, r1}, "gt, r0, r1", "gt_r0_r1"},
388 {{ne, r11, r12}, "ne, r11, r12", "ne_r11_r12"},
389 {{ne, r13, r5}, "ne, r13, r5", "ne_r13_r5"},
390 {{mi, r0, r12}, "mi, r0, r12", "mi_r0_r12"},
391 {{lt, r11, r6}, "lt, r11, r6", "lt_r11_r6"},
392 {{eq, r11, r14}, "eq, r11, r14", "eq_r11_r14"},
393 {{vc, r11, r10}, "vc, r11, r10", "vc_r11_r10"},
394 {{cs, r3, r3}, "cs, r3, r3", "cs_r3_r3"},
395 {{le, r12, r2}, "le, r12, r2", "le_r12_r2"},
396 {{hi, r13, r8}, "hi, r13, r8", "hi_r13_r8"},
397 {{pl, r6, r6}, "pl, r6, r6", "pl_r6_r6"},
398 {{al, r4, r5}, "al, r4, r5", "al_r4_r5"},
399 {{hi, r1, r0}, "hi, r1, r0", "hi_r1_r0"},
400 {{ls, r10, r11}, "ls, r10, r11", "ls_r10_r11"},
401 {{al, r8, r7}, "al, r8, r7", "al_r8_r7"},
402 {{vc, r7, r1}, "vc, r7, r1", "vc_r7_r1"},
403 {{ne, r7, r14}, "ne, r7, r14", "ne_r7_r14"},
404 {{lt, r5, r9}, "lt, r5, r9", "lt_r5_r9"},
405 {{al, r13, r8}, "al, r13, r8", "al_r13_r8"},
406 {{ls, r6, r14}, "ls, r6, r14", "ls_r6_r14"},
407 {{eq, r12, r0}, "eq, r12, r0", "eq_r12_r0"},
408 {{mi, r8, r14}, "mi, r8, r14", "mi_r8_r14"},
409 {{hi, r13, r2}, "hi, r13, r2", "hi_r13_r2"},
410 {{al, r13, r2}, "al, r13, r2", "al_r13_r2"},
411 {{vs, r8, r9}, "vs, r8, r9", "vs_r8_r9"},
412 {{cc, r6, r2}, "cc, r6, r2", "cc_r6_r2"},
413 {{lt, r8, r0}, "lt, r8, r0", "lt_r8_r0"},
414 {{ls, r3, r13}, "ls, r3, r13", "ls_r3_r13"},
415 {{gt, r10, r14}, "gt, r10, r14", "gt_r10_r14"},
416 {{pl, r9, r8}, "pl, r9, r8", "pl_r9_r8"},
417 {{pl, r14, r11}, "pl, r14, r11", "pl_r14_r11"},
418 {{lt, r9, r3}, "lt, r9, r3", "lt_r9_r3"},
419 {{hi, r9, r0}, "hi, r9, r0", "hi_r9_r0"},
420 {{cc, r9, r3}, "cc, r9, r3", "cc_r9_r3"},
421 {{ge, r10, r14}, "ge, r10, r14", "ge_r10_r14"},
422 {{vs, r2, r1}, "vs, r2, r1", "vs_r2_r1"},
423 {{vc, r4, r13}, "vc, r4, r13", "vc_r4_r13"},
424 {{ls, r1, r9}, "ls, r1, r9", "ls_r1_r9"},
425 {{lt, r13, r11}, "lt, r13, r11", "lt_r13_r11"},
426 {{cs, r2, r10}, "cs, r2, r10", "cs_r2_r10"},
427 {{le, r0, r13}, "le, r0, r13", "le_r0_r13"},
428 {{al, r13, r11}, "al, r13, r11", "al_r13_r11"},
429 {{eq, r5, r2}, "eq, r5, r2", "eq_r5_r2"},
430 {{vs, r5, r12}, "vs, r5, r12", "vs_r5_r12"},
431 {{al, r12, r0}, "al, r12, r0", "al_r12_r0"},
432 {{le, r13, r9}, "le, r13, r9", "le_r13_r9"},
433 {{cs, r14, r4}, "cs, r14, r4", "cs_r14_r4"},
434 {{ne, r5, r7}, "ne, r5, r7", "ne_r5_r7"},
435 {{al, r6, r6}, "al, r6, r6", "al_r6_r6"},
436 {{gt, r4, r8}, "gt, r4, r8", "gt_r4_r8"},
437 {{gt, r12, r8}, "gt, r12, r8", "gt_r12_r8"},
438 {{eq, r4, r12}, "eq, r4, r12", "eq_r4_r12"},
439 {{cs, r7, r13}, "cs, r7, r13", "cs_r7_r13"},
440 {{cs, r2, r4}, "cs, r2, r4", "cs_r2_r4"},
441 {{al, r10, r3}, "al, r10, r3", "al_r10_r3"},
442 {{cs, r8, r9}, "cs, r8, r9", "cs_r8_r9"},
443 {{cs, r1, r12}, "cs, r1, r12", "cs_r1_r12"},
444 {{gt, r13, r0}, "gt, r13, r0", "gt_r13_r0"},
445 {{vc, r13, r12}, "vc, r13, r12", "vc_r13_r12"},
446 {{lt, r12, r14}, "lt, r12, r14", "lt_r12_r14"},
447 {{lt, r0, r1}, "lt, r0, r1", "lt_r0_r1"},
448 {{cc, r10, r2}, "cc, r10, r2", "cc_r10_r2"},
449 {{le, r3, r5}, "le, r3, r5", "le_r3_r5"},
450 {{eq, r2, r11}, "eq, r2, r11", "eq_r2_r11"},
451 {{al, r12, r4}, "al, r12, r4", "al_r12_r4"},
452 {{cs, r6, r5}, "cs, r6, r5", "cs_r6_r5"},
453 {{hi, r13, r10}, "hi, r13, r10", "hi_r13_r10"},
454 {{vs, r4, r3}, "vs, r4, r3", "vs_r4_r3"},
455 {{ls, r7, r9}, "ls, r7, r9", "ls_r7_r9"},
456 {{vs, r14, r8}, "vs, r14, r8", "vs_r14_r8"},
457 {{cs, r1, r0}, "cs, r1, r0", "cs_r1_r0"},
458 {{mi, r10, r8}, "mi, r10, r8", "mi_r10_r8"},
459 {{ge, r10, r4}, "ge, r10, r4", "ge_r10_r4"},
460 {{cc, r5, r4}, "cc, r5, r4", "cc_r5_r4"},
461 {{lt, r0, r7}, "lt, r0, r7", "lt_r0_r7"},
462 {{mi, r14, r10}, "mi, r14, r10", "mi_r14_r10"},
463 {{mi, r0, r14}, "mi, r0, r14", "mi_r0_r14"},
464 {{eq, r14, r10}, "eq, r14, r10", "eq_r14_r10"},
465 {{ls, r4, r4}, "ls, r4, r4", "ls_r4_r4"},
466 {{pl, r14, r1}, "pl, r14, r1", "pl_r14_r1"},
467 {{eq, r10, r8}, "eq, r10, r8", "eq_r10_r8"},
468 {{cs, r10, r6}, "cs, r10, r6", "cs_r10_r6"},
469 {{al, r12, r2}, "al, r12, r2", "al_r12_r2"},
470 {{ls, r12, r1}, "ls, r12, r1", "ls_r12_r1"},
471 {{eq, r12, r11}, "eq, r12, r11", "eq_r12_r11"},
472 {{vc, r4, r1}, "vc, r4, r1", "vc_r4_r1"},
473 {{vs, r12, r2}, "vs, r12, r2", "vs_r12_r2"},
474 {{al, r11, r8}, "al, r11, r8", "al_r11_r8"},
475 {{hi, r6, r13}, "hi, r6, r13", "hi_r6_r13"},
476 {{eq, r2, r8}, "eq, r2, r8", "eq_r2_r8"},
477 {{cc, r9, r5}, "cc, r9, r5", "cc_r9_r5"},
478 {{cc, r9, r7}, "cc, r9, r7", "cc_r9_r7"},
479 {{lt, r4, r6}, "lt, r4, r6", "lt_r4_r6"},
480 {{cc, r14, r13}, "cc, r14, r13", "cc_r14_r13"},
481 {{vc, r3, r2}, "vc, r3, r2", "vc_r3_r2"},
482 {{al, r6, r13}, "al, r6, r13", "al_r6_r13"},
483 {{vs, r10, r10}, "vs, r10, r10", "vs_r10_r10"},
484 {{cs, r6, r10}, "cs, r6, r10", "cs_r6_r10"},
485 {{cc, r8, r12}, "cc, r8, r12", "cc_r8_r12"},
486 {{vs, r7, r5}, "vs, r7, r5", "vs_r7_r5"},
487 {{pl, r14, r10}, "pl, r14, r10", "pl_r14_r10"},
488 {{hi, r1, r14}, "hi, r1, r14", "hi_r1_r14"},
489 {{vc, r8, r12}, "vc, r8, r12", "vc_r8_r12"},
490 {{ls, r2, r4}, "ls, r2, r4", "ls_r2_r4"},
491 {{mi, r5, r12}, "mi, r5, r12", "mi_r5_r12"},
492 {{eq, r6, r12}, "eq, r6, r12", "eq_r6_r12"},
493 {{lt, r14, r9}, "lt, r14, r9", "lt_r14_r9"},
494 {{lt, r11, r9}, "lt, r11, r9", "lt_r11_r9"},
495 {{ne, r1, r9}, "ne, r1, r9", "ne_r1_r9"},
496 {{pl, r11, r8}, "pl, r11, r8", "pl_r11_r8"},
497 {{ne, r0, r6}, "ne, r0, r6", "ne_r0_r6"},
498 {{vs, r4, r4}, "vs, r4, r4", "vs_r4_r4"},
499 {{ls, r12, r9}, "ls, r12, r9", "ls_r12_r9"},
500 {{cs, r9, r7}, "cs, r9, r7", "cs_r9_r7"},
501 {{ne, r7, r2}, "ne, r7, r2", "ne_r7_r2"},
502 {{hi, r9, r10}, "hi, r9, r10", "hi_r9_r10"},
503 {{gt, r5, r2}, "gt, r5, r2", "gt_r5_r2"},
504 {{pl, r4, r6}, "pl, r4, r6", "pl_r4_r6"},
505 {{lt, r11, r8}, "lt, r11, r8", "lt_r11_r8"},
506 {{hi, r13, r4}, "hi, r13, r4", "hi_r13_r4"},
507 {{le, r1, r10}, "le, r1, r10", "le_r1_r10"},
508 {{le, r11, r3}, "le, r11, r3", "le_r11_r3"},
509 {{pl, r0, r11}, "pl, r0, r11", "pl_r0_r11"},
510 {{le, r7, r4}, "le, r7, r4", "le_r7_r4"},
511 {{le, r2, r11}, "le, r2, r11", "le_r2_r11"},
512 {{cc, r1, r10}, "cc, r1, r10", "cc_r1_r10"},
513 {{gt, r13, r14}, "gt, r13, r14", "gt_r13_r14"},
514 {{ls, r10, r6}, "ls, r10, r6", "ls_r10_r6"},
515 {{ls, r13, r4}, "ls, r13, r4", "ls_r13_r4"},
516 {{gt, r12, r13}, "gt, r12, r13", "gt_r12_r13"},
517 {{pl, r13, r7}, "pl, r13, r7", "pl_r13_r7"},
518 {{le, r14, r0}, "le, r14, r0", "le_r14_r0"},
519 {{gt, r1, r4}, "gt, r1, r4", "gt_r1_r4"},
520 {{mi, r3, r5}, "mi, r3, r5", "mi_r3_r5"},
521 {{vc, r4, r0}, "vc, r4, r0", "vc_r4_r0"},
522 {{gt, r4, r11}, "gt, r4, r11", "gt_r4_r11"},
523 {{vc, r5, r3}, "vc, r5, r3", "vc_r5_r3"},
524 {{pl, r4, r7}, "pl, r4, r7", "pl_r4_r7"},
525 {{al, r12, r6}, "al, r12, r6", "al_r12_r6"},
526 {{mi, r2, r3}, "mi, r2, r3", "mi_r2_r3"},
527 {{lt, r12, r4}, "lt, r12, r4", "lt_r12_r4"},
528 {{lt, r10, r4}, "lt, r10, r4", "lt_r10_r4"},
529 {{hi, r10, r8}, "hi, r10, r8", "hi_r10_r8"},
530 {{al, r0, r14}, "al, r0, r14", "al_r0_r14"},
531 {{cc, r3, r3}, "cc, r3, r3", "cc_r3_r3"},
532 {{pl, r10, r13}, "pl, r10, r13", "pl_r10_r13"},
533 {{lt, r7, r8}, "lt, r7, r8", "lt_r7_r8"},
534 {{le, r12, r7}, "le, r12, r7", "le_r12_r7"},
535 {{ge, r11, r8}, "ge, r11, r8", "ge_r11_r8"},
536 {{ls, r10, r8}, "ls, r10, r8", "ls_r10_r8"},
537 {{vs, r9, r1}, "vs, r9, r1", "vs_r9_r1"},
538 {{ne, r10, r10}, "ne, r10, r10", "ne_r10_r10"},
539 {{al, r6, r4}, "al, r6, r4", "al_r6_r4"},
540 {{ls, r10, r0}, "ls, r10, r0", "ls_r10_r0"},
541 {{eq, r7, r1}, "eq, r7, r1", "eq_r7_r1"},
542 {{al, r11, r6}, "al, r11, r6", "al_r11_r6"},
543 {{ge, r5, r10}, "ge, r5, r10", "ge_r5_r10"},
544 {{vs, r0, r8}, "vs, r0, r8", "vs_r0_r8"},
545 {{lt, r2, r1}, "lt, r2, r1", "lt_r2_r1"},
546 {{le, r13, r2}, "le, r13, r2", "le_r13_r2"},
547 {{al, r13, r6}, "al, r13, r6", "al_r13_r6"},
548 {{lt, r12, r10}, "lt, r12, r10", "lt_r12_r10"},
549 {{al, r13, r1}, "al, r13, r1", "al_r13_r1"},
550 {{ge, r8, r14}, "ge, r8, r14", "ge_r8_r14"},
551 {{mi, r11, r6}, "mi, r11, r6", "mi_r11_r6"},
552 {{pl, r12, r14}, "pl, r12, r14", "pl_r12_r14"},
553 {{ne, r14, r9}, "ne, r14, r9", "ne_r14_r9"},
554 {{cc, r3, r1}, "cc, r3, r1", "cc_r3_r1"},
555 {{ge, r0, r8}, "ge, r0, r8", "ge_r0_r8"},
556 {{vc, r7, r9}, "vc, r7, r9", "vc_r7_r9"},
557 {{gt, r11, r4}, "gt, r11, r4", "gt_r11_r4"},
558 {{mi, r4, r0}, "mi, r4, r0", "mi_r4_r0"},
559 {{ls, r3, r11}, "ls, r3, r11", "ls_r3_r11"},
560 {{le, r14, r5}, "le, r14, r5", "le_r14_r5"},
561 {{ls, r6, r7}, "ls, r6, r7", "ls_r6_r7"},
562 {{ne, r4, r6}, "ne, r4, r6", "ne_r4_r6"},
563 {{cc, r1, r14}, "cc, r1, r14", "cc_r1_r14"},
564 {{pl, r11, r7}, "pl, r11, r7", "pl_r11_r7"},
565 {{vc, r6, r5}, "vc, r6, r5", "vc_r6_r5"},
566 {{al, r1, r11}, "al, r1, r11", "al_r1_r11"},
567 {{ne, r2, r13}, "ne, r2, r13", "ne_r2_r13"},
568 {{vc, r14, r6}, "vc, r14, r6", "vc_r14_r6"},
569 {{gt, r3, r8}, "gt, r3, r8", "gt_r3_r8"},
570 {{pl, r1, r8}, "pl, r1, r8", "pl_r1_r8"},
571 {{vc, r2, r14}, "vc, r2, r14", "vc_r2_r14"},
572 {{pl, r12, r3}, "pl, r12, r3", "pl_r12_r3"},
573 {{ls, r0, r12}, "ls, r0, r12", "ls_r0_r12"},
574 {{le, r2, r1}, "le, r2, r1", "le_r2_r1"},
575 {{eq, r13, r5}, "eq, r13, r5", "eq_r13_r5"},
576 {{al, r11, r11}, "al, r11, r11", "al_r11_r11"},
577 {{ls, r9, r3}, "ls, r9, r3", "ls_r9_r3"},
578 {{ne, r7, r12}, "ne, r7, r12", "ne_r7_r12"},
579 {{al, r6, r2}, "al, r6, r2", "al_r6_r2"},
580 {{ne, r7, r4}, "ne, r7, r4", "ne_r7_r4"},
581 {{vc, r7, r5}, "vc, r7, r5", "vc_r7_r5"},
582 {{ne, r7, r1}, "ne, r7, r1", "ne_r7_r1"},
583 {{eq, r5, r3}, "eq, r5, r3", "eq_r5_r3"},
584 {{cs, r3, r5}, "cs, r3, r5", "cs_r3_r5"},
585 {{lt, r7, r4}, "lt, r7, r4", "lt_r7_r4"},
586 {{ls, r4, r5}, "ls, r4, r5", "ls_r4_r5"},
587 {{eq, r11, r2}, "eq, r11, r2", "eq_r11_r2"},
588 {{hi, r2, r6}, "hi, r2, r6", "hi_r2_r6"},
589 {{vc, r2, r3}, "vc, r2, r3", "vc_r2_r3"},
590 {{ls, r12, r12}, "ls, r12, r12", "ls_r12_r12"},
591 {{lt, r8, r2}, "lt, r8, r2", "lt_r8_r2"},
592 {{cc, r14, r8}, "cc, r14, r8", "cc_r14_r8"},
593 {{ge, r12, r8}, "ge, r12, r8", "ge_r12_r8"}};
594
595 typedef void (MacroAssembler::*Fn)(Condition cond, Register rd, Register rn);
596
597 // Use a customised disassembler to label test cases.
598 typedef std::map<uint32_t, int> TestCaseSymbolMap;
599
600 class TestDisassembler : public PrintDisassembler {
601 public:
TestDisassembler(std::ostream & os,const TestCaseSymbolMap & symbols,const char * mnemonic)602 TestDisassembler(std::ostream& os, // NOLINT(runtime/references)
603 const TestCaseSymbolMap& symbols,
604 const char* mnemonic)
605 : PrintDisassembler(os), symbols_(symbols), mnemonic_(mnemonic) {}
606
PrintCodeAddress(uint32_t pc)607 virtual void PrintCodeAddress(uint32_t pc) VIXL_OVERRIDE {
608 // Label test cases.
609 TestCaseSymbolMap::const_iterator symbol = symbols_.find(pc);
610 if (symbol != symbols_.end()) {
611 int n = symbol->second;
612 os().os() << "// " << mnemonic_ << "(" << kTests[n].operands_description
613 << ")" << std::endl;
614 }
615 // Print the code address as normal.
616 PrintDisassembler::PrintCodeAddress(pc);
617 }
618
619 private:
620 const TestCaseSymbolMap& symbols_;
621 const char* mnemonic_;
622 };
623
TestHelper(Fn instruction,const char * mnemonic)624 void TestHelper(Fn instruction, const char* mnemonic) {
625 MacroAssembler masm(BUF_SIZE);
626
627 masm.UseA32();
628
629 TestCaseSymbolMap symbols;
630
631 for (unsigned i = 0; i < ARRAY_SIZE(kTests); i++) {
632 if (Test::disassemble()) {
633 // TODO: This will fail if the MacroAssembler generates no code. We can
634 // fix this with multimap but then we must take care to print the labels
635 // in the correct order. (Insertion order is only preserved for C++11.)
636 symbols.insert(std::pair<uint32_t, int>(masm.GetCursorOffset(), i));
637 }
638
639 // Values to pass to the macro-assembler.
640 UseScratchRegisterScope scratch_registers(&masm);
641 Condition cond = kTests[i].operands.cond;
642 Register rd = kTests[i].operands.rd;
643 Register rn = kTests[i].operands.rn;
644 scratch_registers.Exclude(rd);
645 scratch_registers.Exclude(rn);
646
647 (masm.*instruction)(cond, rd, rn);
648
649 // For now, these test don't currently produce (or check) any trace; we just
650 // check that the MacroAssembler didn't crash.
651 // TODO: We could generate disassembly as a trace here, to check for sane
652 // output, though the trace would need to be manually checked.
653 }
654
655 masm.FinalizeCode();
656
657 if (Test::disassemble()) {
658 // Disassemble to stdout if given --disassemble on the command line.
659 TestDisassembler dis(std::cout, symbols, mnemonic);
660 if (masm.IsUsingT32()) {
661 dis.DisassembleT32Buffer(masm.GetBuffer()->GetStartAddress<uint16_t*>(),
662 masm.GetCursorOffset());
663 } else {
664 dis.DisassembleA32Buffer(masm.GetBuffer()->GetStartAddress<uint32_t*>(),
665 masm.GetCursorOffset());
666 }
667 }
668 }
669
670 // Instantiate tests for each instruction in the list.
671 #define TEST(mnemonic) \
672 void Test_##mnemonic() { TestHelper(&MacroAssembler::mnemonic, #mnemonic); } \
673 Test test_##mnemonic("AARCH32_MACRO_ASSEMBLER_COND_RD_RN_" #mnemonic, \
674 &Test_##mnemonic);
675 FOREACH_INSTRUCTION(TEST)
676 #undef TEST
677
678 } // namespace
679 #endif
680
681 } // namespace aarch32
682 } // namespace vixl
683