| 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 1455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1466 double res = reinterpret_cast<PackedDoubleSub>(test->entry())(); | 1466 double res = reinterpret_cast<PackedDoubleSub>(test->entry())(); |
| 1467 EXPECT_FLOAT_EQ(-2.0, res, 0.000001f); | 1467 EXPECT_FLOAT_EQ(-2.0, res, 0.000001f); |
| 1468 } | 1468 } |
| 1469 | 1469 |
| 1470 | 1470 |
| 1471 ASSEMBLER_TEST_GENERATE(PackedDoubleNegate, assembler) { | 1471 ASSEMBLER_TEST_GENERATE(PackedDoubleNegate, assembler) { |
| 1472 static const struct ALIGN16 { | 1472 static const struct ALIGN16 { |
| 1473 double a; | 1473 double a; |
| 1474 double b; | 1474 double b; |
| 1475 } constant0 = { 1.0, 2.0 }; | 1475 } constant0 = { 1.0, 2.0 }; |
| 1476 __ pushq(PP); // Save caller's pool pointer and load a new one here. |
| 1477 __ LoadPoolPointer(PP); |
| 1476 __ movq(RAX, Immediate(reinterpret_cast<uword>(&constant0))); | 1478 __ movq(RAX, Immediate(reinterpret_cast<uword>(&constant0))); |
| 1477 __ movups(XMM10, Address(RAX, 0)); | 1479 __ movups(XMM10, Address(RAX, 0)); |
| 1478 __ negatepd(XMM10); | 1480 __ negatepd(XMM10); |
| 1479 __ movaps(XMM0, XMM10); | 1481 __ movaps(XMM0, XMM10); |
| 1482 __ popq(PP); // Restore caller's pool pointer. |
| 1480 __ ret(); | 1483 __ ret(); |
| 1481 } | 1484 } |
| 1482 | 1485 |
| 1483 | 1486 |
| 1484 ASSEMBLER_TEST_RUN(PackedDoubleNegate, test) { | 1487 ASSEMBLER_TEST_RUN(PackedDoubleNegate, test) { |
| 1485 typedef double (*PackedDoubleNegate)(); | 1488 typedef double (*PackedDoubleNegate)(); |
| 1486 double res = reinterpret_cast<PackedDoubleNegate>(test->entry())(); | 1489 double res = reinterpret_cast<PackedDoubleNegate>(test->entry())(); |
| 1487 EXPECT_FLOAT_EQ(-1.0, res, 0.000001f); | 1490 EXPECT_FLOAT_EQ(-1.0, res, 0.000001f); |
| 1488 } | 1491 } |
| 1489 | 1492 |
| 1490 | 1493 |
| 1491 ASSEMBLER_TEST_GENERATE(PackedDoubleAbsolute, assembler) { | 1494 ASSEMBLER_TEST_GENERATE(PackedDoubleAbsolute, assembler) { |
| 1492 static const struct ALIGN16 { | 1495 static const struct ALIGN16 { |
| 1493 double a; | 1496 double a; |
| 1494 double b; | 1497 double b; |
| 1495 } constant0 = { -1.0, 2.0 }; | 1498 } constant0 = { -1.0, 2.0 }; |
| 1499 __ pushq(PP); // Save caller's pool pointer and load a new one here. |
| 1500 __ LoadPoolPointer(PP); |
| 1496 __ movq(RAX, Immediate(reinterpret_cast<uword>(&constant0))); | 1501 __ movq(RAX, Immediate(reinterpret_cast<uword>(&constant0))); |
| 1497 __ movups(XMM10, Address(RAX, 0)); | 1502 __ movups(XMM10, Address(RAX, 0)); |
| 1498 __ abspd(XMM10); | 1503 __ abspd(XMM10); |
| 1499 __ movaps(XMM0, XMM10); | 1504 __ movaps(XMM0, XMM10); |
| 1505 __ popq(PP); // Restore caller's pool pointer. |
| 1500 __ ret(); | 1506 __ ret(); |
| 1501 } | 1507 } |
| 1502 | 1508 |
| 1503 | 1509 |
| 1504 ASSEMBLER_TEST_RUN(PackedDoubleAbsolute, test) { | 1510 ASSEMBLER_TEST_RUN(PackedDoubleAbsolute, test) { |
| 1505 typedef double (*PackedDoubleAbsolute)(); | 1511 typedef double (*PackedDoubleAbsolute)(); |
| 1506 double res = reinterpret_cast<PackedDoubleAbsolute>(test->entry())(); | 1512 double res = reinterpret_cast<PackedDoubleAbsolute>(test->entry())(); |
| 1507 EXPECT_FLOAT_EQ(1.0, res, 0.000001f); | 1513 EXPECT_FLOAT_EQ(1.0, res, 0.000001f); |
| 1508 } | 1514 } |
| 1509 | 1515 |
| (...skipping 1404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2914 EXPECT_EQ(1, res); // Greater equal. | 2920 EXPECT_EQ(1, res); // Greater equal. |
| 2915 res = reinterpret_cast<ConditionalMovesCompareCode>(test->entry())(5, 5); | 2921 res = reinterpret_cast<ConditionalMovesCompareCode>(test->entry())(5, 5); |
| 2916 EXPECT_EQ(1, res); // Greater equal. | 2922 EXPECT_EQ(1, res); // Greater equal. |
| 2917 res = reinterpret_cast<ConditionalMovesCompareCode>(test->entry())(2, 5); | 2923 res = reinterpret_cast<ConditionalMovesCompareCode>(test->entry())(2, 5); |
| 2918 EXPECT_EQ(-1, res); // Less. | 2924 EXPECT_EQ(-1, res); // Less. |
| 2919 } | 2925 } |
| 2920 | 2926 |
| 2921 } // namespace dart | 2927 } // namespace dart |
| 2922 | 2928 |
| 2923 #endif // defined TARGET_ARCH_X64 | 2929 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |