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

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

Issue 701233003: Implement bigint intrinsics on arm64. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 1 month 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_ARM64) 6 #if defined(TARGET_ARCH_ARM64)
7 7
8 #include "vm/assembler.h" 8 #include "vm/assembler.h"
9 #include "vm/cpu.h" 9 #include "vm/cpu.h"
10 #include "vm/os.h" 10 #include "vm/os.h"
(...skipping 869 matching lines...) Expand 10 before | Expand all | Expand 10 after
880 __ ret(); 880 __ ret();
881 } 881 }
882 882
883 883
884 ASSEMBLER_TEST_RUN(CmpLtBranchNotTaken, test) { 884 ASSEMBLER_TEST_RUN(CmpLtBranchNotTaken, test) {
885 typedef int64_t (*Int64Return)() DART_UNUSED; 885 typedef int64_t (*Int64Return)() DART_UNUSED;
886 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); 886 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry()));
887 } 887 }
888 888
889 889
890 ASSEMBLER_TEST_GENERATE(CmpBranchIfZero, assembler) {
891 Label l;
892
893 __ movz(R0, Immediate(42), 0);
894 __ movz(R1, Immediate(0), 0);
895
896 __ cbz(&l, R1);
897 __ movz(R0, Immediate(0), 0);
898 __ Bind(&l);
899 __ ret();
900 }
901
902
903 ASSEMBLER_TEST_RUN(CmpBranchIfZero, test) {
904 typedef int64_t (*Int64Return)() DART_UNUSED;
905 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry()));
906 }
907
908
909 ASSEMBLER_TEST_GENERATE(CmpBranchIfZeroNotTaken, assembler) {
910 Label l;
911
912 __ movz(R0, Immediate(0), 0);
913 __ movz(R1, Immediate(1), 0);
914
915 __ cbz(&l, R1);
916 __ movz(R0, Immediate(42), 0);
917 __ Bind(&l);
918 __ ret();
919 }
920
921
922 ASSEMBLER_TEST_RUN(CmpBranchIfZeroNotTaken, test) {
923 typedef int64_t (*Int64Return)() DART_UNUSED;
924 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry()));
925 }
926
927
928 ASSEMBLER_TEST_GENERATE(CmpBranchIfNotZero, assembler) {
929 Label l;
930
931 __ movz(R0, Immediate(42), 0);
932 __ movz(R1, Immediate(1), 0);
933
934 __ cbnz(&l, R1);
935 __ movz(R0, Immediate(0), 0);
936 __ Bind(&l);
937 __ ret();
938 }
939
940
941 ASSEMBLER_TEST_RUN(CmpBranchIfNotZero, test) {
942 typedef int64_t (*Int64Return)() DART_UNUSED;
943 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry()));
944 }
945
946
947 ASSEMBLER_TEST_GENERATE(CmpBranchIfNotZeroNotTaken, assembler) {
948 Label l;
949
950 __ movz(R0, Immediate(0), 0);
951 __ movz(R1, Immediate(0), 0);
952
953 __ cbnz(&l, R1);
954 __ movz(R0, Immediate(42), 0);
955 __ Bind(&l);
956 __ ret();
957 }
958
959
960 ASSEMBLER_TEST_RUN(CmpBranchIfNotZeroNotTaken, test) {
961 typedef int64_t (*Int64Return)() DART_UNUSED;
962 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry()));
963 }
964
965
890 ASSEMBLER_TEST_GENERATE(FcmpEqBranch, assembler) { 966 ASSEMBLER_TEST_GENERATE(FcmpEqBranch, assembler) {
891 Label l; 967 Label l;
892 968
893 __ LoadDImmediate(V0, 42.0, kNoPP); 969 __ LoadDImmediate(V0, 42.0, kNoPP);
894 __ LoadDImmediate(V1, 234.0, kNoPP); 970 __ LoadDImmediate(V1, 234.0, kNoPP);
895 __ LoadDImmediate(V2, 234.0, kNoPP); 971 __ LoadDImmediate(V2, 234.0, kNoPP);
896 972
897 __ fcmpd(V1, V2); 973 __ fcmpd(V1, V2);
898 __ b(&l, EQ); 974 __ b(&l, EQ);
899 __ LoadDImmediate(V0, 0.0, kNoPP); 975 __ LoadDImmediate(V0, 0.0, kNoPP);
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after
1366 __ ret(); 1442 __ ret();
1367 } 1443 }
1368 1444
1369 1445
1370 ASSEMBLER_TEST_RUN(Smulh_neg, test) { 1446 ASSEMBLER_TEST_RUN(Smulh_neg, test) {
1371 typedef int64_t (*Int64Return)() DART_UNUSED; 1447 typedef int64_t (*Int64Return)() DART_UNUSED;
1372 EXPECT_EQ(-1, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); 1448 EXPECT_EQ(-1, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry()));
1373 } 1449 }
1374 1450
1375 1451
1452 ASSEMBLER_TEST_GENERATE(Umaddl, assembler) {
1453 __ movn(R1, Immediate(0), 0); // W1 = 0xffffffff.
1454 __ movz(R2, Immediate(7), 0); // W2 = 7.
1455 __ movz(R3, Immediate(8), 0); // X3 = 8.
1456 __ umaddl(R0, R1, R2, R3); // X0 = W1*W2 + X3 = 0x700000001.
1457 __ ret();
1458 }
1459
1460
1461 ASSEMBLER_TEST_RUN(Umaddl, test) {
1462 typedef int64_t (*Int64Return)() DART_UNUSED;
1463 EXPECT_EQ(0x700000001, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry()));
1464 }
1465
1466
1376 // Loading immediate values without the object pool. 1467 // Loading immediate values without the object pool.
1377 ASSEMBLER_TEST_GENERATE(LoadImmediateSmall, assembler) { 1468 ASSEMBLER_TEST_GENERATE(LoadImmediateSmall, assembler) {
1378 __ LoadImmediate(R0, 42, kNoRegister); 1469 __ LoadImmediate(R0, 42, kNoRegister);
1379 __ ret(); 1470 __ ret();
1380 } 1471 }
1381 1472
1382 1473
1383 ASSEMBLER_TEST_RUN(LoadImmediateSmall, test) { 1474 ASSEMBLER_TEST_RUN(LoadImmediateSmall, test) {
1384 typedef int64_t (*Int64Return)() DART_UNUSED; 1475 typedef int64_t (*Int64Return)() DART_UNUSED;
1385 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); 1476 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry()));
(...skipping 2042 matching lines...) Expand 10 before | Expand all | Expand 10 after
3428 __ Pop(LR); 3519 __ Pop(LR);
3429 __ Pop(CTX); 3520 __ Pop(CTX);
3430 __ PopAndUntagPP(); 3521 __ PopAndUntagPP();
3431 __ mov(CSP, SP); 3522 __ mov(CSP, SP);
3432 __ ret(); 3523 __ ret();
3433 } 3524 }
3434 3525
3435 } // namespace dart 3526 } // namespace dart
3436 3527
3437 #endif // defined(TARGET_ARCH_ARM64) 3528 #endif // defined(TARGET_ARCH_ARM64)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698