| 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 2002 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2013 } | 2013 } |
| 2014 | 2014 |
| 2015 | 2015 |
| 2016 ASSEMBLER_TEST_RUN(PackedDoubleSub, test) { | 2016 ASSEMBLER_TEST_RUN(PackedDoubleSub, test) { |
| 2017 typedef double (*PackedDoubleSub)(); | 2017 typedef double (*PackedDoubleSub)(); |
| 2018 double res = reinterpret_cast<PackedDoubleSub>(test->entry())(); | 2018 double res = reinterpret_cast<PackedDoubleSub>(test->entry())(); |
| 2019 EXPECT_FLOAT_EQ(-2.0, res, 0.000001f); | 2019 EXPECT_FLOAT_EQ(-2.0, res, 0.000001f); |
| 2020 } | 2020 } |
| 2021 | 2021 |
| 2022 | 2022 |
| 2023 static void EnterTestFrame(Assembler* assembler) { |
| 2024 __ EnterFrame(0); |
| 2025 __ pushq(CODE_REG); |
| 2026 __ pushq(PP); |
| 2027 __ movq(CODE_REG, Address(CallingConventions::kArg1Reg, |
| 2028 VMHandles::kOffsetOfRawPtrInHandle)); |
| 2029 __ LoadPoolPointer(PP); |
| 2030 } |
| 2031 |
| 2032 |
| 2033 static void LeaveTestFrame(Assembler* assembler) { |
| 2034 __ popq(PP); |
| 2035 __ popq(CODE_REG); |
| 2036 __ LeaveFrame(); |
| 2037 } |
| 2038 |
| 2039 |
| 2023 ASSEMBLER_TEST_GENERATE(PackedDoubleNegate, assembler) { | 2040 ASSEMBLER_TEST_GENERATE(PackedDoubleNegate, assembler) { |
| 2024 static const struct ALIGN16 { | 2041 static const struct ALIGN16 { |
| 2025 double a; | 2042 double a; |
| 2026 double b; | 2043 double b; |
| 2027 } constant0 = { 1.0, 2.0 }; | 2044 } constant0 = { 1.0, 2.0 }; |
| 2028 __ EnterStubFrame(); | 2045 EnterTestFrame(assembler); |
| 2029 __ movq(RAX, Immediate(reinterpret_cast<uword>(&constant0))); | 2046 __ movq(RAX, Immediate(reinterpret_cast<uword>(&constant0))); |
| 2030 __ movups(XMM10, Address(RAX, 0)); | 2047 __ movups(XMM10, Address(RAX, 0)); |
| 2031 __ negatepd(XMM10); | 2048 __ negatepd(XMM10); |
| 2032 __ movaps(XMM0, XMM10); | 2049 __ movaps(XMM0, XMM10); |
| 2033 __ LeaveStubFrame(); | 2050 LeaveTestFrame(assembler); |
| 2034 __ ret(); | 2051 __ ret(); |
| 2035 } | 2052 } |
| 2036 | 2053 |
| 2037 | 2054 |
| 2038 ASSEMBLER_TEST_RUN(PackedDoubleNegate, test) { | 2055 ASSEMBLER_TEST_RUN(PackedDoubleNegate, test) { |
| 2039 double res = test->Invoke<double>(); | 2056 double res = test->InvokeWithCode<double>(); |
| 2040 EXPECT_FLOAT_EQ(-1.0, res, 0.000001f); | 2057 EXPECT_FLOAT_EQ(-1.0, res, 0.000001f); |
| 2041 } | 2058 } |
| 2042 | 2059 |
| 2043 | 2060 |
| 2044 ASSEMBLER_TEST_GENERATE(PackedDoubleAbsolute, assembler) { | 2061 ASSEMBLER_TEST_GENERATE(PackedDoubleAbsolute, assembler) { |
| 2045 static const struct ALIGN16 { | 2062 static const struct ALIGN16 { |
| 2046 double a; | 2063 double a; |
| 2047 double b; | 2064 double b; |
| 2048 } constant0 = { -1.0, 2.0 }; | 2065 } constant0 = { -1.0, 2.0 }; |
| 2049 __ EnterStubFrame(); | 2066 EnterTestFrame(assembler); |
| 2050 __ movq(RAX, Immediate(reinterpret_cast<uword>(&constant0))); | 2067 __ movq(RAX, Immediate(reinterpret_cast<uword>(&constant0))); |
| 2051 __ movups(XMM10, Address(RAX, 0)); | 2068 __ movups(XMM10, Address(RAX, 0)); |
| 2052 __ abspd(XMM10); | 2069 __ abspd(XMM10); |
| 2053 __ movaps(XMM0, XMM10); | 2070 __ movaps(XMM0, XMM10); |
| 2054 __ LeaveStubFrame(); | 2071 LeaveTestFrame(assembler); |
| 2055 __ ret(); | 2072 __ ret(); |
| 2056 } | 2073 } |
| 2057 | 2074 |
| 2058 | 2075 |
| 2059 ASSEMBLER_TEST_RUN(PackedDoubleAbsolute, test) { | 2076 ASSEMBLER_TEST_RUN(PackedDoubleAbsolute, test) { |
| 2060 double res = test->Invoke<double>(); | 2077 double res = test->InvokeWithCode<double>(); |
| 2061 EXPECT_FLOAT_EQ(1.0, res, 0.000001f); | 2078 EXPECT_FLOAT_EQ(1.0, res, 0.000001f); |
| 2062 } | 2079 } |
| 2063 | 2080 |
| 2064 | 2081 |
| 2065 ASSEMBLER_TEST_GENERATE(PackedDoubleMul, assembler) { | 2082 ASSEMBLER_TEST_GENERATE(PackedDoubleMul, assembler) { |
| 2066 static const struct ALIGN16 { | 2083 static const struct ALIGN16 { |
| 2067 double a; | 2084 double a; |
| 2068 double b; | 2085 double b; |
| 2069 } constant0 = { 3.0, 2.0 }; | 2086 } constant0 = { 3.0, 2.0 }; |
| 2070 static const struct ALIGN16 { | 2087 static const struct ALIGN16 { |
| (...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2484 | 2501 |
| 2485 | 2502 |
| 2486 ASSEMBLER_TEST_RUN(PackedCompareNLE, test) { | 2503 ASSEMBLER_TEST_RUN(PackedCompareNLE, test) { |
| 2487 typedef uint32_t (*PackedCompareNLECode)(); | 2504 typedef uint32_t (*PackedCompareNLECode)(); |
| 2488 uint32_t res = reinterpret_cast<PackedCompareNLECode>(test->entry())(); | 2505 uint32_t res = reinterpret_cast<PackedCompareNLECode>(test->entry())(); |
| 2489 EXPECT_EQ(static_cast<uword>(0x0), res); | 2506 EXPECT_EQ(static_cast<uword>(0x0), res); |
| 2490 } | 2507 } |
| 2491 | 2508 |
| 2492 | 2509 |
| 2493 ASSEMBLER_TEST_GENERATE(PackedNegate, assembler) { | 2510 ASSEMBLER_TEST_GENERATE(PackedNegate, assembler) { |
| 2494 __ EnterStubFrame(); | 2511 EnterTestFrame(assembler); |
| 2495 __ movl(RAX, Immediate(bit_cast<int32_t, float>(12.3f))); | 2512 __ movl(RAX, Immediate(bit_cast<int32_t, float>(12.3f))); |
| 2496 __ movd(XMM0, RAX); | 2513 __ movd(XMM0, RAX); |
| 2497 __ shufps(XMM0, XMM0, Immediate(0x0)); | 2514 __ shufps(XMM0, XMM0, Immediate(0x0)); |
| 2498 __ negateps(XMM0); | 2515 __ negateps(XMM0); |
| 2499 __ shufps(XMM0, XMM0, Immediate(0xAA)); // Copy third lane into all 4 lanes. | 2516 __ shufps(XMM0, XMM0, Immediate(0xAA)); // Copy third lane into all 4 lanes. |
| 2500 __ LeaveStubFrame(); | 2517 LeaveTestFrame(assembler); |
| 2501 __ ret(); | 2518 __ ret(); |
| 2502 } | 2519 } |
| 2503 | 2520 |
| 2504 | 2521 |
| 2505 ASSEMBLER_TEST_RUN(PackedNegate, test) { | 2522 ASSEMBLER_TEST_RUN(PackedNegate, test) { |
| 2506 float res = test->Invoke<float>(); | 2523 float res = test->InvokeWithCode<float>(); |
| 2507 EXPECT_FLOAT_EQ(-12.3f, res, 0.001f); | 2524 EXPECT_FLOAT_EQ(-12.3f, res, 0.001f); |
| 2508 } | 2525 } |
| 2509 | 2526 |
| 2510 | 2527 |
| 2511 ASSEMBLER_TEST_GENERATE(PackedAbsolute, assembler) { | 2528 ASSEMBLER_TEST_GENERATE(PackedAbsolute, assembler) { |
| 2512 __ EnterStubFrame(); | 2529 EnterTestFrame(assembler); |
| 2513 __ movl(RAX, Immediate(bit_cast<int32_t, float>(-15.3f))); | 2530 __ movl(RAX, Immediate(bit_cast<int32_t, float>(-15.3f))); |
| 2514 __ movd(XMM0, RAX); | 2531 __ movd(XMM0, RAX); |
| 2515 __ shufps(XMM0, XMM0, Immediate(0x0)); | 2532 __ shufps(XMM0, XMM0, Immediate(0x0)); |
| 2516 __ absps(XMM0); | 2533 __ absps(XMM0); |
| 2517 __ shufps(XMM0, XMM0, Immediate(0xAA)); // Copy third lane into all 4 lanes. | 2534 __ shufps(XMM0, XMM0, Immediate(0xAA)); // Copy third lane into all 4 lanes. |
| 2518 __ LeaveStubFrame(); | 2535 LeaveTestFrame(assembler); |
| 2519 __ ret(); | 2536 __ ret(); |
| 2520 } | 2537 } |
| 2521 | 2538 |
| 2522 | 2539 |
| 2523 ASSEMBLER_TEST_RUN(PackedAbsolute, test) { | 2540 ASSEMBLER_TEST_RUN(PackedAbsolute, test) { |
| 2524 float res = test->Invoke<float>(); | 2541 float res = test->InvokeWithCode<float>(); |
| 2525 EXPECT_FLOAT_EQ(15.3f, res, 0.001f); | 2542 EXPECT_FLOAT_EQ(15.3f, res, 0.001f); |
| 2526 } | 2543 } |
| 2527 | 2544 |
| 2528 | 2545 |
| 2529 ASSEMBLER_TEST_GENERATE(PackedSetWZero, assembler) { | 2546 ASSEMBLER_TEST_GENERATE(PackedSetWZero, assembler) { |
| 2530 __ EnterStubFrame(); | 2547 EnterTestFrame(assembler); |
| 2531 __ set1ps(XMM0, RAX, Immediate(bit_cast<int32_t, float>(12.3f))); | 2548 __ set1ps(XMM0, RAX, Immediate(bit_cast<int32_t, float>(12.3f))); |
| 2532 __ zerowps(XMM0); | 2549 __ zerowps(XMM0); |
| 2533 __ shufps(XMM0, XMM0, Immediate(0xFF)); // Copy the W lane which is now 0.0. | 2550 __ shufps(XMM0, XMM0, Immediate(0xFF)); // Copy the W lane which is now 0.0. |
| 2534 __ LeaveStubFrame(); | 2551 LeaveTestFrame(assembler); |
| 2535 __ ret(); | 2552 __ ret(); |
| 2536 } | 2553 } |
| 2537 | 2554 |
| 2538 | 2555 |
| 2539 ASSEMBLER_TEST_RUN(PackedSetWZero, test) { | 2556 ASSEMBLER_TEST_RUN(PackedSetWZero, test) { |
| 2540 float res = test->Invoke<float>(); | 2557 float res = test->InvokeWithCode<float>(); |
| 2541 EXPECT_FLOAT_EQ(0.0f, res, 0.001f); | 2558 EXPECT_FLOAT_EQ(0.0f, res, 0.001f); |
| 2542 } | 2559 } |
| 2543 | 2560 |
| 2544 | 2561 |
| 2545 ASSEMBLER_TEST_GENERATE(PackedMin, assembler) { | 2562 ASSEMBLER_TEST_GENERATE(PackedMin, assembler) { |
| 2546 __ set1ps(XMM0, RAX, Immediate(bit_cast<int32_t, float>(2.0f))); | 2563 __ set1ps(XMM0, RAX, Immediate(bit_cast<int32_t, float>(2.0f))); |
| 2547 __ set1ps(XMM1, RAX, Immediate(bit_cast<int32_t, float>(4.0f))); | 2564 __ set1ps(XMM1, RAX, Immediate(bit_cast<int32_t, float>(4.0f))); |
| 2548 __ minps(XMM0, XMM1); | 2565 __ minps(XMM0, XMM1); |
| 2549 __ ret(); | 2566 __ ret(); |
| 2550 } | 2567 } |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2640 | 2657 |
| 2641 | 2658 |
| 2642 ASSEMBLER_TEST_GENERATE(PackedLogicalNot, assembler) { | 2659 ASSEMBLER_TEST_GENERATE(PackedLogicalNot, assembler) { |
| 2643 static const struct ALIGN16 { | 2660 static const struct ALIGN16 { |
| 2644 uint32_t a; | 2661 uint32_t a; |
| 2645 uint32_t b; | 2662 uint32_t b; |
| 2646 uint32_t c; | 2663 uint32_t c; |
| 2647 uint32_t d; | 2664 uint32_t d; |
| 2648 } constant1 = | 2665 } constant1 = |
| 2649 { 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF }; | 2666 { 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF }; |
| 2650 __ EnterStubFrame(); | 2667 EnterTestFrame(assembler); |
| 2651 __ LoadImmediate(RAX, Immediate(reinterpret_cast<intptr_t>(&constant1))); | 2668 __ LoadImmediate(RAX, Immediate(reinterpret_cast<intptr_t>(&constant1))); |
| 2652 __ movups(XMM9, Address(RAX, 0)); | 2669 __ movups(XMM9, Address(RAX, 0)); |
| 2653 __ notps(XMM9); | 2670 __ notps(XMM9); |
| 2654 __ movaps(XMM0, XMM9); | 2671 __ movaps(XMM0, XMM9); |
| 2655 __ pushq(RAX); | 2672 __ pushq(RAX); |
| 2656 __ movss(Address(RSP, 0), XMM0); | 2673 __ movss(Address(RSP, 0), XMM0); |
| 2657 __ popq(RAX); | 2674 __ popq(RAX); |
| 2658 __ LeaveStubFrame(); | 2675 LeaveTestFrame(assembler); |
| 2659 __ ret(); | 2676 __ ret(); |
| 2660 } | 2677 } |
| 2661 | 2678 |
| 2662 | 2679 |
| 2663 ASSEMBLER_TEST_RUN(PackedLogicalNot, test) { | 2680 ASSEMBLER_TEST_RUN(PackedLogicalNot, test) { |
| 2664 uint32_t res = test->Invoke<uint32_t>(); | 2681 uint32_t res = test->InvokeWithCode<uint32_t>(); |
| 2665 EXPECT_EQ(static_cast<uword>(0x0), res); | 2682 EXPECT_EQ(static_cast<uword>(0x0), res); |
| 2666 } | 2683 } |
| 2667 | 2684 |
| 2668 | 2685 |
| 2669 ASSEMBLER_TEST_GENERATE(PackedMoveHighLow, assembler) { | 2686 ASSEMBLER_TEST_GENERATE(PackedMoveHighLow, assembler) { |
| 2670 static const struct ALIGN16 { | 2687 static const struct ALIGN16 { |
| 2671 float a; | 2688 float a; |
| 2672 float b; | 2689 float b; |
| 2673 float c; | 2690 float c; |
| 2674 float d; | 2691 float d; |
| (...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3046 typedef int64_t (*DoubleToInt64ConversionCode)(); | 3063 typedef int64_t (*DoubleToInt64ConversionCode)(); |
| 3047 int64_t res = reinterpret_cast<DoubleToInt64ConversionCode>(test->entry())(); | 3064 int64_t res = reinterpret_cast<DoubleToInt64ConversionCode>(test->entry())(); |
| 3048 EXPECT_EQ(0, res); | 3065 EXPECT_EQ(0, res); |
| 3049 } | 3066 } |
| 3050 | 3067 |
| 3051 | 3068 |
| 3052 ASSEMBLER_TEST_GENERATE(TestObjectCompare, assembler) { | 3069 ASSEMBLER_TEST_GENERATE(TestObjectCompare, assembler) { |
| 3053 ObjectStore* object_store = Isolate::Current()->object_store(); | 3070 ObjectStore* object_store = Isolate::Current()->object_store(); |
| 3054 const Object& obj = Object::ZoneHandle(object_store->smi_class()); | 3071 const Object& obj = Object::ZoneHandle(object_store->smi_class()); |
| 3055 Label fail; | 3072 Label fail; |
| 3056 __ EnterStubFrame(); | 3073 EnterTestFrame(assembler); |
| 3057 __ LoadObject(RAX, obj); | 3074 __ LoadObject(RAX, obj); |
| 3058 __ CompareObject(RAX, obj); | 3075 __ CompareObject(RAX, obj); |
| 3059 __ j(NOT_EQUAL, &fail); | 3076 __ j(NOT_EQUAL, &fail); |
| 3060 __ LoadObject(RCX, obj); | 3077 __ LoadObject(RCX, obj); |
| 3061 __ CompareObject(RCX, obj); | 3078 __ CompareObject(RCX, obj); |
| 3062 __ j(NOT_EQUAL, &fail); | 3079 __ j(NOT_EQUAL, &fail); |
| 3063 const Smi& smi = Smi::ZoneHandle(Smi::New(15)); | 3080 const Smi& smi = Smi::ZoneHandle(Smi::New(15)); |
| 3064 __ LoadObject(RCX, smi); | 3081 __ LoadObject(RCX, smi); |
| 3065 __ CompareObject(RCX, smi); | 3082 __ CompareObject(RCX, smi); |
| 3066 __ j(NOT_EQUAL, &fail); | 3083 __ j(NOT_EQUAL, &fail); |
| 3067 __ pushq(RAX); | 3084 __ pushq(RAX); |
| 3068 __ StoreObject(Address(RSP, 0), obj); | 3085 __ StoreObject(Address(RSP, 0), obj); |
| 3069 __ popq(RCX); | 3086 __ popq(RCX); |
| 3070 __ CompareObject(RCX, obj); | 3087 __ CompareObject(RCX, obj); |
| 3071 __ j(NOT_EQUAL, &fail); | 3088 __ j(NOT_EQUAL, &fail); |
| 3072 __ pushq(RAX); | 3089 __ pushq(RAX); |
| 3073 __ StoreObject(Address(RSP, 0), smi); | 3090 __ StoreObject(Address(RSP, 0), smi); |
| 3074 __ popq(RCX); | 3091 __ popq(RCX); |
| 3075 __ CompareObject(RCX, smi); | 3092 __ CompareObject(RCX, smi); |
| 3076 __ j(NOT_EQUAL, &fail); | 3093 __ j(NOT_EQUAL, &fail); |
| 3077 __ movl(RAX, Immediate(1)); // OK | 3094 __ movl(RAX, Immediate(1)); // OK |
| 3078 __ popq(PP); // Restore caller's pool pointer. | 3095 __ popq(PP); // Restore caller's pool pointer. |
| 3079 __ LeaveFrame(); | 3096 __ LeaveFrame(); |
| 3080 __ ret(); | 3097 __ ret(); |
| 3081 __ Bind(&fail); | 3098 __ Bind(&fail); |
| 3082 __ movl(RAX, Immediate(0)); // Fail. | 3099 __ movl(RAX, Immediate(0)); // Fail. |
| 3083 __ LeaveStubFrame(); | 3100 LeaveTestFrame(assembler); |
| 3084 __ ret(); | 3101 __ ret(); |
| 3085 } | 3102 } |
| 3086 | 3103 |
| 3087 | 3104 |
| 3088 ASSEMBLER_TEST_RUN(TestObjectCompare, test) { | 3105 ASSEMBLER_TEST_RUN(TestObjectCompare, test) { |
| 3089 bool res = test->Invoke<bool>(); | 3106 bool res = test->InvokeWithCode<bool>(); |
| 3090 EXPECT_EQ(true, res); | 3107 EXPECT_EQ(true, res); |
| 3091 } | 3108 } |
| 3092 | 3109 |
| 3093 | 3110 |
| 3094 ASSEMBLER_TEST_GENERATE(TestNop, assembler) { | 3111 ASSEMBLER_TEST_GENERATE(TestNop, assembler) { |
| 3095 __ nop(1); | 3112 __ nop(1); |
| 3096 __ nop(2); | 3113 __ nop(2); |
| 3097 __ nop(3); | 3114 __ nop(3); |
| 3098 __ nop(4); | 3115 __ nop(4); |
| 3099 __ nop(5); | 3116 __ nop(5); |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3283 typedef double (*SquareRootDoubleCode)(double d); | 3300 typedef double (*SquareRootDoubleCode)(double d); |
| 3284 const double kDoubleConst = .7; | 3301 const double kDoubleConst = .7; |
| 3285 double res = | 3302 double res = |
| 3286 reinterpret_cast<SquareRootDoubleCode>(test->entry())(kDoubleConst); | 3303 reinterpret_cast<SquareRootDoubleCode>(test->entry())(kDoubleConst); |
| 3287 EXPECT_FLOAT_EQ(sqrt(kDoubleConst), res, 0.0001); | 3304 EXPECT_FLOAT_EQ(sqrt(kDoubleConst), res, 0.0001); |
| 3288 } | 3305 } |
| 3289 | 3306 |
| 3290 | 3307 |
| 3291 // Called from assembler_test.cc. | 3308 // Called from assembler_test.cc. |
| 3292 ASSEMBLER_TEST_GENERATE(StoreIntoObject, assembler) { | 3309 ASSEMBLER_TEST_GENERATE(StoreIntoObject, assembler) { |
| 3310 __ pushq(CODE_REG); |
| 3293 __ pushq(THR); | 3311 __ pushq(THR); |
| 3294 __ movq(THR, CallingConventions::kArg3Reg); | 3312 __ movq(THR, CallingConventions::kArg3Reg); |
| 3295 __ StoreIntoObject(CallingConventions::kArg2Reg, | 3313 __ StoreIntoObject(CallingConventions::kArg2Reg, |
| 3296 FieldAddress(CallingConventions::kArg2Reg, | 3314 FieldAddress(CallingConventions::kArg2Reg, |
| 3297 GrowableObjectArray::data_offset()), | 3315 GrowableObjectArray::data_offset()), |
| 3298 CallingConventions::kArg1Reg); | 3316 CallingConventions::kArg1Reg); |
| 3299 __ popq(THR); | 3317 __ popq(THR); |
| 3318 __ popq(CODE_REG); |
| 3300 __ ret(); | 3319 __ ret(); |
| 3301 } | 3320 } |
| 3302 | 3321 |
| 3303 | 3322 |
| 3304 ASSEMBLER_TEST_GENERATE(DoubleFPUStackMoves, assembler) { | 3323 ASSEMBLER_TEST_GENERATE(DoubleFPUStackMoves, assembler) { |
| 3305 int64_t l = bit_cast<int64_t, double>(1024.67); | 3324 int64_t l = bit_cast<int64_t, double>(1024.67); |
| 3306 __ movq(RAX, Immediate(l)); | 3325 __ movq(RAX, Immediate(l)); |
| 3307 __ pushq(RAX); | 3326 __ pushq(RAX); |
| 3308 __ fldl(Address(RSP, 0)); | 3327 __ fldl(Address(RSP, 0)); |
| 3309 __ movq(Address(RSP, 0), Immediate(0)); | 3328 __ movq(Address(RSP, 0), Immediate(0)); |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3403 res = reinterpret_cast<DoubleToDoubleTruncCode>(test->entry())(12.8); | 3422 res = reinterpret_cast<DoubleToDoubleTruncCode>(test->entry())(12.8); |
| 3404 EXPECT_EQ(12.0, res); | 3423 EXPECT_EQ(12.0, res); |
| 3405 res = reinterpret_cast<DoubleToDoubleTruncCode>(test->entry())(-12.3); | 3424 res = reinterpret_cast<DoubleToDoubleTruncCode>(test->entry())(-12.3); |
| 3406 EXPECT_EQ(-12.0, res); | 3425 EXPECT_EQ(-12.0, res); |
| 3407 res = reinterpret_cast<DoubleToDoubleTruncCode>(test->entry())(-12.8); | 3426 res = reinterpret_cast<DoubleToDoubleTruncCode>(test->entry())(-12.8); |
| 3408 EXPECT_EQ(-12.0, res); | 3427 EXPECT_EQ(-12.0, res); |
| 3409 } | 3428 } |
| 3410 | 3429 |
| 3411 | 3430 |
| 3412 ASSEMBLER_TEST_GENERATE(DoubleAbs, assembler) { | 3431 ASSEMBLER_TEST_GENERATE(DoubleAbs, assembler) { |
| 3413 __ EnterStubFrame(); | 3432 EnterTestFrame(assembler); |
| 3433 #if defined(TARGET_OS_WINDOWS) |
| 3434 // First argument is code object, MSVC passes second argument in XMM1. |
| 3435 __ DoubleAbs(XMM1); |
| 3436 __ movaps(XMM0, XMM1); |
| 3437 #else |
| 3414 __ DoubleAbs(XMM0); | 3438 __ DoubleAbs(XMM0); |
| 3415 __ LeaveStubFrame(); | 3439 #endif |
| 3440 LeaveTestFrame(assembler); |
| 3416 __ ret(); | 3441 __ ret(); |
| 3417 } | 3442 } |
| 3418 | 3443 |
| 3419 | 3444 |
| 3420 ASSEMBLER_TEST_RUN(DoubleAbs, test) { | 3445 ASSEMBLER_TEST_RUN(DoubleAbs, test) { |
| 3421 double val = -12.45; | 3446 double val = -12.45; |
| 3422 double res = test->Invoke<double, double>(val); | 3447 double res = test->InvokeWithCode<double, double>(val); |
| 3423 EXPECT_FLOAT_EQ(-val, res, 0.001); | 3448 EXPECT_FLOAT_EQ(-val, res, 0.001); |
| 3424 val = 12.45; | 3449 val = 12.45; |
| 3425 res = test->Invoke<double, double>(val); | 3450 res = test->InvokeWithCode<double, double>(val); |
| 3426 EXPECT_FLOAT_EQ(val, res, 0.001); | 3451 EXPECT_FLOAT_EQ(val, res, 0.001); |
| 3427 } | 3452 } |
| 3428 | 3453 |
| 3429 | 3454 |
| 3430 ASSEMBLER_TEST_GENERATE(ExtractSignBits, assembler) { | 3455 ASSEMBLER_TEST_GENERATE(ExtractSignBits, assembler) { |
| 3431 __ movmskpd(RAX, XMM0); | 3456 __ movmskpd(RAX, XMM0); |
| 3432 __ andq(RAX, Immediate(0x1)); | 3457 __ andq(RAX, Immediate(0x1)); |
| 3433 __ ret(); | 3458 __ ret(); |
| 3434 } | 3459 } |
| 3435 | 3460 |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3618 EXPECT_EQ(ICData::kInt64RangeBit, range_of(Integer::New(kMaxInt64))); | 3643 EXPECT_EQ(ICData::kInt64RangeBit, range_of(Integer::New(kMaxInt64))); |
| 3619 EXPECT_EQ(ICData::kInt64RangeBit, range_of(Integer::New(kMinInt64))); | 3644 EXPECT_EQ(ICData::kInt64RangeBit, range_of(Integer::New(kMinInt64))); |
| 3620 | 3645 |
| 3621 EXPECT_EQ(0, range_of(Bool::True().raw())); | 3646 EXPECT_EQ(0, range_of(Bool::True().raw())); |
| 3622 } | 3647 } |
| 3623 | 3648 |
| 3624 | 3649 |
| 3625 } // namespace dart | 3650 } // namespace dart |
| 3626 | 3651 |
| 3627 #endif // defined TARGET_ARCH_X64 | 3652 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |