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

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

Issue 15144004: Implements int to double conversion instructions for MIPS simulator, assembler, disassembler. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 7 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_mips.h ('k') | runtime/vm/constants_mips.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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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_MIPS) 6 #if defined(TARGET_ARCH_MIPS)
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 1466 matching lines...) Expand 10 before | Expand all | Expand 10 after
1477 __ Ret(); 1477 __ Ret();
1478 } 1478 }
1479 1479
1480 1480
1481 ASSEMBLER_TEST_RUN(Cop1COLE_not_taken, test) { 1481 ASSEMBLER_TEST_RUN(Cop1COLE_not_taken, test) {
1482 typedef int (*SimpleCode)(); 1482 typedef int (*SimpleCode)();
1483 EXPECT_EQ(0, EXECUTE_TEST_CODE_INT32(SimpleCode, test->entry())); 1483 EXPECT_EQ(0, EXECUTE_TEST_CODE_INT32(SimpleCode, test->entry()));
1484 } 1484 }
1485 1485
1486 1486
1487 ASSEMBLER_TEST_GENERATE(Cop1CvtDW, assembler) {
1488 __ LoadImmediate(T0, 42);
1489 __ mtc1(T0, F0);
1490 __ cvtdw(F2, F0);
1491 __ mfc1(V0, F2);
1492 __ mfc1(V1, F3);
1493 __ Ret();
1494 }
1495
1496
1497 ASSEMBLER_TEST_RUN(Cop1CvtDW, test) {
1498 typedef double (*SimpleCode)();
1499 EXPECT(test != NULL);
1500 double res = EXECUTE_TEST_CODE_DOUBLE(SimpleCode, test->entry());
1501 EXPECT_FLOAT_EQ(42.0, res, 0.001);
1502 }
1503
1504
1505 ASSEMBLER_TEST_GENERATE(Cop1CvtDW_neg, assembler) {
1506 __ LoadImmediate(T0, -42);
1507 __ mtc1(T0, F0);
1508 __ cvtdw(F2, F0);
1509 __ mfc1(V0, F2);
1510 __ mfc1(V1, F3);
1511 __ Ret();
1512 }
1513
1514
1515 ASSEMBLER_TEST_RUN(Cop1CvtDW_neg, test) {
1516 typedef double (*SimpleCode)();
1517 EXPECT(test != NULL);
1518 double res = EXECUTE_TEST_CODE_DOUBLE(SimpleCode, test->entry());
1519 EXPECT_FLOAT_EQ(-42.0, res, 0.001);
1520 }
1521
1522
1523 ASSEMBLER_TEST_GENERATE(Cop1CvtDL, assembler) {
1524 __ LoadImmediate(T0, 0x1);
1525 __ mtc1(ZR, F0);
1526 __ mtc1(T0, F1); // D0 <- 0x100000000 = 4294967296
1527 __ cvtdl(F2, F0);
1528 __ mfc1(V0, F2);
1529 __ mfc1(V1, F3);
1530 __ Ret();
1531 }
1532
1533
1534 ASSEMBLER_TEST_RUN(Cop1CvtDL, test) {
1535 typedef double (*SimpleCode)();
1536 EXPECT(test != NULL);
1537 double res = EXECUTE_TEST_CODE_DOUBLE(SimpleCode, test->entry());
1538 EXPECT_FLOAT_EQ(4294967296.0, res, 0.001);
1539 }
1540
1541
1542 ASSEMBLER_TEST_GENERATE(Cop1CvtDL_neg, assembler) {
1543 __ LoadImmediate(T0, 0xffffffff);
1544 __ mtc1(T0, F0);
1545 __ mtc1(T0, F1); // D0 <- 0xffffffffffffffff = -1
1546 __ cvtdl(F2, F0);
1547 __ mfc1(V0, F2);
1548 __ mfc1(V1, F3);
1549 __ Ret();
1550 }
1551
1552
1553 ASSEMBLER_TEST_RUN(Cop1CvtDL_neg, test) {
1554 typedef double (*SimpleCode)();
1555 EXPECT(test != NULL);
1556 double res = EXECUTE_TEST_CODE_DOUBLE(SimpleCode, test->entry());
1557 EXPECT_FLOAT_EQ(-1.0, res, 0.001);
1558 }
1559
1560
1487 // Called from assembler_test.cc. 1561 // Called from assembler_test.cc.
1488 // RA: return address. 1562 // RA: return address.
1489 // A0: context. 1563 // A0: context.
1490 // A1: value. 1564 // A1: value.
1491 // A2: growable array. 1565 // A2: growable array.
1492 ASSEMBLER_TEST_GENERATE(StoreIntoObject, assembler) { 1566 ASSEMBLER_TEST_GENERATE(StoreIntoObject, assembler) {
1493 __ addiu(SP, SP, Immediate(-2 * kWordSize)); 1567 __ addiu(SP, SP, Immediate(-2 * kWordSize));
1494 __ sw(CTX, Address(SP, 1 * kWordSize)); 1568 __ sw(CTX, Address(SP, 1 * kWordSize));
1495 __ sw(RA, Address(SP, 0 * kWordSize)); 1569 __ sw(RA, Address(SP, 0 * kWordSize));
1496 1570
1497 __ mov(CTX, A0); 1571 __ mov(CTX, A0);
1498 __ StoreIntoObject(A2, 1572 __ StoreIntoObject(A2,
1499 FieldAddress(A2, GrowableObjectArray::data_offset()), 1573 FieldAddress(A2, GrowableObjectArray::data_offset()),
1500 A1); 1574 A1);
1501 __ lw(RA, Address(SP, 0 * kWordSize)); 1575 __ lw(RA, Address(SP, 0 * kWordSize));
1502 __ lw(CTX, Address(SP, 1 * kWordSize)); 1576 __ lw(CTX, Address(SP, 1 * kWordSize));
1503 __ addiu(SP, SP, Immediate(2 * kWordSize)); 1577 __ addiu(SP, SP, Immediate(2 * kWordSize));
1504 __ Ret(); 1578 __ Ret();
1505 } 1579 }
1506 1580
1507 } // namespace dart 1581 } // namespace dart
1508 1582
1509 #endif // defined TARGET_ARCH_MIPS 1583 #endif // defined TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « runtime/vm/assembler_mips.h ('k') | runtime/vm/constants_mips.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698