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

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
« no previous file with comments | « runtime/vm/assembler_x64.cc ('k') | runtime/vm/constants_arm64.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 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(R11, Immediate(0x1111111100000006));
2444 __ movl(RDX, Immediate(8)); 2444 __ cvtsi2sdl(XMM0, R11);
2445 __ cvtsi2sd(XMM8, RDX); 2445 // Fill upper bits with garbage.
2446 __ movq(R11, Immediate(0x2222222200000008));
2447 __ cvtsi2sdl(XMM8, R11);
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 __ cvtsi2sdq(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
2464 __ ret(); 2466 __ ret();
2465 } 2467 }
2466 2468
2467 2469
2468 ASSEMBLER_TEST_RUN(Int64ToDoubleConversion, test) { 2470 ASSEMBLER_TEST_RUN(Int64ToDoubleConversion, test) {
2469 typedef double (*Int64ToDoubleConversionCode)(); 2471 typedef double (*Int64ToDoubleConversionCode)();
2470 double res = reinterpret_cast<Int64ToDoubleConversionCode>(test->entry())(); 2472 double res = reinterpret_cast<Int64ToDoubleConversionCode>(test->entry())();
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
2808 ASSEMBLER_TEST_RUN(Cosine, test) { 2810 ASSEMBLER_TEST_RUN(Cosine, test) {
2809 typedef double (*CosineCode)(double f); 2811 typedef double (*CosineCode)(double f);
2810 const double kDoubleConst = 0.7; 2812 const double kDoubleConst = 0.7;
2811 double res = reinterpret_cast<CosineCode>(test->entry())(kDoubleConst); 2813 double res = reinterpret_cast<CosineCode>(test->entry())(kDoubleConst);
2812 EXPECT_FLOAT_EQ(cos(kDoubleConst), res, 0.0001); 2814 EXPECT_FLOAT_EQ(cos(kDoubleConst), res, 0.0001);
2813 } 2815 }
2814 2816
2815 2817
2816 ASSEMBLER_TEST_GENERATE(IntToDoubleConversion, assembler) { 2818 ASSEMBLER_TEST_GENERATE(IntToDoubleConversion, assembler) {
2817 __ movq(RDX, Immediate(6)); 2819 __ movq(RDX, Immediate(6));
2818 __ cvtsi2sd(XMM0, RDX); 2820 __ cvtsi2sdq(XMM0, RDX);
2819 __ ret(); 2821 __ ret();
2820 } 2822 }
2821 2823
2822 2824
2823 ASSEMBLER_TEST_RUN(IntToDoubleConversion, test) { 2825 ASSEMBLER_TEST_RUN(IntToDoubleConversion, test) {
2824 typedef double (*IntToDoubleConversionCode)(); 2826 typedef double (*IntToDoubleConversionCode)();
2825 double res = reinterpret_cast<IntToDoubleConversionCode>(test->entry())(); 2827 double res = reinterpret_cast<IntToDoubleConversionCode>(test->entry())();
2826 EXPECT_FLOAT_EQ(6.0, res, 0.001); 2828 EXPECT_FLOAT_EQ(6.0, res, 0.001);
2827 } 2829 }
2828 2830
(...skipping 195 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
« no previous file with comments | « runtime/vm/assembler_x64.cc ('k') | runtime/vm/constants_arm64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698