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 856 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
867 | 867 |
868 F_CVT f = FUNCTION_CAST<F_CVT>(code->entry()); | 868 F_CVT f = FUNCTION_CAST<F_CVT>(code->entry()); |
869 | 869 |
870 int64_t r = | 870 int64_t r = |
871 reinterpret_cast<int64_t>(CALL_GENERATED_CODE(isolate, f, 0, 0, 0, 0, 0)); | 871 reinterpret_cast<int64_t>(CALL_GENERATED_CODE(isolate, f, 0, 0, 0, 0, 0)); |
872 | 872 |
873 DCHECK(r == 0 || r == 1); | 873 DCHECK(r == 0 || r == 1); |
874 return r; | 874 return r; |
875 } | 875 } |
876 | 876 |
| 877 TEST(BranchOverflowInt32BothLabelsTrampoline) { |
| 878 if (kArchVariant != kMips64r6) return; |
| 879 static const int kMaxBranchOffset = (1 << (18 - 1)) - 1; |
| 880 |
| 881 FOR_INT32_INPUTS(i, overflow_int32_test_values) { |
| 882 FOR_INT32_INPUTS(j, overflow_int32_test_values) { |
| 883 FOR_ENUM_INPUTS(br, OverflowBranchType, overflow_branch_type) { |
| 884 FOR_STRUCT_INPUTS(regComb, OverflowRegisterCombination, |
| 885 overflow_register_combination) { |
| 886 int32_t ii = *i; |
| 887 int32_t jj = *j; |
| 888 enum OverflowBranchType branchType = *br; |
| 889 struct OverflowRegisterCombination rc = *regComb; |
| 890 |
| 891 // If left and right register are same then left and right |
| 892 // test values must also be same, otherwise we skip the test |
| 893 if (rc.left.code() == rc.right.code()) { |
| 894 if (ii != jj) { |
| 895 continue; |
| 896 } |
| 897 } |
| 898 |
| 899 bool res1 = runOverflow<int32_t>( |
| 900 ii, jj, [branchType, rc](MacroAssembler* masm, int32_t valLeft, |
| 901 int32_t valRight) { |
| 902 Label overflow, no_overflow, end; |
| 903 __ li(rc.left, valLeft); |
| 904 __ li(rc.right, valRight); |
| 905 switch (branchType) { |
| 906 case kAddBranchOverflow: |
| 907 __ AddBranchOvf(rc.dst, rc.left, rc.right, &overflow, |
| 908 &no_overflow, rc.scratch); |
| 909 break; |
| 910 case kSubBranchOverflow: |
| 911 __ SubBranchOvf(rc.dst, rc.left, rc.right, &overflow, |
| 912 &no_overflow, rc.scratch); |
| 913 break; |
| 914 } |
| 915 |
| 916 Label done; |
| 917 size_t nr_calls = |
| 918 kMaxBranchOffset / (2 * Instruction::kInstrSize) + 2; |
| 919 for (size_t i = 0; i < nr_calls; ++i) { |
| 920 __ BranchShort(&done, eq, a0, Operand(a1)); |
| 921 } |
| 922 __ bind(&done); |
| 923 |
| 924 __ li(v0, 2); |
| 925 __ Branch(&end); |
| 926 __ bind(&overflow); |
| 927 __ li(v0, 1); |
| 928 __ Branch(&end); |
| 929 __ bind(&no_overflow); |
| 930 __ li(v0, 0); |
| 931 __ bind(&end); |
| 932 }); |
| 933 |
| 934 switch (branchType) { |
| 935 case kAddBranchOverflow: |
| 936 CHECK_EQ(IsAddOverflow<int32_t>(ii, jj), res1); |
| 937 break; |
| 938 case kSubBranchOverflow: |
| 939 CHECK_EQ(IsSubOverflow<int32_t>(ii, jj), res1); |
| 940 break; |
| 941 default: |
| 942 UNREACHABLE(); |
| 943 } |
| 944 } |
| 945 } |
| 946 } |
| 947 } |
| 948 } |
| 949 |
877 TEST(BranchOverflowInt32BothLabels) { | 950 TEST(BranchOverflowInt32BothLabels) { |
878 FOR_INT32_INPUTS(i, overflow_int32_test_values) { | 951 FOR_INT32_INPUTS(i, overflow_int32_test_values) { |
879 FOR_INT32_INPUTS(j, overflow_int32_test_values) { | 952 FOR_INT32_INPUTS(j, overflow_int32_test_values) { |
880 FOR_ENUM_INPUTS(br, OverflowBranchType, overflow_branch_type) { | 953 FOR_ENUM_INPUTS(br, OverflowBranchType, overflow_branch_type) { |
881 FOR_STRUCT_INPUTS(regComb, OverflowRegisterCombination, | 954 FOR_STRUCT_INPUTS(regComb, OverflowRegisterCombination, |
882 overflow_register_combination) { | 955 overflow_register_combination) { |
883 int32_t ii = *i; | 956 int32_t ii = *i; |
884 int32_t jj = *j; | 957 int32_t jj = *j; |
885 enum OverflowBranchType branchType = *br; | 958 enum OverflowBranchType branchType = *br; |
886 struct OverflowRegisterCombination rc = *regComb; | 959 struct OverflowRegisterCombination rc = *regComb; |
(...skipping 935 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1822 int32_t out_offset) { | 1895 int32_t out_offset) { |
1823 __ Uldc1(f0, MemOperand(a0, in_offset), t0); | 1896 __ Uldc1(f0, MemOperand(a0, in_offset), t0); |
1824 __ Usdc1(f0, MemOperand(a0, out_offset), t0); | 1897 __ Usdc1(f0, MemOperand(a0, out_offset), t0); |
1825 })); | 1898 })); |
1826 } | 1899 } |
1827 } | 1900 } |
1828 } | 1901 } |
1829 } | 1902 } |
1830 | 1903 |
1831 #undef __ | 1904 #undef __ |
OLD | NEW |