Index: runtime/vm/assembler_x64_test.cc |
diff --git a/runtime/vm/assembler_x64_test.cc b/runtime/vm/assembler_x64_test.cc |
index 5a9a8128547d45c8a9f36fdbd9b6c35435acb30d..8c04d7d4f9afb17d219c5681d8ca335ed501f33f 100644 |
--- a/runtime/vm/assembler_x64_test.cc |
+++ b/runtime/vm/assembler_x64_test.cc |
@@ -1749,7 +1749,7 @@ ASSEMBLER_TEST_GENERATE(CompareSwapEQ, assembler) { |
__ movq(RAX, Immediate(4)); |
__ movq(RCX, Immediate(0)); |
__ movq(Address(RSP, 0), RAX); |
- __ lock_cmpxchgq(Address(RSP, 0), RCX); |
+ __ LockCmpxchgq(Address(RSP, 0), RCX); |
__ popq(RAX); |
__ ret(); |
} |
@@ -1767,7 +1767,7 @@ ASSEMBLER_TEST_GENERATE(CompareSwapNEQ, assembler) { |
__ movq(RAX, Immediate(2)); |
__ movq(RCX, Immediate(4)); |
__ movq(Address(RSP, 0), RCX); |
- __ lock_cmpxchgq(Address(RSP, 0), RCX); |
+ __ LockCmpxchgq(Address(RSP, 0), RCX); |
__ popq(RAX); |
__ ret(); |
} |
@@ -1779,6 +1779,47 @@ ASSEMBLER_TEST_RUN(CompareSwapNEQ, test) { |
} |
+ASSEMBLER_TEST_GENERATE(CompareSwapEQ32, assembler) { |
+ __ movq(RAX, Immediate(0x100000000)); |
+ __ pushq(RAX); |
+ __ movq(RAX, Immediate(4)); |
+ __ movq(RCX, Immediate(0)); |
+ // 32 bit store of 4. |
+ __ movl(Address(RSP, 0), RAX); |
+ // Compare 32 bit memory location with RAX (4) and write 0. |
+ __ LockCmpxchgl(Address(RSP, 0), RCX); |
+ // Pop unchanged high word and zeroed out low word. |
+ __ popq(RAX); |
+ __ ret(); |
+} |
+ |
+ |
+ASSEMBLER_TEST_RUN(CompareSwapEQ32, test) { |
+ typedef intptr_t (*CompareSwapEQ32Code)(); |
+ EXPECT_EQ(0x100000000, |
+ reinterpret_cast<CompareSwapEQ32Code>(test->entry())()); |
+} |
+ |
+ |
+ASSEMBLER_TEST_GENERATE(CompareSwapNEQ32, assembler) { |
+ __ movq(RAX, Immediate(0x100000000)); |
+ __ pushq(RAX); |
+ __ movq(RAX, Immediate(2)); |
+ __ movq(RCX, Immediate(4)); |
+ __ movl(Address(RSP, 0), RCX); |
+ __ LockCmpxchgl(Address(RSP, 0), RCX); |
+ __ popq(RAX); |
+ __ ret(); |
+} |
+ |
+ |
+ASSEMBLER_TEST_RUN(CompareSwapNEQ32, test) { |
+ typedef intptr_t (*CompareSwapNEQ32Code)(); |
+ EXPECT_EQ(0x100000004l, |
+ reinterpret_cast<CompareSwapNEQ32Code>(test->entry())()); |
+} |
+ |
+ |
ASSEMBLER_TEST_GENERATE(Exchange, assembler) { |
__ movq(RAX, Immediate(kLargeConstant)); |
__ movq(RDX, Immediate(kAnotherLargeConstant)); |