blob: 69b067819957271eacaf339896d7e758458470aa [file] [log] [blame]
Pierre Langlois88c46b82016-06-02 18:15:32 +01001// Copyright 2015, ARM Limited
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#include "../test-runner.h"
28#include "../test-utils-a64.h"
29#include "custom-disassembler.h"
30#include "examples.h"
31#include "non-const-visitor.h"
32
33#include "a64/macro-assembler-a64.h"
34#include "a64/debugger-a64.h"
35#include "a64/simulator-a64.h"
36#define TEST(name) TEST_(EXAMPLE_##name)
37
38using namespace vixl;
39using namespace vixl::aarch64;
40
41
42TEST(custom_disassembler) {
43 TestCustomDisassembler();
44}
45
46
47// The tests below only work with the simulator.
48#ifdef VIXL_INCLUDE_SIMULATOR
49
50#define BUF_SIZE (4096)
51#define __ masm->
52
53uint64_t FactorialC(uint64_t n) {
54 uint64_t result = 1;
55
56 while (n != 0) {
57 result *= n;
58 n--;
59 }
60
61 return result;
62}
63
64// Multiply two column-major 4x4 matrices of 32 bit floating point values.
65// Return a column-major 4x4 matrix of 32 bit floating point values in 'C'.
66void MatrixMultiplyC(float C[16], float A[16], float B[16]) {
67 C[ 0] = A[ 0]*B[ 0] + A[ 4]*B[ 1] + A[ 8]*B[ 2] + A[12]*B[ 3];
68 C[ 1] = A[ 1]*B[ 0] + A[ 5]*B[ 1] + A[ 9]*B[ 2] + A[13]*B[ 3];
69 C[ 2] = A[ 2]*B[ 0] + A[ 6]*B[ 1] + A[10]*B[ 2] + A[14]*B[ 3];
70 C[ 3] = A[ 3]*B[ 0] + A[ 7]*B[ 1] + A[11]*B[ 2] + A[15]*B[ 3];
71
72 C[ 4] = A[ 0]*B[ 4] + A[ 4]*B[ 5] + A[ 8]*B[ 6] + A[12]*B[ 7];
73 C[ 5] = A[ 1]*B[ 4] + A[ 5]*B[ 5] + A[ 9]*B[ 6] + A[13]*B[ 7];
74 C[ 6] = A[ 2]*B[ 4] + A[ 6]*B[ 5] + A[10]*B[ 6] + A[14]*B[ 7];
75 C[ 7] = A[ 3]*B[ 4] + A[ 7]*B[ 5] + A[11]*B[ 6] + A[15]*B[ 7];
76
77 C[ 8] = A[ 0]*B[ 8] + A[ 4]*B[ 9] + A[ 8]*B[10] + A[12]*B[11];
78 C[ 9] = A[ 1]*B[ 8] + A[ 5]*B[ 9] + A[ 9]*B[10] + A[13]*B[11];
79 C[10] = A[ 2]*B[ 8] + A[ 6]*B[ 9] + A[10]*B[10] + A[14]*B[11];
80 C[11] = A[ 3]*B[ 8] + A[ 7]*B[ 9] + A[11]*B[10] + A[15]*B[11];
81
82 C[12] = A[ 0]*B[12] + A[ 4]*B[13] + A[ 8]*B[14] + A[12]*B[15];
83 C[13] = A[ 1]*B[12] + A[ 5]*B[13] + A[ 9]*B[14] + A[13]*B[15];
84 C[14] = A[ 2]*B[12] + A[ 6]*B[13] + A[10]*B[14] + A[14]*B[15];
85 C[15] = A[ 3]*B[12] + A[ 7]*B[13] + A[11]*B[14] + A[15]*B[15];
86}
87
88double Add3DoubleC(double x, double y, double z) {
89 return x + y + z;
90}
91
92double Add4DoubleC(uint64_t a, double b, uint64_t c, double d) {
93 return static_cast<double>(a) + b + static_cast<double>(c) + d;
94}
95
96uint32_t SumArrayC(uint8_t* array, uint32_t size) {
97 uint32_t result = 0;
98
99 for (uint32_t i = 0; i < size; ++i) {
100 result += array[i];
101 }
102
103 return result;
104}
105
106
107void GenerateTestWrapper(MacroAssembler* masm, RegisterDump *regs) {
108 __ Push(xzr, lr);
109 __ Blr(x15);
110 regs->Dump(masm);
111 __ Pop(lr, xzr);
112 __ Ret();
113}
114
115
116#define TEST_FUNCTION(Func) \
117 do { \
118 int64_t saved_xregs[13]; \
119 saved_xregs[0] = simulator.ReadXRegister(19); \
120 saved_xregs[1] = simulator.ReadXRegister(20); \
121 saved_xregs[2] = simulator.ReadXRegister(21); \
122 saved_xregs[3] = simulator.ReadXRegister(22); \
123 saved_xregs[4] = simulator.ReadXRegister(23); \
124 saved_xregs[5] = simulator.ReadXRegister(24); \
125 saved_xregs[6] = simulator.ReadXRegister(25); \
126 saved_xregs[7] = simulator.ReadXRegister(26); \
127 saved_xregs[8] = simulator.ReadXRegister(27); \
128 saved_xregs[9] = simulator.ReadXRegister(28); \
129 saved_xregs[10] = simulator.ReadXRegister(29); \
130 saved_xregs[11] = simulator.ReadXRegister(30); \
131 saved_xregs[12] = simulator.ReadXRegister(31); \
132 \
133 uint64_t saved_dregs[8]; \
134 saved_dregs[0] = simulator.ReadDRegisterBits(8); \
135 saved_dregs[1] = simulator.ReadDRegisterBits(9); \
136 saved_dregs[2] = simulator.ReadDRegisterBits(10); \
137 saved_dregs[3] = simulator.ReadDRegisterBits(11); \
138 saved_dregs[4] = simulator.ReadDRegisterBits(12); \
139 saved_dregs[5] = simulator.ReadDRegisterBits(13); \
140 saved_dregs[6] = simulator.ReadDRegisterBits(14); \
141 saved_dregs[7] = simulator.ReadDRegisterBits(15); \
142 \
143 simulator.WriteXRegister(15, masm.GetLabelAddress<uint64_t>(&Func));\
144 simulator.RunFrom(masm.GetLabelAddress<Instruction*>(&test)); \
145 \
146 assert(saved_xregs[0] == simulator.ReadXRegister(19)); \
147 assert(saved_xregs[1] == simulator.ReadXRegister(20)); \
148 assert(saved_xregs[2] == simulator.ReadXRegister(21)); \
149 assert(saved_xregs[3] == simulator.ReadXRegister(22)); \
150 assert(saved_xregs[4] == simulator.ReadXRegister(23)); \
151 assert(saved_xregs[5] == simulator.ReadXRegister(24)); \
152 assert(saved_xregs[6] == simulator.ReadXRegister(25)); \
153 assert(saved_xregs[7] == simulator.ReadXRegister(26)); \
154 assert(saved_xregs[8] == simulator.ReadXRegister(27)); \
155 assert(saved_xregs[9] == simulator.ReadXRegister(28)); \
156 assert(saved_xregs[10] == simulator.ReadXRegister(29)); \
157 assert(saved_xregs[11] == simulator.ReadXRegister(30)); \
158 assert(saved_xregs[12] == simulator.ReadXRegister(31)); \
159 \
160 assert(saved_dregs[0] == simulator.ReadDRegisterBits(8)); \
161 assert(saved_dregs[1] == simulator.ReadDRegisterBits(9)); \
162 assert(saved_dregs[2] == simulator.ReadDRegisterBits(10)); \
163 assert(saved_dregs[3] == simulator.ReadDRegisterBits(11)); \
164 assert(saved_dregs[4] == simulator.ReadDRegisterBits(12)); \
165 assert(saved_dregs[5] == simulator.ReadDRegisterBits(13)); \
166 assert(saved_dregs[6] == simulator.ReadDRegisterBits(14)); \
167 assert(saved_dregs[7] == simulator.ReadDRegisterBits(15)); \
168 \
169 } while (0)
170
171#define START() \
172 MacroAssembler masm(BUF_SIZE); \
173 Decoder decoder; \
174 Debugger simulator(&decoder); \
175 simulator.SetColouredTrace(Test::coloured_trace()); \
176 PrintDisassembler* pdis = NULL; \
177 Instrument* inst = NULL; \
178 if (Test::trace_sim()) { \
179 pdis = new PrintDisassembler(stdout); \
180 decoder.PrependVisitor(pdis); \
181 } \
182 if (Test::instruction_stats()) { \
183 inst = new Instrument("vixl_stats.csv", 10); \
184 inst->Enable(); \
185 decoder.AppendVisitor(inst); \
186 } \
187 RegisterDump regs; \
188 \
189 Label test; \
190 masm.Bind(&test); \
191 GenerateTestWrapper(&masm, &regs); \
192 masm.FinalizeCode()
193
194
195
196#define FACTORIAL_DOTEST(N) \
197 do { \
198 simulator.ResetState(); \
199 simulator.WriteXRegister(0, N); \
200 TEST_FUNCTION(factorial); \
201 assert(static_cast<uint64_t>(regs.xreg(0)) == FactorialC(N)); \
202 } while (0)
203
204TEST(factorial) {
205 START();
206
207 Label factorial;
208 masm.Bind(&factorial);
209 GenerateFactorial(&masm);
210 masm.FinalizeCode();
211
212 FACTORIAL_DOTEST(0);
213 FACTORIAL_DOTEST(1);
214 FACTORIAL_DOTEST(5);
215 FACTORIAL_DOTEST(10);
216 FACTORIAL_DOTEST(20);
217 FACTORIAL_DOTEST(25);
218}
219
220
221#define FACTORIAL_REC_DOTEST(N) \
222 do { \
223 simulator.ResetState(); \
224 simulator.WriteXRegister(0, N); \
225 TEST_FUNCTION(factorial_rec); \
226 assert(static_cast<uint64_t>(regs.xreg(0)) == FactorialC(N)); \
227 } while (0)
228
229TEST(factorial_rec) {
230 START();
231
232 Label factorial_rec;
233 masm.Bind(&factorial_rec);
234 GenerateFactorialRec(&masm);
235 masm.FinalizeCode();
236
237 FACTORIAL_REC_DOTEST(0);
238 FACTORIAL_REC_DOTEST(1);
239 FACTORIAL_REC_DOTEST(5);
240 FACTORIAL_REC_DOTEST(10);
241 FACTORIAL_REC_DOTEST(20);
242 FACTORIAL_REC_DOTEST(25);
243}
244
245TEST(neon_matrix_multiply) {
246 START();
247
248 Label neon_matrix_multiply;
249 masm.Bind(&neon_matrix_multiply);
250 GenerateNEONMatrixMultiply(&masm);
251 masm.FinalizeCode();
252
253 {
254 const int kRowSize = 4;
255 const int kColSize = 4;
256 const int kLength = kRowSize * kColSize;
257
258 float mat1[kLength], mat2[kLength], expected[kLength], output[kLength];
259
260 // Fill the two input matrices with some 32 bit floating point values.
261
262 mat1[0] = 1.0f; mat1[4] = 2.0f; mat1[ 8] = 3.0f; mat1[12] = 4.0f;
263 mat1[1] = 52.03f; mat1[5] = 12.24f; mat1[ 9] = 53.56f; mat1[13] = 22.22f;
264 mat1[2] = 4.43f; mat1[6] = 5.00f; mat1[10] = 7.00f; mat1[14] = 3.11f;
265 mat1[3] = 43.47f; mat1[7] = 10.97f; mat1[11] = 37.78f; mat1[15] = 90.91f;
266
267 mat2[0] = 1.0f; mat2[4] = 11.24f; mat2[ 8] = 21.00f; mat2[12] = 21.31f;
268 mat2[1] = 2.0f; mat2[5] = 2.24f; mat2[ 9] = 8.56f; mat2[13] = 52.03f;
269 mat2[2] = 3.0f; mat2[6] = 51.00f; mat2[10] = 21.00f; mat2[14] = 33.11f;
270 mat2[3] = 4.0f; mat2[7] = 0.00f; mat2[11] = 84.00f; mat2[15] = 1.97f;
271
272 MatrixMultiplyC(expected, mat1, mat2);
273
274 simulator.ResetState();
275 simulator.WriteXRegister(0, reinterpret_cast<uintptr_t>(output));
276 simulator.WriteXRegister(1, reinterpret_cast<uintptr_t>(mat1));
277 simulator.WriteXRegister(2, reinterpret_cast<uintptr_t>(mat2));
278 TEST_FUNCTION(neon_matrix_multiply);
279
280 // Check that the results match what is expected.
281 for (int i = 0; i < kLength; i++) {
282 assert(output[i] == expected[i]);
283 }
284 }
285}
286
287TEST(add2_vectors) {
288 START();
289
290 // Create and initialize the assembler and the simulator.
291 Label add2_vectors;
292 masm.Bind(&add2_vectors);
293 GenerateAdd2Vectors(&masm);
294 masm.FinalizeCode();
295
296 // Initialize input data for the example function.
297 uint8_t A[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 200};
298 uint8_t B[] = {16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, \
299 30, 31, 50};
300 uint8_t D[ARRAY_SIZE(A)];
301 uintptr_t A_addr = reinterpret_cast<uintptr_t>(A);
302 uintptr_t B_addr = reinterpret_cast<uintptr_t>(B);
303
304 // Check whether number of elements in vectors match.
305 VIXL_STATIC_ASSERT(ARRAY_SIZE(A) == ARRAY_SIZE(B));
306 VIXL_STATIC_ASSERT(ARRAY_SIZE(A) == ARRAY_SIZE(D));
307
308 // Compute vector sum for comparison later.
309 for (unsigned i = 0; i < ARRAY_SIZE(A); i++) {
310 D[i] = A[i] + B[i];
311 }
312
313 // Set up simulator and run example function.
314 simulator.ResetState();
315 simulator.WriteXRegister(0, A_addr);
316 simulator.WriteXRegister(1, B_addr);
317 simulator.WriteXRegister(2, ARRAY_SIZE(A));
318 TEST_FUNCTION(add2_vectors);
319
320 // Compare vectors to ensure sums are equal.
321 for (unsigned i = 0; i < ARRAY_SIZE(A); i++) {
322 assert(A[i] == D[i]);
323 }
324}
325
326#define ADD3_DOUBLE_DOTEST(A, B, C) \
327 do { \
328 simulator.ResetState(); \
329 simulator.WriteDRegister(0, A); \
330 simulator.WriteDRegister(1, B); \
331 simulator.WriteDRegister(2, C); \
332 TEST_FUNCTION(add3_double); \
333 assert(regs.dreg(0) == Add3DoubleC(A, B, C)); \
334 } while (0)
335
336TEST(add3_double) {
337 START();
338
339 Label add3_double;
340 masm.Bind(&add3_double);
341 GenerateAdd3Double(&masm);
342 masm.FinalizeCode();
343
344 ADD3_DOUBLE_DOTEST(0.0, 0.0, 0.0);
345 ADD3_DOUBLE_DOTEST(457.698, 14.36, 2.00025);
346 ADD3_DOUBLE_DOTEST(-45.55, -98.9, -0.354);
347 ADD3_DOUBLE_DOTEST(.55, .9, .12);
348}
349
350
351#define ADD4_DOUBLE_DOTEST(A, B, C, D) \
352 do { \
353 simulator.ResetState(); \
354 simulator.WriteXRegister(0, A); \
355 simulator.WriteDRegister(0, B); \
356 simulator.WriteXRegister(1, C); \
357 simulator.WriteDRegister(1, D); \
358 TEST_FUNCTION(add4_double); \
359 assert(regs.dreg(0) == Add4DoubleC(A, B, C, D)); \
360 } while (0)
361
362TEST(add4_double) {
363 START();
364
365 Label add4_double;
366 masm.Bind(&add4_double);
367 GenerateAdd4Double(&masm);
368 masm.FinalizeCode();
369
370 ADD4_DOUBLE_DOTEST(0, 0, 0, 0);
371 ADD4_DOUBLE_DOTEST(4, 3.287, 6, 13.48);
372 ADD4_DOUBLE_DOTEST(56, 665.368, 0, -4932.4697);
373 ADD4_DOUBLE_DOTEST(56, 0, 546, 0);
374 ADD4_DOUBLE_DOTEST(0, 0.658, 0, 0.00000011540026);
375}
376
377
378#define SUM_ARRAY_DOTEST(Array) \
379 do { \
380 simulator.ResetState(); \
381 uintptr_t addr = reinterpret_cast<uintptr_t>(Array); \
382 simulator.WriteXRegister(0, addr); \
383 simulator.WriteXRegister(1, ARRAY_SIZE(Array)); \
384 TEST_FUNCTION(sum_array); \
385 assert(regs.xreg(0) == SumArrayC(Array, ARRAY_SIZE(Array))); \
386 } while (0)
387
388TEST(sum_array) {
389 START();
390
391 Label sum_array;
392 masm.Bind(&sum_array);
393 GenerateSumArray(&masm);
394 masm.FinalizeCode();
395
396 uint8_t data1[] = { 4, 9, 13, 3, 2, 6, 5 };
397 SUM_ARRAY_DOTEST(data1);
398
399 uint8_t data2[] = { 42 };
400 SUM_ARRAY_DOTEST(data2);
401
402 uint8_t data3[1000];
403 for (unsigned int i = 0; i < ARRAY_SIZE(data3); ++i)
404 data3[i] = 255;
405 SUM_ARRAY_DOTEST(data3);
406}
407
408
409#define ABS_DOTEST(X) \
410 do { \
411 simulator.ResetState(); \
412 simulator.WriteXRegister(0, X); \
413 TEST_FUNCTION(func_abs); \
414 assert(regs.xreg(0) == abs(X)); \
415 } while (0)
416
417TEST(abs) {
418 START();
419
420 Label func_abs;
421 masm.Bind(&func_abs);
422 GenerateAbs(&masm);
423 masm.FinalizeCode();
424
425 ABS_DOTEST(-42);
426 ABS_DOTEST(0);
427 ABS_DOTEST(545);
428 ABS_DOTEST(-428751489);
429}
430
431
432TEST(crc32) {
433 START();
434
435 Label crc32;
436 masm.Bind(&crc32);
437 GenerateCrc32(&masm);
438 masm.FinalizeCode();
439
440 const char *msg = "Hello World!";
441 uintptr_t msg_addr = reinterpret_cast<uintptr_t>(msg);
442 size_t msg_size = strlen(msg);
443 int64_t chksum = INT64_C(0xe3d6e35c);
444 simulator.WriteXRegister(0, msg_addr);
445 simulator.WriteXRegister(1, msg_size);
446 TEST_FUNCTION(crc32);
447 assert(regs.xreg(0) == chksum);
448}
449
450
451TEST(swap4) {
452 START();
453
454 Label swap4;
455 masm.Bind(&swap4);
456 GenerateSwap4(&masm);
457 masm.FinalizeCode();
458
459 int64_t a = 15;
460 int64_t b = 26;
461 int64_t c = 46;
462 int64_t d = 79;
463
464 simulator.WriteXRegister(0, a);
465 simulator.WriteXRegister(1, b);
466 simulator.WriteXRegister(2, c);
467 simulator.WriteXRegister(3, d);
468 TEST_FUNCTION(swap4);
469 assert(regs.xreg(0) == d);
470 assert(regs.xreg(1) == c);
471 assert(regs.xreg(2) == b);
472 assert(regs.xreg(3) == a);
473}
474
475
476TEST(swap_int32) {
477 START();
478
479 Label swap_int32;
480 masm.Bind(&swap_int32);
481 GenerateSwapInt32(&masm);
482 masm.FinalizeCode();
483
484 int32_t x = 168;
485 int32_t y = 246;
486 simulator.WriteWRegister(0, x);
487 simulator.WriteWRegister(1, y);
488 TEST_FUNCTION(swap_int32);
489 assert(regs.wreg(0) == y);
490 assert(regs.wreg(1) == x);
491}
492
493
494#define CHECKBOUNDS_DOTEST(Value, Low, High) \
495 do { \
496 simulator.ResetState(); \
497 simulator.WriteXRegister(0, Value); \
498 simulator.WriteXRegister(1, Low); \
499 simulator.WriteXRegister(2, High); \
500 TEST_FUNCTION(check_bounds); \
501 assert(regs.xreg(0) == ((Low <= Value) && (Value <= High))); \
502 } while (0)
503
504TEST(check_bounds) {
505 START();
506
507 Label check_bounds;
508 masm.Bind(&check_bounds);
509 GenerateCheckBounds(&masm);
510 masm.FinalizeCode();
511
512 CHECKBOUNDS_DOTEST(0, 100, 200);
513 CHECKBOUNDS_DOTEST(58, 100, 200);
514 CHECKBOUNDS_DOTEST(99, 100, 200);
515 CHECKBOUNDS_DOTEST(100, 100, 200);
516 CHECKBOUNDS_DOTEST(101, 100, 200);
517 CHECKBOUNDS_DOTEST(150, 100, 200);
518 CHECKBOUNDS_DOTEST(199, 100, 200);
519 CHECKBOUNDS_DOTEST(200, 100, 200);
520 CHECKBOUNDS_DOTEST(201, 100, 200);
521}
522
523
524#define GETTING_STARTED_DOTEST(Value) \
525 do { \
526 simulator.ResetState(); \
527 simulator.WriteXRegister(0, Value); \
528 TEST_FUNCTION(demo_function); \
529 assert(regs.xreg(0) == (Value & 0x1122334455667788)); \
530 } while (0)
531
532TEST(getting_started) {
533 START();
534
535 Label demo_function;
536 masm.Bind(&demo_function);
537 GenerateDemoFunction(&masm);
538 masm.FinalizeCode();
539
540 GETTING_STARTED_DOTEST(0x8899aabbccddeeff);
541 GETTING_STARTED_DOTEST(0x1122334455667788);
542 GETTING_STARTED_DOTEST(0x0000000000000000);
543 GETTING_STARTED_DOTEST(0xffffffffffffffff);
544 GETTING_STARTED_DOTEST(0x5a5a5a5a5a5a5a5a);
545}
546
547
548TEST(non_const_visitor) {
549 byte assm_buf[BUF_SIZE];
550 MacroAssembler masm(assm_buf, BUF_SIZE);
551
552 Label code_start, code_end;
553 masm.Bind(&code_start);
554 GenerateNonConstVisitorTestCode(&masm);
555 masm.Bind(&code_end);
556 masm.FinalizeCode();
557 Instruction* instr_start = masm.GetLabelAddress<Instruction*>(&code_start);
558 Instruction* instr_end = masm.GetLabelAddress<Instruction*>(&code_end);
559
560 int64_t res_orig = RunNonConstVisitorTestGeneratedCode(instr_start);
561
562 ModifyNonConstVisitorTestGeneratedCode(instr_start, instr_end);
563
564 int64_t res_mod = RunNonConstVisitorTestGeneratedCode(instr_start);
565 assert(res_orig == -res_mod);
566}
567
568
569TEST(literal_example) {
570 VIXL_ASSERT(LiteralExample(1, 2) == 3);
571 VIXL_ASSERT(
572 LiteralExample(INT64_C(0x100000000), 0x1) == INT64_C(0x100000001));
573}
574
575#endif // VIXL_INCLUDE_SIMULATOR