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

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

Issue 15822008: Implements intrinsics for ARM. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 6 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
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 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 218
219 219
220 ASSEMBLER_TEST_RUN(DoubleFPOperations, test) { 220 ASSEMBLER_TEST_RUN(DoubleFPOperations, test) {
221 EXPECT(test != NULL); 221 EXPECT(test != NULL);
222 typedef double (*DoubleFPOperations)(); 222 typedef double (*DoubleFPOperations)();
223 double res = EXECUTE_TEST_CODE_DOUBLE(DoubleFPOperations, test->entry()); 223 double res = EXECUTE_TEST_CODE_DOUBLE(DoubleFPOperations, test->entry());
224 EXPECT_FLOAT_EQ(3.8340579, res, 0.001); 224 EXPECT_FLOAT_EQ(3.8340579, res, 0.001);
225 } 225 }
226 226
227 227
228 ASSEMBLER_TEST_GENERATE(DoubleSqrtNeg, assembler) {
229 // Check that sqrt of a negative double gives NaN.
230 __ LoadDImmediate(D1, -1.0, R0);
231 __ vsqrtd(D0, D1);
232 __ vcmpd(D0, D0);
233 __ vmstat();
234 __ mov(R0, ShifterOperand(1), VS);
235 __ eor(R0, R0, ShifterOperand(R0), VC);
regis 2013/05/28 22:01:44 mov(R0, ShifterOperand(0), VC) may be clearer than
zra 2013/05/28 22:49:31 Done.
236 __ Ret();
237 }
238
239
240 ASSEMBLER_TEST_RUN(DoubleSqrtNeg, test) {
241 EXPECT(test != NULL);
242 typedef double (*DoubleFPOperations)();
243 EXPECT_EQ(1, EXECUTE_TEST_CODE_INT32(DoubleFPOperations, test->entry()));
244 }
245
246
228 ASSEMBLER_TEST_GENERATE(IntToDoubleConversion, assembler) { 247 ASSEMBLER_TEST_GENERATE(IntToDoubleConversion, assembler) {
229 __ mov(R3, ShifterOperand(6)); 248 __ mov(R3, ShifterOperand(6));
230 __ vmovsr(S3, R3); 249 __ vmovsr(S3, R3);
231 __ vcvtdi(D1, S3); 250 __ vcvtdi(D1, S3);
232 __ vmovrrd(R0, R1, D1); 251 __ vmovrrd(R0, R1, D1);
233 __ mov(PC, ShifterOperand(LR)); 252 __ mov(PC, ShifterOperand(LR));
234 } 253 }
235 254
236 255
237 ASSEMBLER_TEST_RUN(IntToDoubleConversion, test) { 256 ASSEMBLER_TEST_RUN(IntToDoubleConversion, test) {
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after
643 662
644 663
645 ASSEMBLER_TEST_RUN(Multiply32To64, test) { 664 ASSEMBLER_TEST_RUN(Multiply32To64, test) {
646 EXPECT(test != NULL); 665 EXPECT(test != NULL);
647 typedef int64_t (*Multiply32To64)(int64_t operand0, int64_t operand1); 666 typedef int64_t (*Multiply32To64)(int64_t operand0, int64_t operand1);
648 EXPECT_EQ(6, 667 EXPECT_EQ(6,
649 EXECUTE_TEST_CODE_INT64_LL(Multiply32To64, test->entry(), -3, -2)); 668 EXECUTE_TEST_CODE_INT64_LL(Multiply32To64, test->entry(), -3, -2));
650 } 669 }
651 670
652 671
672 ASSEMBLER_TEST_GENERATE(MultiplyAccum32To64, assembler) {
673 __ smlal(R0, R1, R0, R2);
674 __ mov(PC, ShifterOperand(LR));
675 }
676
677
678 ASSEMBLER_TEST_RUN(MultiplyAccum32To64, test) {
679 EXPECT(test != NULL);
680 typedef int64_t (*Multiply32To64)(int64_t operand0, int64_t operand1);
681 EXPECT_EQ(3,
682 EXECUTE_TEST_CODE_INT64_LL(Multiply32To64, test->entry(), -3, -2));
683 }
684
685
653 ASSEMBLER_TEST_GENERATE(Clz, assembler) { 686 ASSEMBLER_TEST_GENERATE(Clz, assembler) {
654 Label error; 687 Label error;
655 688
656 __ mov(R0, ShifterOperand(0)); 689 __ mov(R0, ShifterOperand(0));
657 __ clz(R1, R0); 690 __ clz(R1, R0);
658 __ cmp(R1, ShifterOperand(32)); 691 __ cmp(R1, ShifterOperand(32));
659 __ b(&error, NE); 692 __ b(&error, NE);
660 __ mov(R2, ShifterOperand(42)); 693 __ mov(R2, ShifterOperand(42));
661 __ clz(R2, R2); 694 __ clz(R2, R2);
662 __ cmp(R2, ShifterOperand(26)); 695 __ cmp(R2, ShifterOperand(26));
(...skipping 934 matching lines...) Expand 10 before | Expand all | Expand 10 after
1597 __ StoreIntoObject(R2, 1630 __ StoreIntoObject(R2,
1598 FieldAddress(R2, GrowableObjectArray::data_offset()), 1631 FieldAddress(R2, GrowableObjectArray::data_offset()),
1599 R1); 1632 R1);
1600 __ PopList((1 << CTX) | (1 << LR)); 1633 __ PopList((1 << CTX) | (1 << LR));
1601 __ Ret(); 1634 __ Ret();
1602 } 1635 }
1603 1636
1604 } // namespace dart 1637 } // namespace dart
1605 1638
1606 #endif // defined TARGET_ARCH_ARM 1639 #endif // defined TARGET_ARCH_ARM
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698