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 1620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1631 } | 1631 } |
1632 | 1632 |
1633 | 1633 |
1634 ASSEMBLER_TEST_RUN(PackedDoubleMax, test) { | 1634 ASSEMBLER_TEST_RUN(PackedDoubleMax, test) { |
1635 typedef double (*PackedDoubleMax)(); | 1635 typedef double (*PackedDoubleMax)(); |
1636 double res = reinterpret_cast<PackedDoubleMax>(test->entry())(); | 1636 double res = reinterpret_cast<PackedDoubleMax>(test->entry())(); |
1637 EXPECT_FLOAT_EQ(9.0, res, 0.000001f); | 1637 EXPECT_FLOAT_EQ(9.0, res, 0.000001f); |
1638 } | 1638 } |
1639 | 1639 |
1640 | 1640 |
| 1641 ASSEMBLER_TEST_GENERATE(PackedDoubleShuffle, assembler) { |
| 1642 static const struct ALIGN16 { |
| 1643 double a; |
| 1644 double b; |
| 1645 } constant0 = { 2.0, 9.0 }; |
| 1646 __ movq(RAX, Immediate(reinterpret_cast<uword>(&constant0))); |
| 1647 __ movups(XMM10, Address(RAX, 0)); |
| 1648 // Splat Y across all lanes. |
| 1649 __ shufpd(XMM10, XMM10, Immediate(0x33)); |
| 1650 // Splat X across all lanes. |
| 1651 __ shufpd(XMM10, XMM10, Immediate(0x0)); |
| 1652 // Set return value. |
| 1653 __ movaps(XMM0, XMM10); |
| 1654 __ ret(); |
| 1655 } |
| 1656 |
| 1657 |
| 1658 ASSEMBLER_TEST_RUN(PackedDoubleShuffle, test) { |
| 1659 typedef double (*PackedDoubleShuffle)(); |
| 1660 double res = reinterpret_cast<PackedDoubleShuffle>(test->entry())(); |
| 1661 EXPECT_FLOAT_EQ(9.0, res, 0.000001f); |
| 1662 } |
| 1663 |
| 1664 |
1641 ASSEMBLER_TEST_GENERATE(PackedDoubleToSingle, assembler) { | 1665 ASSEMBLER_TEST_GENERATE(PackedDoubleToSingle, assembler) { |
1642 static const struct ALIGN16 { | 1666 static const struct ALIGN16 { |
1643 double a; | 1667 double a; |
1644 double b; | 1668 double b; |
1645 } constant0 = { 9.0, 2.0 }; | 1669 } constant0 = { 9.0, 2.0 }; |
1646 __ movq(RAX, Immediate(reinterpret_cast<uword>(&constant0))); | 1670 __ movq(RAX, Immediate(reinterpret_cast<uword>(&constant0))); |
1647 __ movups(XMM11, Address(RAX, 0)); | 1671 __ movups(XMM11, Address(RAX, 0)); |
1648 __ cvtpd2ps(XMM10, XMM11); | 1672 __ cvtpd2ps(XMM10, XMM11); |
1649 __ movaps(XMM0, XMM10); | 1673 __ movaps(XMM0, XMM10); |
1650 __ ret(); | 1674 __ ret(); |
(...skipping 1269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2920 EXPECT_EQ(1, res); // Greater equal. | 2944 EXPECT_EQ(1, res); // Greater equal. |
2921 res = reinterpret_cast<ConditionalMovesCompareCode>(test->entry())(5, 5); | 2945 res = reinterpret_cast<ConditionalMovesCompareCode>(test->entry())(5, 5); |
2922 EXPECT_EQ(1, res); // Greater equal. | 2946 EXPECT_EQ(1, res); // Greater equal. |
2923 res = reinterpret_cast<ConditionalMovesCompareCode>(test->entry())(2, 5); | 2947 res = reinterpret_cast<ConditionalMovesCompareCode>(test->entry())(2, 5); |
2924 EXPECT_EQ(-1, res); // Less. | 2948 EXPECT_EQ(-1, res); // Less. |
2925 } | 2949 } |
2926 | 2950 |
2927 } // namespace dart | 2951 } // namespace dart |
2928 | 2952 |
2929 #endif // defined TARGET_ARCH_X64 | 2953 #endif // defined TARGET_ARCH_X64 |
OLD | NEW |