Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(241)

Side by Side Diff: runtime/vm/disassembler_arm64.cc

Issue 231373003: Adds logical operations to arm64. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/constants_arm64.h ('k') | runtime/vm/simulator_arm64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/disassembler.h" 5 #include "vm/disassembler.h"
6 6
7 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM64. 7 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM64.
8 #if defined(TARGET_ARCH_ARM64) 8 #if defined(TARGET_ARCH_ARM64)
9 #include "platform/assert.h" 9 #include "platform/assert.h"
10 10
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 "lsl %d", 340 "lsl %d",
341 shift); 341 shift);
342 } 342 }
343 return 2; 343 return 2;
344 } 344 }
345 case 'm': { 345 case 'm': {
346 ASSERT(STRING_STARTS_WITH(format, "memop")); 346 ASSERT(STRING_STARTS_WITH(format, "memop"));
347 PrintMemOperand(instr); 347 PrintMemOperand(instr);
348 return 5; 348 return 5;
349 } 349 }
350 case 'b': {
351 ASSERT(STRING_STARTS_WITH(format, "bitimm"));
352 const uint64_t imm = instr->ImmLogical();
353 buffer_pos_ += OS::SNPrint(current_position_in_buffer(),
354 remaining_size_in_buffer(),
355 "0x%"Px64,
356 imm);
357 return 6;
358 }
350 default: { 359 default: {
351 UNREACHABLE(); 360 UNREACHABLE();
352 break; 361 break;
353 } 362 }
354 } 363 }
355 UNREACHABLE(); 364 UNREACHABLE();
356 return -1; 365 return -1;
357 } 366 }
358 367
359 368
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 if (instr->Bit(22) == 1) { 416 if (instr->Bit(22) == 1) {
408 Format(instr, "ldr'sz 'rt, 'memop"); 417 Format(instr, "ldr'sz 'rt, 'memop");
409 } else { 418 } else {
410 Format(instr, "str'sz 'rt, 'memop"); 419 Format(instr, "str'sz 'rt, 'memop");
411 } 420 }
412 } 421 }
413 422
414 423
415 void ARM64Decoder::DecodeAddSubImm(Instr* instr) { 424 void ARM64Decoder::DecodeAddSubImm(Instr* instr) {
416 switch (instr->Bit(30)) { 425 switch (instr->Bit(30)) {
426 case 0: {
427 if ((instr->RdField() == R31) && (instr->SFField())) {
428 Format(instr, "cmni'sf 'rn, 'imm12s");
429 } else {
430 Format(instr, "addi'sf's 'rd, 'rn, 'imm12s");
431 }
432 break;
433 }
434 case 1: {
435 if ((instr->RdField() == R31) && (instr->SFField())) {
436 Format(instr, "cmpi'sf 'rn, 'imm12s");
437 } else {
438 Format(instr, "subi'sf's 'rd, 'rn, 'imm12s");
439 }
440 break;
441 }
442 default:
443 Unknown(instr);
444 break;
445 }
446 }
447
448
449 void ARM64Decoder::DecodeLogicalImm(Instr* instr) {
450 int op = instr->Bits(29, 2);
451 switch (op) {
417 case 0: 452 case 0:
418 Format(instr, "addi'sf's 'rd, 'rn, 'imm12s"); 453 Format(instr, "andi'sf 'rd, 'rn, 'bitimm");
419 break; 454 break;
420 case 1: 455 case 1:
421 Format(instr, "subi'sf's 'rd, 'rn, 'imm12s"); 456 Format(instr, "orri'sf 'rd, 'rn, 'bitimm");
457 break;
458 case 2:
459 Format(instr, "eori'sf 'rd, 'rn, 'bitimm");
460 break;
461 case 3:
462 Format(instr, "andi'sfs 'rd, 'rn, 'bitimm");
422 break; 463 break;
423 default: 464 default:
424 Unknown(instr); 465 Unknown(instr);
425 break; 466 break;
426 } 467 }
427 } 468 }
428 469
470
429 void ARM64Decoder::DecodeDPImmediate(Instr* instr) { 471 void ARM64Decoder::DecodeDPImmediate(Instr* instr) {
430 if (instr->IsMoveWideOp()) { 472 if (instr->IsMoveWideOp()) {
431 DecodeMoveWide(instr); 473 DecodeMoveWide(instr);
432 } else if (instr->IsAddSubImmOp()) { 474 } else if (instr->IsAddSubImmOp()) {
433 DecodeAddSubImm(instr); 475 DecodeAddSubImm(instr);
476 } else if (instr->IsLogicalImmOp()) {
477 DecodeLogicalImm(instr);
434 } else { 478 } else {
435 Unknown(instr); 479 Unknown(instr);
436 } 480 }
437 } 481 }
438 482
439 483
440 void ARM64Decoder::DecodeExceptionGen(Instr* instr) { 484 void ARM64Decoder::DecodeExceptionGen(Instr* instr) {
441 if ((instr->Bits(0, 2) == 1) && (instr->Bits(2, 3) == 0) && 485 if ((instr->Bits(0, 2) == 1) && (instr->Bits(2, 3) == 0) &&
442 (instr->Bits(21, 3) == 0)) { 486 (instr->Bits(21, 3) == 0)) {
443 Format(instr, "svc 'imm16"); 487 Format(instr, "svc 'imm16");
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
504 if (instr->IsLoadStoreRegOp()) { 548 if (instr->IsLoadStoreRegOp()) {
505 DecodeLoadStoreReg(instr); 549 DecodeLoadStoreReg(instr);
506 } else { 550 } else {
507 Unknown(instr); 551 Unknown(instr);
508 } 552 }
509 } 553 }
510 554
511 555
512 void ARM64Decoder::DecodeAddSubShiftExt(Instr* instr) { 556 void ARM64Decoder::DecodeAddSubShiftExt(Instr* instr) {
513 switch (instr->Bit(30)) { 557 switch (instr->Bit(30)) {
558 case 0: {
559 if ((instr->RdField() == R31) && (instr->SFField())) {
560 Format(instr, "cmn'sf 'rn, 'shift_op");
561 } else {
562 Format(instr, "add'sf's 'rd, 'rn, 'shift_op");
563 }
564 break;
565 }
566 case 1: {
567 if ((instr->RdField() == R31) && (instr->SFField())) {
568 Format(instr, "cmp'sf 'rn, 'shift_op");
569 } else {
570 Format(instr, "sub'sf's 'rd, 'rn, 'shift_op");
571 }
572 break;
573 }
574 default:
575 UNREACHABLE();
576 break;
577 }
578 }
579
580
581 void ARM64Decoder::DecodeLogicalShift(Instr* instr) {
582 const int op = (instr->Bits(29, 2) << 1) | instr->Bit(21);
583 switch (op) {
514 case 0: 584 case 0:
515 Format(instr, "add'sf's 'rd, 'rn, 'shift_op"); 585 Format(instr, "and'sf 'rd, 'rn, 'shift_op");
516 break; 586 break;
517 case 1: 587 case 1:
518 Format(instr, "sub'sf's 'rd, 'rn, 'shift_op"); 588 Format(instr, "bic'sf 'rd, 'rn, 'shift_op");
589 break;
590 case 2:
591 Format(instr, "orr'sf 'rd, 'rn, 'shift_op");
592 break;
593 case 3:
594 Format(instr, "orn'sf 'rd, 'rn, 'shift_op");
595 break;
596 case 4:
597 Format(instr, "eor'sf 'rd, 'rn, 'shift_op");
598 break;
599 case 5:
600 Format(instr, "eon'sf 'rd, 'rn, 'shift_op");
601 break;
602 case 6:
603 Format(instr, "and'sfs 'rd, 'rn, 'shift_op");
604 break;
605 case 7:
606 Format(instr, "bic'sfs 'rd, 'rn, 'shift_op");
519 break; 607 break;
520 default: 608 default:
521 UNREACHABLE(); 609 UNREACHABLE();
522 break; 610 break;
523 } 611 }
524 } 612 }
525 613
526 614
527 void ARM64Decoder::DecodeDPRegister(Instr* instr) { 615 void ARM64Decoder::DecodeDPRegister(Instr* instr) {
528 if (instr->IsAddSubShiftExtOp()) { 616 if (instr->IsAddSubShiftExtOp()) {
529 DecodeAddSubShiftExt(instr); 617 DecodeAddSubShiftExt(instr);
618 } else if (instr->IsLogicalShiftOp()) {
619 DecodeLogicalShift(instr);
530 } else { 620 } else {
531 Unknown(instr); 621 Unknown(instr);
532 } 622 }
533 } 623 }
534 624
535 625
536 void ARM64Decoder::DecodeDPSimd1(Instr* instr) { 626 void ARM64Decoder::DecodeDPSimd1(Instr* instr) {
537 Unknown(instr); 627 Unknown(instr);
538 } 628 }
539 629
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
604 human_buffer, 694 human_buffer,
605 sizeof(human_buffer), 695 sizeof(human_buffer),
606 pc); 696 pc);
607 pc += instruction_length; 697 pc += instruction_length;
608 } 698 }
609 } 699 }
610 700
611 } // namespace dart 701 } // namespace dart
612 702
613 #endif // defined TARGET_ARCH_ARM 703 #endif // defined TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « runtime/vm/constants_arm64.h ('k') | runtime/vm/simulator_arm64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698