| 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 |
| 208 Condition FlagsConditionToConditionCmp(FlagsCondition condition) { |
| 209 switch (condition) { |
| 210 case kEqual: |
| 211 return eq; |
| 212 break; |
| 213 case kNotEqual: |
| 214 return ne; |
| 215 break; |
| 216 case kSignedLessThan: |
| 217 return lt; |
| 218 break; |
| 219 case kSignedGreaterThanOrEqual: |
| 220 return ge; |
| 221 break; |
| 222 case kSignedLessThanOrEqual: |
| 223 return le; |
| 224 break; |
| 225 case kSignedGreaterThan: |
| 226 return gt; |
| 227 break; |
| 228 case kUnsignedLessThan: |
| 229 return lo; |
| 230 break; |
| 231 case kUnsignedGreaterThanOrEqual: |
| 232 return hs; |
| 233 break; |
| 234 case kUnsignedLessThanOrEqual: |
| 235 return ls; |
| 236 break; |
| 237 case kUnsignedGreaterThan: |
| 238 return hi; |
| 239 break; |
| 240 default: |
| 241 break; |
| 242 } |
| 243 UNREACHABLE(); |
| 244 return kNoCondition; |
| 245 } |
| 246 |
| 247 |
| 248 Condition FlagsConditionToConditionTst(FlagsCondition condition) { |
| 249 switch (condition) { |
| 250 case kNotEqual: |
| 251 return ne; |
| 252 break; |
| 253 case kEqual: |
| 254 return eq; |
| 255 break; |
| 256 default: |
| 257 break; |
| 258 } |
| 259 UNREACHABLE(); |
| 260 return kNoCondition; |
| 261 } |
| 262 |
| 263 |
| 264 Condition FlagsConditionToConditionOvf(FlagsCondition condition) { |
| 265 switch (condition) { |
| 266 case kOverflow: |
| 267 return ne; |
| 268 break; |
| 269 case kNotOverflow: |
| 270 return eq; |
| 271 break; |
| 272 default: |
| 273 break; |
| 274 } |
| 275 UNREACHABLE(); |
| 276 return kNoCondition; |
| 277 } |
| 278 |
| 207 } // namespace | 279 } // namespace |
| 208 | 280 |
| 209 | 281 |
| 210 #define ASSEMBLE_CHECKED_LOAD_FLOAT(width, asm_instr) \ | 282 #define ASSEMBLE_CHECKED_LOAD_FLOAT(width, asm_instr) \ |
| 211 do { \ | 283 do { \ |
| 212 auto result = i.Output##width##Register(); \ | 284 auto result = i.Output##width##Register(); \ |
| 213 auto ool = new (zone()) OutOfLineLoad##width(this, result); \ | 285 auto ool = new (zone()) OutOfLineLoad##width(this, result); \ |
| 214 if (instr->InputAt(0)->IsRegister()) { \ | 286 if (instr->InputAt(0)->IsRegister()) { \ |
| 215 auto offset = i.InputRegister(0); \ | 287 auto offset = i.InputRegister(0); \ |
| 216 __ Branch(USE_DELAY_SLOT, ool->entry(), hs, offset, i.InputOperand(1)); \ | 288 __ 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 | 781 // MIPS does not have condition code flags, so compare and branch are |
| 710 // implemented differently than on the other arch's. The compare operations | 782 // implemented differently than on the other arch's. The compare operations |
| 711 // emit mips psuedo-instructions, which are handled here by branch | 783 // emit mips psuedo-instructions, which are handled here by branch |
| 712 // instructions that do the actual comparison. Essential that the input | 784 // instructions that do the actual comparison. Essential that the input |
| 713 // registers to compare psuedo-op are not modified before this branch op, as | 785 // registers to compare psuedo-op are not modified before this branch op, as |
| 714 // they are tested here. | 786 // they are tested here. |
| 715 // TODO(plind): Add CHECK() to ensure that test/cmp and this branch were | 787 // TODO(plind): Add CHECK() to ensure that test/cmp and this branch were |
| 716 // not separated by other instructions. | 788 // not separated by other instructions. |
| 717 | 789 |
| 718 if (instr->arch_opcode() == kMips64Tst) { | 790 if (instr->arch_opcode() == kMips64Tst) { |
| 719 switch (branch->condition) { | 791 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)); | 792 __ And(at, i.InputRegister(0), i.InputOperand(1)); |
| 731 __ Branch(tlabel, cc, at, Operand(zero_reg)); | 793 __ Branch(tlabel, cc, at, Operand(zero_reg)); |
| 732 } else if (instr->arch_opcode() == kMips64Tst32) { | 794 } else if (instr->arch_opcode() == kMips64Tst32) { |
| 733 switch (branch->condition) { | 795 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 | 796 // Zero-extend registers on MIPS64 only 64-bit operand |
| 745 // branch and compare op. is available. | 797 // branch and compare op. is available. |
| 746 // This is a disadvantage to perform 32-bit operation on MIPS64. | 798 // This is a disadvantage to perform 32-bit operation on MIPS64. |
| 747 // Try to force globally in front-end Word64 representation to be preferred | 799 // Try to force globally in front-end Word64 representation to be preferred |
| 748 // for MIPS64 even for Word32. | 800 // for MIPS64 even for Word32. |
| 749 __ And(at, i.InputRegister(0), i.InputOperand(1)); | 801 __ And(at, i.InputRegister(0), i.InputOperand(1)); |
| 750 __ Dext(at, at, 0, 32); | 802 __ Dext(at, at, 0, 32); |
| 751 __ Branch(tlabel, cc, at, Operand(zero_reg)); | 803 __ Branch(tlabel, cc, at, Operand(zero_reg)); |
| 752 } else if (instr->arch_opcode() == kMips64Dadd || | 804 } else if (instr->arch_opcode() == kMips64Dadd || |
| 753 instr->arch_opcode() == kMips64Dsub) { | 805 instr->arch_opcode() == kMips64Dsub) { |
| 754 switch (branch->condition) { | 806 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 | 807 |
| 766 __ dsra32(kScratchReg, i.OutputRegister(), 0); | 808 __ dsra32(kScratchReg, i.OutputRegister(), 0); |
| 767 __ sra(at, i.OutputRegister(), 31); | 809 __ sra(at, i.OutputRegister(), 31); |
| 768 __ Branch(tlabel, cc, at, Operand(kScratchReg)); | 810 __ Branch(tlabel, cc, at, Operand(kScratchReg)); |
| 769 } else if (instr->arch_opcode() == kMips64Cmp) { | 811 } else if (instr->arch_opcode() == kMips64Cmp) { |
| 770 switch (branch->condition) { | 812 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)); | 813 __ Branch(tlabel, cc, i.InputRegister(0), i.InputOperand(1)); |
| 806 | 814 |
| 807 if (!branch->fallthru) __ Branch(flabel); // no fallthru to flabel. | 815 if (!branch->fallthru) __ Branch(flabel); // no fallthru to flabel. |
| 808 | 816 |
| 809 } else if (instr->arch_opcode() == kMips64Cmp32) { | 817 } else if (instr->arch_opcode() == kMips64Cmp32) { |
| 810 switch (branch->condition) { | 818 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 | 819 |
| 846 switch (branch->condition) { | 820 switch (branch->condition) { |
| 847 case kEqual: | 821 case kEqual: |
| 848 case kNotEqual: | 822 case kNotEqual: |
| 849 case kSignedLessThan: | 823 case kSignedLessThan: |
| 850 case kSignedGreaterThanOrEqual: | 824 case kSignedGreaterThanOrEqual: |
| 851 case kSignedLessThanOrEqual: | 825 case kSignedLessThanOrEqual: |
| 852 case kSignedGreaterThan: | 826 case kSignedGreaterThan: |
| 853 // Sign-extend registers on MIPS64 only 64-bit operand | 827 // Sign-extend registers on MIPS64 only 64-bit operand |
| 854 // branch and compare op. is available. | 828 // branch and compare op. is available. |
| (...skipping 18 matching lines...) Expand all Loading... |
| 873 break; | 847 break; |
| 874 } | 848 } |
| 875 __ Branch(tlabel, cc, i.InputRegister(0), i.InputOperand(1)); | 849 __ Branch(tlabel, cc, i.InputRegister(0), i.InputOperand(1)); |
| 876 | 850 |
| 877 if (!branch->fallthru) __ Branch(flabel); // no fallthru to flabel. | 851 if (!branch->fallthru) __ Branch(flabel); // no fallthru to flabel. |
| 878 } else if (instr->arch_opcode() == kMips64CmpD) { | 852 } else if (instr->arch_opcode() == kMips64CmpD) { |
| 879 // TODO(dusmil) optimize unordered checks to use less instructions | 853 // TODO(dusmil) optimize unordered checks to use less instructions |
| 880 // even if we have to unfold BranchF macro. | 854 // even if we have to unfold BranchF macro. |
| 881 Label* nan = flabel; | 855 Label* nan = flabel; |
| 882 switch (branch->condition) { | 856 switch (branch->condition) { |
| 883 case kUnorderedEqual: | 857 case kEqual: |
| 884 cc = eq; | 858 cc = eq; |
| 885 break; | 859 break; |
| 886 case kUnorderedNotEqual: | 860 case kNotEqual: |
| 887 cc = ne; | 861 cc = ne; |
| 888 nan = tlabel; | 862 nan = tlabel; |
| 889 break; | 863 break; |
| 890 case kUnorderedLessThan: | 864 case kUnsignedLessThan: |
| 891 cc = lt; | 865 cc = lt; |
| 892 break; | 866 break; |
| 893 case kUnorderedGreaterThanOrEqual: | 867 case kUnsignedGreaterThanOrEqual: |
| 894 cc = ge; | 868 cc = ge; |
| 895 nan = tlabel; | 869 nan = tlabel; |
| 896 break; | 870 break; |
| 897 case kUnorderedLessThanOrEqual: | 871 case kUnsignedLessThanOrEqual: |
| 898 cc = le; | 872 cc = le; |
| 899 break; | 873 break; |
| 900 case kUnorderedGreaterThan: | 874 case kUnsignedGreaterThan: |
| 901 cc = gt; | 875 cc = gt; |
| 902 nan = tlabel; | 876 nan = tlabel; |
| 903 break; | 877 break; |
| 904 default: | 878 default: |
| 905 UNSUPPORTED_COND(kMips64CmpD, branch->condition); | 879 UNSUPPORTED_COND(kMips64CmpD, branch->condition); |
| 906 break; | 880 break; |
| 907 } | 881 } |
| 908 __ BranchF(tlabel, nan, cc, i.InputDoubleRegister(0), | 882 __ BranchF(tlabel, nan, cc, i.InputDoubleRegister(0), |
| 909 i.InputDoubleRegister(1)); | 883 i.InputDoubleRegister(1)); |
| 910 | 884 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 937 | 911 |
| 938 // MIPS does not have condition code flags, so compare and branch are | 912 // MIPS does not have condition code flags, so compare and branch are |
| 939 // implemented differently than on the other arch's. The compare operations | 913 // implemented differently than on the other arch's. The compare operations |
| 940 // emit mips pseudo-instructions, which are checked and handled here. | 914 // emit mips pseudo-instructions, which are checked and handled here. |
| 941 | 915 |
| 942 // For materializations, we use delay slot to set the result true, and | 916 // 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 | 917 // in the false case, where we fall through the branch, we reset the result |
| 944 // false. | 918 // false. |
| 945 | 919 |
| 946 if (instr->arch_opcode() == kMips64Tst) { | 920 if (instr->arch_opcode() == kMips64Tst) { |
| 947 switch (condition) { | 921 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)); | 922 __ And(at, i.InputRegister(0), i.InputOperand(1)); |
| 959 __ Branch(USE_DELAY_SLOT, &done, cc, at, Operand(zero_reg)); | 923 __ Branch(USE_DELAY_SLOT, &done, cc, at, Operand(zero_reg)); |
| 960 __ li(result, Operand(1)); // In delay slot. | 924 __ li(result, Operand(1)); // In delay slot. |
| 961 } else if (instr->arch_opcode() == kMips64Tst32) { | 925 } else if (instr->arch_opcode() == kMips64Tst32) { |
| 962 switch (condition) { | 926 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 | 927 // Zero-extend register on MIPS64 only 64-bit operand |
| 974 // branch and compare op. is available. | 928 // branch and compare op. is available. |
| 975 __ And(at, i.InputRegister(0), i.InputOperand(1)); | 929 __ And(at, i.InputRegister(0), i.InputOperand(1)); |
| 976 __ Dext(at, at, 0, 32); | 930 __ Dext(at, at, 0, 32); |
| 977 __ Branch(USE_DELAY_SLOT, &done, cc, at, Operand(zero_reg)); | 931 __ Branch(USE_DELAY_SLOT, &done, cc, at, Operand(zero_reg)); |
| 978 __ li(result, Operand(1)); // In delay slot. | 932 __ li(result, Operand(1)); // In delay slot. |
| 979 } else if (instr->arch_opcode() == kMips64Dadd || | 933 } else if (instr->arch_opcode() == kMips64Dadd || |
| 980 instr->arch_opcode() == kMips64Dsub) { | 934 instr->arch_opcode() == kMips64Dsub) { |
| 981 switch (condition) { | 935 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); | 936 __ dsra32(kScratchReg, i.OutputRegister(), 0); |
| 993 __ sra(at, i.OutputRegister(), 31); | 937 __ sra(at, i.OutputRegister(), 31); |
| 994 __ Branch(USE_DELAY_SLOT, &done, cc, at, Operand(kScratchReg)); | 938 __ Branch(USE_DELAY_SLOT, &done, cc, at, Operand(kScratchReg)); |
| 995 __ li(result, Operand(1)); // In delay slot. | 939 __ li(result, Operand(1)); // In delay slot. |
| 996 } else if (instr->arch_opcode() == kMips64Cmp) { | 940 } else if (instr->arch_opcode() == kMips64Cmp) { |
| 997 Register left = i.InputRegister(0); | 941 Register left = i.InputRegister(0); |
| 998 Operand right = i.InputOperand(1); | 942 Operand right = i.InputOperand(1); |
| 999 switch (condition) { | 943 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); | 944 __ Branch(USE_DELAY_SLOT, &done, cc, left, right); |
| 1035 __ li(result, Operand(1)); // In delay slot. | 945 __ li(result, Operand(1)); // In delay slot. |
| 1036 } else if (instr->arch_opcode() == kMips64Cmp32) { | 946 } else if (instr->arch_opcode() == kMips64Cmp32) { |
| 1037 Register left = i.InputRegister(0); | 947 Register left = i.InputRegister(0); |
| 1038 Operand right = i.InputOperand(1); | 948 Operand right = i.InputOperand(1); |
| 1039 switch (condition) { | 949 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 | 950 |
| 1075 switch (condition) { | 951 switch (condition) { |
| 1076 case kEqual: | 952 case kEqual: |
| 1077 case kNotEqual: | 953 case kNotEqual: |
| 1078 case kSignedLessThan: | 954 case kSignedLessThan: |
| 1079 case kSignedGreaterThanOrEqual: | 955 case kSignedGreaterThanOrEqual: |
| 1080 case kSignedLessThanOrEqual: | 956 case kSignedLessThanOrEqual: |
| 1081 case kSignedGreaterThan: | 957 case kSignedGreaterThan: |
| 1082 // Sign-extend registers on MIPS64 only 64-bit operand | 958 // Sign-extend registers on MIPS64 only 64-bit operand |
| 1083 // branch and compare op. is available. | 959 // branch and compare op. is available. |
| (...skipping 20 matching lines...) Expand all Loading... |
| 1104 __ Branch(USE_DELAY_SLOT, &done, cc, left, right); | 980 __ Branch(USE_DELAY_SLOT, &done, cc, left, right); |
| 1105 __ li(result, Operand(1)); // In delay slot. | 981 __ li(result, Operand(1)); // In delay slot. |
| 1106 } else if (instr->arch_opcode() == kMips64CmpD) { | 982 } else if (instr->arch_opcode() == kMips64CmpD) { |
| 1107 FPURegister left = i.InputDoubleRegister(0); | 983 FPURegister left = i.InputDoubleRegister(0); |
| 1108 FPURegister right = i.InputDoubleRegister(1); | 984 FPURegister right = i.InputDoubleRegister(1); |
| 1109 // TODO(plind): Provide NaN-testing macro-asm function without need for | 985 // TODO(plind): Provide NaN-testing macro-asm function without need for |
| 1110 // BranchF. | 986 // BranchF. |
| 1111 FPURegister dummy1 = f0; | 987 FPURegister dummy1 = f0; |
| 1112 FPURegister dummy2 = f2; | 988 FPURegister dummy2 = f2; |
| 1113 switch (condition) { | 989 switch (condition) { |
| 1114 case kUnorderedEqual: | 990 case kEqual: |
| 1115 // TODO(plind): improve the NaN testing throughout this function. | 991 // TODO(plind): improve the NaN testing throughout this function. |
| 1116 __ BranchF(NULL, &false_value, kNoCondition, dummy1, dummy2); | 992 __ BranchF(NULL, &false_value, kNoCondition, dummy1, dummy2); |
| 1117 cc = eq; | 993 cc = eq; |
| 1118 break; | 994 break; |
| 1119 case kUnorderedNotEqual: | 995 case kNotEqual: |
| 1120 __ BranchF(USE_DELAY_SLOT, NULL, &done, kNoCondition, dummy1, dummy2); | 996 __ BranchF(USE_DELAY_SLOT, NULL, &done, kNoCondition, dummy1, dummy2); |
| 1121 __ li(result, Operand(1)); // In delay slot - returns 1 on NaN. | 997 __ li(result, Operand(1)); // In delay slot - returns 1 on NaN. |
| 1122 cc = ne; | 998 cc = ne; |
| 1123 break; | 999 break; |
| 1124 case kUnorderedLessThan: | 1000 case kUnsignedLessThan: |
| 1125 __ BranchF(NULL, &false_value, kNoCondition, dummy1, dummy2); | 1001 __ BranchF(NULL, &false_value, kNoCondition, dummy1, dummy2); |
| 1126 cc = lt; | 1002 cc = lt; |
| 1127 break; | 1003 break; |
| 1128 case kUnorderedGreaterThanOrEqual: | 1004 case kUnsignedGreaterThanOrEqual: |
| 1129 __ BranchF(USE_DELAY_SLOT, NULL, &done, kNoCondition, dummy1, dummy2); | 1005 __ BranchF(USE_DELAY_SLOT, NULL, &done, kNoCondition, dummy1, dummy2); |
| 1130 __ li(result, Operand(1)); // In delay slot - returns 1 on NaN. | 1006 __ li(result, Operand(1)); // In delay slot - returns 1 on NaN. |
| 1131 cc = ge; | 1007 cc = ge; |
| 1132 break; | 1008 break; |
| 1133 case kUnorderedLessThanOrEqual: | 1009 case kUnsignedLessThanOrEqual: |
| 1134 __ BranchF(NULL, &false_value, kNoCondition, dummy1, dummy2); | 1010 __ BranchF(NULL, &false_value, kNoCondition, dummy1, dummy2); |
| 1135 cc = le; | 1011 cc = le; |
| 1136 break; | 1012 break; |
| 1137 case kUnorderedGreaterThan: | 1013 case kUnsignedGreaterThan: |
| 1138 __ BranchF(USE_DELAY_SLOT, NULL, &done, kNoCondition, dummy1, dummy2); | 1014 __ BranchF(USE_DELAY_SLOT, NULL, &done, kNoCondition, dummy1, dummy2); |
| 1139 __ li(result, Operand(1)); // In delay slot - returns 1 on NaN. | 1015 __ li(result, Operand(1)); // In delay slot - returns 1 on NaN. |
| 1140 cc = gt; | 1016 cc = gt; |
| 1141 break; | 1017 break; |
| 1142 default: | 1018 default: |
| 1143 UNSUPPORTED_COND(kMips64Cmp, condition); | 1019 UNSUPPORTED_COND(kMips64Cmp, condition); |
| 1144 break; | 1020 break; |
| 1145 } | 1021 } |
| 1146 __ BranchF(USE_DELAY_SLOT, &done, NULL, cc, left, right); | 1022 __ BranchF(USE_DELAY_SLOT, &done, NULL, cc, left, right); |
| 1147 __ li(result, Operand(1)); // In delay slot - branch taken returns 1. | 1023 __ 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 } | 1329 } |
| 1454 } | 1330 } |
| 1455 MarkLazyDeoptSite(); | 1331 MarkLazyDeoptSite(); |
| 1456 } | 1332 } |
| 1457 | 1333 |
| 1458 #undef __ | 1334 #undef __ |
| 1459 | 1335 |
| 1460 } // namespace compiler | 1336 } // namespace compiler |
| 1461 } // namespace internal | 1337 } // namespace internal |
| 1462 } // namespace v8 | 1338 } // namespace v8 |
| OLD | NEW |