41 using namespace v8::internal;
43 #define TEST_(name) TEST(DISASM_##name)
45 #define EXP_SIZE (256)
46 #define INSTR_SIZE (1024)
47 #define SET_UP_CLASS(ASMCLASS) \
49 Isolate* isolate = Isolate::Current(); \
50 HandleScope scope(isolate); \
51 byte* buf = static_cast<byte*>(malloc(INSTR_SIZE)); \
52 uint32_t encoding = 0; \
53 ASMCLASS* assm = new ASMCLASS(isolate, buf, INSTR_SIZE); \
54 Decoder<DispatchingDecoderVisitor>* decoder = \
55 new Decoder<DispatchingDecoderVisitor>(); \
56 Disassembler* disasm = new Disassembler(); \
57 decoder->AppendVisitor(disasm)
59 #define SET_UP() SET_UP_CLASS(Assembler)
61 #define COMPARE(ASM, EXP) \
64 assm->GetCode(NULL); \
65 decoder->Decode(reinterpret_cast<Instruction*>(buf)); \
66 encoding = *reinterpret_cast<uint32_t*>(buf); \
67 if (strcmp(disasm->GetOutput(), EXP) != 0) { \
68 printf("%u : Encoding: %08" PRIx32 "\nExpected: %s\nFound: %s\n", \
69 __LINE__, encoding, EXP, disasm->GetOutput()); \
73 #define COMPARE_PREFIX(ASM, EXP) \
76 assm->GetCode(NULL); \
77 decoder->Decode(reinterpret_cast<Instruction*>(buf)); \
78 encoding = *reinterpret_cast<uint32_t*>(buf); \
79 if (strncmp(disasm->GetOutput(), EXP, strlen(EXP)) != 0) { \
80 printf("%u : Encoding: %08" PRIx32 "\nExpected: %s\nFound: %s\n", \
81 __LINE__, encoding, EXP, disasm->GetOutput()); \
91 static bool vm_initialized =
false;
94 static void InitializeVM() {
95 if (!vm_initialized) {
97 vm_initialized =
true;
107 COMPARE(dci(0xa9ba7bfd),
"stp fp, lr, [csp, #-96]!");
108 COMPARE(dci(0x910003fd),
"mov fp, csp");
109 COMPARE(dci(0x9100e3a0),
"add x0, fp, #0x38 (56)");
110 COMPARE(dci(0xb900001f),
"str wzr, [x0]");
111 COMPARE(dci(0x528000e1),
"movz w1, #0x7");
112 COMPARE(dci(0xb9001c01),
"str w1, [x0, #28]");
113 COMPARE(dci(0x390043a0),
"strb w0, [fp, #16]");
114 COMPARE(dci(0x790027a0),
"strh w0, [fp, #18]");
115 COMPARE(dci(0xb9400400),
"ldr w0, [x0, #4]");
116 COMPARE(dci(0x0b000021),
"add w1, w1, w0");
117 COMPARE(dci(0x531b6800),
"lsl w0, w0, #5");
118 COMPARE(dci(0x521e0400),
"eor w0, w0, #0xc");
119 COMPARE(dci(0x72af0f00),
"movk w0, #0x7878, lsl #16");
120 COMPARE(dci(0xd360fc00),
"lsr x0, x0, #32");
121 COMPARE(dci(0x13037c01),
"asr w1, w0, #3");
122 COMPARE(dci(0x4b000021),
"sub w1, w1, w0");
123 COMPARE(dci(0x2a0103e0),
"mov w0, w1");
124 COMPARE(dci(0x93407c00),
"sxtw x0, w0");
125 COMPARE(dci(0x2a000020),
"orr w0, w1, w0");
126 COMPARE(dci(0xa8c67bfd),
"ldp fp, lr, [csp], #96");
146 COMPARE(Mov(x0, csp),
"mov x0, csp");
147 COMPARE(Mov(w0, wcsp),
"mov w0, wcsp");
148 COMPARE(Mov(x0, xzr),
"mov x0, xzr");
149 COMPARE(Mov(w0, wzr),
"mov w0, wzr");
150 COMPARE(mov(x0, csp),
"mov x0, csp");
151 COMPARE(mov(w0, wcsp),
"mov w0, wcsp");
152 COMPARE(mov(x0, xzr),
"mov x0, xzr");
153 COMPARE(mov(w0, wzr),
"mov w0, wzr");
169 COMPARE(movz(w0, 0x1234),
"movz w0, #0x1234");
170 COMPARE(movz(x1, 0xabcd0000),
"movz x1, #0xabcd0000");
171 COMPARE(movz(x2, 0x555500000000),
"movz x2, #0x555500000000");
172 COMPARE(movz(x3, 0xaaaa000000000000),
"movz x3, #0xaaaa000000000000");
173 COMPARE(movz(x4, 0xabcd, 16),
"movz x4, #0xabcd0000");
174 COMPARE(movz(x5, 0x5555, 32),
"movz x5, #0x555500000000");
175 COMPARE(movz(x6, 0xaaaa, 48),
"movz x6, #0xaaaa000000000000");
177 COMPARE(movk(w7, 0x1234),
"movk w7, #0x1234");
178 COMPARE(movk(x8, 0xabcd0000),
"movk x8, #0xabcd, lsl #16");
179 COMPARE(movk(x9, 0x555500000000),
"movk x9, #0x5555, lsl #32");
180 COMPARE(movk(x10, 0xaaaa000000000000),
"movk x10, #0xaaaa, lsl #48");
181 COMPARE(movk(w11, 0xabcd, 16),
"movk w11, #0xabcd, lsl #16");
182 COMPARE(movk(x12, 0x5555, 32),
"movk x12, #0x5555, lsl #32");
183 COMPARE(movk(x13, 0xaaaa, 48),
"movk x13, #0xaaaa, lsl #48");
185 COMPARE(movn(w14, 0x1234),
"movn w14, #0x1234");
186 COMPARE(movn(x15, 0xabcd0000),
"movn x15, #0xabcd0000");
187 COMPARE(movn(x16, 0x555500000000),
"movn x16, #0x555500000000");
188 COMPARE(movn(x17, 0xaaaa000000000000),
"movn x17, #0xaaaa000000000000");
189 COMPARE(movn(w18, 0xabcd, 16),
"movn w18, #0xabcd0000");
190 COMPARE(movn(x19, 0x5555, 32),
"movn x19, #0x555500000000");
191 COMPARE(movn(x20, 0xaaaa, 48),
"movn x20, #0xaaaa000000000000");
193 COMPARE(movk(w21, 0),
"movk w21, #0x0");
194 COMPARE(movk(x22, 0, 0),
"movk x22, #0x0");
195 COMPARE(movk(w23, 0, 16),
"movk w23, #0x0, lsl #16");
196 COMPARE(movk(x24, 0, 32),
"movk x24, #0x0, lsl #32");
197 COMPARE(movk(x25, 0, 48),
"movk x25, #0x0, lsl #48");
208 COMPARE(Mov(w0, 0),
"movz w0, #0x0");
209 COMPARE(Mov(w0, 0x0000ffff),
"movz w0, #0xffff");
210 COMPARE(Mov(w0, 0x00010000),
"movz w0, #0x10000");
211 COMPARE(Mov(w0, 0xffff0000),
"movz w0, #0xffff0000");
212 COMPARE(Mov(w0, 0x0001ffff),
"movn w0, #0xfffe0000");
213 COMPARE(Mov(w0, 0xffff8000),
"movn w0, #0x7fff");
214 COMPARE(Mov(w0, 0xfffffffe),
"movn w0, #0x1");
215 COMPARE(Mov(w0, 0xffffffff),
"movn w0, #0x0");
216 COMPARE(Mov(w0, 0x00ffff00),
"mov w0, #0xffff00");
217 COMPARE(Mov(w0, 0xfffe7fff),
"mov w0, #0xfffe7fff");
218 COMPARE(Mov(w0, 0xfffeffff),
"movn w0, #0x10000");
219 COMPARE(Mov(w0, 0xffff7fff),
"movn w0, #0x8000");
221 COMPARE(Mov(x0, 0),
"movz x0, #0x0");
222 COMPARE(Mov(x0, 0x0000ffff),
"movz x0, #0xffff");
223 COMPARE(Mov(x0, 0x00010000),
"movz x0, #0x10000");
224 COMPARE(Mov(x0, 0xffff0000),
"movz x0, #0xffff0000");
225 COMPARE(Mov(x0, 0x0001ffff),
"mov x0, #0x1ffff");
226 COMPARE(Mov(x0, 0xffff8000),
"mov x0, #0xffff8000");
227 COMPARE(Mov(x0, 0xfffffffe),
"mov x0, #0xfffffffe");
228 COMPARE(Mov(x0, 0xffffffff),
"mov x0, #0xffffffff");
229 COMPARE(Mov(x0, 0x00ffff00),
"mov x0, #0xffff00");
230 COMPARE(Mov(x0, 0xffff000000000000),
"movz x0, #0xffff000000000000");
231 COMPARE(Mov(x0, 0x0000ffff00000000),
"movz x0, #0xffff00000000");
232 COMPARE(Mov(x0, 0x00000000ffff0000),
"movz x0, #0xffff0000");
233 COMPARE(Mov(x0, 0xffffffffffff0000),
"movn x0, #0xffff");
234 COMPARE(Mov(x0, 0xffffffff0000ffff),
"movn x0, #0xffff0000");
235 COMPARE(Mov(x0, 0xffff0000ffffffff),
"movn x0, #0xffff00000000");
236 COMPARE(Mov(x0, 0x0000ffffffffffff),
"movn x0, #0xffff000000000000");
237 COMPARE(Mov(x0, 0xfffe7fffffffffff),
"mov x0, #0xfffe7fffffffffff");
238 COMPARE(Mov(x0, 0xfffeffffffffffff),
"movn x0, #0x1000000000000");
239 COMPARE(Mov(x0, 0xffff7fffffffffff),
"movn x0, #0x800000000000");
240 COMPARE(Mov(x0, 0xfffffffe7fffffff),
"mov x0, #0xfffffffe7fffffff");
241 COMPARE(Mov(x0, 0xfffffffeffffffff),
"movn x0, #0x100000000");
242 COMPARE(Mov(x0, 0xffffffff7fffffff),
"movn x0, #0x80000000");
243 COMPARE(Mov(x0, 0xfffffffffffe7fff),
"mov x0, #0xfffffffffffe7fff");
244 COMPARE(Mov(x0, 0xfffffffffffeffff),
"movn x0, #0x10000");
245 COMPARE(Mov(x0, 0xffffffffffff7fff),
"movn x0, #0x8000");
246 COMPARE(Mov(x0, 0xffffffffffffffff),
"movn x0, #0x0");
248 COMPARE(Movk(w0, 0x1234, 0),
"movk w0, #0x1234");
249 COMPARE(Movk(x1, 0x2345, 0),
"movk x1, #0x2345");
250 COMPARE(Movk(w2, 0x3456, 16),
"movk w2, #0x3456, lsl #16");
251 COMPARE(Movk(x3, 0x4567, 16),
"movk x3, #0x4567, lsl #16");
252 COMPARE(Movk(x4, 0x5678, 32),
"movk x4, #0x5678, lsl #32");
253 COMPARE(Movk(x5, 0x6789, 48),
"movk x5, #0x6789, lsl #48");
263 COMPARE(add(x2, x3,
Operand(0x3ff)),
"add x2, x3, #0x3ff (1023)");
264 COMPARE(add(w4, w5,
Operand(0xfff)),
"add w4, w5, #0xfff (4095)");
265 COMPARE(add(x6, x7,
Operand(0x1000)),
"add x6, x7, #0x1000 (4096)");
266 COMPARE(add(w8, w9,
Operand(0xff000)),
"add w8, w9, #0xff000 (1044480)");
268 "add x10, x11, #0x3ff000 (4190208)");
270 "add w12, w13, #0xfff000 (16773120)");
271 COMPARE(adds(w14, w15,
Operand(0xff)),
"adds w14, w15, #0xff (255)");
273 "adds x16, x17, #0xaa000 (696320)");
275 COMPARE(cmn(x19,
Operand(0xff000)),
"cmn x19, #0xff000 (1044480)");
281 COMPARE(add(wcsp, wcsp,
Operand(42)),
"add wcsp, wcsp, #0x2a (42)");
293 COMPARE(sub(x2, x3,
Operand(0x3ff)),
"sub x2, x3, #0x3ff (1023)");
294 COMPARE(sub(w4, w5,
Operand(0xfff)),
"sub w4, w5, #0xfff (4095)");
295 COMPARE(sub(x6, x7,
Operand(0x1000)),
"sub x6, x7, #0x1000 (4096)");
296 COMPARE(sub(w8, w9,
Operand(0xff000)),
"sub w8, w9, #0xff000 (1044480)");
298 "sub x10, x11, #0x3ff000 (4190208)");
300 "sub w12, w13, #0xfff000 (16773120)");
301 COMPARE(subs(w14, w15,
Operand(0xff)),
"subs w14, w15, #0xff (255)");
303 "subs x16, x17, #0xaa000 (696320)");
305 COMPARE(cmp(x19,
Operand(0xff000)),
"cmp x19, #0xff000 (1044480)");
309 COMPARE(add(wcsp, wcsp,
Operand(42)),
"add wcsp, wcsp, #0x2a (42)");
448 COMPARE(mul(w0, w1, w2),
"mul w0, w1, w2");
449 COMPARE(mul(x3, x4, x5),
"mul x3, x4, x5");
450 COMPARE(mul(w30, w0, w1),
"mul w30, w0, w1");
451 COMPARE(mul(
lr, x0, x1),
"mul lr, x0, x1");
452 COMPARE(mneg(w0, w1, w2),
"mneg w0, w1, w2");
453 COMPARE(mneg(x3, x4, x5),
"mneg x3, x4, x5");
454 COMPARE(mneg(w30, w0, w1),
"mneg w30, w0, w1");
455 COMPARE(mneg(
lr, x0, x1),
"mneg lr, x0, x1");
456 COMPARE(smull(x0, w0, w1),
"smull x0, w0, w1");
457 COMPARE(smull(
lr, w30, w0),
"smull lr, w30, w0");
458 COMPARE(smulh(x0, x1, x2),
"smulh x0, x1, x2");
460 COMPARE(madd(w0, w1, w2, w3),
"madd w0, w1, w2, w3");
461 COMPARE(madd(x4, x5, x6, x7),
"madd x4, x5, x6, x7");
462 COMPARE(madd(w8, w9, w10, wzr),
"mul w8, w9, w10");
463 COMPARE(madd(x11, x12, x13, xzr),
"mul x11, x12, x13");
464 COMPARE(msub(w14, w15, w16, w17),
"msub w14, w15, w16, w17");
465 COMPARE(msub(x18, x19, x20, x21),
"msub x18, x19, x20, x21");
466 COMPARE(msub(w22, w23, w24, wzr),
"mneg w22, w23, w24");
467 COMPARE(msub(x25, x26, x0, xzr),
"mneg x25, x26, x0");
469 COMPARE(sdiv(w0, w1, w2),
"sdiv w0, w1, w2");
470 COMPARE(sdiv(x3, x4, x5),
"sdiv x3, x4, x5");
471 COMPARE(udiv(w6, w7, w8),
"udiv w6, w7, w8");
472 COMPARE(udiv(x9, x10, x11),
"udiv x9, x10, x11");
481 COMPARE(smaddl(x0, w1, w2, x3),
"smaddl x0, w1, w2, x3");
482 COMPARE(smaddl(x25, w21, w22, x16),
"smaddl x25, w21, w22, x16");
483 COMPARE(umaddl(x0, w1, w2, x3),
"umaddl x0, w1, w2, x3");
484 COMPARE(umaddl(x25, w21, w22, x16),
"umaddl x25, w21, w22, x16");
486 COMPARE(smsubl(x0, w1, w2, x3),
"smsubl x0, w1, w2, x3");
487 COMPARE(smsubl(x25, w21, w22, x16),
"smsubl x25, w21, w22, x16");
488 COMPARE(umsubl(x0, w1, w2, x3),
"umsubl x0, w1, w2, x3");
489 COMPARE(umsubl(x25, w21, w22, x16),
"umsubl x25, w21, w22, x16");
498 COMPARE(rbit(w0, w1),
"rbit w0, w1");
499 COMPARE(rbit(x2, x3),
"rbit x2, x3");
500 COMPARE(rev16(w4, w5),
"rev16 w4, w5");
501 COMPARE(rev16(x6, x7),
"rev16 x6, x7");
502 COMPARE(rev32(x8, x9),
"rev32 x8, x9");
503 COMPARE(rev(w10, w11),
"rev w10, w11");
504 COMPARE(rev(x12, x13),
"rev x12, x13");
505 COMPARE(clz(w14, w15),
"clz w14, w15");
506 COMPARE(clz(x16, x17),
"clz x16, x17");
507 COMPARE(cls(w18, w19),
"cls w18, w19");
508 COMPARE(cls(x20, x21),
"cls x20, x21");
517 COMPARE(sxtb(w0, w1),
"sxtb w0, w1");
518 COMPARE(sxtb(x2, x3),
"sxtb x2, w3");
519 COMPARE(sxth(w4, w5),
"sxth w4, w5");
520 COMPARE(sxth(x6, x7),
"sxth x6, w7");
521 COMPARE(sxtw(x8, x9),
"sxtw x8, w9");
522 COMPARE(sxtb(x0, w1),
"sxtb x0, w1");
523 COMPARE(sxth(x2, w3),
"sxth x2, w3");
524 COMPARE(sxtw(x4, w5),
"sxtw x4, w5");
526 COMPARE(uxtb(w10, w11),
"uxtb w10, w11");
527 COMPARE(uxtb(x12, x13),
"uxtb x12, w13");
528 COMPARE(uxth(w14, w15),
"uxth w14, w15");
529 COMPARE(uxth(x16, x17),
"uxth x16, w17");
530 COMPARE(uxtw(x18, x19),
"ubfx x18, x19, #0, #32");
532 COMPARE(asr(w20, w21, 10),
"asr w20, w21, #10");
533 COMPARE(asr(x22, x23, 20),
"asr x22, x23, #20");
534 COMPARE(lsr(w24, w25, 10),
"lsr w24, w25, #10");
535 COMPARE(lsr(x26,
cp, 20),
"lsr x26, cp, #20");
536 COMPARE(lsl(w28, w29, 10),
"lsl w28, w29, #10");
537 COMPARE(lsl(
lr, x0, 20),
"lsl lr, x0, #20");
539 COMPARE(sbfiz(w1, w2, 1, 20),
"sbfiz w1, w2, #1, #20");
540 COMPARE(sbfiz(x3, x4, 2, 19),
"sbfiz x3, x4, #2, #19");
541 COMPARE(sbfx(w5, w6, 3, 18),
"sbfx w5, w6, #3, #18");
542 COMPARE(sbfx(x7, x8, 4, 17),
"sbfx x7, x8, #4, #17");
543 COMPARE(bfi(w9, w10, 5, 16),
"bfi w9, w10, #5, #16");
544 COMPARE(bfi(x11, x12, 6, 15),
"bfi x11, x12, #6, #15");
545 COMPARE(bfxil(w13, w14, 7, 14),
"bfxil w13, w14, #7, #14");
546 COMPARE(bfxil(x15, x16, 8, 13),
"bfxil x15, x16, #8, #13");
547 COMPARE(ubfiz(w17, w18, 9, 12),
"ubfiz w17, w18, #9, #12");
548 COMPARE(ubfiz(x19, x20, 10, 11),
"ubfiz x19, x20, #10, #11");
549 COMPARE(ubfx(w21, w22, 11, 10),
"ubfx w21, w22, #11, #10");
550 COMPARE(ubfx(x23, x24, 12, 9),
"ubfx x23, x24, #12, #9");
559 COMPARE(extr(w0, w1, w2, 0),
"extr w0, w1, w2, #0");
560 COMPARE(extr(x3, x4, x5, 1),
"extr x3, x4, x5, #1");
561 COMPARE(extr(w6, w7, w8, 31),
"extr w6, w7, w8, #31");
562 COMPARE(extr(x9, x10, x11, 63),
"extr x9, x10, x11, #63");
563 COMPARE(extr(w12, w13, w13, 10),
"ror w12, w13, #10");
564 COMPARE(extr(x14, x15, x15, 42),
"ror x14, x15, #42");
572 #define RESULT_SIZE (256)
578 uint64_t value = 0x7fffffff;
579 for (
int i = 0; i < 64; i++) {
580 snprintf(result,
RESULT_SIZE,
"and x0, x0, #0x%" PRIx64, value);
582 value = ((value & 1) << 63) | (value >> 1);
586 value = 0x00003fff00003fff
L;
587 for (
int i = 0; i < 32; i++) {
588 snprintf(result,
RESULT_SIZE,
"and x0, x0, #0x%" PRIx64, value);
590 value = ((value & 1) << 63) | (value >> 1);
594 value = 0x001f001f001f001f
L;
595 for (
int i = 0; i < 16; i++) {
596 snprintf(result,
RESULT_SIZE,
"and x0, x0, #0x%" PRIx64, value);
598 value = ((value & 1) << 63) | (value >> 1);
602 value = 0x0e0e0e0e0e0e0e0e
L;
603 for (
int i = 0; i < 8; i++) {
604 snprintf(result,
RESULT_SIZE,
"and x0, x0, #0x%" PRIx64, value);
606 value = ((value & 1) << 63) | (value >> 1);
610 value = 0x6666666666666666
L;
611 for (
int i = 0; i < 4; i++) {
612 snprintf(result,
RESULT_SIZE,
"and x0, x0, #0x%" PRIx64, value);
614 value = ((value & 1) << 63) | (value >> 1);
619 "and x0, x0, #0x5555555555555555");
621 "and x0, x0, #0xaaaaaaaaaaaaaaaa");
625 "and w0, w0, #0xff8007ff");
627 "and w0, w0, #0xf87ff87f");
629 "and w0, w0, #0x87878787");
631 "and w0, w0, #0x66666666");
633 "and w0, w0, #0x55555555");
637 "tst w1, #0x11111111");
639 "tst x2, #0x8888888888888888");
641 "orr w7, w8, #0xaaaaaaaa");
643 "orr x9, x10, #0x5555555555555555");
645 "eor w15, w16, #0x1");
647 "eor x17, x18, #0x3");
648 COMPARE(ands(w23, w24,
Operand(0x0000000f)),
"ands w23, w24, #0xf");
650 "ands x25, x26, #0x800000000000000f");
654 "and w3, w4, #0xdfdfdfdf");
656 "and x5, x6, #0xbfbfbfbfbfbfbfbf");
658 "orr w11, w12, #0xbfffbfff");
660 "orr x13, x14, #0x7e7e7e7e7e7e7e7e");
662 "eor w19, w20, #0x7ffffffe");
664 "eor x21, x22, #0x3ffffffffffffffc");
665 COMPARE(bics(w27, w28,
Operand(0xfffffff7)),
"ands w27, w28, #0x8");
667 "ands fp, x0, #0x100000000");
676 COMPARE(orr(w0, wzr,
Operand(0x00000780)),
"orr w0, wzr, #0x780");
677 COMPARE(orr(w1, wzr,
Operand(0x00007800)),
"orr w1, wzr, #0x7800");
679 COMPARE(orr(w3, wzr,
Operand(0x00780000)),
"orr w3, wzr, #0x780000");
680 COMPARE(orr(w4, wzr,
Operand(0x07800000)),
"orr w4, wzr, #0x7800000");
682 "orr x5, xzr, #0xffffffffffffc001");
684 "mov x6, #0xfffffffffffc001f");
686 "mov x7, #0xffffffffffc001ff");
688 "mov x8, #0xfffffffffc001fff");
690 "orr x9, xzr, #0xffffffffc001ffff");
769 COMPARE(lslv(w0, w1, w2),
"lsl w0, w1, w2");
770 COMPARE(lslv(x3, x4, x5),
"lsl x3, x4, x5");
771 COMPARE(lsrv(w6, w7, w8),
"lsr w6, w7, w8");
772 COMPARE(lsrv(x9, x10, x11),
"lsr x9, x10, x11");
773 COMPARE(asrv(w12, w13, w14),
"asr w12, w13, w14");
774 COMPARE(asrv(x15, x16, x17),
"asr x15, x16, x17");
775 COMPARE(rorv(w18, w19, w20),
"ror w18, w19, w20");
776 COMPARE(rorv(x21, x22, x23),
"ror x21, x22, x23");
801 #define INST_OFF(x) ((x) >> kInstructionSizeLog2)
901 "ldr w15, [x16, w17, sxtw #2]");
904 "ldr w21, [x22, x23, sxtx #2]");
911 "ldr x15, [x16, w17, sxtw #3]");
914 "ldr x21, [x22, x23, sxtx #3]");
922 "str w15, [x16, w17, sxtw #2]");
925 "str w21, [x22, x23, sxtx #2]");
932 "str x15, [x16, w17, sxtw #3]");
935 "str x21, [x22, x23, sxtx #3]");
950 "ldrh w9, [x10, x11, lsl #1]");
953 "ldrh w15, [x16, w17, sxtw #1]");
956 "ldrh w21, [x22, x23, sxtx #1]");
961 "strh w9, [x10, x11, lsl #1]");
964 "strh w15, [x16, w17, sxtw #1]");
967 "strh w21, [x22, x23, sxtx #1]");
987 "ldrb w12, [x13], #-256");
993 "strb w22, [x23, #-256]!");
996 "strb w26, [cp], #-256");
1019 "ldrh w12, [x13], #-256");
1025 "strh w22, [x23, #-256]!");
1028 "strh w26, [cp], #-256");
1142 "ldp w24, w25, [x26, #252]!");
1144 "ldp cp, jssp, [fp, #504]!");
1146 "ldp w30, w0, [x1, #-256]!");
1148 "ldp x2, x3, [x4, #-512]!");
1150 "ldp w5, w6, [x7], #252");
1152 "ldp x8, x9, [x10], #504");
1154 "ldp w11, w12, [x13], #-256");
1156 "ldp x14, x15, [x16], #-512");
1162 "ldp s26, s27, [jssp, #252]!");
1164 "ldp s29, s30, [fp, #-256]!");
1166 "ldp s31, s0, [x1], #252");
1168 "ldp s2, s3, [x4], #-256");
1173 "ldp d26, d27, [jssp, #504]!");
1175 "ldp d29, d30, [fp, #-512]!");
1177 "ldp d31, d0, [x1], #504");
1179 "ldp d2, d3, [x4], #-512");
1190 "stp w24, w25, [x26, #252]!");
1192 "stp cp, jssp, [fp, #504]!");
1194 "stp w30, w0, [x1, #-256]!");
1196 "stp x2, x3, [x4, #-512]!");
1198 "stp w5, w6, [x7], #252");
1200 "stp x8, x9, [x10], #504");
1202 "stp w11, w12, [x13], #-256");
1204 "stp x14, x15, [x16], #-512");
1210 "stp s26, s27, [jssp, #252]!");
1212 "stp s29, s30, [fp, #-256]!");
1214 "stp s31, s0, [x1], #252");
1216 "stp s2, s3, [x4], #-256");
1221 "stp d26, d27, [jssp, #504]!");
1223 "stp d29, d30, [fp, #-512]!");
1225 "stp d31, d0, [x1], #504");
1227 "stp d2, d3, [x4], #-512");
1231 "ldp w16, w17, [jssp], #4");
1233 "stp x18, x19, [jssp, #-8]!");
1235 "ldp s30, s31, [jssp], #12");
1237 "stp d30, d31, [jssp, #-16]");
1242 "ldpsw x6, x7, [x8, #-32]!");
1244 "ldpsw x9, x10, [x11], #128");
1269 #if 0 // TODO(all): enable.
1270 TEST_(load_literal) {
1285 COMPARE(csel(w0, w1, w2,
eq),
"csel w0, w1, w2, eq");
1286 COMPARE(csel(x3, x4, x5,
ne),
"csel x3, x4, x5, ne");
1287 COMPARE(csinc(w6, w7, w8,
hs),
"csinc w6, w7, w8, hs");
1288 COMPARE(csinc(x9, x10, x11,
lo),
"csinc x9, x10, x11, lo");
1289 COMPARE(csinv(w12, w13, w14,
mi),
"csinv w12, w13, w14, mi");
1290 COMPARE(csinv(x15, x16, x17,
pl),
"csinv x15, x16, x17, pl");
1291 COMPARE(csneg(w18, w19, w20,
vs),
"csneg w18, w19, w20, vs");
1292 COMPARE(csneg(x21, x22, x23,
vc),
"csneg x21, x22, x23, vc");
1295 COMPARE(csetm(w26,
ge),
"csetm w26, ge");
1297 COMPARE(cinc(w28, w29,
gt),
"cinc w28, w29, gt");
1299 COMPARE(cinv(w1, w2,
eq),
"cinv w1, w2, eq");
1300 COMPARE(cinv(x3, x4,
ne),
"cinv x3, x4, ne");
1301 COMPARE(cneg(w5, w6,
hs),
"cneg w5, w6, hs");
1302 COMPARE(cneg(x7, x8,
lo),
"cneg x7, x8, lo");
1304 COMPARE(csel(x0, x1, x2,
al),
"csel x0, x1, x2, al");
1305 COMPARE(csel(x1, x2, x3,
nv),
"csel x1, x2, x3, nv");
1306 COMPARE(csinc(x2, x3, x4,
al),
"csinc x2, x3, x4, al");
1307 COMPARE(csinc(x3, x4, x5,
nv),
"csinc x3, x4, x5, nv");
1308 COMPARE(csinv(x4, x5, x6,
al),
"csinv x4, x5, x6, al");
1309 COMPARE(csinv(x5, x6, x7,
nv),
"csinv x5, x6, x7, nv");
1310 COMPARE(csneg(x6, x7, x8,
al),
"csneg x6, x7, x8, al");
1311 COMPARE(csneg(x7, x8, x9,
nv),
"csneg x7, x8, x9, nv");
1320 COMPARE(Csel(w0, w1, -1,
eq),
"csinv w0, w1, wzr, eq");
1321 COMPARE(Csel(w2, w3, 0,
ne),
"csel w2, w3, wzr, ne");
1322 COMPARE(Csel(w4, w5, 1,
hs),
"csinc w4, w5, wzr, hs");
1323 COMPARE(Csel(x6, x7, -1,
lo),
"csinv x6, x7, xzr, lo");
1324 COMPARE(Csel(x8, x9, 0,
mi),
"csel x8, x9, xzr, mi");
1325 COMPARE(Csel(x10, x11, 1,
pl),
"csinc x10, x11, xzr, pl");
1364 COMPARE(fmov(
s0, 1.0f),
"fmov s0, #0x70 (1.0000)");
1365 COMPARE(fmov(
s31, -13.0f),
"fmov s31, #0xaa (-13.0000)");
1366 COMPARE(fmov(
d1, 1.0),
"fmov d1, #0x70 (1.0000)");
1367 COMPARE(fmov(
d29, -13.0),
"fmov d29, #0xaa (-13.0000)");
1511 COMPARE(fcvtas(w0,
s1),
"fcvtas w0, s1");
1512 COMPARE(fcvtas(x2,
s3),
"fcvtas x2, s3");
1513 COMPARE(fcvtas(w4,
d5),
"fcvtas w4, d5");
1514 COMPARE(fcvtas(x6,
d7),
"fcvtas x6, d7");
1515 COMPARE(fcvtau(w8,
s9),
"fcvtau w8, s9");
1516 COMPARE(fcvtau(x10,
s11),
"fcvtau x10, s11");
1517 COMPARE(fcvtau(w12,
d13),
"fcvtau w12, d13");
1518 COMPARE(fcvtau(x14,
d15),
"fcvtau x14, d15");
1519 COMPARE(fcvtns(w0,
s1),
"fcvtns w0, s1");
1520 COMPARE(fcvtns(x2,
s3),
"fcvtns x2, s3");
1521 COMPARE(fcvtns(w4,
d5),
"fcvtns w4, d5");
1522 COMPARE(fcvtns(x6,
d7),
"fcvtns x6, d7");
1523 COMPARE(fcvtnu(w8,
s9),
"fcvtnu w8, s9");
1524 COMPARE(fcvtnu(x10,
s11),
"fcvtnu x10, s11");
1525 COMPARE(fcvtnu(w12,
d13),
"fcvtnu w12, d13");
1526 COMPARE(fcvtnu(x14,
d15),
"fcvtnu x14, d15");
1527 COMPARE(fcvtzu(x16,
d17),
"fcvtzu x16, d17");
1528 COMPARE(fcvtzu(w18,
d19),
"fcvtzu w18, d19");
1529 COMPARE(fcvtzs(x20,
d21),
"fcvtzs x20, d21");
1530 COMPARE(fcvtzs(w22,
d23),
"fcvtzs w22, d23");
1531 COMPARE(fcvtzu(x16,
s17),
"fcvtzu x16, s17");
1532 COMPARE(fcvtzu(w18,
s19),
"fcvtzu w18, s19");
1533 COMPARE(fcvtzs(x20,
s21),
"fcvtzs x20, s21");
1534 COMPARE(fcvtzs(w22,
s23),
"fcvtzs w22, s23");
1543 COMPARE(ucvtf(
d0, x1, 0),
"ucvtf d0, x1");
1544 COMPARE(ucvtf(
s0, x1, 0),
"ucvtf s0, x1");
1545 COMPARE(scvtf(
d1, x2, 1),
"scvtf d1, x2, #1");
1546 COMPARE(scvtf(
s1, x2, 1),
"scvtf s1, x2, #1");
1547 COMPARE(scvtf(
d3, x4, 15),
"scvtf d3, x4, #15");
1548 COMPARE(scvtf(
s3, x4, 15),
"scvtf s3, x4, #15");
1549 COMPARE(scvtf(
d5, x6, 32),
"scvtf d5, x6, #32");
1550 COMPARE(scvtf(
s5, x6, 32),
"scvtf s5, x6, #32");
1551 COMPARE(ucvtf(
d7, x8, 2),
"ucvtf d7, x8, #2");
1552 COMPARE(ucvtf(
s7, x8, 2),
"ucvtf s7, x8, #2");
1553 COMPARE(ucvtf(
d9, x10, 16),
"ucvtf d9, x10, #16");
1554 COMPARE(ucvtf(
s9, x10, 16),
"ucvtf s9, x10, #16");
1555 COMPARE(ucvtf(
d11, x12, 33),
"ucvtf d11, x12, #33");
1556 COMPARE(ucvtf(
s11, x12, 33),
"ucvtf s11, x12, #33");
1557 COMPARE(fcvtms(w0,
s1),
"fcvtms w0, s1");
1558 COMPARE(fcvtms(x2,
s3),
"fcvtms x2, s3");
1559 COMPARE(fcvtms(w4,
d5),
"fcvtms w4, d5");
1560 COMPARE(fcvtms(x6,
d7),
"fcvtms x6, d7");
1561 COMPARE(fcvtmu(w8,
s9),
"fcvtmu w8, s9");
1562 COMPARE(fcvtmu(x10,
s11),
"fcvtmu x10, s11");
1563 COMPARE(fcvtmu(w12,
d13),
"fcvtmu w12, d13");
1564 COMPARE(fcvtmu(x14,
d15),
"fcvtmu x14, d15");
1625 COMPARE(hlt(65535),
"hlt #0xffff");
1636 COMPARE(brk(65535),
"brk #0xffff");
1645 COMPARE(Add(x10, x0, -42),
"sub x10, x0, #0x2a (42)");
1646 COMPARE(Add(x11, x1, -687),
"sub x11, x1, #0x2af (687)");
1647 COMPARE(Add(x12, x2, -0x88),
"sub x12, x2, #0x88 (136)");
1649 COMPARE(Sub(x13, x0, -600),
"add x13, x0, #0x258 (600)");
1650 COMPARE(Sub(x14, x1, -313),
"add x14, x1, #0x139 (313)");
1651 COMPARE(Sub(x15, x2, -0x555),
"add x15, x2, #0x555 (1365)");
1653 COMPARE(Add(w19, w3, -0x344),
"sub w19, w3, #0x344 (836)");
1654 COMPARE(Add(w20, w4, -2000),
"sub w20, w4, #0x7d0 (2000)");
1656 COMPARE(Sub(w21, w3, -0xbc),
"add w21, w3, #0xbc (188)");
1657 COMPARE(Sub(w22, w4, -2000),
"add w22, w4, #0x7d0 (2000)");
1659 COMPARE(Cmp(w0, -1),
"cmn w0, #0x1 (1)");
1660 COMPARE(Cmp(x1, -1),
"cmn x1, #0x1 (1)");
1661 COMPARE(Cmp(w2, -4095),
"cmn w2, #0xfff (4095)");
1662 COMPARE(Cmp(x3, -4095),
"cmn x3, #0xfff (4095)");
1664 COMPARE(Cmn(w0, -1),
"cmp w0, #0x1 (1)");
1665 COMPARE(Cmn(x1, -1),
"cmp x1, #0x1 (1)");
1666 COMPARE(Cmn(w2, -4095),
"cmp w2, #0xfff (4095)");
1667 COMPARE(Cmn(x3, -4095),
"cmp x3, #0xfff (4095)");
1676 COMPARE(And(w0, w1, 0),
"movz w0, #0x0");
1677 COMPARE(And(x0, x1, 0),
"movz x0, #0x0");
1678 COMPARE(Orr(w2, w3, 0),
"mov w2, w3");
1679 COMPARE(Orr(x2, x3, 0),
"mov x2, x3");
1680 COMPARE(Eor(w4, w5, 0),
"mov w4, w5");
1681 COMPARE(Eor(x4, x5, 0),
"mov x4, x5");
1682 COMPARE(Bic(w6, w7, 0),
"mov w6, w7");
1683 COMPARE(Bic(x6, x7, 0),
"mov x6, x7");
1684 COMPARE(Orn(w8, w9, 0),
"movn w8, #0x0");
1685 COMPARE(Orn(x8, x9, 0),
"movn x8, #0x0");
1686 COMPARE(Eon(w10, w11, 0),
"mvn w10, w11");
1687 COMPARE(Eon(x10, x11, 0),
"mvn x10, x11");
1689 COMPARE(And(w12, w13, 0xffffffff),
"mov w12, w13");
1690 COMPARE(And(x12, x13, 0xffffffff),
"and x12, x13, #0xffffffff");
1691 COMPARE(And(x12, x13, 0xffffffffffffffff),
"mov x12, x13");
1692 COMPARE(Orr(w14, w15, 0xffffffff),
"movn w14, #0x0");
1693 COMPARE(Orr(x14, x15, 0xffffffff),
"orr x14, x15, #0xffffffff");
1694 COMPARE(Orr(x14, x15, 0xffffffffffffffff),
"movn x14, #0x0");
1695 COMPARE(Eor(w16, w17, 0xffffffff),
"mvn w16, w17");
1696 COMPARE(Eor(x16, x17, 0xffffffff),
"eor x16, x17, #0xffffffff");
1697 COMPARE(Eor(x16, x17, 0xffffffffffffffff),
"mvn x16, x17");
1698 COMPARE(Bic(w18, w19, 0xffffffff),
"movz w18, #0x0");
1699 COMPARE(Bic(x18, x19, 0xffffffff),
"and x18, x19, #0xffffffff00000000");
1700 COMPARE(Bic(x18, x19, 0xffffffffffffffff),
"movz x18, #0x0");
1701 COMPARE(Orn(w20, w21, 0xffffffff),
"mov w20, w21");
1702 COMPARE(Orn(x20, x21, 0xffffffff),
"orr x20, x21, #0xffffffff00000000");
1703 COMPARE(Orn(x20, x21, 0xffffffffffffffff),
"mov x20, x21");
1704 COMPARE(Eon(w22, w23, 0xffffffff),
"mov w22, w23");
1705 COMPARE(Eon(x22, x23, 0xffffffff),
"eor x22, x23, #0xffffffff00000000");
1706 COMPARE(Eon(x22, x23, 0xffffffffffffffff),
"mov x22, x23");
const LowDwVfpRegister d11
const LowDwVfpRegister d0
const LowDwVfpRegister d15
#define ASSERT(condition)
const LowDwVfpRegister d3
#define COMPARE(ASM, EXP)
const LowDwVfpRegister d10
#define SET_UP_CLASS(ASMCLASS)
const LowDwVfpRegister d14
const LowDwVfpRegister d7
const LowDwVfpRegister d4
const LowDwVfpRegister d13
const LowDwVfpRegister d6
const LowDwVfpRegister d5
#define COMPARE_PREFIX(ASM, EXP)
const LowDwVfpRegister d9
const LowDwVfpRegister d2
static void InitializeVM()
const LowDwVfpRegister d12
const LowDwVfpRegister d1
const LowDwVfpRegister d8
const Instr kImmExceptionIsDebug