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 616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
627 | 627 |
628 F_CVT f = FUNCTION_CAST<F_CVT>(code->entry()); | 628 F_CVT f = FUNCTION_CAST<F_CVT>(code->entry()); |
629 | 629 |
630 int32_t r = | 630 int32_t r = |
631 reinterpret_cast<int32_t>(CALL_GENERATED_CODE(isolate, f, 0, 0, 0, 0, 0)); | 631 reinterpret_cast<int32_t>(CALL_GENERATED_CODE(isolate, f, 0, 0, 0, 0, 0)); |
632 | 632 |
633 DCHECK(r == 0 || r == 1); | 633 DCHECK(r == 0 || r == 1); |
634 return r; | 634 return r; |
635 } | 635 } |
636 | 636 |
| 637 TEST(BranchOverflowInt32BothLabelsTrampoline) { |
| 638 if (!IsMipsArchVariant(kMips32r6)) return; |
| 639 static const int kMaxBranchOffset = (1 << (18 - 1)) - 1; |
| 640 |
| 641 FOR_INT32_INPUTS(i, overflow_int32_test_values) { |
| 642 FOR_INT32_INPUTS(j, overflow_int32_test_values) { |
| 643 FOR_ENUM_INPUTS(br, OverflowBranchType, overflow_branch_type) { |
| 644 FOR_STRUCT_INPUTS(regComb, OverflowRegisterCombination, |
| 645 overflow_register_combination) { |
| 646 int32_t ii = *i; |
| 647 int32_t jj = *j; |
| 648 enum OverflowBranchType branchType = *br; |
| 649 struct OverflowRegisterCombination rc = *regComb; |
| 650 |
| 651 // If left and right register are same then left and right |
| 652 // test values must also be same, otherwise we skip the test |
| 653 if (rc.left.code() == rc.right.code()) { |
| 654 if (ii != jj) { |
| 655 continue; |
| 656 } |
| 657 } |
| 658 |
| 659 bool res1 = runOverflow<int32_t>( |
| 660 ii, jj, [branchType, rc](MacroAssembler* masm, int32_t valLeft, |
| 661 int32_t valRight) { |
| 662 Label overflow, no_overflow, end; |
| 663 __ li(rc.left, valLeft); |
| 664 __ li(rc.right, valRight); |
| 665 switch (branchType) { |
| 666 case kAddBranchOverflow: |
| 667 __ AddBranchOvf(rc.dst, rc.left, rc.right, &overflow, |
| 668 &no_overflow, rc.scratch); |
| 669 break; |
| 670 case kSubBranchOverflow: |
| 671 __ SubBranchOvf(rc.dst, rc.left, rc.right, &overflow, |
| 672 &no_overflow, rc.scratch); |
| 673 break; |
| 674 } |
| 675 |
| 676 Label done; |
| 677 size_t nr_calls = |
| 678 kMaxBranchOffset / (2 * Instruction::kInstrSize) + 2; |
| 679 for (size_t i = 0; i < nr_calls; ++i) { |
| 680 __ BranchShort(&done, eq, a0, Operand(a1)); |
| 681 } |
| 682 __ bind(&done); |
| 683 |
| 684 __ li(v0, 2); |
| 685 __ Branch(&end); |
| 686 __ bind(&overflow); |
| 687 __ li(v0, 1); |
| 688 __ Branch(&end); |
| 689 __ bind(&no_overflow); |
| 690 __ li(v0, 0); |
| 691 __ bind(&end); |
| 692 }); |
| 693 |
| 694 switch (branchType) { |
| 695 case kAddBranchOverflow: |
| 696 CHECK_EQ(IsAddOverflow<int32_t>(ii, jj), res1); |
| 697 break; |
| 698 case kSubBranchOverflow: |
| 699 CHECK_EQ(IsSubOverflow<int32_t>(ii, jj), res1); |
| 700 break; |
| 701 default: |
| 702 UNREACHABLE(); |
| 703 } |
| 704 } |
| 705 } |
| 706 } |
| 707 } |
| 708 } |
| 709 |
637 TEST(BranchOverflowInt32BothLabels) { | 710 TEST(BranchOverflowInt32BothLabels) { |
638 FOR_INT32_INPUTS(i, overflow_int32_test_values) { | 711 FOR_INT32_INPUTS(i, overflow_int32_test_values) { |
639 FOR_INT32_INPUTS(j, overflow_int32_test_values) { | 712 FOR_INT32_INPUTS(j, overflow_int32_test_values) { |
640 FOR_ENUM_INPUTS(br, OverflowBranchType, overflow_branch_type) { | 713 FOR_ENUM_INPUTS(br, OverflowBranchType, overflow_branch_type) { |
641 FOR_STRUCT_INPUTS(regComb, OverflowRegisterCombination, | 714 FOR_STRUCT_INPUTS(regComb, OverflowRegisterCombination, |
642 overflow_register_combination) { | 715 overflow_register_combination) { |
643 int32_t ii = *i; | 716 int32_t ii = *i; |
644 int32_t jj = *j; | 717 int32_t jj = *j; |
645 enum OverflowBranchType branchType = *br; | 718 enum OverflowBranchType branchType = *br; |
646 struct OverflowRegisterCombination rc = *regComb; | 719 struct OverflowRegisterCombination rc = *regComb; |
(...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1227 int32_t out_offset) { | 1300 int32_t out_offset) { |
1228 __ Uldc1(f0, MemOperand(a0, in_offset), t0); | 1301 __ Uldc1(f0, MemOperand(a0, in_offset), t0); |
1229 __ Usdc1(f0, MemOperand(a0, out_offset), t0); | 1302 __ Usdc1(f0, MemOperand(a0, out_offset), t0); |
1230 })); | 1303 })); |
1231 } | 1304 } |
1232 } | 1305 } |
1233 } | 1306 } |
1234 } | 1307 } |
1235 | 1308 |
1236 #undef __ | 1309 #undef __ |
OLD | NEW |