| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 1089 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1100 } | 1100 } |
| 1101 | 1101 |
| 1102 | 1102 |
| 1103 ASSEMBLER_TEST_RUN(DoubleFPOperations, entry) { | 1103 ASSEMBLER_TEST_RUN(DoubleFPOperations, entry) { |
| 1104 typedef double (*SingleFPOperationsCode)(); | 1104 typedef double (*SingleFPOperationsCode)(); |
| 1105 double res = reinterpret_cast<SingleFPOperationsCode>(entry)(); | 1105 double res = reinterpret_cast<SingleFPOperationsCode>(entry)(); |
| 1106 EXPECT_FLOAT_EQ(14.7, res, 0.001); | 1106 EXPECT_FLOAT_EQ(14.7, res, 0.001); |
| 1107 } | 1107 } |
| 1108 | 1108 |
| 1109 | 1109 |
| 1110 ASSEMBLER_TEST_GENERATE(IntToDoubleConversion, assembler) { | 1110 ASSEMBLER_TEST_GENERATE(Int32ToDoubleConversion, assembler) { |
| 1111 __ movl(RDX, Immediate(6)); | 1111 __ movl(RDX, Immediate(6)); |
| 1112 __ cvtsi2sd(XMM0, RDX); | 1112 __ cvtsi2sd(XMM0, RDX); |
| 1113 __ ret(); | 1113 __ ret(); |
| 1114 } | 1114 } |
| 1115 | 1115 |
| 1116 | 1116 |
| 1117 ASSEMBLER_TEST_RUN(IntToDoubleConversion, entry) { | 1117 ASSEMBLER_TEST_RUN(Int32ToDoubleConversion, entry) { |
| 1118 typedef double (*IntToDoubleConversionCode)(); | 1118 typedef double (*IntToDoubleConversionCode)(); |
| 1119 double res = reinterpret_cast<IntToDoubleConversionCode>(entry)(); | 1119 double res = reinterpret_cast<IntToDoubleConversionCode>(entry)(); |
| 1120 EXPECT_FLOAT_EQ(6.0, res, 0.001); | 1120 EXPECT_FLOAT_EQ(6.0, res, 0.001); |
| 1121 } | 1121 } |
| 1122 | 1122 |
| 1123 | 1123 |
| 1124 ASSEMBLER_TEST_GENERATE(Int64ToDoubleConversion, assembler) { |
| 1125 __ movq(RDX, Immediate(12LL << 32)); |
| 1126 __ cvtsi2sd(XMM0, RDX); |
| 1127 __ ret(); |
| 1128 } |
| 1129 |
| 1130 |
| 1131 ASSEMBLER_TEST_RUN(Int64ToDoubleConversion, entry) { |
| 1132 typedef double (*IntToDoubleConversionCode)(); |
| 1133 double res = reinterpret_cast<IntToDoubleConversionCode>(entry)(); |
| 1134 EXPECT_FLOAT_EQ(static_cast<double>(12LL << 32), res, 0.001); |
| 1135 } |
| 1136 |
| 1137 |
| 1124 ASSEMBLER_TEST_GENERATE(TestObjectCompare, assembler) { | 1138 ASSEMBLER_TEST_GENERATE(TestObjectCompare, assembler) { |
| 1125 ObjectStore* object_store = Isolate::Current()->object_store(); | 1139 ObjectStore* object_store = Isolate::Current()->object_store(); |
| 1126 const Object& obj = Object::ZoneHandle(object_store->smi_class()); | 1140 const Object& obj = Object::ZoneHandle(object_store->smi_class()); |
| 1127 Label fail; | 1141 Label fail; |
| 1128 __ LoadObject(RAX, obj); | 1142 __ LoadObject(RAX, obj); |
| 1129 __ CompareObject(RAX, obj); | 1143 __ CompareObject(RAX, obj); |
| 1130 __ j(NOT_EQUAL, &fail); | 1144 __ j(NOT_EQUAL, &fail); |
| 1131 __ LoadObject(RCX, obj); | 1145 __ LoadObject(RCX, obj); |
| 1132 __ CompareObject(RCX, obj); | 1146 __ CompareObject(RCX, obj); |
| 1133 __ j(NOT_EQUAL, &fail); | 1147 __ j(NOT_EQUAL, &fail); |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1272 | 1286 |
| 1273 ASSEMBLER_TEST_RUN(XorpdZeroing, entry) { | 1287 ASSEMBLER_TEST_RUN(XorpdZeroing, entry) { |
| 1274 typedef double (*XorpdZeroingCode)(double d); | 1288 typedef double (*XorpdZeroingCode)(double d); |
| 1275 double res = reinterpret_cast<XorpdZeroingCode>(entry)(12.56e3); | 1289 double res = reinterpret_cast<XorpdZeroingCode>(entry)(12.56e3); |
| 1276 EXPECT_FLOAT_EQ(0.0, res, 0.0001); | 1290 EXPECT_FLOAT_EQ(0.0, res, 0.0001); |
| 1277 } | 1291 } |
| 1278 | 1292 |
| 1279 } // namespace dart | 1293 } // namespace dart |
| 1280 | 1294 |
| 1281 #endif // defined TARGET_ARCH_X64 | 1295 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |