40 using namespace v8::internal;
50 if (strcmp(compare_string, disasm_buffer.
start()) != 0) {
56 compare_string, disasm_buffer.
start());
67 CcTest::InitializeVM(); \
68 Isolate* isolate = CcTest::i_isolate(); \
69 HandleScope scope(isolate); \
70 byte *buffer = reinterpret_cast<byte*>(malloc(4*1024)); \
71 Assembler assm(isolate, buffer, 4*1024); \
79 #define COMPARE(asm_, compare_string) \
81 int pc_offset = assm.pc_offset(); \
82 byte *progcounter = &buffer[pc_offset]; \
84 if (!DisassembleAndCompare(progcounter, compare_string)) failure = true; \
88 #define EMIT_PENDING_LITERALS() \
89 assm.CheckConstPool(true, false)
94 #define VERIFY_RUN() \
96 V8_Fatal(__FILE__, __LINE__, "ARM Disassembler tests failed.\n"); \
104 "e0010002 and r0, r1, r2");
106 "e0021003 and r1, r2, r3");
108 "e0132004 ands r2, r3, r4");
110 "00043005 andeq r3, r4, r5");
113 "e0254006 eor r4, r5, r6");
115 "e0354087 eors r4, r5, r7, lsl #1");
117 "10254108 eorne r4, r5, r8, lsl #2");
119 "20354189 eorcss r4, r5, r9, lsl #3");
122 "20465f8a subcs r5, r6, r10, lsl #31");
124 "30565f0a subccs r5, r6, r10, lsl #30");
126 "30465c0a subcc r5, r6, r10, lsl #24");
128 "4056580a submis r5, r6, r10, lsl #16");
131 "e067600b rsb r6, r7, fp");
133 "e06760ab rsb r6, r7, fp, lsr #1");
135 "e077602b rsbs r6, r7, fp, lsr #32");
137 "50676fab rsbpl r6, r7, fp, lsr #31");
140 "e08870cc add r7, r8, ip, asr #1");
142 "e088704c add r7, r8, ip, asr #32");
144 "e098700c adds r7, r8, ip");
146 "60987fcc addvss r7, r8, ip, asr #31");
149 "e0ab72cc adc r7, fp, ip, asr #5");
151 "70ac40cc adcvc r4, ip, ip, asr #1");
153 "e0bd500c adcs r5, sp, ip");
155 "70be8fcc adcvcs r8, lr, ip, asr #31");
158 "80c170ec sbchi r7, r1, ip, ror #1");
160 "e0c9726c sbc r7, r9, ip, ror #4");
162 "e0da700c sbcs r7, r10, ip");
164 "80dc7fec sbchis r7, ip, ip, ror #31");
167 "e0e8701c rsc r7, r8, ip, lsl r0");
169 "e0e8711c rsc r7, r8, ip, lsl r1");
171 "e0f8700c rscs r7, r8, ip");
173 "90f8731c rsclss r7, r8, ip, lsl r3");
176 "a1170c55 tstge r7, r5, asr ip");
178 "e1170d56 tst r7, r6, asr sp");
180 "a1170007 tstge r7, r7");
182 "a1170b58 tstge r7, r8, asr fp");
185 "b1370075 teqlt r7, r5, ror r0");
187 "e1370e76 teq r7, r6, ror lr");
189 "b1370007 teqlt r7, r7");
191 "e1370178 teq r7, r8, ror r1");
194 "e1570004 cmp r7, r4");
196 "c1570086 cmpgt r7, r6, lsl #1");
198 "c15701a8 cmpgt r7, r8, lsr #3");
200 "e15709c8 cmp r7, r8, asr #19");
203 "e1700004 cmn r0, r4");
205 "e17100e6 cmn r1, r6, ror #1");
207 "e1720008 cmn r2, r8");
209 "d173000b cmnle r3, fp");
212 "e188700e orr r7, r8, lr");
214 "e188700b orr r7, r8, fp");
216 "e198700d orrs r7, r8, sp");
218 "e198700c orrs r7, r8, ip");
221 "01a00001 moveq r0, r1");
223 "e1a00002 mov r0, r2");
225 "e1b00003 movs r0, r3");
227 "51b00004 movpls r0, r4");
230 "61ce0001 bicvs r0, lr, r1");
232 "71c90002 bicvc r0, r9, r2");
234 "e1d50003 bics r0, r5, r3");
236 "51d10004 bicpls r0, r1, r4");
239 "e1e0a001 mvn r10, r1");
241 "e1e09002 mvn r9, r2");
243 "e1f00003 mvns r0, r3");
245 "31f05004 mvnccs r5, r4");
250 "e3e03000 mvn r3, #0");
252 "e3f04001 mvns r4, #1");
254 "13f052ff mvnnes r5, #-268435441");
256 "13e06000 mvnne r6, #0");
260 "e3a03000 mov r3, #0");
262 "e3b04001 movs r4, #1");
264 "13b052ff movnes r5, #-268435441");
266 "13a06000 movne r6, #0");
271 "13015234 movwne r5, #4660");
274 "1301c234 movwne ip, #4660");
278 "1301c234 movwne ip, #4660");
286 "1301c234 movwne ip, #4660");
289 "13445321 movtne r5, #17185");
291 "030a5bcd movweq r5, #43981");
297 "13e0c0cb mvnne ip, #203");
301 "e3c537ff bic r3, r5, #66846720");
303 "e20537ff and r3, r5, #66846720");
307 "e2453b01 sub r3, r5, #1024");
309 "e2853b01 add r3, r5, #1024");
313 "e3730b01 cmn r3, #1024");
315 "e3530b01 cmp r3, #1024");
323 "e12fff7f bkpt 65535");
325 "e16f6f17 clz r6, r7");
335 "e2010000 and r0, r1, #0");
337 "e2021001 and r1, r2, #1");
339 "e2132010 ands r2, r3, #16");
341 "02043c01 andeq r3, r4, #256");
343 "12154a01 andnes r4, r5, #4096");
346 "e2254a01 eor r4, r5, #4096");
348 "e2244801 eor r4, r4, #65536");
350 "e2334601 eors r4, r3, #1048576");
352 "22224401 eorcs r4, r2, #16777216");
354 "32314201 eorccs r4, r1, #268435456");
365 "e7e902d1 ubfx r0, r1, #5, #10");
367 "e7e912d0 ubfx r1, r0, #5, #10");
369 "e7e00fd1 ubfx r0, r1, #31, #1");
371 "e7e01fd0 ubfx r1, r0, #31, #1");
374 "e7a902d1 sbfx r0, r1, #5, #10");
376 "e7a912d0 sbfx r1, r0, #5, #10");
378 "e7a00fd1 sbfx r0, r1, #31, #1");
380 "e7a01fd0 sbfx r1, r0, #31, #1");
383 "e7ce029f bfc r0, #5, #10");
385 "e7ce129f bfc r1, #5, #10");
387 "e7df0f9f bfc r0, #31, #1");
389 "e7df1f9f bfc r1, #31, #1");
392 "e7ce0291 bfi r0, r1, #5, #10");
394 "e7ce1290 bfi r1, r0, #5, #10");
396 "e7df0f91 bfi r0, r1, #31, #1");
398 "e7df1f90 bfi r1, r0, #31, #1");
401 "e6e10011 usat r0, #1, r1");
403 "e6e7201e usat r2, #7, lr");
405 "e6ff3f94 usat r3, #31, r4, lsl #31");
407 "e6e088d5 usat r8, #0, r5, asr #17");
410 "e6843895 pkhbt r3, r4, r5, lsl #17");
412 "e68438d5 pkhtb r3, r4, r5, asr #17");
414 "e6ef907a uxtb r9, r10");
416 "e6ef3474 uxtb r3, r4, ror #8");
418 "e6e43475 uxtab r3, r4, r5, ror #8");
420 "e6cf3474 uxtb16 r3, r4, ror #8");
432 CpuFeatureScope scope(&assm,
VFP3);
434 "ec432b10 vmov d0, r2, r3");
436 "ec532b10 vmov r2, r3, d0");
438 "eeb00b41 vmov.f64 d0, d1");
440 "0eb03b43 vmoveq.f64 d3, d3");
443 "eeb00a6f vmov.f32 s0, s31");
445 "eef0fa40 vmov.f32 s31, s0");
447 "ee100a10 vmov r0, s0");
449 "ee1faa90 vmov r10, s31");
451 "ee000a10 vmov s0, r0");
453 "ee0faa90 vmov s31, r10");
456 "eeb00bc1 vabs.f64 d0, d1");
458 "4eb03bc4 vabsmi.f64 d3, d4");
461 "eeb10b41 vneg.f64 d0, d1");
463 "4eb13b44 vnegmi.f64 d3, d4");
466 "ee310b02 vadd.f64 d0, d1, d2");
468 "4e343b05 vaddmi.f64 d3, d4, d5");
471 "ee310b42 vsub.f64 d0, d1, d2");
473 "1e343b45 vsubne.f64 d3, d4, d5");
476 "ee212b00 vmul.f64 d2, d1, d0");
478 "3e246b05 vmulcc.f64 d6, d4, d5");
481 "ee822b02 vdiv.f64 d2, d2, d2");
483 "8e876b07 vdivhi.f64 d6, d7, d7");
486 "eeb40b41 vcmp.f64 d0, d1");
488 "eeb50b40 vcmp.f64 d0, #0.0");
491 "eeb10bc0 vsqrt.f64 d0, d0");
493 "1eb12bc3 vsqrtne.f64 d2, d3");
496 "eeb70b00 vmov.f64 d0, #1");
498 "eeba2b0a vmov.f64 d2, #-13");
501 "ee000b10 vmov.32 d0[0], r0");
503 "ee200b10 vmov.32 d0[1], r0");
506 "ee1f2b10 vmov.32 r2, d15[0]");
508 "ee3e3b10 vmov.32 r3, d14[1]");
511 "ed900a00 vldr s0, [r0 + 4*0]");
513 "edd10a01 vldr s1, [r1 + 4*1]");
515 "edd47a04 vldr s15, [r4 + 4*4]");
517 "ed958a05 vldr s16, [r5 + 4*5]");
519 "eddafaff vldr s31, [r10 + 4*255]");
522 "ed800a00 vstr s0, [r0 + 4*0]");
524 "edc10a01 vstr s1, [r1 + 4*1]");
526 "edc87a02 vstr s15, [r8 + 4*2]");
528 "ed898a03 vstr s16, [r9 + 4*3]");
530 "edcafaff vstr s31, [r10 + 4*255]");
533 "ed900b00 vldr d0, [r0 + 4*0]");
535 "ed911b01 vldr d1, [r1 + 4*1]");
537 "ed9afbff vldr d15, [r10 + 4*255]");
539 "ed800b00 vstr d0, [r0 + 4*0]");
541 "ed811b01 vstr d1, [r1 + 4*1]");
543 "ed8afbff vstr d15, [r10 + 4*255]");
546 "eee15a10 vmsr FPSCR, r5");
548 "5ee1aa10 vmsrpl FPSCR, r10");
550 "eee1fa10 vmsr FPSCR, APSR");
552 "eef15a10 vmrs r5, FPSCR");
554 "aef1aa10 vmrsge r10, FPSCR");
556 "eef1fa10 vmrs APSR, FPSCR");
559 "ec801b06 vstmia r0, {d1-d3}");
561 "ec912b08 vldmia r1, {d2-d5}");
563 "ec820b20 vstmia r2, {d0-d15}");
565 "ec930b20 vldmia r3, {d0-d15}");
567 "ecc40a03 vstmia r4, {s1-s3}");
569 "ec951a04 vldmia r5, {s2-s5}");
571 "ec860a20 vstmia r6, {s0-s31}");
573 "ec970a20 vldmia r7, {s0-s31}");
576 "ee012b00 vmla.f64 d2, d1, d0");
578 "3e046b05 vmlacc.f64 d6, d4, d5");
581 "ee012b40 vmls.f64 d2, d1, d0");
583 "3e046b45 vmlscc.f64 d6, d4, d5");
586 "eebc0bc0 vcvt.u32.f64 s0, d0");
588 "eebd0bc0 vcvt.s32.f64 s0, d0");
590 "eeb80b60 vcvt.f64.u32 d0, s1");
592 "eeb80be0 vcvt.f64.s32 d0, s1");
594 "eeb80ac1 vcvt.f32.s32 s0, s2");
596 "eeba0bef vcvt.f64.s32 d0, d0, #1");
600 "eeb03b6b vmov.f64 d3, d27");
602 "eef02b47 vmov.f64 d18, d7");
604 "ec432b32 vmov d18, r2, r3");
606 "ec532b32 vmov r2, r3, d18");
608 "eef04b6f vmov.f64 d20, d31");
611 "eef00bef vabs.f64 d16, d31");
614 "eef10b6f vneg.f64 d16, d31");
617 "ee710ba2 vadd.f64 d16, d17, d18");
620 "ee710be2 vsub.f64 d16, d17, d18");
623 "ee610ba2 vmul.f64 d16, d17, d18");
626 "eec10ba2 vdiv.f64 d16, d17, d18");
629 "eef40b61 vcmp.f64 d16, d17");
631 "eef50b40 vcmp.f64 d16, #0.0");
634 "eef10be1 vsqrt.f64 d16, d17");
637 "eef3eb00 vmov.f64 d30, #16");
640 "ee0f7b90 vmov.32 d31[0], r7");
642 "ee2f7b90 vmov.32 d31[1], r7");
645 "edd09b00 vldr d25, [r0 + 4*0]");
647 "edd1ab01 vldr d26, [r1 + 4*1]");
649 "eddafbff vldr d31, [r10 + 4*255]");
652 "edc00b00 vstr d16, [r0 + 4*0]");
654 "edc11b01 vstr d17, [r1 + 4*1]");
656 "edcafbff vstr d31, [r10 + 4*255]");
659 "ecc00b20 vstmia r0, {d16-d31}");
661 "ecd30b20 vldmia r3, {d16-d31}");
663 "ecc07b0a vstmia r0, {d23-d27}");
665 "ecd37b0a vldmia r3, {d23-d27}");
668 "ee410ba2 vmla.f64 d16, d17, d18");
671 "eebc0be0 vcvt.u32.f64 s0, d16");
673 "eebd0be0 vcvt.s32.f64 s0, d16");
675 "eef80b60 vcvt.f64.u32 d16, s1");
687 CpuFeatureScope scope(&assm,
NEON);
689 "f421420f vld1.8 {d4, d5, d6, d7}, [r1]");
691 "f449124f vst1.16 {d17, d18, d19, d20}, [r9]");
693 "f3886a11 vmovl.u8 q3, d1");
695 "f3888a12 vmovl.u8 q4, d2");
706 "e5d10000 ldrb r0, [r1, #+0]");
708 "e5d3202a ldrb r2, [r3, #+42]");
710 "e555402a ldrb r4, [r5, #-42]");
712 "e4d7602a ldrb r6, [r7], #+42");
714 "e459802a ldrb r8, [r9], #-42");
716 "e5fba02a ldrb r10, [fp, #+42]!");
718 "e57dc02a ldrb ip, [sp, #-42]!");
720 "e7d10002 ldrb r0, [r1, +r2]");
722 "e7510002 ldrb r0, [r1, -r2]");
724 "e6d10002 ldrb r0, [r1], +r2");
726 "e6510002 ldrb r0, [r1], -r2");
728 "e7f10002 ldrb r0, [r1, +r2]!");
730 "e7710002 ldrb r0, [r1, -r2]!");
733 "e5c10000 strb r0, [r1, #+0]");
735 "e5c3202a strb r2, [r3, #+42]");
737 "e545402a strb r4, [r5, #-42]");
739 "e4c7602a strb r6, [r7], #+42");
741 "e449802a strb r8, [r9], #-42");
743 "e5eba02a strb r10, [fp, #+42]!");
745 "e56dc02a strb ip, [sp, #-42]!");
747 "e7c10002 strb r0, [r1, +r2]");
749 "e7410002 strb r0, [r1, -r2]");
751 "e6c10002 strb r0, [r1], +r2");
753 "e6410002 strb r0, [r1], -r2");
755 "e7e10002 strb r0, [r1, +r2]!");
757 "e7610002 strb r0, [r1, -r2]!");
760 "e1d100b0 ldrh r0, [r1, #+0]");
762 "e1d322ba ldrh r2, [r3, #+42]");
764 "e15542ba ldrh r4, [r5, #-42]");
766 "e0d762ba ldrh r6, [r7], #+42");
768 "e05982ba ldrh r8, [r9], #-42");
770 "e1fba2ba ldrh r10, [fp, #+42]!");
772 "e17dc2ba ldrh ip, [sp, #-42]!");
774 "e19100b2 ldrh r0, [r1, +r2]");
776 "e11100b2 ldrh r0, [r1, -r2]");
778 "e09100b2 ldrh r0, [r1], +r2");
780 "e01100b2 ldrh r0, [r1], -r2");
782 "e1b100b2 ldrh r0, [r1, +r2]!");
784 "e13100b2 ldrh r0, [r1, -r2]!");
787 "e1c100b0 strh r0, [r1, #+0]");
789 "e1c322ba strh r2, [r3, #+42]");
791 "e14542ba strh r4, [r5, #-42]");
793 "e0c762ba strh r6, [r7], #+42");
795 "e04982ba strh r8, [r9], #-42");
797 "e1eba2ba strh r10, [fp, #+42]!");
799 "e16dc2ba strh ip, [sp, #-42]!");
801 "e18100b2 strh r0, [r1, +r2]");
803 "e10100b2 strh r0, [r1, -r2]");
805 "e08100b2 strh r0, [r1], +r2");
807 "e00100b2 strh r0, [r1], -r2");
809 "e1a100b2 strh r0, [r1, +r2]!");
811 "e12100b2 strh r0, [r1, -r2]!");
814 "e5910000 ldr r0, [r1, #+0]");
816 "e593202a ldr r2, [r3, #+42]");
818 "e515402a ldr r4, [r5, #-42]");
820 "e497602a ldr r6, [r7], #+42");
822 "e419802a ldr r8, [r9], #-42");
824 "e5bba02a ldr r10, [fp, #+42]!");
826 "e53dc02a ldr ip, [sp, #-42]!");
828 "e7910002 ldr r0, [r1, +r2]");
830 "e7110002 ldr r0, [r1, -r2]");
832 "e6910002 ldr r0, [r1], +r2");
834 "e6110002 ldr r0, [r1], -r2");
836 "e7b10002 ldr r0, [r1, +r2]!");
838 "e7310002 ldr r0, [r1, -r2]!");
841 "e5810000 str r0, [r1, #+0]");
843 "e583202a str r2, [r3, #+42]");
845 "e505402a str r4, [r5, #-42]");
847 "e487602a str r6, [r7], #+42");
849 "e409802a str r8, [r9], #-42");
851 "e5aba02a str r10, [fp, #+42]!");
853 "e52dc02a str ip, [sp, #-42]!");
855 "e7810002 str r0, [r1, +r2]");
857 "e7010002 str r0, [r1, -r2]");
859 "e6810002 str r0, [r1], +r2");
861 "e6010002 str r0, [r1], -r2");
863 "e7a10002 str r0, [r1, +r2]!");
865 "e7210002 str r0, [r1, -r2]!");
868 CpuFeatureScope scope(&assm,
ARMv7);
870 "e1c100d0 ldrd r0, [r1, #+0]");
872 "e1c327df ldrd r2, [r3, #+127]");
874 "e14547df ldrd r4, [r5, #-127]");
876 "e0c767df ldrd r6, [r7], #+127");
878 "e04987df ldrd r8, [r9], #-127");
880 "e1eba7df ldrd r10, [fp, #+127]!");
882 "e16dc7df ldrd ip, [sp, #-127]!");
885 "e1c100f0 strd r0, [r1, #+0]");
887 "e1c327ff strd r2, [r3, #+127]");
889 "e14547ff strd r4, [r5, #-127]");
891 "e0c767ff strd r6, [r7], #+127");
893 "e04987ff strd r8, [r9], #-127");
895 "e1eba7ff strd r10, [fp, #+127]!");
897 "e16dc7ff strd ip, [sp, #-127]!");
900 "f5d1f000 pld [r1]");
902 "f5d2f080 pld [r2, #+128]");
#define EMIT_PENDING_LITERALS()
#define COMPARE(asm_, compare_string)
const LowDwVfpRegister d0
static bool IsSupported(CpuFeature f)
const LowDwVfpRegister d15
const LowDwVfpRegister d3
const VmovIndex VmovIndexHi
const LowDwVfpRegister d14
const LowDwVfpRegister d7
const LowDwVfpRegister d4
int InstructionDecode(v8::internal::Vector< char > buffer, byte *instruction)
const LowDwVfpRegister d6
const LowDwVfpRegister d5
const LowDwVfpRegister d2
const VmovIndex VmovIndexLo
bool DisassembleAndCompare(byte *pc, const char *compare_string)
const LowDwVfpRegister d1