Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(714)

Side by Side Diff: runtime/vm/assembler_x64_test.cc

Issue 1283733003: VM: Refactor assembler test that rely on the constant pool. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Added comments, fixed that pass in Thread Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/vm/assembler_test.cc ('k') | runtime/vm/unit_test.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 2007 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 ASSEMBLER_TEST_GENERATE(PackedDoubleNegate, assembler) { 2023 ASSEMBLER_TEST_GENERATE(PackedDoubleNegate, assembler) {
2024 static const struct ALIGN16 { 2024 static const struct ALIGN16 {
2025 double a; 2025 double a;
2026 double b; 2026 double b;
2027 } constant0 = { 1.0, 2.0 }; 2027 } constant0 = { 1.0, 2.0 };
2028 __ pushq(PP); // Save caller's pool pointer and load a new one here. 2028 __ EnterStubFrame();
2029 __ LoadPoolPointer();
2030 __ movq(RAX, Immediate(reinterpret_cast<uword>(&constant0))); 2029 __ movq(RAX, Immediate(reinterpret_cast<uword>(&constant0)));
2031 __ movups(XMM10, Address(RAX, 0)); 2030 __ movups(XMM10, Address(RAX, 0));
2032 __ negatepd(XMM10); 2031 __ negatepd(XMM10);
2033 __ movaps(XMM0, XMM10); 2032 __ movaps(XMM0, XMM10);
2034 __ popq(PP); // Restore caller's pool pointer. 2033 __ LeaveStubFrame();
2035 __ ret(); 2034 __ ret();
2036 } 2035 }
2037 2036
2038 2037
2039 ASSEMBLER_TEST_RUN(PackedDoubleNegate, test) { 2038 ASSEMBLER_TEST_RUN(PackedDoubleNegate, test) {
2040 typedef double (*PackedDoubleNegate)(); 2039 double res = test->Invoke<double>();
2041 double res = reinterpret_cast<PackedDoubleNegate>(test->entry())();
2042 EXPECT_FLOAT_EQ(-1.0, res, 0.000001f); 2040 EXPECT_FLOAT_EQ(-1.0, res, 0.000001f);
2043 } 2041 }
2044 2042
2045 2043
2046 ASSEMBLER_TEST_GENERATE(PackedDoubleAbsolute, assembler) { 2044 ASSEMBLER_TEST_GENERATE(PackedDoubleAbsolute, assembler) {
2047 static const struct ALIGN16 { 2045 static const struct ALIGN16 {
2048 double a; 2046 double a;
2049 double b; 2047 double b;
2050 } constant0 = { -1.0, 2.0 }; 2048 } constant0 = { -1.0, 2.0 };
2051 __ pushq(PP); // Save caller's pool pointer and load a new one here. 2049 __ EnterStubFrame();
2052 __ LoadPoolPointer();
2053 __ movq(RAX, Immediate(reinterpret_cast<uword>(&constant0))); 2050 __ movq(RAX, Immediate(reinterpret_cast<uword>(&constant0)));
2054 __ movups(XMM10, Address(RAX, 0)); 2051 __ movups(XMM10, Address(RAX, 0));
2055 __ abspd(XMM10); 2052 __ abspd(XMM10);
2056 __ movaps(XMM0, XMM10); 2053 __ movaps(XMM0, XMM10);
2057 __ popq(PP); // Restore caller's pool pointer. 2054 __ LeaveStubFrame();
2058 __ ret(); 2055 __ ret();
2059 } 2056 }
2060 2057
2061 2058
2062 ASSEMBLER_TEST_RUN(PackedDoubleAbsolute, test) { 2059 ASSEMBLER_TEST_RUN(PackedDoubleAbsolute, test) {
2063 typedef double (*PackedDoubleAbsolute)(); 2060 double res = test->Invoke<double>();
2064 double res = reinterpret_cast<PackedDoubleAbsolute>(test->entry())();
2065 EXPECT_FLOAT_EQ(1.0, res, 0.000001f); 2061 EXPECT_FLOAT_EQ(1.0, res, 0.000001f);
2066 } 2062 }
2067 2063
2068 2064
2069 ASSEMBLER_TEST_GENERATE(PackedDoubleMul, assembler) { 2065 ASSEMBLER_TEST_GENERATE(PackedDoubleMul, assembler) {
2070 static const struct ALIGN16 { 2066 static const struct ALIGN16 {
2071 double a; 2067 double a;
2072 double b; 2068 double b;
2073 } constant0 = { 3.0, 2.0 }; 2069 } constant0 = { 3.0, 2.0 };
2074 static const struct ALIGN16 { 2070 static const struct ALIGN16 {
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after
2488 2484
2489 2485
2490 ASSEMBLER_TEST_RUN(PackedCompareNLE, test) { 2486 ASSEMBLER_TEST_RUN(PackedCompareNLE, test) {
2491 typedef uint32_t (*PackedCompareNLECode)(); 2487 typedef uint32_t (*PackedCompareNLECode)();
2492 uint32_t res = reinterpret_cast<PackedCompareNLECode>(test->entry())(); 2488 uint32_t res = reinterpret_cast<PackedCompareNLECode>(test->entry())();
2493 EXPECT_EQ(static_cast<uword>(0x0), res); 2489 EXPECT_EQ(static_cast<uword>(0x0), res);
2494 } 2490 }
2495 2491
2496 2492
2497 ASSEMBLER_TEST_GENERATE(PackedNegate, assembler) { 2493 ASSEMBLER_TEST_GENERATE(PackedNegate, assembler) {
2498 __ pushq(PP); // Save caller's pool pointer and load a new one here. 2494 __ EnterStubFrame();
2499 __ LoadPoolPointer();
2500 __ movl(RAX, Immediate(bit_cast<int32_t, float>(12.3f))); 2495 __ movl(RAX, Immediate(bit_cast<int32_t, float>(12.3f)));
2501 __ movd(XMM0, RAX); 2496 __ movd(XMM0, RAX);
2502 __ shufps(XMM0, XMM0, Immediate(0x0)); 2497 __ shufps(XMM0, XMM0, Immediate(0x0));
2503 __ negateps(XMM0); 2498 __ negateps(XMM0);
2504 __ 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.
2505 __ popq(PP); // Restore caller's pool pointer. 2500 __ LeaveStubFrame();
2506 __ ret(); 2501 __ ret();
2507 } 2502 }
2508 2503
2509 2504
2510 ASSEMBLER_TEST_RUN(PackedNegate, test) { 2505 ASSEMBLER_TEST_RUN(PackedNegate, test) {
2511 typedef float (*PackedNegateCode)(); 2506 float res = test->Invoke<float>();
2512 float res = reinterpret_cast<PackedNegateCode>(test->entry())();
2513 EXPECT_FLOAT_EQ(-12.3f, res, 0.001f); 2507 EXPECT_FLOAT_EQ(-12.3f, res, 0.001f);
2514 } 2508 }
2515 2509
2516 2510
2517 ASSEMBLER_TEST_GENERATE(PackedAbsolute, assembler) { 2511 ASSEMBLER_TEST_GENERATE(PackedAbsolute, assembler) {
2518 __ pushq(PP); // Save caller's pool pointer and load a new one here. 2512 __ EnterStubFrame();
2519 __ LoadPoolPointer();
2520 __ movl(RAX, Immediate(bit_cast<int32_t, float>(-15.3f))); 2513 __ movl(RAX, Immediate(bit_cast<int32_t, float>(-15.3f)));
2521 __ movd(XMM0, RAX); 2514 __ movd(XMM0, RAX);
2522 __ shufps(XMM0, XMM0, Immediate(0x0)); 2515 __ shufps(XMM0, XMM0, Immediate(0x0));
2523 __ absps(XMM0); 2516 __ absps(XMM0);
2524 __ 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.
2525 __ popq(PP); // Restore caller's pool pointer. 2518 __ LeaveStubFrame();
2526 __ ret(); 2519 __ ret();
2527 } 2520 }
2528 2521
2529 2522
2530 ASSEMBLER_TEST_RUN(PackedAbsolute, test) { 2523 ASSEMBLER_TEST_RUN(PackedAbsolute, test) {
2531 typedef float (*PackedAbsoluteCode)(); 2524 float res = test->Invoke<float>();
2532 float res = reinterpret_cast<PackedAbsoluteCode>(test->entry())();
2533 EXPECT_FLOAT_EQ(15.3f, res, 0.001f); 2525 EXPECT_FLOAT_EQ(15.3f, res, 0.001f);
2534 } 2526 }
2535 2527
2536 2528
2537 ASSEMBLER_TEST_GENERATE(PackedSetWZero, assembler) { 2529 ASSEMBLER_TEST_GENERATE(PackedSetWZero, assembler) {
2538 __ pushq(PP); // Save caller's pool pointer and load a new one here. 2530 __ EnterStubFrame();
2539 __ LoadPoolPointer();
2540 __ set1ps(XMM0, RAX, Immediate(bit_cast<int32_t, float>(12.3f))); 2531 __ set1ps(XMM0, RAX, Immediate(bit_cast<int32_t, float>(12.3f)));
2541 __ zerowps(XMM0); 2532 __ zerowps(XMM0);
2542 __ 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.
2543 __ popq(PP); // Restore caller's pool pointer. 2534 __ LeaveStubFrame();
2544 __ ret(); 2535 __ ret();
2545 } 2536 }
2546 2537
2547 2538
2548 ASSEMBLER_TEST_RUN(PackedSetWZero, test) { 2539 ASSEMBLER_TEST_RUN(PackedSetWZero, test) {
2549 typedef float (*PackedSetWZeroCode)(); 2540 float res = test->Invoke<float>();
2550 float res = reinterpret_cast<PackedSetWZeroCode>(test->entry())();
2551 EXPECT_FLOAT_EQ(0.0f, res, 0.001f); 2541 EXPECT_FLOAT_EQ(0.0f, res, 0.001f);
2552 } 2542 }
2553 2543
2554 2544
2555 ASSEMBLER_TEST_GENERATE(PackedMin, assembler) { 2545 ASSEMBLER_TEST_GENERATE(PackedMin, assembler) {
2556 __ set1ps(XMM0, RAX, Immediate(bit_cast<int32_t, float>(2.0f))); 2546 __ set1ps(XMM0, RAX, Immediate(bit_cast<int32_t, float>(2.0f)));
2557 __ set1ps(XMM1, RAX, Immediate(bit_cast<int32_t, float>(4.0f))); 2547 __ set1ps(XMM1, RAX, Immediate(bit_cast<int32_t, float>(4.0f)));
2558 __ minps(XMM0, XMM1); 2548 __ minps(XMM0, XMM1);
2559 __ ret(); 2549 __ ret();
2560 } 2550 }
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
2650 2640
2651 2641
2652 ASSEMBLER_TEST_GENERATE(PackedLogicalNot, assembler) { 2642 ASSEMBLER_TEST_GENERATE(PackedLogicalNot, assembler) {
2653 static const struct ALIGN16 { 2643 static const struct ALIGN16 {
2654 uint32_t a; 2644 uint32_t a;
2655 uint32_t b; 2645 uint32_t b;
2656 uint32_t c; 2646 uint32_t c;
2657 uint32_t d; 2647 uint32_t d;
2658 } constant1 = 2648 } constant1 =
2659 { 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF }; 2649 { 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF };
2660 __ pushq(PP); // Save caller's pool pointer and load a new one here. 2650 __ EnterStubFrame();
2661 __ LoadPoolPointer();
2662 __ LoadImmediate(RAX, Immediate(reinterpret_cast<intptr_t>(&constant1))); 2651 __ LoadImmediate(RAX, Immediate(reinterpret_cast<intptr_t>(&constant1)));
2663 __ movups(XMM9, Address(RAX, 0)); 2652 __ movups(XMM9, Address(RAX, 0));
2664 __ notps(XMM9); 2653 __ notps(XMM9);
2665 __ movaps(XMM0, XMM9); 2654 __ movaps(XMM0, XMM9);
2666 __ pushq(RAX); 2655 __ pushq(RAX);
2667 __ movss(Address(RSP, 0), XMM0); 2656 __ movss(Address(RSP, 0), XMM0);
2668 __ popq(RAX); 2657 __ popq(RAX);
2669 __ popq(PP); // Restore caller's pool pointer. 2658 __ LeaveStubFrame();
2670 __ ret(); 2659 __ ret();
2671 } 2660 }
2672 2661
2673 2662
2674 ASSEMBLER_TEST_RUN(PackedLogicalNot, test) { 2663 ASSEMBLER_TEST_RUN(PackedLogicalNot, test) {
2675 typedef uint32_t (*PackedLogicalNotCode)(); 2664 uint32_t res = test->Invoke<uint32_t>();
2676 uint32_t res = reinterpret_cast<PackedLogicalNotCode>(test->entry())();
2677 EXPECT_EQ(static_cast<uword>(0x0), res); 2665 EXPECT_EQ(static_cast<uword>(0x0), res);
2678 } 2666 }
2679 2667
2680 2668
2681 ASSEMBLER_TEST_GENERATE(PackedMoveHighLow, assembler) { 2669 ASSEMBLER_TEST_GENERATE(PackedMoveHighLow, assembler) {
2682 static const struct ALIGN16 { 2670 static const struct ALIGN16 {
2683 float a; 2671 float a;
2684 float b; 2672 float b;
2685 float c; 2673 float c;
2686 float d; 2674 float d;
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
3058 typedef int64_t (*DoubleToInt64ConversionCode)(); 3046 typedef int64_t (*DoubleToInt64ConversionCode)();
3059 int64_t res = reinterpret_cast<DoubleToInt64ConversionCode>(test->entry())(); 3047 int64_t res = reinterpret_cast<DoubleToInt64ConversionCode>(test->entry())();
3060 EXPECT_EQ(0, res); 3048 EXPECT_EQ(0, res);
3061 } 3049 }
3062 3050
3063 3051
3064 ASSEMBLER_TEST_GENERATE(TestObjectCompare, assembler) { 3052 ASSEMBLER_TEST_GENERATE(TestObjectCompare, assembler) {
3065 ObjectStore* object_store = Isolate::Current()->object_store(); 3053 ObjectStore* object_store = Isolate::Current()->object_store();
3066 const Object& obj = Object::ZoneHandle(object_store->smi_class()); 3054 const Object& obj = Object::ZoneHandle(object_store->smi_class());
3067 Label fail; 3055 Label fail;
3068 __ EnterFrame(0); 3056 __ EnterStubFrame();
3069 __ pushq(PP); // Save caller's pool pointer and load a new one here.
3070 __ LoadPoolPointer();
3071 __ LoadObject(RAX, obj); 3057 __ LoadObject(RAX, obj);
3072 __ CompareObject(RAX, obj); 3058 __ CompareObject(RAX, obj);
3073 __ j(NOT_EQUAL, &fail); 3059 __ j(NOT_EQUAL, &fail);
3074 __ LoadObject(RCX, obj); 3060 __ LoadObject(RCX, obj);
3075 __ CompareObject(RCX, obj); 3061 __ CompareObject(RCX, obj);
3076 __ j(NOT_EQUAL, &fail); 3062 __ j(NOT_EQUAL, &fail);
3077 const Smi& smi = Smi::ZoneHandle(Smi::New(15)); 3063 const Smi& smi = Smi::ZoneHandle(Smi::New(15));
3078 __ LoadObject(RCX, smi); 3064 __ LoadObject(RCX, smi);
3079 __ CompareObject(RCX, smi); 3065 __ CompareObject(RCX, smi);
3080 __ j(NOT_EQUAL, &fail); 3066 __ j(NOT_EQUAL, &fail);
3081 __ pushq(RAX); 3067 __ pushq(RAX);
3082 __ StoreObject(Address(RSP, 0), obj); 3068 __ StoreObject(Address(RSP, 0), obj);
3083 __ popq(RCX); 3069 __ popq(RCX);
3084 __ CompareObject(RCX, obj); 3070 __ CompareObject(RCX, obj);
3085 __ j(NOT_EQUAL, &fail); 3071 __ j(NOT_EQUAL, &fail);
3086 __ pushq(RAX); 3072 __ pushq(RAX);
3087 __ StoreObject(Address(RSP, 0), smi); 3073 __ StoreObject(Address(RSP, 0), smi);
3088 __ popq(RCX); 3074 __ popq(RCX);
3089 __ CompareObject(RCX, smi); 3075 __ CompareObject(RCX, smi);
3090 __ j(NOT_EQUAL, &fail); 3076 __ j(NOT_EQUAL, &fail);
3091 __ movl(RAX, Immediate(1)); // OK 3077 __ movl(RAX, Immediate(1)); // OK
3092 __ popq(PP); // Restore caller's pool pointer. 3078 __ popq(PP); // Restore caller's pool pointer.
3093 __ LeaveFrame(); 3079 __ LeaveFrame();
3094 __ ret(); 3080 __ ret();
3095 __ Bind(&fail); 3081 __ Bind(&fail);
3096 __ movl(RAX, Immediate(0)); // Fail. 3082 __ movl(RAX, Immediate(0)); // Fail.
3097 __ popq(PP); // Restore caller's pool pointer. 3083 __ LeaveStubFrame();
3098 __ LeaveFrame();
3099 __ ret(); 3084 __ ret();
3100 } 3085 }
3101 3086
3102 3087
3103 ASSEMBLER_TEST_RUN(TestObjectCompare, test) { 3088 ASSEMBLER_TEST_RUN(TestObjectCompare, test) {
3104 typedef bool (*TestObjectCompare)(); 3089 bool res = test->Invoke<bool>();
3105 bool res = reinterpret_cast<TestObjectCompare>(test->entry())();
3106 EXPECT_EQ(true, res); 3090 EXPECT_EQ(true, res);
3107 } 3091 }
3108 3092
3109 3093
3110 ASSEMBLER_TEST_GENERATE(TestNop, assembler) { 3094 ASSEMBLER_TEST_GENERATE(TestNop, assembler) {
3111 __ nop(1); 3095 __ nop(1);
3112 __ nop(2); 3096 __ nop(2);
3113 __ nop(3); 3097 __ nop(3);
3114 __ nop(4); 3098 __ nop(4);
3115 __ nop(5); 3099 __ nop(5);
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
3299 typedef double (*SquareRootDoubleCode)(double d); 3283 typedef double (*SquareRootDoubleCode)(double d);
3300 const double kDoubleConst = .7; 3284 const double kDoubleConst = .7;
3301 double res = 3285 double res =
3302 reinterpret_cast<SquareRootDoubleCode>(test->entry())(kDoubleConst); 3286 reinterpret_cast<SquareRootDoubleCode>(test->entry())(kDoubleConst);
3303 EXPECT_FLOAT_EQ(sqrt(kDoubleConst), res, 0.0001); 3287 EXPECT_FLOAT_EQ(sqrt(kDoubleConst), res, 0.0001);
3304 } 3288 }
3305 3289
3306 3290
3307 // Called from assembler_test.cc. 3291 // Called from assembler_test.cc.
3308 ASSEMBLER_TEST_GENERATE(StoreIntoObject, assembler) { 3292 ASSEMBLER_TEST_GENERATE(StoreIntoObject, assembler) {
3309 __ pushq(PP); // Save caller's pool pointer and load a new one here.
3310 __ LoadPoolPointer();
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(PP); // Restore caller's pool pointer.
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
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 __ pushq(PP); // Save caller's pool pointer and load a new one here. 3413 __ EnterStubFrame();
3433 __ LoadPoolPointer();
3434 __ DoubleAbs(XMM0); 3414 __ DoubleAbs(XMM0);
3435 __ popq(PP); // Restore caller's pool pointer. 3415 __ LeaveStubFrame();
3436 __ ret(); 3416 __ ret();
3437 } 3417 }
3438 3418
3439 3419
3440 ASSEMBLER_TEST_RUN(DoubleAbs, test) { 3420 ASSEMBLER_TEST_RUN(DoubleAbs, test) {
3441 typedef double (*DoubleAbsCode)(double d);
3442 double val = -12.45; 3421 double val = -12.45;
3443 double res = reinterpret_cast<DoubleAbsCode>(test->entry())(val); 3422 double res = test->Invoke<double, double>(val);
3444 EXPECT_FLOAT_EQ(-val, res, 0.001); 3423 EXPECT_FLOAT_EQ(-val, res, 0.001);
3445 val = 12.45; 3424 val = 12.45;
3446 res = reinterpret_cast<DoubleAbsCode>(test->entry())(val); 3425 res = test->Invoke<double, double>(val);
3447 EXPECT_FLOAT_EQ(val, res, 0.001); 3426 EXPECT_FLOAT_EQ(val, res, 0.001);
3448 } 3427 }
3449 3428
3450 3429
3451 ASSEMBLER_TEST_GENERATE(ExtractSignBits, assembler) { 3430 ASSEMBLER_TEST_GENERATE(ExtractSignBits, assembler) {
3452 __ movmskpd(RAX, XMM0); 3431 __ movmskpd(RAX, XMM0);
3453 __ andq(RAX, Immediate(0x1)); 3432 __ andq(RAX, Immediate(0x1));
3454 __ ret(); 3433 __ ret();
3455 } 3434 }
3456 3435
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
3639 EXPECT_EQ(ICData::kInt64RangeBit, range_of(Integer::New(kMaxInt64))); 3618 EXPECT_EQ(ICData::kInt64RangeBit, range_of(Integer::New(kMaxInt64)));
3640 EXPECT_EQ(ICData::kInt64RangeBit, range_of(Integer::New(kMinInt64))); 3619 EXPECT_EQ(ICData::kInt64RangeBit, range_of(Integer::New(kMinInt64)));
3641 3620
3642 EXPECT_EQ(0, range_of(Bool::True().raw())); 3621 EXPECT_EQ(0, range_of(Bool::True().raw()));
3643 } 3622 }
3644 3623
3645 3624
3646 } // namespace dart 3625 } // namespace dart
3647 3626
3648 #endif // defined TARGET_ARCH_X64 3627 #endif // defined TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « runtime/vm/assembler_test.cc ('k') | runtime/vm/unit_test.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698