| 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 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 508 __ ret(); | 508 __ ret(); |
| 509 } | 509 } |
| 510 | 510 |
| 511 | 511 |
| 512 ASSEMBLER_TEST_RUN(MoveExtend, test) { | 512 ASSEMBLER_TEST_RUN(MoveExtend, test) { |
| 513 typedef int (*MoveExtend)(); | 513 typedef int (*MoveExtend)(); |
| 514 EXPECT_EQ(0xff - 1 + 0xffff, reinterpret_cast<MoveExtend>(test->entry())()); | 514 EXPECT_EQ(0xff - 1 + 0xffff, reinterpret_cast<MoveExtend>(test->entry())()); |
| 515 } | 515 } |
| 516 | 516 |
| 517 | 517 |
| 518 ASSEMBLER_TEST_GENERATE(MoveExtend32, assembler) { |
| 519 __ movq(RDX, Immediate(0xffffffff)); |
| 520 __ movsxl(RDX, RDX); |
| 521 __ movq(RAX, Immediate(0x7fffffff)); |
| 522 __ movsxl(RAX, RAX); |
| 523 __ addq(RAX, RDX); |
| 524 __ ret(); |
| 525 } |
| 526 |
| 527 |
| 528 ASSEMBLER_TEST_RUN(MoveExtend32, test) { |
| 529 typedef intptr_t (*MoveExtend)(); |
| 530 EXPECT_EQ(0x7ffffffe, reinterpret_cast<MoveExtend>(test->entry())()); |
| 531 } |
| 532 |
| 533 |
| 518 ASSEMBLER_TEST_GENERATE(MoveExtendMemory, assembler) { | 534 ASSEMBLER_TEST_GENERATE(MoveExtendMemory, assembler) { |
| 519 __ movq(RDX, Immediate(0x123456781234ffff)); | 535 __ movq(RDX, Immediate(0x123456781234ffff)); |
| 520 | 536 |
| 521 __ pushq(RDX); | 537 __ pushq(RDX); |
| 522 __ movzxb(RAX, Address(RSP, 0)); // RAX = 0xff | 538 __ movzxb(RAX, Address(RSP, 0)); // RAX = 0xff |
| 523 __ movsxw(R8, Address(RSP, 0)); // R8 = -1 | 539 __ movsxw(R8, Address(RSP, 0)); // R8 = -1 |
| 524 __ movzxw(RCX, Address(RSP, 0)); // RCX = 0xffff | 540 __ movzxw(RCX, Address(RSP, 0)); // RCX = 0xffff |
| 525 __ addq(RSP, Immediate(kWordSize)); | 541 __ addq(RSP, Immediate(kWordSize)); |
| 526 | 542 |
| 527 __ addq(R8, RCX); | 543 __ addq(R8, RCX); |
| (...skipping 1725 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2253 EXPECT_EQ(0, res); | 2269 EXPECT_EQ(0, res); |
| 2254 res = reinterpret_cast<ExtractSignBits>(test->entry())(-1.0); | 2270 res = reinterpret_cast<ExtractSignBits>(test->entry())(-1.0); |
| 2255 EXPECT_EQ(1, res); | 2271 EXPECT_EQ(1, res); |
| 2256 res = reinterpret_cast<ExtractSignBits>(test->entry())(-0.0); | 2272 res = reinterpret_cast<ExtractSignBits>(test->entry())(-0.0); |
| 2257 EXPECT_EQ(1, res); | 2273 EXPECT_EQ(1, res); |
| 2258 } | 2274 } |
| 2259 | 2275 |
| 2260 } // namespace dart | 2276 } // namespace dart |
| 2261 | 2277 |
| 2262 #endif // defined TARGET_ARCH_X64 | 2278 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |