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 1724 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1735 __ movq(RAX, Immediate(0)); | 1735 __ movq(RAX, Immediate(0)); |
1736 __ ret(); | 1736 __ ret(); |
1737 } | 1737 } |
1738 | 1738 |
1739 | 1739 |
1740 ASSEMBLER_TEST_RUN(LogicalTestQ, test) { | 1740 ASSEMBLER_TEST_RUN(LogicalTestQ, test) { |
1741 typedef int (*LogicalTestCode)(); | 1741 typedef int (*LogicalTestCode)(); |
1742 EXPECT_EQ(0, reinterpret_cast<LogicalTestCode>(test->entry())()); | 1742 EXPECT_EQ(0, reinterpret_cast<LogicalTestCode>(test->entry())()); |
1743 } | 1743 } |
1744 | 1744 |
1745 | 1745 |
rmacnak
2017/06/19 18:12:21
Duplicate tests for 32-bit access.
erikcorry
2017/06/21 12:12:12
Done.
| |
1746 ASSEMBLER_TEST_GENERATE(CompareSwapEQ, assembler) { | 1746 ASSEMBLER_TEST_GENERATE(CompareSwapEQ, assembler) { |
1747 __ movq(RAX, Immediate(0)); | 1747 __ movq(RAX, Immediate(0)); |
1748 __ pushq(RAX); | 1748 __ pushq(RAX); |
1749 __ movq(RAX, Immediate(4)); | 1749 __ movq(RAX, Immediate(4)); |
1750 __ movq(RCX, Immediate(0)); | 1750 __ movq(RCX, Immediate(0)); |
1751 __ movq(Address(RSP, 0), RAX); | 1751 __ movq(Address(RSP, 0), RAX); |
1752 __ lock_cmpxchgq(Address(RSP, 0), RCX); | 1752 __ LockCmpxchgq(Address(RSP, 0), RCX); |
1753 __ popq(RAX); | 1753 __ popq(RAX); |
1754 __ ret(); | 1754 __ ret(); |
1755 } | 1755 } |
1756 | 1756 |
1757 | 1757 |
1758 ASSEMBLER_TEST_RUN(CompareSwapEQ, test) { | 1758 ASSEMBLER_TEST_RUN(CompareSwapEQ, test) { |
1759 typedef int (*CompareSwapEQCode)(); | 1759 typedef int (*CompareSwapEQCode)(); |
1760 EXPECT_EQ(0, reinterpret_cast<CompareSwapEQCode>(test->entry())()); | 1760 EXPECT_EQ(0, reinterpret_cast<CompareSwapEQCode>(test->entry())()); |
1761 } | 1761 } |
1762 | 1762 |
1763 | 1763 |
1764 ASSEMBLER_TEST_GENERATE(CompareSwapNEQ, assembler) { | 1764 ASSEMBLER_TEST_GENERATE(CompareSwapNEQ, assembler) { |
1765 __ movq(RAX, Immediate(0)); | 1765 __ movq(RAX, Immediate(0)); |
1766 __ pushq(RAX); | 1766 __ pushq(RAX); |
1767 __ movq(RAX, Immediate(2)); | 1767 __ movq(RAX, Immediate(2)); |
1768 __ movq(RCX, Immediate(4)); | 1768 __ movq(RCX, Immediate(4)); |
1769 __ movq(Address(RSP, 0), RCX); | 1769 __ movq(Address(RSP, 0), RCX); |
1770 __ lock_cmpxchgq(Address(RSP, 0), RCX); | 1770 __ LockCmpxchgq(Address(RSP, 0), RCX); |
1771 __ popq(RAX); | 1771 __ popq(RAX); |
1772 __ ret(); | 1772 __ ret(); |
1773 } | 1773 } |
1774 | 1774 |
1775 | 1775 |
1776 ASSEMBLER_TEST_RUN(CompareSwapNEQ, test) { | 1776 ASSEMBLER_TEST_RUN(CompareSwapNEQ, test) { |
1777 typedef int (*CompareSwapNEQCode)(); | 1777 typedef int (*CompareSwapNEQCode)(); |
1778 EXPECT_EQ(4, reinterpret_cast<CompareSwapNEQCode>(test->entry())()); | 1778 EXPECT_EQ(4, reinterpret_cast<CompareSwapNEQCode>(test->entry())()); |
1779 } | 1779 } |
1780 | 1780 |
(...skipping 1799 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3580 int res = reinterpret_cast<ConditionalMovesNoOverflowCode>(test->entry())( | 3580 int res = reinterpret_cast<ConditionalMovesNoOverflowCode>(test->entry())( |
3581 0x7fffffffffffffff, 2); | 3581 0x7fffffffffffffff, 2); |
3582 EXPECT_EQ(1, res); | 3582 EXPECT_EQ(1, res); |
3583 res = reinterpret_cast<ConditionalMovesNoOverflowCode>(test->entry())(1, 1); | 3583 res = reinterpret_cast<ConditionalMovesNoOverflowCode>(test->entry())(1, 1); |
3584 EXPECT_EQ(0, res); | 3584 EXPECT_EQ(0, res); |
3585 } | 3585 } |
3586 | 3586 |
3587 } // namespace dart | 3587 } // namespace dart |
3588 | 3588 |
3589 #endif // defined TARGET_ARCH_X64 | 3589 #endif // defined TARGET_ARCH_X64 |
OLD | NEW |