OLD | NEW |
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 598 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
609 | 609 |
610 ASSEMBLER_TEST_RUN(QuotientRemainder, test) { | 610 ASSEMBLER_TEST_RUN(QuotientRemainder, test) { |
611 EXPECT(test != NULL); | 611 EXPECT(test != NULL); |
612 typedef int64_t (*QuotientRemainder)(int64_t dividend, int64_t divisor); | 612 typedef int64_t (*QuotientRemainder)(int64_t dividend, int64_t divisor); |
613 EXPECT_EQ(0x1000400000da8LL, | 613 EXPECT_EQ(0x1000400000da8LL, |
614 EXECUTE_TEST_CODE_INT64_LL(QuotientRemainder, test->entry(), | 614 EXECUTE_TEST_CODE_INT64_LL(QuotientRemainder, test->entry(), |
615 0x12345678, 0x1234)); | 615 0x12345678, 0x1234)); |
616 } | 616 } |
617 | 617 |
618 | 618 |
619 ASSEMBLER_TEST_GENERATE(LongMultiply, assembler) { | 619 ASSEMBLER_TEST_GENERATE(Multiply64To64, assembler) { |
620 __ Push(R4); | 620 __ Push(R4); |
621 __ Mov(IP, R0); | 621 __ Mov(IP, R0); |
622 __ mul(R4, R2, R1); | 622 __ mul(R4, R2, R1); |
623 __ umull(R0, R1, R2, IP); | 623 __ umull(R0, R1, R2, IP); |
624 __ mla(R2, IP, R3, R4); | 624 __ mla(R2, IP, R3, R4); |
625 __ add(R1, R2, ShifterOperand(R1)); | 625 __ add(R1, R2, ShifterOperand(R1)); |
626 __ Pop(R4); | 626 __ Pop(R4); |
627 __ mov(PC, ShifterOperand(LR)); | 627 __ mov(PC, ShifterOperand(LR)); |
628 } | 628 } |
629 | 629 |
630 | 630 |
631 ASSEMBLER_TEST_RUN(LongMultiply, test) { | 631 ASSEMBLER_TEST_RUN(Multiply64To64, test) { |
632 EXPECT(test != NULL); | 632 EXPECT(test != NULL); |
633 typedef int64_t (*LongMultiply)(int64_t operand0, int64_t operand1); | 633 typedef int64_t (*Multiply64To64)(int64_t operand0, int64_t operand1); |
634 EXPECT_EQ(6, EXECUTE_TEST_CODE_INT64_LL(LongMultiply, test->entry(), -3, -2)); | 634 EXPECT_EQ(6, |
| 635 EXECUTE_TEST_CODE_INT64_LL(Multiply64To64, test->entry(), -3, -2)); |
| 636 } |
| 637 |
| 638 |
| 639 ASSEMBLER_TEST_GENERATE(Multiply32To64, assembler) { |
| 640 __ smull(R0, R1, R0, R2); |
| 641 __ mov(PC, ShifterOperand(LR)); |
| 642 } |
| 643 |
| 644 |
| 645 ASSEMBLER_TEST_RUN(Multiply32To64, test) { |
| 646 EXPECT(test != NULL); |
| 647 typedef int64_t (*Multiply32To64)(int64_t operand0, int64_t operand1); |
| 648 EXPECT_EQ(6, |
| 649 EXECUTE_TEST_CODE_INT64_LL(Multiply32To64, test->entry(), -3, -2)); |
635 } | 650 } |
636 | 651 |
637 | 652 |
638 ASSEMBLER_TEST_GENERATE(Clz, assembler) { | 653 ASSEMBLER_TEST_GENERATE(Clz, assembler) { |
639 Label error; | 654 Label error; |
640 | 655 |
641 __ mov(R0, ShifterOperand(0)); | 656 __ mov(R0, ShifterOperand(0)); |
642 __ clz(R1, R0); | 657 __ clz(R1, R0); |
643 __ cmp(R1, ShifterOperand(32)); | 658 __ cmp(R1, ShifterOperand(32)); |
644 __ b(&error, NE); | 659 __ b(&error, NE); |
(...skipping 902 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1547 __ StoreIntoObject(R2, | 1562 __ StoreIntoObject(R2, |
1548 FieldAddress(R2, GrowableObjectArray::data_offset()), | 1563 FieldAddress(R2, GrowableObjectArray::data_offset()), |
1549 R1); | 1564 R1); |
1550 __ PopList((1 << CTX) | (1 << LR)); | 1565 __ PopList((1 << CTX) | (1 << LR)); |
1551 __ Ret(); | 1566 __ Ret(); |
1552 } | 1567 } |
1553 | 1568 |
1554 } // namespace dart | 1569 } // namespace dart |
1555 | 1570 |
1556 #endif // defined TARGET_ARCH_ARM | 1571 #endif // defined TARGET_ARCH_ARM |
OLD | NEW |