| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/globals.h" | 5 #include "vm/globals.h" |
| 6 #if defined(TARGET_ARCH_X64) | 6 #if defined(TARGET_ARCH_X64) |
| 7 | 7 |
| 8 #include "vm/assembler.h" | 8 #include "vm/assembler.h" |
| 9 #include "vm/os.h" | 9 #include "vm/os.h" |
| 10 #include "vm/unit_test.h" | 10 #include "vm/unit_test.h" |
| (...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 682 EXPECT_EQ(0xffff, reinterpret_cast<MoveWordRex>(test->entry())()); | 682 EXPECT_EQ(0xffff, reinterpret_cast<MoveWordRex>(test->entry())()); |
| 683 } | 683 } |
| 684 | 684 |
| 685 | 685 |
| 686 ASSEMBLER_TEST_GENERATE(LongAddReg, assembler) { | 686 ASSEMBLER_TEST_GENERATE(LongAddReg, assembler) { |
| 687 __ pushq(CallingConventions::kArg2Reg); | 687 __ pushq(CallingConventions::kArg2Reg); |
| 688 __ pushq(CallingConventions::kArg1Reg); | 688 __ pushq(CallingConventions::kArg1Reg); |
| 689 __ movl(RAX, Address(RSP, 0)); // left low. | 689 __ movl(RAX, Address(RSP, 0)); // left low. |
| 690 __ movl(RDX, Address(RSP, 4)); // left high. | 690 __ movl(RDX, Address(RSP, 4)); // left high. |
| 691 __ movl(RCX, Address(RSP, 8)); // right low. | 691 __ movl(RCX, Address(RSP, 8)); // right low. |
| 692 __ movl(RBX, Address(RSP, 12)); // right high | 692 __ movl(R8, Address(RSP, 12)); // right high |
| 693 __ addl(RAX, RCX); | 693 __ addl(RAX, RCX); |
| 694 __ adcl(RDX, RBX); | 694 __ adcl(RDX, R8); |
| 695 // Result is in RAX/RDX. | 695 // Result is in RAX/RDX. |
| 696 __ movl(Address(RSP, 0), RAX); // result low. | 696 __ movl(Address(RSP, 0), RAX); // result low. |
| 697 __ movl(Address(RSP, 4), RDX); // result high. | 697 __ movl(Address(RSP, 4), RDX); // result high. |
| 698 __ popq(RAX); | 698 __ popq(RAX); |
| 699 __ popq(RDX); | 699 __ popq(RDX); |
| 700 __ ret(); | 700 __ ret(); |
| 701 } | 701 } |
| 702 | 702 |
| 703 | 703 |
| 704 ASSEMBLER_TEST_RUN(LongAddReg, test) { | 704 ASSEMBLER_TEST_RUN(LongAddReg, test) { |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 742 EXPECT_EQ((a + b), res); | 742 EXPECT_EQ((a + b), res); |
| 743 } | 743 } |
| 744 | 744 |
| 745 | 745 |
| 746 ASSEMBLER_TEST_GENERATE(LongSubReg, assembler) { | 746 ASSEMBLER_TEST_GENERATE(LongSubReg, assembler) { |
| 747 __ pushq(CallingConventions::kArg2Reg); | 747 __ pushq(CallingConventions::kArg2Reg); |
| 748 __ pushq(CallingConventions::kArg1Reg); | 748 __ pushq(CallingConventions::kArg1Reg); |
| 749 __ movl(RAX, Address(RSP, 0)); // left low. | 749 __ movl(RAX, Address(RSP, 0)); // left low. |
| 750 __ movl(RDX, Address(RSP, 4)); // left high. | 750 __ movl(RDX, Address(RSP, 4)); // left high. |
| 751 __ movl(RCX, Address(RSP, 8)); // right low. | 751 __ movl(RCX, Address(RSP, 8)); // right low. |
| 752 __ movl(RBX, Address(RSP, 12)); // right high | 752 __ movl(R8, Address(RSP, 12)); // right high |
| 753 __ subl(RAX, RCX); | 753 __ subl(RAX, RCX); |
| 754 __ sbbl(RDX, RBX); | 754 __ sbbl(RDX, R8); |
| 755 // Result is in RAX/RDX. | 755 // Result is in RAX/RDX. |
| 756 __ movl(Address(RSP, 0), RAX); // result low. | 756 __ movl(Address(RSP, 0), RAX); // result low. |
| 757 __ movl(Address(RSP, 4), RDX); // result high. | 757 __ movl(Address(RSP, 4), RDX); // result high. |
| 758 __ popq(RAX); | 758 __ popq(RAX); |
| 759 __ popq(RDX); | 759 __ popq(RDX); |
| 760 __ ret(); | 760 __ ret(); |
| 761 } | 761 } |
| 762 | 762 |
| 763 | 763 |
| 764 ASSEMBLER_TEST_RUN(LongSubReg, test) { | 764 ASSEMBLER_TEST_RUN(LongSubReg, test) { |
| (...skipping 2430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3195 int res = reinterpret_cast<ConditionalMovesNoOverflowCode>( | 3195 int res = reinterpret_cast<ConditionalMovesNoOverflowCode>( |
| 3196 test->entry())(0x7fffffffffffffff, 2); | 3196 test->entry())(0x7fffffffffffffff, 2); |
| 3197 EXPECT_EQ(1, res); | 3197 EXPECT_EQ(1, res); |
| 3198 res = reinterpret_cast<ConditionalMovesNoOverflowCode>(test->entry())(1, 1); | 3198 res = reinterpret_cast<ConditionalMovesNoOverflowCode>(test->entry())(1, 1); |
| 3199 EXPECT_EQ(0, res); | 3199 EXPECT_EQ(0, res); |
| 3200 } | 3200 } |
| 3201 | 3201 |
| 3202 } // namespace dart | 3202 } // namespace dart |
| 3203 | 3203 |
| 3204 #endif // defined TARGET_ARCH_X64 | 3204 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |