| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/compiler/code-generator.h" | 5 #include "src/compiler/code-generator.h" |
| 6 #include "src/compiler/code-generator-impl.h" | 6 #include "src/compiler/code-generator-impl.h" |
| 7 #include "src/compiler/gap-resolver.h" | 7 #include "src/compiler/gap-resolver.h" |
| 8 #include "src/compiler/node-matchers.h" | 8 #include "src/compiler/node-matchers.h" |
| 9 #include "src/compiler/node-properties-inl.h" | 9 #include "src/compiler/node-properties-inl.h" |
| 10 #include "src/compiler/osr.h" | 10 #include "src/compiler/osr.h" |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 }; | 197 }; |
| 198 | 198 |
| 199 | 199 |
| 200 class OutOfLineCeil FINAL : public OutOfLineRound { | 200 class OutOfLineCeil FINAL : public OutOfLineRound { |
| 201 public: | 201 public: |
| 202 OutOfLineCeil(CodeGenerator* gen, DoubleRegister result) | 202 OutOfLineCeil(CodeGenerator* gen, DoubleRegister result) |
| 203 : OutOfLineRound(gen, result) {} | 203 : OutOfLineRound(gen, result) {} |
| 204 }; | 204 }; |
| 205 | 205 |
| 206 | 206 |
| 207 Condition FlagsConditionToConditionCmp(FlagsCondition condition) { |
| 208 switch (condition) { |
| 209 case kEqual: |
| 210 return eq; |
| 211 case kNotEqual: |
| 212 return ne; |
| 213 case kSignedLessThan: |
| 214 return lt; |
| 215 case kSignedGreaterThanOrEqual: |
| 216 return ge; |
| 217 case kSignedLessThanOrEqual: |
| 218 return le; |
| 219 case kSignedGreaterThan: |
| 220 return gt; |
| 221 case kUnsignedLessThan: |
| 222 return lo; |
| 223 case kUnsignedGreaterThanOrEqual: |
| 224 return hs; |
| 225 case kUnsignedLessThanOrEqual: |
| 226 return ls; |
| 227 case kUnsignedGreaterThan: |
| 228 return hi; |
| 229 case kUnorderedEqual: |
| 230 case kUnorderedNotEqual: |
| 231 break; |
| 232 default: |
| 233 break; |
| 234 } |
| 235 UNREACHABLE(); |
| 236 return kNoCondition; |
| 237 } |
| 238 |
| 239 |
| 240 Condition FlagsConditionToConditionTst(FlagsCondition condition) { |
| 241 switch (condition) { |
| 242 case kNotEqual: |
| 243 return ne; |
| 244 case kEqual: |
| 245 return eq; |
| 246 default: |
| 247 break; |
| 248 } |
| 249 UNREACHABLE(); |
| 250 return kNoCondition; |
| 251 } |
| 252 |
| 253 |
| 254 Condition FlagsConditionToConditionOvf(FlagsCondition condition) { |
| 255 switch (condition) { |
| 256 case kOverflow: |
| 257 return ne; |
| 258 case kNotOverflow: |
| 259 return eq; |
| 260 default: |
| 261 break; |
| 262 } |
| 263 UNREACHABLE(); |
| 264 return kNoCondition; |
| 265 } |
| 266 |
| 207 } // namespace | 267 } // namespace |
| 208 | 268 |
| 209 | 269 |
| 210 #define ASSEMBLE_CHECKED_LOAD_FLOAT(width, asm_instr) \ | 270 #define ASSEMBLE_CHECKED_LOAD_FLOAT(width, asm_instr) \ |
| 211 do { \ | 271 do { \ |
| 212 auto result = i.Output##width##Register(); \ | 272 auto result = i.Output##width##Register(); \ |
| 213 auto ool = new (zone()) OutOfLineLoad##width(this, result); \ | 273 auto ool = new (zone()) OutOfLineLoad##width(this, result); \ |
| 214 if (instr->InputAt(0)->IsRegister()) { \ | 274 if (instr->InputAt(0)->IsRegister()) { \ |
| 215 auto offset = i.InputRegister(0); \ | 275 auto offset = i.InputRegister(0); \ |
| 216 __ Branch(USE_DELAY_SLOT, ool->entry(), hs, offset, i.InputOperand(1)); \ | 276 __ Branch(USE_DELAY_SLOT, ool->entry(), hs, offset, i.InputOperand(1)); \ |
| (...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 709 // MIPS does not have condition code flags, so compare and branch are | 769 // MIPS does not have condition code flags, so compare and branch are |
| 710 // implemented differently than on the other arch's. The compare operations | 770 // implemented differently than on the other arch's. The compare operations |
| 711 // emit mips psuedo-instructions, which are handled here by branch | 771 // emit mips psuedo-instructions, which are handled here by branch |
| 712 // instructions that do the actual comparison. Essential that the input | 772 // instructions that do the actual comparison. Essential that the input |
| 713 // registers to compare psuedo-op are not modified before this branch op, as | 773 // registers to compare psuedo-op are not modified before this branch op, as |
| 714 // they are tested here. | 774 // they are tested here. |
| 715 // TODO(plind): Add CHECK() to ensure that test/cmp and this branch were | 775 // TODO(plind): Add CHECK() to ensure that test/cmp and this branch were |
| 716 // not separated by other instructions. | 776 // not separated by other instructions. |
| 717 | 777 |
| 718 if (instr->arch_opcode() == kMips64Tst) { | 778 if (instr->arch_opcode() == kMips64Tst) { |
| 719 switch (branch->condition) { | 779 cc = FlagsConditionToConditionTst(branch->condition); |
| 720 case kNotEqual: | |
| 721 cc = ne; | |
| 722 break; | |
| 723 case kEqual: | |
| 724 cc = eq; | |
| 725 break; | |
| 726 default: | |
| 727 UNSUPPORTED_COND(kMips64Tst, branch->condition); | |
| 728 break; | |
| 729 } | |
| 730 __ And(at, i.InputRegister(0), i.InputOperand(1)); | 780 __ And(at, i.InputRegister(0), i.InputOperand(1)); |
| 731 __ Branch(tlabel, cc, at, Operand(zero_reg)); | 781 __ Branch(tlabel, cc, at, Operand(zero_reg)); |
| 732 } else if (instr->arch_opcode() == kMips64Tst32) { | 782 } else if (instr->arch_opcode() == kMips64Tst32) { |
| 733 switch (branch->condition) { | 783 cc = FlagsConditionToConditionTst(branch->condition); |
| 734 case kNotEqual: | |
| 735 cc = ne; | |
| 736 break; | |
| 737 case kEqual: | |
| 738 cc = eq; | |
| 739 break; | |
| 740 default: | |
| 741 UNSUPPORTED_COND(kMips64Tst32, branch->condition); | |
| 742 break; | |
| 743 } | |
| 744 // Zero-extend registers on MIPS64 only 64-bit operand | 784 // Zero-extend registers on MIPS64 only 64-bit operand |
| 745 // branch and compare op. is available. | 785 // branch and compare op. is available. |
| 746 // This is a disadvantage to perform 32-bit operation on MIPS64. | 786 // This is a disadvantage to perform 32-bit operation on MIPS64. |
| 747 // Try to force globally in front-end Word64 representation to be preferred | 787 // Try to force globally in front-end Word64 representation to be preferred |
| 748 // for MIPS64 even for Word32. | 788 // for MIPS64 even for Word32. |
| 749 __ And(at, i.InputRegister(0), i.InputOperand(1)); | 789 __ And(at, i.InputRegister(0), i.InputOperand(1)); |
| 750 __ Dext(at, at, 0, 32); | 790 __ Dext(at, at, 0, 32); |
| 751 __ Branch(tlabel, cc, at, Operand(zero_reg)); | 791 __ Branch(tlabel, cc, at, Operand(zero_reg)); |
| 752 } else if (instr->arch_opcode() == kMips64Dadd || | 792 } else if (instr->arch_opcode() == kMips64Dadd || |
| 753 instr->arch_opcode() == kMips64Dsub) { | 793 instr->arch_opcode() == kMips64Dsub) { |
| 754 switch (branch->condition) { | 794 cc = FlagsConditionToConditionOvf(branch->condition); |
| 755 case kOverflow: | |
| 756 cc = ne; | |
| 757 break; | |
| 758 case kNotOverflow: | |
| 759 cc = eq; | |
| 760 break; | |
| 761 default: | |
| 762 UNSUPPORTED_COND(kMips64Dadd, branch->condition); | |
| 763 break; | |
| 764 } | |
| 765 | 795 |
| 766 __ dsra32(kScratchReg, i.OutputRegister(), 0); | 796 __ dsra32(kScratchReg, i.OutputRegister(), 0); |
| 767 __ sra(at, i.OutputRegister(), 31); | 797 __ sra(at, i.OutputRegister(), 31); |
| 768 __ Branch(tlabel, cc, at, Operand(kScratchReg)); | 798 __ Branch(tlabel, cc, at, Operand(kScratchReg)); |
| 769 } else if (instr->arch_opcode() == kMips64Cmp) { | 799 } else if (instr->arch_opcode() == kMips64Cmp) { |
| 770 switch (branch->condition) { | 800 cc = FlagsConditionToConditionCmp(branch->condition); |
| 771 case kEqual: | |
| 772 cc = eq; | |
| 773 break; | |
| 774 case kNotEqual: | |
| 775 cc = ne; | |
| 776 break; | |
| 777 case kSignedLessThan: | |
| 778 cc = lt; | |
| 779 break; | |
| 780 case kSignedGreaterThanOrEqual: | |
| 781 cc = ge; | |
| 782 break; | |
| 783 case kSignedLessThanOrEqual: | |
| 784 cc = le; | |
| 785 break; | |
| 786 case kSignedGreaterThan: | |
| 787 cc = gt; | |
| 788 break; | |
| 789 case kUnsignedLessThan: | |
| 790 cc = lo; | |
| 791 break; | |
| 792 case kUnsignedGreaterThanOrEqual: | |
| 793 cc = hs; | |
| 794 break; | |
| 795 case kUnsignedLessThanOrEqual: | |
| 796 cc = ls; | |
| 797 break; | |
| 798 case kUnsignedGreaterThan: | |
| 799 cc = hi; | |
| 800 break; | |
| 801 default: | |
| 802 UNSUPPORTED_COND(kMips64Cmp, branch->condition); | |
| 803 break; | |
| 804 } | |
| 805 __ Branch(tlabel, cc, i.InputRegister(0), i.InputOperand(1)); | 801 __ Branch(tlabel, cc, i.InputRegister(0), i.InputOperand(1)); |
| 806 | 802 |
| 807 if (!branch->fallthru) __ Branch(flabel); // no fallthru to flabel. | 803 if (!branch->fallthru) __ Branch(flabel); // no fallthru to flabel. |
| 808 | 804 |
| 809 } else if (instr->arch_opcode() == kMips64Cmp32) { | 805 } else if (instr->arch_opcode() == kMips64Cmp32) { |
| 810 switch (branch->condition) { | 806 cc = FlagsConditionToConditionCmp(branch->condition); |
| 811 case kEqual: | |
| 812 cc = eq; | |
| 813 break; | |
| 814 case kNotEqual: | |
| 815 cc = ne; | |
| 816 break; | |
| 817 case kSignedLessThan: | |
| 818 cc = lt; | |
| 819 break; | |
| 820 case kSignedGreaterThanOrEqual: | |
| 821 cc = ge; | |
| 822 break; | |
| 823 case kSignedLessThanOrEqual: | |
| 824 cc = le; | |
| 825 break; | |
| 826 case kSignedGreaterThan: | |
| 827 cc = gt; | |
| 828 break; | |
| 829 case kUnsignedLessThan: | |
| 830 cc = lo; | |
| 831 break; | |
| 832 case kUnsignedGreaterThanOrEqual: | |
| 833 cc = hs; | |
| 834 break; | |
| 835 case kUnsignedLessThanOrEqual: | |
| 836 cc = ls; | |
| 837 break; | |
| 838 case kUnsignedGreaterThan: | |
| 839 cc = hi; | |
| 840 break; | |
| 841 default: | |
| 842 UNSUPPORTED_COND(kMips64Cmp32, branch->condition); | |
| 843 break; | |
| 844 } | |
| 845 | 807 |
| 846 switch (branch->condition) { | 808 switch (branch->condition) { |
| 847 case kEqual: | 809 case kEqual: |
| 848 case kNotEqual: | 810 case kNotEqual: |
| 849 case kSignedLessThan: | 811 case kSignedLessThan: |
| 850 case kSignedGreaterThanOrEqual: | 812 case kSignedGreaterThanOrEqual: |
| 851 case kSignedLessThanOrEqual: | 813 case kSignedLessThanOrEqual: |
| 852 case kSignedGreaterThan: | 814 case kSignedGreaterThan: |
| 853 // Sign-extend registers on MIPS64 only 64-bit operand | 815 // Sign-extend registers on MIPS64 only 64-bit operand |
| 854 // branch and compare op. is available. | 816 // branch and compare op. is available. |
| (...skipping 18 matching lines...) Expand all Loading... |
| 873 break; | 835 break; |
| 874 } | 836 } |
| 875 __ Branch(tlabel, cc, i.InputRegister(0), i.InputOperand(1)); | 837 __ Branch(tlabel, cc, i.InputRegister(0), i.InputOperand(1)); |
| 876 | 838 |
| 877 if (!branch->fallthru) __ Branch(flabel); // no fallthru to flabel. | 839 if (!branch->fallthru) __ Branch(flabel); // no fallthru to flabel. |
| 878 } else if (instr->arch_opcode() == kMips64CmpD) { | 840 } else if (instr->arch_opcode() == kMips64CmpD) { |
| 879 // TODO(dusmil) optimize unordered checks to use less instructions | 841 // TODO(dusmil) optimize unordered checks to use less instructions |
| 880 // even if we have to unfold BranchF macro. | 842 // even if we have to unfold BranchF macro. |
| 881 Label* nan = flabel; | 843 Label* nan = flabel; |
| 882 switch (branch->condition) { | 844 switch (branch->condition) { |
| 883 case kUnorderedEqual: | 845 case kEqual: |
| 884 cc = eq; | 846 cc = eq; |
| 885 break; | 847 break; |
| 886 case kUnorderedNotEqual: | 848 case kNotEqual: |
| 887 cc = ne; | 849 cc = ne; |
| 888 nan = tlabel; | 850 nan = tlabel; |
| 889 break; | 851 break; |
| 890 case kUnorderedLessThan: | 852 case kUnsignedLessThan: |
| 891 cc = lt; | 853 cc = lt; |
| 892 break; | 854 break; |
| 893 case kUnorderedGreaterThanOrEqual: | 855 case kUnsignedGreaterThanOrEqual: |
| 894 cc = ge; | 856 cc = ge; |
| 895 nan = tlabel; | 857 nan = tlabel; |
| 896 break; | 858 break; |
| 897 case kUnorderedLessThanOrEqual: | 859 case kUnsignedLessThanOrEqual: |
| 898 cc = le; | 860 cc = le; |
| 899 break; | 861 break; |
| 900 case kUnorderedGreaterThan: | 862 case kUnsignedGreaterThan: |
| 901 cc = gt; | 863 cc = gt; |
| 902 nan = tlabel; | 864 nan = tlabel; |
| 903 break; | 865 break; |
| 904 default: | 866 default: |
| 905 UNSUPPORTED_COND(kMips64CmpD, branch->condition); | 867 UNSUPPORTED_COND(kMips64CmpD, branch->condition); |
| 906 break; | 868 break; |
| 907 } | 869 } |
| 908 __ BranchF(tlabel, nan, cc, i.InputDoubleRegister(0), | 870 __ BranchF(tlabel, nan, cc, i.InputDoubleRegister(0), |
| 909 i.InputDoubleRegister(1)); | 871 i.InputDoubleRegister(1)); |
| 910 | 872 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 937 | 899 |
| 938 // MIPS does not have condition code flags, so compare and branch are | 900 // MIPS does not have condition code flags, so compare and branch are |
| 939 // implemented differently than on the other arch's. The compare operations | 901 // implemented differently than on the other arch's. The compare operations |
| 940 // emit mips pseudo-instructions, which are checked and handled here. | 902 // emit mips pseudo-instructions, which are checked and handled here. |
| 941 | 903 |
| 942 // For materializations, we use delay slot to set the result true, and | 904 // For materializations, we use delay slot to set the result true, and |
| 943 // in the false case, where we fall through the branch, we reset the result | 905 // in the false case, where we fall through the branch, we reset the result |
| 944 // false. | 906 // false. |
| 945 | 907 |
| 946 if (instr->arch_opcode() == kMips64Tst) { | 908 if (instr->arch_opcode() == kMips64Tst) { |
| 947 switch (condition) { | 909 cc = FlagsConditionToConditionTst(condition); |
| 948 case kNotEqual: | |
| 949 cc = ne; | |
| 950 break; | |
| 951 case kEqual: | |
| 952 cc = eq; | |
| 953 break; | |
| 954 default: | |
| 955 UNSUPPORTED_COND(kMips64Tst, condition); | |
| 956 break; | |
| 957 } | |
| 958 __ And(at, i.InputRegister(0), i.InputOperand(1)); | 910 __ And(at, i.InputRegister(0), i.InputOperand(1)); |
| 959 __ Branch(USE_DELAY_SLOT, &done, cc, at, Operand(zero_reg)); | 911 __ Branch(USE_DELAY_SLOT, &done, cc, at, Operand(zero_reg)); |
| 960 __ li(result, Operand(1)); // In delay slot. | 912 __ li(result, Operand(1)); // In delay slot. |
| 961 } else if (instr->arch_opcode() == kMips64Tst32) { | 913 } else if (instr->arch_opcode() == kMips64Tst32) { |
| 962 switch (condition) { | 914 cc = FlagsConditionToConditionTst(condition); |
| 963 case kNotEqual: | |
| 964 cc = ne; | |
| 965 break; | |
| 966 case kEqual: | |
| 967 cc = eq; | |
| 968 break; | |
| 969 default: | |
| 970 UNSUPPORTED_COND(kMips64Tst, condition); | |
| 971 break; | |
| 972 } | |
| 973 // Zero-extend register on MIPS64 only 64-bit operand | 915 // Zero-extend register on MIPS64 only 64-bit operand |
| 974 // branch and compare op. is available. | 916 // branch and compare op. is available. |
| 975 __ And(at, i.InputRegister(0), i.InputOperand(1)); | 917 __ And(at, i.InputRegister(0), i.InputOperand(1)); |
| 976 __ Dext(at, at, 0, 32); | 918 __ Dext(at, at, 0, 32); |
| 977 __ Branch(USE_DELAY_SLOT, &done, cc, at, Operand(zero_reg)); | 919 __ Branch(USE_DELAY_SLOT, &done, cc, at, Operand(zero_reg)); |
| 978 __ li(result, Operand(1)); // In delay slot. | 920 __ li(result, Operand(1)); // In delay slot. |
| 979 } else if (instr->arch_opcode() == kMips64Dadd || | 921 } else if (instr->arch_opcode() == kMips64Dadd || |
| 980 instr->arch_opcode() == kMips64Dsub) { | 922 instr->arch_opcode() == kMips64Dsub) { |
| 981 switch (condition) { | 923 cc = FlagsConditionToConditionOvf(condition); |
| 982 case kOverflow: | |
| 983 cc = ne; | |
| 984 break; | |
| 985 case kNotOverflow: | |
| 986 cc = eq; | |
| 987 break; | |
| 988 default: | |
| 989 UNSUPPORTED_COND(kMips64DAdd, condition); | |
| 990 break; | |
| 991 } | |
| 992 __ dsra32(kScratchReg, i.OutputRegister(), 0); | 924 __ dsra32(kScratchReg, i.OutputRegister(), 0); |
| 993 __ sra(at, i.OutputRegister(), 31); | 925 __ sra(at, i.OutputRegister(), 31); |
| 994 __ Branch(USE_DELAY_SLOT, &done, cc, at, Operand(kScratchReg)); | 926 __ Branch(USE_DELAY_SLOT, &done, cc, at, Operand(kScratchReg)); |
| 995 __ li(result, Operand(1)); // In delay slot. | 927 __ li(result, Operand(1)); // In delay slot. |
| 996 } else if (instr->arch_opcode() == kMips64Cmp) { | 928 } else if (instr->arch_opcode() == kMips64Cmp) { |
| 997 Register left = i.InputRegister(0); | 929 Register left = i.InputRegister(0); |
| 998 Operand right = i.InputOperand(1); | 930 Operand right = i.InputOperand(1); |
| 999 switch (condition) { | 931 cc = FlagsConditionToConditionCmp(condition); |
| 1000 case kEqual: | |
| 1001 cc = eq; | |
| 1002 break; | |
| 1003 case kNotEqual: | |
| 1004 cc = ne; | |
| 1005 break; | |
| 1006 case kSignedLessThan: | |
| 1007 cc = lt; | |
| 1008 break; | |
| 1009 case kSignedGreaterThanOrEqual: | |
| 1010 cc = ge; | |
| 1011 break; | |
| 1012 case kSignedLessThanOrEqual: | |
| 1013 cc = le; | |
| 1014 break; | |
| 1015 case kSignedGreaterThan: | |
| 1016 cc = gt; | |
| 1017 break; | |
| 1018 case kUnsignedLessThan: | |
| 1019 cc = lo; | |
| 1020 break; | |
| 1021 case kUnsignedGreaterThanOrEqual: | |
| 1022 cc = hs; | |
| 1023 break; | |
| 1024 case kUnsignedLessThanOrEqual: | |
| 1025 cc = ls; | |
| 1026 break; | |
| 1027 case kUnsignedGreaterThan: | |
| 1028 cc = hi; | |
| 1029 break; | |
| 1030 default: | |
| 1031 UNSUPPORTED_COND(kMips64Cmp, condition); | |
| 1032 break; | |
| 1033 } | |
| 1034 __ Branch(USE_DELAY_SLOT, &done, cc, left, right); | 932 __ Branch(USE_DELAY_SLOT, &done, cc, left, right); |
| 1035 __ li(result, Operand(1)); // In delay slot. | 933 __ li(result, Operand(1)); // In delay slot. |
| 1036 } else if (instr->arch_opcode() == kMips64Cmp32) { | 934 } else if (instr->arch_opcode() == kMips64Cmp32) { |
| 1037 Register left = i.InputRegister(0); | 935 Register left = i.InputRegister(0); |
| 1038 Operand right = i.InputOperand(1); | 936 Operand right = i.InputOperand(1); |
| 1039 switch (condition) { | 937 cc = FlagsConditionToConditionCmp(condition); |
| 1040 case kEqual: | |
| 1041 cc = eq; | |
| 1042 break; | |
| 1043 case kNotEqual: | |
| 1044 cc = ne; | |
| 1045 break; | |
| 1046 case kSignedLessThan: | |
| 1047 cc = lt; | |
| 1048 break; | |
| 1049 case kSignedGreaterThanOrEqual: | |
| 1050 cc = ge; | |
| 1051 break; | |
| 1052 case kSignedLessThanOrEqual: | |
| 1053 cc = le; | |
| 1054 break; | |
| 1055 case kSignedGreaterThan: | |
| 1056 cc = gt; | |
| 1057 break; | |
| 1058 case kUnsignedLessThan: | |
| 1059 cc = lo; | |
| 1060 break; | |
| 1061 case kUnsignedGreaterThanOrEqual: | |
| 1062 cc = hs; | |
| 1063 break; | |
| 1064 case kUnsignedLessThanOrEqual: | |
| 1065 cc = ls; | |
| 1066 break; | |
| 1067 case kUnsignedGreaterThan: | |
| 1068 cc = hi; | |
| 1069 break; | |
| 1070 default: | |
| 1071 UNSUPPORTED_COND(kMips64Cmp, condition); | |
| 1072 break; | |
| 1073 } | |
| 1074 | 938 |
| 1075 switch (condition) { | 939 switch (condition) { |
| 1076 case kEqual: | 940 case kEqual: |
| 1077 case kNotEqual: | 941 case kNotEqual: |
| 1078 case kSignedLessThan: | 942 case kSignedLessThan: |
| 1079 case kSignedGreaterThanOrEqual: | 943 case kSignedGreaterThanOrEqual: |
| 1080 case kSignedLessThanOrEqual: | 944 case kSignedLessThanOrEqual: |
| 1081 case kSignedGreaterThan: | 945 case kSignedGreaterThan: |
| 1082 // Sign-extend registers on MIPS64 only 64-bit operand | 946 // Sign-extend registers on MIPS64 only 64-bit operand |
| 1083 // branch and compare op. is available. | 947 // branch and compare op. is available. |
| (...skipping 20 matching lines...) Expand all Loading... |
| 1104 __ Branch(USE_DELAY_SLOT, &done, cc, left, right); | 968 __ Branch(USE_DELAY_SLOT, &done, cc, left, right); |
| 1105 __ li(result, Operand(1)); // In delay slot. | 969 __ li(result, Operand(1)); // In delay slot. |
| 1106 } else if (instr->arch_opcode() == kMips64CmpD) { | 970 } else if (instr->arch_opcode() == kMips64CmpD) { |
| 1107 FPURegister left = i.InputDoubleRegister(0); | 971 FPURegister left = i.InputDoubleRegister(0); |
| 1108 FPURegister right = i.InputDoubleRegister(1); | 972 FPURegister right = i.InputDoubleRegister(1); |
| 1109 // TODO(plind): Provide NaN-testing macro-asm function without need for | 973 // TODO(plind): Provide NaN-testing macro-asm function without need for |
| 1110 // BranchF. | 974 // BranchF. |
| 1111 FPURegister dummy1 = f0; | 975 FPURegister dummy1 = f0; |
| 1112 FPURegister dummy2 = f2; | 976 FPURegister dummy2 = f2; |
| 1113 switch (condition) { | 977 switch (condition) { |
| 1114 case kUnorderedEqual: | 978 case kEqual: |
| 1115 // TODO(plind): improve the NaN testing throughout this function. | 979 // TODO(plind): improve the NaN testing throughout this function. |
| 1116 __ BranchF(NULL, &false_value, kNoCondition, dummy1, dummy2); | 980 __ BranchF(NULL, &false_value, kNoCondition, dummy1, dummy2); |
| 1117 cc = eq; | 981 cc = eq; |
| 1118 break; | 982 break; |
| 1119 case kUnorderedNotEqual: | 983 case kNotEqual: |
| 1120 __ BranchF(USE_DELAY_SLOT, NULL, &done, kNoCondition, dummy1, dummy2); | 984 __ BranchF(USE_DELAY_SLOT, NULL, &done, kNoCondition, dummy1, dummy2); |
| 1121 __ li(result, Operand(1)); // In delay slot - returns 1 on NaN. | 985 __ li(result, Operand(1)); // In delay slot - returns 1 on NaN. |
| 1122 cc = ne; | 986 cc = ne; |
| 1123 break; | 987 break; |
| 1124 case kUnorderedLessThan: | 988 case kUnsignedLessThan: |
| 1125 __ BranchF(NULL, &false_value, kNoCondition, dummy1, dummy2); | 989 __ BranchF(NULL, &false_value, kNoCondition, dummy1, dummy2); |
| 1126 cc = lt; | 990 cc = lt; |
| 1127 break; | 991 break; |
| 1128 case kUnorderedGreaterThanOrEqual: | 992 case kUnsignedGreaterThanOrEqual: |
| 1129 __ BranchF(USE_DELAY_SLOT, NULL, &done, kNoCondition, dummy1, dummy2); | 993 __ BranchF(USE_DELAY_SLOT, NULL, &done, kNoCondition, dummy1, dummy2); |
| 1130 __ li(result, Operand(1)); // In delay slot - returns 1 on NaN. | 994 __ li(result, Operand(1)); // In delay slot - returns 1 on NaN. |
| 1131 cc = ge; | 995 cc = ge; |
| 1132 break; | 996 break; |
| 1133 case kUnorderedLessThanOrEqual: | 997 case kUnsignedLessThanOrEqual: |
| 1134 __ BranchF(NULL, &false_value, kNoCondition, dummy1, dummy2); | 998 __ BranchF(NULL, &false_value, kNoCondition, dummy1, dummy2); |
| 1135 cc = le; | 999 cc = le; |
| 1136 break; | 1000 break; |
| 1137 case kUnorderedGreaterThan: | 1001 case kUnsignedGreaterThan: |
| 1138 __ BranchF(USE_DELAY_SLOT, NULL, &done, kNoCondition, dummy1, dummy2); | 1002 __ BranchF(USE_DELAY_SLOT, NULL, &done, kNoCondition, dummy1, dummy2); |
| 1139 __ li(result, Operand(1)); // In delay slot - returns 1 on NaN. | 1003 __ li(result, Operand(1)); // In delay slot - returns 1 on NaN. |
| 1140 cc = gt; | 1004 cc = gt; |
| 1141 break; | 1005 break; |
| 1142 default: | 1006 default: |
| 1143 UNSUPPORTED_COND(kMips64Cmp, condition); | 1007 UNSUPPORTED_COND(kMips64Cmp, condition); |
| 1144 break; | 1008 break; |
| 1145 } | 1009 } |
| 1146 __ BranchF(USE_DELAY_SLOT, &done, NULL, cc, left, right); | 1010 __ BranchF(USE_DELAY_SLOT, &done, NULL, cc, left, right); |
| 1147 __ li(result, Operand(1)); // In delay slot - branch taken returns 1. | 1011 __ li(result, Operand(1)); // In delay slot - branch taken returns 1. |
| (...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1453 } | 1317 } |
| 1454 } | 1318 } |
| 1455 MarkLazyDeoptSite(); | 1319 MarkLazyDeoptSite(); |
| 1456 } | 1320 } |
| 1457 | 1321 |
| 1458 #undef __ | 1322 #undef __ |
| 1459 | 1323 |
| 1460 } // namespace compiler | 1324 } // namespace compiler |
| 1461 } // namespace internal | 1325 } // namespace internal |
| 1462 } // namespace v8 | 1326 } // namespace v8 |
| OLD | NEW |