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