| 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_IA32) | 6 #if defined(TARGET_ARCH_IA32) |
| 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 856 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 867 } | 867 } |
| 868 | 868 |
| 869 | 869 |
| 870 ASSEMBLER_TEST_RUN(PackedFPOperations, test) { | 870 ASSEMBLER_TEST_RUN(PackedFPOperations, test) { |
| 871 typedef float (*PackedFPOperationsCode)(); | 871 typedef float (*PackedFPOperationsCode)(); |
| 872 float res = reinterpret_cast<PackedFPOperationsCode>(test->entry())(); | 872 float res = reinterpret_cast<PackedFPOperationsCode>(test->entry())(); |
| 873 EXPECT_FLOAT_EQ(14.7f, res, 0.001f); | 873 EXPECT_FLOAT_EQ(14.7f, res, 0.001f); |
| 874 } | 874 } |
| 875 | 875 |
| 876 | 876 |
| 877 ASSEMBLER_TEST_GENERATE(PackedIntOperations, assembler) { |
| 878 __ movl(EAX, Immediate(0x2)); |
| 879 __ movd(XMM0, EAX); |
| 880 __ shufps(XMM0, XMM0, Immediate(0x0)); |
| 881 __ movl(EAX, Immediate(0x1)); |
| 882 __ movd(XMM1, EAX); |
| 883 __ shufps(XMM1, XMM1, Immediate(0x0)); |
| 884 __ addpl(XMM0, XMM1); // 0x3 |
| 885 __ addpl(XMM0, XMM0); // 0x6 |
| 886 __ subpl(XMM0, XMM1); // 0x5 |
| 887 // Copy the low lane at ESP. |
| 888 __ pushl(EAX); |
| 889 __ movss(Address(ESP, 0), XMM0); |
| 890 __ popl(EAX); |
| 891 __ ret(); |
| 892 } |
| 893 |
| 894 |
| 895 ASSEMBLER_TEST_RUN(PackedIntOperations, test) { |
| 896 typedef uint32_t (*PackedIntOperationsCode)(); |
| 897 uint32_t res = reinterpret_cast<PackedIntOperationsCode>(test->entry())(); |
| 898 EXPECT_EQ(static_cast<uword>(0x5), res); |
| 899 } |
| 900 |
| 901 |
| 877 ASSEMBLER_TEST_GENERATE(PackedFPOperations2, assembler) { | 902 ASSEMBLER_TEST_GENERATE(PackedFPOperations2, assembler) { |
| 878 __ movl(EAX, Immediate(bit_cast<int32_t, float>(4.0f))); | 903 __ movl(EAX, Immediate(bit_cast<int32_t, float>(4.0f))); |
| 879 __ movd(XMM0, EAX); | 904 __ movd(XMM0, EAX); |
| 880 __ shufps(XMM0, XMM0, Immediate(0x0)); | 905 __ shufps(XMM0, XMM0, Immediate(0x0)); |
| 881 | 906 |
| 882 __ movaps(XMM1, XMM0); // Copy XMM0 | 907 __ movaps(XMM1, XMM0); // Copy XMM0 |
| 883 __ reciprocalps(XMM1); // 0.25 | 908 __ reciprocalps(XMM1); // 0.25 |
| 884 __ sqrtps(XMM1); // 0.5 | 909 __ sqrtps(XMM1); // 0.5 |
| 885 __ rsqrtps(XMM0); // ~0.5 | 910 __ rsqrtps(XMM0); // ~0.5 |
| 886 __ subps(XMM0, XMM1); // ~0.0 | 911 __ subps(XMM0, XMM1); // ~0.0 |
| (...skipping 1941 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2828 FieldAddress(ECX, GrowableObjectArray::data_offset()), | 2853 FieldAddress(ECX, GrowableObjectArray::data_offset()), |
| 2829 EAX); | 2854 EAX); |
| 2830 __ popl(EAX); | 2855 __ popl(EAX); |
| 2831 __ popl(CTX); | 2856 __ popl(CTX); |
| 2832 __ ret(); | 2857 __ ret(); |
| 2833 } | 2858 } |
| 2834 | 2859 |
| 2835 } // namespace dart | 2860 } // namespace dart |
| 2836 | 2861 |
| 2837 #endif // defined TARGET_ARCH_IA32 | 2862 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |