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

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

Issue 12459005: Adds muls, sdiv, udiv instructions to ARM simulator, assembler, disassembler (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 9 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_arm.cc ('k') | runtime/vm/constants_arm.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_ARM) 6 #if defined(TARGET_ARCH_ARM)
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 1405 matching lines...) Expand 10 before | Expand all | Expand 10 after
1416 bool have_div = CPUFeatures::integer_division_supported(); 1416 bool have_div = CPUFeatures::integer_division_supported();
1417 int32_t r = EXECUTE_TEST_CODE_INT32(Tst, test->entry()); 1417 int32_t r = EXECUTE_TEST_CODE_INT32(Tst, test->entry());
1418 if (have_div) { 1418 if (have_div) {
1419 EXPECT_LT(0, r); 1419 EXPECT_LT(0, r);
1420 } else { 1420 } else {
1421 EXPECT_EQ(0, r); 1421 EXPECT_EQ(0, r);
1422 } 1422 }
1423 } 1423 }
1424 1424
1425 1425
1426 ASSEMBLER_TEST_GENERATE(Udiv, assembler) {
1427 __ mov(R0, ShifterOperand(27));
1428 __ mov(R1, ShifterOperand(9));
1429 __ udiv(R2, R0, R1);
1430 __ Mov(R0, R2);
1431 __ mov(PC, ShifterOperand(LR));
1432 }
1433
1434
1435 ASSEMBLER_TEST_RUN(Udiv, test) {
1436 EXPECT(test != NULL);
1437 typedef int (*Tst)();
1438 EXPECT_EQ(3, EXECUTE_TEST_CODE_INT32(Tst, test->entry()));
1439 }
1440
1441
1442 ASSEMBLER_TEST_GENERATE(Sdiv, assembler) {
1443 __ mov(R0, ShifterOperand(27));
1444 __ LoadImmediate(R1, -9);
1445 __ sdiv(R2, R0, R1);
1446 __ Mov(R0, R2);
1447 __ mov(PC, ShifterOperand(LR));
1448 }
1449
1450
1451 ASSEMBLER_TEST_RUN(Sdiv, test) {
1452 EXPECT(test != NULL);
1453 typedef int (*Tst)();
1454 EXPECT_EQ(-3, EXECUTE_TEST_CODE_INT32(Tst, test->entry()));
1455 }
1456
1457
1458 ASSEMBLER_TEST_GENERATE(Udiv_zero, assembler) {
1459 __ mov(R0, ShifterOperand(27));
1460 __ mov(R1, ShifterOperand(0));
1461 __ udiv(R2, R0, R1);
1462 __ Mov(R0, R2);
1463 __ mov(PC, ShifterOperand(LR));
1464 }
1465
1466
1467 ASSEMBLER_TEST_RUN(Udiv_zero, test) {
1468 EXPECT(test != NULL);
1469 typedef int (*Tst)();
1470 EXPECT_EQ(0, EXECUTE_TEST_CODE_INT32(Tst, test->entry()));
1471 }
1472
1473
1474 ASSEMBLER_TEST_GENERATE(Sdiv_zero, assembler) {
1475 __ mov(R0, ShifterOperand(27));
1476 __ mov(R1, ShifterOperand(0));
1477 __ udiv(R2, R0, R1);
1478 __ Mov(R0, R2);
1479 __ mov(PC, ShifterOperand(LR));
1480 }
1481
1482
1483 ASSEMBLER_TEST_RUN(Sdiv_zero, test) {
1484 EXPECT(test != NULL);
1485 typedef int (*Tst)();
1486 EXPECT_EQ(0, EXECUTE_TEST_CODE_INT32(Tst, test->entry()));
1487 }
1488
1489
1490 ASSEMBLER_TEST_GENERATE(Udiv_corner, assembler) {
1491 __ LoadImmediate(R0, 0x80000000);
1492 __ LoadImmediate(R1, 0xffffffff);
1493 __ udiv(R2, R0, R1);
1494 __ Mov(R0, R2);
1495 __ mov(PC, ShifterOperand(LR));
1496 }
1497
1498
1499 ASSEMBLER_TEST_RUN(Udiv_corner, test) {
1500 EXPECT(test != NULL);
1501 typedef int (*Tst)();
1502 EXPECT_EQ(0, EXECUTE_TEST_CODE_INT32(Tst, test->entry()));
1503 }
1504
1505
1506 ASSEMBLER_TEST_GENERATE(Sdiv_corner, assembler) {
1507 __ LoadImmediate(R0, 0x80000000);
1508 __ LoadImmediate(R1, 0xffffffff);
1509 __ sdiv(R2, R0, R1);
1510 __ Mov(R0, R2);
1511 __ mov(PC, ShifterOperand(LR));
1512 }
1513
1514
1515 ASSEMBLER_TEST_RUN(Sdiv_corner, test) {
1516 EXPECT(test != NULL);
1517 typedef int (*Tst)();
1518 EXPECT_EQ(static_cast<int32_t>(0x80000000),
1519 EXECUTE_TEST_CODE_INT32(Tst, test->entry()));
1520 }
1521
1522
1523 ASSEMBLER_TEST_GENERATE(Muls, assembler) {
1524 __ mov(R0, ShifterOperand(3));
1525 __ LoadImmediate(R1, -9);
1526 __ muls(R2, R0, R1);
1527 __ mov(R0, ShifterOperand(42), MI);
1528 __ mov(PC, ShifterOperand(LR));
1529 }
1530
1531
1532 ASSEMBLER_TEST_RUN(Muls, test) {
1533 EXPECT(test != NULL);
1534 typedef int (*Tst)();
1535 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT32(Tst, test->entry()));
1536 }
1537
1538
1426 } // namespace dart 1539 } // namespace dart
1427 1540
1428 #endif // defined TARGET_ARCH_ARM 1541 #endif // defined TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « runtime/vm/assembler_arm.cc ('k') | runtime/vm/constants_arm.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698