OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
530 set_fpreg(code, value); | 530 set_fpreg(code, value); |
531 } | 531 } |
532 | 532 |
533 bool N() { return nzcv_.N() != 0; } | 533 bool N() { return nzcv_.N() != 0; } |
534 bool Z() { return nzcv_.Z() != 0; } | 534 bool Z() { return nzcv_.Z() != 0; } |
535 bool C() { return nzcv_.C() != 0; } | 535 bool C() { return nzcv_.C() != 0; } |
536 bool V() { return nzcv_.V() != 0; } | 536 bool V() { return nzcv_.V() != 0; } |
537 SimSystemRegister& nzcv() { return nzcv_; } | 537 SimSystemRegister& nzcv() { return nzcv_; } |
538 | 538 |
539 // TODO(jbramley): Find a way to make the fpcr_ members return the proper | 539 // TODO(jbramley): Find a way to make the fpcr_ members return the proper |
540 // types, so this accessor is not necessary. | 540 // types, so these accessors are not necessary. |
541 FPRounding RMode() { return static_cast<FPRounding>(fpcr_.RMode()); } | 541 FPRounding RMode() { return static_cast<FPRounding>(fpcr_.RMode()); } |
| 542 bool DN() { return fpcr_.DN() != 0; } |
542 SimSystemRegister& fpcr() { return fpcr_; } | 543 SimSystemRegister& fpcr() { return fpcr_; } |
543 | 544 |
544 // Debug helpers | 545 // Debug helpers |
545 | 546 |
546 // Simulator breakpoints. | 547 // Simulator breakpoints. |
547 struct Breakpoint { | 548 struct Breakpoint { |
548 Instruction* location; | 549 Instruction* location; |
549 bool enabled; | 550 bool enabled; |
550 }; | 551 }; |
551 std::vector<Breakpoint> breakpoints_; | 552 std::vector<Breakpoint> breakpoints_; |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
700 Shift shift_type, | 701 Shift shift_type, |
701 unsigned amount); | 702 unsigned amount); |
702 int64_t ExtendValue(unsigned reg_width, | 703 int64_t ExtendValue(unsigned reg_width, |
703 int64_t value, | 704 int64_t value, |
704 Extend extend_type, | 705 Extend extend_type, |
705 unsigned left_shift = 0); | 706 unsigned left_shift = 0); |
706 | 707 |
707 uint64_t ReverseBits(uint64_t value, unsigned num_bits); | 708 uint64_t ReverseBits(uint64_t value, unsigned num_bits); |
708 uint64_t ReverseBytes(uint64_t value, ReverseByteMode mode); | 709 uint64_t ReverseBytes(uint64_t value, ReverseByteMode mode); |
709 | 710 |
| 711 template <typename T> |
| 712 T FPDefaultNaN() const; |
| 713 |
710 void FPCompare(double val0, double val1); | 714 void FPCompare(double val0, double val1); |
711 double FPRoundInt(double value, FPRounding round_mode); | 715 double FPRoundInt(double value, FPRounding round_mode); |
712 double FPToDouble(float value); | 716 double FPToDouble(float value); |
713 float FPToFloat(double value, FPRounding round_mode); | 717 float FPToFloat(double value, FPRounding round_mode); |
714 double FixedToDouble(int64_t src, int fbits, FPRounding round_mode); | 718 double FixedToDouble(int64_t src, int fbits, FPRounding round_mode); |
715 double UFixedToDouble(uint64_t src, int fbits, FPRounding round_mode); | 719 double UFixedToDouble(uint64_t src, int fbits, FPRounding round_mode); |
716 float FixedToFloat(int64_t src, int fbits, FPRounding round_mode); | 720 float FixedToFloat(int64_t src, int fbits, FPRounding round_mode); |
717 float UFixedToFloat(uint64_t src, int fbits, FPRounding round_mode); | 721 float UFixedToFloat(uint64_t src, int fbits, FPRounding round_mode); |
718 int32_t FPToInt32(double value, FPRounding rmode); | 722 int32_t FPToInt32(double value, FPRounding rmode); |
719 int64_t FPToInt64(double value, FPRounding rmode); | 723 int64_t FPToInt64(double value, FPRounding rmode); |
720 uint32_t FPToUInt32(double value, FPRounding rmode); | 724 uint32_t FPToUInt32(double value, FPRounding rmode); |
721 uint64_t FPToUInt64(double value, FPRounding rmode); | 725 uint64_t FPToUInt64(double value, FPRounding rmode); |
722 | 726 |
723 template <typename T> | 727 template <typename T> |
| 728 T FPAdd(T op1, T op2); |
| 729 |
| 730 template <typename T> |
| 731 T FPDiv(T op1, T op2); |
| 732 |
| 733 template <typename T> |
724 T FPMax(T a, T b); | 734 T FPMax(T a, T b); |
725 | 735 |
726 template <typename T> | 736 template <typename T> |
727 T FPMin(T a, T b); | 737 T FPMaxNM(T a, T b); |
728 | 738 |
729 template <typename T> | 739 template <typename T> |
730 T FPMaxNM(T a, T b); | 740 T FPMin(T a, T b); |
731 | 741 |
732 template <typename T> | 742 template <typename T> |
733 T FPMinNM(T a, T b); | 743 T FPMinNM(T a, T b); |
734 | 744 |
| 745 template <typename T> |
| 746 T FPMul(T op1, T op2); |
| 747 |
| 748 template <typename T> |
| 749 T FPMulAdd(T a, T op1, T op2); |
| 750 |
| 751 template <typename T> |
| 752 T FPSqrt(T op); |
| 753 |
| 754 template <typename T> |
| 755 T FPSub(T op1, T op2); |
| 756 |
| 757 // Standard NaN processing. |
| 758 template <typename T> |
| 759 T FPProcessNaN(T op); |
| 760 |
| 761 bool FPProcessNaNs(Instruction* instr); |
| 762 |
| 763 template <typename T> |
| 764 T FPProcessNaNs(T op1, T op2); |
| 765 |
| 766 template <typename T> |
| 767 T FPProcessNaNs3(T op1, T op2, T op3); |
| 768 |
735 void CheckStackAlignment(); | 769 void CheckStackAlignment(); |
736 | 770 |
737 inline void CheckPCSComplianceAndRun(); | 771 inline void CheckPCSComplianceAndRun(); |
738 | 772 |
739 #ifdef DEBUG | 773 #ifdef DEBUG |
740 // Corruption values should have their least significant byte cleared to | 774 // Corruption values should have their least significant byte cleared to |
741 // allow the code of the register being corrupted to be inserted. | 775 // allow the code of the register being corrupted to be inserted. |
742 static const uint64_t kCallerSavedRegisterCorruptionValue = | 776 static const uint64_t kCallerSavedRegisterCorruptionValue = |
743 0xca11edc0de000000UL; | 777 0xca11edc0de000000UL; |
744 // This value is a NaN in both 32-bit and 64-bit FP. | 778 // This value is a NaN in both 32-bit and 64-bit FP. |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
777 SimSystemRegister fpcr_; | 811 SimSystemRegister fpcr_; |
778 | 812 |
779 // Only a subset of FPCR features are supported by the simulator. This helper | 813 // Only a subset of FPCR features are supported by the simulator. This helper |
780 // checks that the FPCR settings are supported. | 814 // checks that the FPCR settings are supported. |
781 // | 815 // |
782 // This is checked when floating-point instructions are executed, not when | 816 // This is checked when floating-point instructions are executed, not when |
783 // FPCR is set. This allows generated code to modify FPCR for external | 817 // FPCR is set. This allows generated code to modify FPCR for external |
784 // functions, or to save and restore it when entering and leaving generated | 818 // functions, or to save and restore it when entering and leaving generated |
785 // code. | 819 // code. |
786 void AssertSupportedFPCR() { | 820 void AssertSupportedFPCR() { |
787 ASSERT(fpcr().DN() == 0); // No default-NaN support. | |
788 ASSERT(fpcr().FZ() == 0); // No flush-to-zero support. | 821 ASSERT(fpcr().FZ() == 0); // No flush-to-zero support. |
789 ASSERT(fpcr().RMode() == FPTieEven); // Ties-to-even rounding only. | 822 ASSERT(fpcr().RMode() == FPTieEven); // Ties-to-even rounding only. |
790 | 823 |
791 // The simulator does not support half-precision operations so fpcr().AHP() | 824 // The simulator does not support half-precision operations so fpcr().AHP() |
792 // is irrelevant, and is not checked here. | 825 // is irrelevant, and is not checked here. |
793 } | 826 } |
794 | 827 |
795 static int CalcNFlag(uint64_t result, unsigned reg_size) { | 828 static int CalcNFlag(uint64_t result, unsigned reg_size) { |
796 return (result >> (reg_size - 1)) & 1; | 829 return (result >> (reg_size - 1)) & 1; |
797 } | 830 } |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
874 static void UnregisterCTryCatch() { | 907 static void UnregisterCTryCatch() { |
875 Simulator::current(Isolate::Current())->PopAddress(); | 908 Simulator::current(Isolate::Current())->PopAddress(); |
876 } | 909 } |
877 }; | 910 }; |
878 | 911 |
879 #endif // !defined(USE_SIMULATOR) | 912 #endif // !defined(USE_SIMULATOR) |
880 | 913 |
881 } } // namespace v8::internal | 914 } } // namespace v8::internal |
882 | 915 |
883 #endif // V8_A64_SIMULATOR_A64_H_ | 916 #endif // V8_A64_SIMULATOR_A64_H_ |
OLD | NEW |