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

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

Issue 616873003: Use UnboxedInt32 and UnboxedUint32 representation for LoadIndexedInstr (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 2 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
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 2421 matching lines...) Expand 10 before | Expand all | Expand 10 after
2432 2432
2433 2433
2434 ASSEMBLER_TEST_RUN(DoubleFPOperations, test) { 2434 ASSEMBLER_TEST_RUN(DoubleFPOperations, test) {
2435 typedef double (*SingleFPOperationsCode)(); 2435 typedef double (*SingleFPOperationsCode)();
2436 double res = reinterpret_cast<SingleFPOperationsCode>(test->entry())(); 2436 double res = reinterpret_cast<SingleFPOperationsCode>(test->entry())();
2437 EXPECT_FLOAT_EQ(7.668, res, 0.001); 2437 EXPECT_FLOAT_EQ(7.668, res, 0.001);
2438 } 2438 }
2439 2439
2440 2440
2441 ASSEMBLER_TEST_GENERATE(Int32ToDoubleConversion, assembler) { 2441 ASSEMBLER_TEST_GENERATE(Int32ToDoubleConversion, assembler) {
2442 __ movl(RDX, Immediate(6)); 2442 // Fill upper bits with garbage.
2443 __ cvtsi2sd(XMM0, RDX); 2443 __ movq(RDX, Immediate(0x1111111100000006));
2444 __ movl(RDX, Immediate(8)); 2444 __ cvtsi2sd32(XMM0, RDX);
2445 __ cvtsi2sd(XMM8, RDX); 2445 // Fill upper bits with garbage.
2446 __ movq(RDX, Immediate(0x2222222200000008));
2447 __ cvtsi2sd32(XMM8, RDX);
2446 __ subsd(XMM0, XMM8); 2448 __ subsd(XMM0, XMM8);
2447 __ ret(); 2449 __ ret();
2448 } 2450 }
2449 2451
2450 2452
2451 ASSEMBLER_TEST_RUN(Int32ToDoubleConversion, test) { 2453 ASSEMBLER_TEST_RUN(Int32ToDoubleConversion, test) {
2452 typedef double (*IntToDoubleConversionCode)(); 2454 typedef double (*Int32ToDoubleConversion)();
2453 double res = reinterpret_cast<IntToDoubleConversionCode>(test->entry())(); 2455 double res = reinterpret_cast<Int32ToDoubleConversion>(test->entry())();
2454 EXPECT_FLOAT_EQ(-2.0, res, 0.001); 2456 EXPECT_FLOAT_EQ(-2.0, res, 0.001);
2455 } 2457 }
2456 2458
2457 2459
2458 ASSEMBLER_TEST_GENERATE(Int64ToDoubleConversion, assembler) { 2460 ASSEMBLER_TEST_GENERATE(Int64ToDoubleConversion, assembler) {
2459 __ movq(RDX, Immediate(12LL << 32)); 2461 __ movq(RDX, Immediate(12LL << 32));
2460 __ cvtsi2sd(XMM0, RDX); 2462 __ cvtsi2sd(XMM0, RDX);
2461 __ movsd(XMM15, XMM0); // Move to high register 2463 __ movsd(XMM15, XMM0); // Move to high register
2462 __ addsd(XMM0, XMM0); // Stomp XMM0 2464 __ addsd(XMM0, XMM0); // Stomp XMM0
2463 __ movsd(XMM0, XMM15); // Move back to XMM0 2465 __ movsd(XMM0, XMM15); // Move back to XMM0
(...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after
3024 int res = reinterpret_cast<ConditionalMovesNoOverflowCode>( 3026 int res = reinterpret_cast<ConditionalMovesNoOverflowCode>(
3025 test->entry())(0x7fffffffffffffff, 2); 3027 test->entry())(0x7fffffffffffffff, 2);
3026 EXPECT_EQ(1, res); 3028 EXPECT_EQ(1, res);
3027 res = reinterpret_cast<ConditionalMovesNoOverflowCode>(test->entry())(1, 1); 3029 res = reinterpret_cast<ConditionalMovesNoOverflowCode>(test->entry())(1, 1);
3028 EXPECT_EQ(0, res); 3030 EXPECT_EQ(0, res);
3029 } 3031 }
3030 3032
3031 } // namespace dart 3033 } // namespace dart
3032 3034
3033 #endif // defined TARGET_ARCH_X64 3035 #endif // defined TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698