28 #ifndef V8_ARM64_DECODER_ARM64_INL_H_
29 #define V8_ARM64_DECODER_ARM64_INL_H_
43 if (instr->
Bits(28, 27) == 0) {
44 V::VisitUnallocated(instr);
46 switch (instr->
Bits(27, 24)) {
48 case 0x0: DecodePCRelAddressing(instr);
break;
51 case 0x1: DecodeAddSubImmediate(instr);
break;
64 case 0xB: DecodeDataProcessing(instr);
break;
68 case 0x2: DecodeLogical(instr);
break;
72 case 0x3: DecodeBitfieldExtract(instr);
break;
85 case 0x7: DecodeBranchSystemException(instr);
break;
100 case 0xD: DecodeLoadStore(instr);
break;
114 case 0xF: DecodeFP(instr);
break;
126 V::VisitPCRelAddressing(instr);
131 void Decoder<V>::DecodeBranchSystemException(Instruction* instr) {
132 ASSERT((instr->Bits(27, 24) == 0x4) ||
133 (instr->Bits(27, 24) == 0x5) ||
134 (instr->Bits(27, 24) == 0x6) ||
135 (instr->Bits(27, 24) == 0x7) );
137 switch (instr->Bits(31, 29)) {
140 V::VisitUnconditionalBranch(instr);
145 if (instr->Bit(25) == 0) {
146 V::VisitCompareBranch(instr);
148 V::VisitTestBranch(instr);
153 if (instr->Bit(25) == 0) {
154 if ((instr->Bit(24) == 0x1) ||
155 (instr->Mask(0x01000010) == 0x00000010)) {
156 V::VisitUnallocated(instr);
158 V::VisitConditionalBranch(instr);
161 V::VisitUnallocated(instr);
166 if (instr->Bit(25) == 0) {
167 if (instr->Bit(24) == 0) {
168 if ((instr->Bits(4, 2) != 0) ||
169 (instr->Mask(0x00E0001D) == 0x00200001) ||
170 (instr->Mask(0x00E0001D) == 0x00400001) ||
171 (instr->Mask(0x00E0001E) == 0x00200002) ||
172 (instr->Mask(0x00E0001E) == 0x00400002) ||
173 (instr->Mask(0x00E0001C) == 0x00600000) ||
174 (instr->Mask(0x00E0001C) == 0x00800000) ||
175 (instr->Mask(0x00E0001F) == 0x00A00000) ||
176 (instr->Mask(0x00C0001C) == 0x00C00000)) {
177 V::VisitUnallocated(instr);
179 V::VisitException(instr);
182 if (instr->Bits(23, 22) == 0) {
183 const Instr masked_003FF0E0 = instr->Mask(0x003FF0E0);
184 if ((instr->Bits(21, 19) == 0x4) ||
185 (masked_003FF0E0 == 0x00033000) ||
186 (masked_003FF0E0 == 0x003FF020) ||
187 (masked_003FF0E0 == 0x003FF060) ||
188 (masked_003FF0E0 == 0x003FF0E0) ||
189 (instr->Mask(0x00388000) == 0x00008000) ||
190 (instr->Mask(0x0038E000) == 0x00000000) ||
191 (instr->Mask(0x0039E000) == 0x00002000) ||
192 (instr->Mask(0x003AE000) == 0x00002000) ||
193 (instr->Mask(0x003CE000) == 0x00042000) ||
194 (instr->Mask(0x003FFFC0) == 0x000320C0) ||
195 (instr->Mask(0x003FF100) == 0x00032100) ||
196 (instr->Mask(0x003FF200) == 0x00032200) ||
197 (instr->Mask(0x003FF400) == 0x00032400) ||
198 (instr->Mask(0x003FF800) == 0x00032800) ||
199 (instr->Mask(0x0038F000) == 0x00005000) ||
200 (instr->Mask(0x0038E000) == 0x00006000)) {
201 V::VisitUnallocated(instr);
203 V::VisitSystem(instr);
206 V::VisitUnallocated(instr);
210 if ((instr->Bit(24) == 0x1) ||
211 (instr->Bits(20, 16) != 0x1F) ||
212 (instr->Bits(15, 10) != 0) ||
213 (instr->Bits(4, 0) != 0) ||
214 (instr->Bits(24, 21) == 0x3) ||
215 (instr->Bits(24, 22) == 0x3)) {
216 V::VisitUnallocated(instr);
218 V::VisitUnconditionalBranchToRegister(instr);
225 V::VisitUnallocated(instr);
233 void Decoder<V>::DecodeLoadStore(Instruction* instr) {
234 ASSERT((instr->Bits(27, 24) == 0x8) ||
235 (instr->Bits(27, 24) == 0x9) ||
236 (instr->Bits(27, 24) == 0xC) ||
237 (instr->Bits(27, 24) == 0xD) );
239 if (instr->Bit(24) == 0) {
240 if (instr->Bit(28) == 0) {
241 if (instr->Bit(29) == 0) {
242 if (instr->Bit(26) == 0) {
244 V::VisitUnimplemented(instr);
246 DecodeAdvSIMDLoadStore(instr);
249 if ((instr->Bits(31, 30) == 0x3) ||
250 (instr->Mask(0xC4400000) == 0x40000000)) {
251 V::VisitUnallocated(instr);
253 if (instr->Bit(23) == 0) {
254 if (instr->Mask(0xC4400000) == 0xC0400000) {
255 V::VisitUnallocated(instr);
257 V::VisitLoadStorePairNonTemporal(instr);
260 V::VisitLoadStorePairPostIndex(instr);
265 if (instr->Bit(29) == 0) {
266 if (instr->Mask(0xC4000000) == 0xC4000000) {
267 V::VisitUnallocated(instr);
269 V::VisitLoadLiteral(instr);
272 if ((instr->Mask(0x84C00000) == 0x80C00000) ||
273 (instr->Mask(0x44800000) == 0x44800000) ||
274 (instr->Mask(0x84800000) == 0x84800000)) {
275 V::VisitUnallocated(instr);
277 if (instr->Bit(21) == 0) {
278 switch (instr->Bits(11, 10)) {
280 V::VisitLoadStoreUnscaledOffset(instr);
284 if (instr->Mask(0xC4C00000) == 0xC0800000) {
285 V::VisitUnallocated(instr);
287 V::VisitLoadStorePostIndex(instr);
293 V::VisitUnimplemented(instr);
297 if (instr->Mask(0xC4C00000) == 0xC0800000) {
298 V::VisitUnallocated(instr);
300 V::VisitLoadStorePreIndex(instr);
306 if (instr->Bits(11, 10) == 0x2) {
307 if (instr->Bit(14) == 0) {
308 V::VisitUnallocated(instr);
310 V::VisitLoadStoreRegisterOffset(instr);
313 V::VisitUnallocated(instr);
320 if (instr->Bit(28) == 0) {
321 if (instr->Bit(29) == 0) {
322 V::VisitUnallocated(instr);
324 if ((instr->Bits(31, 30) == 0x3) ||
325 (instr->Mask(0xC4400000) == 0x40000000)) {
326 V::VisitUnallocated(instr);
328 if (instr->Bit(23) == 0) {
329 V::VisitLoadStorePairOffset(instr);
331 V::VisitLoadStorePairPreIndex(instr);
336 if (instr->Bit(29) == 0) {
337 V::VisitUnallocated(instr);
339 if ((instr->Mask(0x84C00000) == 0x80C00000) ||
340 (instr->Mask(0x44800000) == 0x44800000) ||
341 (instr->Mask(0x84800000) == 0x84800000)) {
342 V::VisitUnallocated(instr);
344 V::VisitLoadStoreUnsignedOffset(instr);
353 void Decoder<V>::DecodeLogical(Instruction* instr) {
354 ASSERT(instr->Bits(27, 24) == 0x2);
356 if (instr->Mask(0x80400000) == 0x00400000) {
357 V::VisitUnallocated(instr);
359 if (instr->Bit(23) == 0) {
360 V::VisitLogicalImmediate(instr);
362 if (instr->Bits(30, 29) == 0x1) {
363 V::VisitUnallocated(instr);
365 V::VisitMoveWideImmediate(instr);
373 void Decoder<V>::DecodeBitfieldExtract(Instruction* instr) {
374 ASSERT(instr->Bits(27, 24) == 0x3);
376 if ((instr->Mask(0x80400000) == 0x80000000) ||
377 (instr->Mask(0x80400000) == 0x00400000) ||
378 (instr->Mask(0x80008000) == 0x00008000)) {
379 V::VisitUnallocated(instr);
380 }
else if (instr->Bit(23) == 0) {
381 if ((instr->Mask(0x80200000) == 0x00200000) ||
382 (instr->Mask(0x60000000) == 0x60000000)) {
383 V::VisitUnallocated(instr);
385 V::VisitBitfield(instr);
388 if ((instr->Mask(0x60200000) == 0x00200000) ||
389 (instr->Mask(0x60000000) != 0x00000000)) {
390 V::VisitUnallocated(instr);
392 V::VisitExtract(instr);
399 void Decoder<V>::DecodeAddSubImmediate(Instruction* instr) {
400 ASSERT(instr->Bits(27, 24) == 0x1);
401 if (instr->Bit(23) == 1) {
402 V::VisitUnallocated(instr);
404 V::VisitAddSubImmediate(instr);
410 void Decoder<V>::DecodeDataProcessing(Instruction* instr) {
411 ASSERT((instr->Bits(27, 24) == 0xA) ||
412 (instr->Bits(27, 24) == 0xB) );
414 if (instr->Bit(24) == 0) {
415 if (instr->Bit(28) == 0) {
416 if (instr->Mask(0x80008000) == 0x00008000) {
417 V::VisitUnallocated(instr);
419 V::VisitLogicalShifted(instr);
422 switch (instr->Bits(23, 21)) {
424 if (instr->Mask(0x0000FC00) != 0) {
425 V::VisitUnallocated(instr);
427 V::VisitAddSubWithCarry(instr);
432 if ((instr->Bit(29) == 0) ||
433 (instr->Mask(0x00000410) != 0)) {
434 V::VisitUnallocated(instr);
436 if (instr->Bit(11) == 0) {
437 V::VisitConditionalCompareRegister(instr);
439 V::VisitConditionalCompareImmediate(instr);
445 if (instr->Mask(0x20000800) != 0x00000000) {
446 V::VisitUnallocated(instr);
448 V::VisitConditionalSelect(instr);
453 if (instr->Bit(29) == 0x1) {
454 V::VisitUnallocated(instr);
456 if (instr->Bit(30) == 0) {
457 if ((instr->Bit(15) == 0x1) ||
458 (instr->Bits(15, 11) == 0) ||
459 (instr->Bits(15, 12) == 0x1) ||
460 (instr->Bits(15, 12) == 0x3) ||
461 (instr->Bits(15, 13) == 0x3) ||
462 (instr->Mask(0x8000EC00) == 0x00004C00) ||
463 (instr->Mask(0x8000E800) == 0x80004000) ||
464 (instr->Mask(0x8000E400) == 0x80004000)) {
465 V::VisitUnallocated(instr);
467 V::VisitDataProcessing2Source(instr);
470 if ((instr->Bit(13) == 1) ||
471 (instr->Bits(20, 16) != 0) ||
472 (instr->Bits(15, 14) != 0) ||
473 (instr->Mask(0xA01FFC00) == 0x00000C00) ||
474 (instr->Mask(0x201FF800) == 0x00001800)) {
475 V::VisitUnallocated(instr);
477 V::VisitDataProcessing1Source(instr);
486 case 7: V::VisitUnallocated(instr);
break;
490 if (instr->Bit(28) == 0) {
491 if (instr->Bit(21) == 0) {
492 if ((instr->Bits(23, 22) == 0x3) ||
493 (instr->Mask(0x80008000) == 0x00008000)) {
494 V::VisitUnallocated(instr);
496 V::VisitAddSubShifted(instr);
499 if ((instr->Mask(0x00C00000) != 0x00000000) ||
500 (instr->Mask(0x00001400) == 0x00001400) ||
501 (instr->Mask(0x00001800) == 0x00001800)) {
502 V::VisitUnallocated(instr);
504 V::VisitAddSubExtended(instr);
508 if ((instr->Bit(30) == 0x1) ||
509 (instr->Bits(30, 29) == 0x1) ||
510 (instr->Mask(0xE0600000) == 0x00200000) ||
511 (instr->Mask(0xE0608000) == 0x00400000) ||
512 (instr->Mask(0x60608000) == 0x00408000) ||
513 (instr->Mask(0x60E00000) == 0x00E00000) ||
514 (instr->Mask(0x60E00000) == 0x00800000) ||
515 (instr->Mask(0x60E00000) == 0x00600000)) {
516 V::VisitUnallocated(instr);
518 V::VisitDataProcessing3Source(instr);
526 void Decoder<V>::DecodeFP(Instruction* instr) {
527 ASSERT((instr->Bits(27, 24) == 0xE) ||
528 (instr->Bits(27, 24) == 0xF) );
530 if (instr->Bit(28) == 0) {
531 DecodeAdvSIMDDataProcessing(instr);
533 if (instr->Bit(29) == 1) {
534 V::VisitUnallocated(instr);
536 if (instr->Bits(31, 30) == 0x3) {
537 V::VisitUnallocated(instr);
538 }
else if (instr->Bits(31, 30) == 0x1) {
539 DecodeAdvSIMDDataProcessing(instr);
541 if (instr->Bit(24) == 0) {
542 if (instr->Bit(21) == 0) {
543 if ((instr->Bit(23) == 1) ||
544 (instr->Bit(18) == 1) ||
545 (instr->Mask(0x80008000) == 0x00000000) ||
546 (instr->Mask(0x000E0000) == 0x00000000) ||
547 (instr->Mask(0x000E0000) == 0x000A0000) ||
548 (instr->Mask(0x00160000) == 0x00000000) ||
549 (instr->Mask(0x00160000) == 0x00120000)) {
550 V::VisitUnallocated(instr);
552 V::VisitFPFixedPointConvert(instr);
555 if (instr->Bits(15, 10) == 32) {
556 V::VisitUnallocated(instr);
557 }
else if (instr->Bits(15, 10) == 0) {
558 if ((instr->Bits(23, 22) == 0x3) ||
559 (instr->Mask(0x000E0000) == 0x000A0000) ||
560 (instr->Mask(0x000E0000) == 0x000C0000) ||
561 (instr->Mask(0x00160000) == 0x00120000) ||
562 (instr->Mask(0x00160000) == 0x00140000) ||
563 (instr->Mask(0x20C40000) == 0x00800000) ||
564 (instr->Mask(0x20C60000) == 0x00840000) ||
565 (instr->Mask(0xA0C60000) == 0x80060000) ||
566 (instr->Mask(0xA0C60000) == 0x00860000) ||
567 (instr->Mask(0xA0C60000) == 0x00460000) ||
568 (instr->Mask(0xA0CE0000) == 0x80860000) ||
569 (instr->Mask(0xA0CE0000) == 0x804E0000) ||
570 (instr->Mask(0xA0CE0000) == 0x000E0000) ||
571 (instr->Mask(0xA0D60000) == 0x00160000) ||
572 (instr->Mask(0xA0D60000) == 0x80560000) ||
573 (instr->Mask(0xA0D60000) == 0x80960000)) {
574 V::VisitUnallocated(instr);
576 V::VisitFPIntegerConvert(instr);
578 }
else if (instr->Bits(14, 10) == 16) {
579 const Instr masked_A0DF8000 = instr->Mask(0xA0DF8000);
580 if ((instr->Mask(0x80180000) != 0) ||
581 (masked_A0DF8000 == 0x00020000) ||
582 (masked_A0DF8000 == 0x00030000) ||
583 (masked_A0DF8000 == 0x00068000) ||
584 (masked_A0DF8000 == 0x00428000) ||
585 (masked_A0DF8000 == 0x00430000) ||
586 (masked_A0DF8000 == 0x00468000) ||
587 (instr->Mask(0xA0D80000) == 0x00800000) ||
588 (instr->Mask(0xA0DE0000) == 0x00C00000) ||
589 (instr->Mask(0xA0DF0000) == 0x00C30000) ||
590 (instr->Mask(0xA0DC0000) == 0x00C40000)) {
591 V::VisitUnallocated(instr);
593 V::VisitFPDataProcessing1Source(instr);
595 }
else if (instr->Bits(13, 10) == 8) {
596 if ((instr->Bits(15, 14) != 0) ||
597 (instr->Bits(2, 0) != 0) ||
598 (instr->Mask(0x80800000) != 0x00000000)) {
599 V::VisitUnallocated(instr);
601 V::VisitFPCompare(instr);
603 }
else if (instr->Bits(12, 10) == 4) {
604 if ((instr->Bits(9, 5) != 0) ||
605 (instr->Mask(0x80800000) != 0x00000000)) {
606 V::VisitUnallocated(instr);
608 V::VisitFPImmediate(instr);
611 if (instr->Mask(0x80800000) != 0x00000000) {
612 V::VisitUnallocated(instr);
614 switch (instr->Bits(11, 10)) {
616 V::VisitFPConditionalCompare(instr);
620 if ((instr->Bits(15, 14) == 0x3) ||
621 (instr->Mask(0x00009000) == 0x00009000) ||
622 (instr->Mask(0x0000A000) == 0x0000A000)) {
623 V::VisitUnallocated(instr);
625 V::VisitFPDataProcessing2Source(instr);
630 V::VisitFPConditionalSelect(instr);
640 ASSERT(instr->Bit(30) == 0);
641 if (instr->Mask(0xA0800000) != 0) {
642 V::VisitUnallocated(instr);
644 V::VisitFPDataProcessing3Source(instr);
654 void Decoder<V>::DecodeAdvSIMDLoadStore(Instruction* instr) {
656 ASSERT(instr->Bits(29, 25) == 0x6);
657 V::VisitUnimplemented(instr);
662 void Decoder<V>::DecodeAdvSIMDDataProcessing(Instruction* instr) {
664 ASSERT(instr->Bits(27, 25) == 0x7);
665 V::VisitUnimplemented(instr);
671 #endif // V8_ARM64_DECODER_ARM64_INL_H_
#define ASSERT(condition)
int Bits(int hi, int lo) const
virtual void Decode(Instruction *instr)