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

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

Issue 23129014: Add packed add and subtract to IA32 and X64 assemblers (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 4 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/disassembler_ia32.cc » ('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 1431 matching lines...) Expand 10 before | Expand all | Expand 10 after
1442 } 1442 }
1443 1443
1444 1444
1445 ASSEMBLER_TEST_RUN(PackedFPOperations, test) { 1445 ASSEMBLER_TEST_RUN(PackedFPOperations, test) {
1446 typedef float (*PackedFPOperationsCode)(); 1446 typedef float (*PackedFPOperationsCode)();
1447 float res = reinterpret_cast<PackedFPOperationsCode>(test->entry())(); 1447 float res = reinterpret_cast<PackedFPOperationsCode>(test->entry())();
1448 EXPECT_FLOAT_EQ(14.7f, res, 0.001f); 1448 EXPECT_FLOAT_EQ(14.7f, res, 0.001f);
1449 } 1449 }
1450 1450
1451 1451
1452 ASSEMBLER_TEST_GENERATE(PackedIntOperations, assembler) {
1453 __ movl(RAX, Immediate(0x2));
1454 __ movd(XMM0, RAX);
1455 __ shufps(XMM0, XMM0, Immediate(0x0));
1456 __ movl(RAX, Immediate(0x1));
1457 __ movd(XMM1, RAX);
1458 __ shufps(XMM1, XMM1, Immediate(0x0));
1459 __ addpl(XMM0, XMM1); // 0x3
1460 __ addpl(XMM0, XMM0); // 0x6
1461 __ subpl(XMM0, XMM1); // 0x5
1462 __ pushq(RAX);
1463 __ movss(Address(RSP, 0), XMM0);
1464 __ popq(RAX);
1465 __ ret();
1466 }
1467
1468
1469 ASSEMBLER_TEST_RUN(PackedIntOperations, test) {
1470 typedef uint32_t (*PackedIntOperationsCode)();
1471 uint32_t res = reinterpret_cast<PackedIntOperationsCode>(test->entry())();
1472 EXPECT_EQ(static_cast<uword>(0x5), res);
1473 }
1474
1475
1452 ASSEMBLER_TEST_GENERATE(PackedFPOperations2, assembler) { 1476 ASSEMBLER_TEST_GENERATE(PackedFPOperations2, assembler) {
1453 __ movq(RAX, Immediate(bit_cast<int32_t, float>(4.0f))); 1477 __ movq(RAX, Immediate(bit_cast<int32_t, float>(4.0f)));
1454 __ movd(XMM0, RAX); 1478 __ movd(XMM0, RAX);
1455 __ shufps(XMM0, XMM0, Immediate(0x0)); 1479 __ shufps(XMM0, XMM0, Immediate(0x0));
1456 1480
1457 __ movaps(XMM11, XMM0); // Copy XMM0 1481 __ movaps(XMM11, XMM0); // Copy XMM0
1458 __ reciprocalps(XMM11); // 0.25 1482 __ reciprocalps(XMM11); // 0.25
1459 __ sqrtps(XMM11); // 0.5 1483 __ sqrtps(XMM11); // 0.5
1460 __ rsqrtps(XMM0); // ~0.5 1484 __ rsqrtps(XMM0); // ~0.5
1461 __ subps(XMM0, XMM11); // ~0.0 1485 __ subps(XMM0, XMM11); // ~0.0
(...skipping 1124 matching lines...) Expand 10 before | Expand all | Expand 10 after
2586 EXPECT_EQ(1, res); // Greater equal. 2610 EXPECT_EQ(1, res); // Greater equal.
2587 res = reinterpret_cast<ConditionalMovesCompareCode>(test->entry())(5, 5); 2611 res = reinterpret_cast<ConditionalMovesCompareCode>(test->entry())(5, 5);
2588 EXPECT_EQ(1, res); // Greater equal. 2612 EXPECT_EQ(1, res); // Greater equal.
2589 res = reinterpret_cast<ConditionalMovesCompareCode>(test->entry())(2, 5); 2613 res = reinterpret_cast<ConditionalMovesCompareCode>(test->entry())(2, 5);
2590 EXPECT_EQ(-1, res); // Less. 2614 EXPECT_EQ(-1, res); // Less.
2591 } 2615 }
2592 2616
2593 } // namespace dart 2617 } // namespace dart
2594 2618
2595 #endif // defined TARGET_ARCH_X64 2619 #endif // defined TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « runtime/vm/assembler_x64.cc ('k') | runtime/vm/disassembler_ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698