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

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

Issue 10914142: Intrinsify Double.toInt. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « runtime/vm/assembler_x64.cc ('k') | runtime/vm/intrinsifier.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 1368 matching lines...) Expand 10 before | Expand all | Expand 10 after
1379 1379
1380 1380
1381 ASSEMBLER_TEST_GENERATE(Int64ToDoubleConversion, assembler) { 1381 ASSEMBLER_TEST_GENERATE(Int64ToDoubleConversion, assembler) {
1382 __ movq(RDX, Immediate(12LL << 32)); 1382 __ movq(RDX, Immediate(12LL << 32));
1383 __ cvtsi2sd(XMM0, RDX); 1383 __ cvtsi2sd(XMM0, RDX);
1384 __ ret(); 1384 __ ret();
1385 } 1385 }
1386 1386
1387 1387
1388 ASSEMBLER_TEST_RUN(Int64ToDoubleConversion, entry) { 1388 ASSEMBLER_TEST_RUN(Int64ToDoubleConversion, entry) {
1389 typedef double (*IntToDoubleConversionCode)(); 1389 typedef double (*Int64ToDoubleConversionCode)();
1390 double res = reinterpret_cast<IntToDoubleConversionCode>(entry)(); 1390 double res = reinterpret_cast<Int64ToDoubleConversionCode>(entry)();
1391 EXPECT_FLOAT_EQ(static_cast<double>(12LL << 32), res, 0.001); 1391 EXPECT_FLOAT_EQ(static_cast<double>(12LL << 32), res, 0.001);
1392 } 1392 }
1393 1393
1394 1394
1395 ASSEMBLER_TEST_GENERATE(DoubleToInt64Conversion, assembler) {
1396 __ movq(RAX, Immediate(bit_cast<int64_t, double>(12.3)));
1397 __ pushq(RAX);
1398 __ movsd(XMM6, Address(RSP, 0));
1399 __ popq(RAX);
1400 __ cvttsd2siq(RDX, XMM6);
1401 __ movq(RAX, RDX);
1402 __ ret();
1403 }
1404
1405
1406 ASSEMBLER_TEST_RUN(DoubleToInt64Conversion, entry) {
1407 typedef int64_t (*DoubleToInt64ConversionCode)();
1408 int64_t res = reinterpret_cast<DoubleToInt64ConversionCode>(entry)();
1409 EXPECT_EQ(12, res);
1410 }
1411
1412
1395 ASSEMBLER_TEST_GENERATE(TestObjectCompare, assembler) { 1413 ASSEMBLER_TEST_GENERATE(TestObjectCompare, assembler) {
1396 ObjectStore* object_store = Isolate::Current()->object_store(); 1414 ObjectStore* object_store = Isolate::Current()->object_store();
1397 const Object& obj = Object::ZoneHandle(object_store->smi_class()); 1415 const Object& obj = Object::ZoneHandle(object_store->smi_class());
1398 Label fail; 1416 Label fail;
1399 __ LoadObject(RAX, obj); 1417 __ LoadObject(RAX, obj);
1400 __ CompareObject(RAX, obj); 1418 __ CompareObject(RAX, obj);
1401 __ j(NOT_EQUAL, &fail); 1419 __ j(NOT_EQUAL, &fail);
1402 __ LoadObject(RCX, obj); 1420 __ LoadObject(RCX, obj);
1403 __ CompareObject(RCX, obj); 1421 __ CompareObject(RCX, obj);
1404 __ j(NOT_EQUAL, &fail); 1422 __ j(NOT_EQUAL, &fail);
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
1707 EXPECT_EQ(0, res); 1725 EXPECT_EQ(0, res);
1708 res = reinterpret_cast<ExtractSignBits>(entry)(-1.0); 1726 res = reinterpret_cast<ExtractSignBits>(entry)(-1.0);
1709 EXPECT_EQ(1, res); 1727 EXPECT_EQ(1, res);
1710 res = reinterpret_cast<ExtractSignBits>(entry)(-0.0); 1728 res = reinterpret_cast<ExtractSignBits>(entry)(-0.0);
1711 EXPECT_EQ(1, res); 1729 EXPECT_EQ(1, res);
1712 } 1730 }
1713 1731
1714 } // namespace dart 1732 } // namespace dart
1715 1733
1716 #endif // defined TARGET_ARCH_X64 1734 #endif // defined TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « runtime/vm/assembler_x64.cc ('k') | runtime/vm/intrinsifier.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698