| 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 3375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3386 } | 3386 } |
| 3387 | 3387 |
| 3388 | 3388 |
| 3389 ASSEMBLER_TEST_RUN(IntToDoubleConversion, test) { | 3389 ASSEMBLER_TEST_RUN(IntToDoubleConversion, test) { |
| 3390 typedef double (*IntToDoubleConversionCode)(); | 3390 typedef double (*IntToDoubleConversionCode)(); |
| 3391 double res = reinterpret_cast<IntToDoubleConversionCode>(test->entry())(); | 3391 double res = reinterpret_cast<IntToDoubleConversionCode>(test->entry())(); |
| 3392 EXPECT_FLOAT_EQ(6.0, res, 0.001); | 3392 EXPECT_FLOAT_EQ(6.0, res, 0.001); |
| 3393 } | 3393 } |
| 3394 | 3394 |
| 3395 | 3395 |
| 3396 ASSEMBLER_TEST_GENERATE(IntToDoubleConversion2, assembler) { | |
| 3397 __ pushq(CallingConventions::kArg1Reg); | |
| 3398 __ fildl(Address(RSP, 0)); | |
| 3399 __ fstpl(Address(RSP, 0)); | |
| 3400 __ movsd(XMM0, Address(RSP, 0)); | |
| 3401 __ popq(RAX); | |
| 3402 __ ret(); | |
| 3403 } | |
| 3404 | |
| 3405 | |
| 3406 ASSEMBLER_TEST_RUN(IntToDoubleConversion2, test) { | |
| 3407 typedef double (*IntToDoubleConversion2Code)(int i); | |
| 3408 double res = reinterpret_cast<IntToDoubleConversion2Code>(test->entry())(3); | |
| 3409 EXPECT_FLOAT_EQ(3.0, res, 0.001); | |
| 3410 } | |
| 3411 | |
| 3412 ASSEMBLER_TEST_GENERATE(DoubleToDoubleTrunc, assembler) { | 3396 ASSEMBLER_TEST_GENERATE(DoubleToDoubleTrunc, assembler) { |
| 3413 __ roundsd(XMM0, XMM0, Assembler::kRoundToZero); | 3397 __ roundsd(XMM0, XMM0, Assembler::kRoundToZero); |
| 3414 __ ret(); | 3398 __ ret(); |
| 3415 } | 3399 } |
| 3416 | 3400 |
| 3417 | 3401 |
| 3418 ASSEMBLER_TEST_RUN(DoubleToDoubleTrunc, test) { | 3402 ASSEMBLER_TEST_RUN(DoubleToDoubleTrunc, test) { |
| 3419 typedef double (*DoubleToDoubleTruncCode)(double d); | 3403 typedef double (*DoubleToDoubleTruncCode)(double d); |
| 3420 double res = reinterpret_cast<DoubleToDoubleTruncCode>(test->entry())(12.3); | 3404 double res = reinterpret_cast<DoubleToDoubleTruncCode>(test->entry())(12.3); |
| 3421 EXPECT_EQ(12.0, res); | 3405 EXPECT_EQ(12.0, res); |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3643 EXPECT_EQ(ICData::kInt64RangeBit, range_of(Integer::New(kMaxInt64))); | 3627 EXPECT_EQ(ICData::kInt64RangeBit, range_of(Integer::New(kMaxInt64))); |
| 3644 EXPECT_EQ(ICData::kInt64RangeBit, range_of(Integer::New(kMinInt64))); | 3628 EXPECT_EQ(ICData::kInt64RangeBit, range_of(Integer::New(kMinInt64))); |
| 3645 | 3629 |
| 3646 EXPECT_EQ(0, range_of(Bool::True().raw())); | 3630 EXPECT_EQ(0, range_of(Bool::True().raw())); |
| 3647 } | 3631 } |
| 3648 | 3632 |
| 3649 | 3633 |
| 3650 } // namespace dart | 3634 } // namespace dart |
| 3651 | 3635 |
| 3652 #endif // defined TARGET_ARCH_X64 | 3636 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |