| OLD | NEW |
| 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 <setjmp.h> // NOLINT | 5 #include <setjmp.h> // NOLINT |
| 6 #include <stdlib.h> | 6 #include <stdlib.h> |
| 7 | 7 |
| 8 #include "vm/globals.h" | 8 #include "vm/globals.h" |
| 9 #if defined(TARGET_ARCH_ARM64) | 9 #if defined(TARGET_ARCH_ARM64) |
| 10 | 10 |
| (...skipping 2402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2413 return top / bottom; | 2413 return top / bottom; |
| 2414 } | 2414 } |
| 2415 } else { | 2415 } else { |
| 2416 const uint32_t utop = static_cast<uint32_t>(top); | 2416 const uint32_t utop = static_cast<uint32_t>(top); |
| 2417 const uint32_t ubottom = static_cast<uint32_t>(bottom); | 2417 const uint32_t ubottom = static_cast<uint32_t>(bottom); |
| 2418 return static_cast<int32_t>(utop / ubottom); | 2418 return static_cast<int32_t>(utop / ubottom); |
| 2419 } | 2419 } |
| 2420 } | 2420 } |
| 2421 | 2421 |
| 2422 | 2422 |
| 2423 void Simulator::DecodeMiscDP1Source(Instr* instr) { |
| 2424 if (instr->Bit(29) != 0) { |
| 2425 UnimplementedInstruction(instr); |
| 2426 } |
| 2427 |
| 2428 const Register rd = instr->RdField(); |
| 2429 const Register rn = instr->RnField(); |
| 2430 const int op = instr->Bits(10, 10); |
| 2431 const int64_t rn_val64 = get_register(rn, R31IsZR); |
| 2432 const int32_t rn_val32 = get_wregister(rn, R31IsZR); |
| 2433 switch (op) { |
| 2434 case 4: { |
| 2435 // Format(instr, "clz'sf 'rd, 'rn"); |
| 2436 int64_t rd_val = 0; |
| 2437 int64_t rn_val = (instr->SFField() == 1) ? rn_val64 : rn_val32; |
| 2438 if (rn_val != 0) { |
| 2439 while (rn_val > 0) { |
| 2440 rd_val++; |
| 2441 rn_val <<= 1; |
| 2442 } |
| 2443 } else { |
| 2444 rd_val = (instr->SFField() == 1) ? 64 : 32; |
| 2445 } |
| 2446 if (instr->SFField() == 1) { |
| 2447 set_register(instr, rd, rd_val, R31IsZR); |
| 2448 } else { |
| 2449 set_wregister(rd, rd_val, R31IsZR); |
| 2450 } |
| 2451 break; |
| 2452 } |
| 2453 default: |
| 2454 UnimplementedInstruction(instr); |
| 2455 break; |
| 2456 } |
| 2457 } |
| 2458 |
| 2459 |
| 2423 void Simulator::DecodeMiscDP2Source(Instr* instr) { | 2460 void Simulator::DecodeMiscDP2Source(Instr* instr) { |
| 2424 if (instr->Bit(29) != 0) { | 2461 if (instr->Bit(29) != 0) { |
| 2425 UnimplementedInstruction(instr); | 2462 UnimplementedInstruction(instr); |
| 2426 } | 2463 } |
| 2427 | 2464 |
| 2428 const Register rd = instr->RdField(); | 2465 const Register rd = instr->RdField(); |
| 2429 const Register rn = instr->RnField(); | 2466 const Register rn = instr->RnField(); |
| 2430 const Register rm = instr->RmField(); | 2467 const Register rm = instr->RmField(); |
| 2431 const int op = instr->Bits(10, 6); | 2468 const int op = instr->Bits(10, 5); |
| 2432 const int64_t rn_val64 = get_register(rn, R31IsZR); | 2469 const int64_t rn_val64 = get_register(rn, R31IsZR); |
| 2433 const int64_t rm_val64 = get_register(rm, R31IsZR); | 2470 const int64_t rm_val64 = get_register(rm, R31IsZR); |
| 2434 const int32_t rn_val32 = get_wregister(rn, R31IsZR); | 2471 const int32_t rn_val32 = get_wregister(rn, R31IsZR); |
| 2435 const int32_t rm_val32 = get_wregister(rm, R31IsZR); | 2472 const int32_t rm_val32 = get_wregister(rm, R31IsZR); |
| 2436 switch (op) { | 2473 switch (op) { |
| 2437 case 2: | 2474 case 2: |
| 2438 case 3: { | 2475 case 3: { |
| 2439 // Format(instr, "udiv'sf 'rd, 'rn, 'rm"); | 2476 // Format(instr, "udiv'sf 'rd, 'rn, 'rm"); |
| 2440 // Format(instr, "sdiv'sf 'rd, 'rn, 'rm"); | 2477 // Format(instr, "sdiv'sf 'rd, 'rn, 'rm"); |
| 2441 const bool signd = instr->Bit(10) == 1; | 2478 const bool signd = instr->Bit(10) == 1; |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2605 } | 2642 } |
| 2606 | 2643 |
| 2607 | 2644 |
| 2608 void Simulator::DecodeDPRegister(Instr* instr) { | 2645 void Simulator::DecodeDPRegister(Instr* instr) { |
| 2609 if (instr->IsAddSubShiftExtOp()) { | 2646 if (instr->IsAddSubShiftExtOp()) { |
| 2610 DecodeAddSubShiftExt(instr); | 2647 DecodeAddSubShiftExt(instr); |
| 2611 } else if (instr->IsAddSubWithCarryOp()) { | 2648 } else if (instr->IsAddSubWithCarryOp()) { |
| 2612 DecodeAddSubWithCarry(instr); | 2649 DecodeAddSubWithCarry(instr); |
| 2613 } else if (instr->IsLogicalShiftOp()) { | 2650 } else if (instr->IsLogicalShiftOp()) { |
| 2614 DecodeLogicalShift(instr); | 2651 DecodeLogicalShift(instr); |
| 2652 } else if (instr->IsMiscDP1SourceOp()) { |
| 2653 DecodeMiscDP1Source(instr); |
| 2615 } else if (instr->IsMiscDP2SourceOp()) { | 2654 } else if (instr->IsMiscDP2SourceOp()) { |
| 2616 DecodeMiscDP2Source(instr); | 2655 DecodeMiscDP2Source(instr); |
| 2617 } else if (instr->IsMiscDP3SourceOp()) { | 2656 } else if (instr->IsMiscDP3SourceOp()) { |
| 2618 DecodeMiscDP3Source(instr); | 2657 DecodeMiscDP3Source(instr); |
| 2619 } else if (instr->IsConditionalSelectOp()) { | 2658 } else if (instr->IsConditionalSelectOp()) { |
| 2620 DecodeConditionalSelect(instr); | 2659 DecodeConditionalSelect(instr); |
| 2621 } else { | 2660 } else { |
| 2622 UnimplementedInstruction(instr); | 2661 UnimplementedInstruction(instr); |
| 2623 } | 2662 } |
| 2624 } | 2663 } |
| (...skipping 869 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3494 set_register(NULL, kExceptionObjectReg, bit_cast<int64_t>(raw_exception)); | 3533 set_register(NULL, kExceptionObjectReg, bit_cast<int64_t>(raw_exception)); |
| 3495 set_register(NULL, kStackTraceObjectReg, bit_cast<int64_t>(raw_stacktrace)); | 3534 set_register(NULL, kStackTraceObjectReg, bit_cast<int64_t>(raw_stacktrace)); |
| 3496 buf->Longjmp(); | 3535 buf->Longjmp(); |
| 3497 } | 3536 } |
| 3498 | 3537 |
| 3499 } // namespace dart | 3538 } // namespace dart |
| 3500 | 3539 |
| 3501 #endif // !defined(HOST_ARCH_ARM64) | 3540 #endif // !defined(HOST_ARCH_ARM64) |
| 3502 | 3541 |
| 3503 #endif // defined TARGET_ARCH_ARM64 | 3542 #endif // defined TARGET_ARCH_ARM64 |
| OLD | NEW |