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

Side by Side Diff: test/cctest/test-assembler-mips64.cc

Issue 426863006: MIPS64: Add support for architecture revision 6. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comments. Created 6 years, 4 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 | « test/cctest/test-api.cc ('k') | test/cctest/test-disasm-mips64.cc » ('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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after
550 } T; 550 } T;
551 T t; 551 T t;
552 552
553 // Create a function that accepts &t, and loads, manipulates, and stores 553 // Create a function that accepts &t, and loads, manipulates, and stores
554 // the doubles t.a ... t.f. 554 // the doubles t.a ... t.f.
555 MacroAssembler assm(isolate, NULL, 0); 555 MacroAssembler assm(isolate, NULL, 0);
556 Label neither_is_nan, less_than, outa_here; 556 Label neither_is_nan, less_than, outa_here;
557 557
558 __ ldc1(f4, MemOperand(a0, OFFSET_OF(T, a)) ); 558 __ ldc1(f4, MemOperand(a0, OFFSET_OF(T, a)) );
559 __ ldc1(f6, MemOperand(a0, OFFSET_OF(T, b)) ); 559 __ ldc1(f6, MemOperand(a0, OFFSET_OF(T, b)) );
560 __ c(UN, D, f4, f6); 560 if (kArchVariant != kMips64r6) {
561 __ bc1f(&neither_is_nan); 561 __ c(UN, D, f4, f6);
562 __ bc1f(&neither_is_nan);
563 } else {
564 __ cmp(UN, L, f2, f4, f6);
565 __ bc1eqz(&neither_is_nan, f2);
566 }
562 __ nop(); 567 __ nop();
563 __ sw(zero_reg, MemOperand(a0, OFFSET_OF(T, result)) ); 568 __ sw(zero_reg, MemOperand(a0, OFFSET_OF(T, result)) );
564 __ Branch(&outa_here); 569 __ Branch(&outa_here);
565 570
566 __ bind(&neither_is_nan); 571 __ bind(&neither_is_nan);
567 572
568 if (kArchVariant == kLoongson) { 573 if (kArchVariant == kMips64r6) {
569 __ c(OLT, D, f6, f4); 574 __ cmp(OLT, L, f2, f6, f4);
570 __ bc1t(&less_than); 575 __ bc1nez(&less_than, f2);
571 } else { 576 } else {
572 __ c(OLT, D, f6, f4, 2); 577 __ c(OLT, D, f6, f4, 2);
573 __ bc1t(&less_than, 2); 578 __ bc1t(&less_than, 2);
574 } 579 }
580
575 __ nop(); 581 __ nop();
576 __ sw(zero_reg, MemOperand(a0, OFFSET_OF(T, result)) ); 582 __ sw(zero_reg, MemOperand(a0, OFFSET_OF(T, result)) );
577 __ Branch(&outa_here); 583 __ Branch(&outa_here);
578 584
579 __ bind(&less_than); 585 __ bind(&less_than);
580 __ Addu(a4, zero_reg, Operand(1)); 586 __ Addu(a4, zero_reg, Operand(1));
581 __ sw(a4, MemOperand(a0, OFFSET_OF(T, result)) ); // Set true. 587 __ sw(a4, MemOperand(a0, OFFSET_OF(T, result)) ); // Set true.
582 588
583 589
584 // This test-case should have additional tests. 590 // This test-case should have additional tests.
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
825 CHECK_EQ(2.147483647e9, t.a_converted); 831 CHECK_EQ(2.147483647e9, t.a_converted);
826 832
827 // 0xFF00FF00FF -> 1.095233372415e12. 833 // 0xFF00FF00FF -> 1.095233372415e12.
828 CHECK_EQ(1.095233372415e12, t.b); 834 CHECK_EQ(1.095233372415e12, t.b);
829 CHECK_EQ(0xFF00FF00FF, t.b_long_as_int64); 835 CHECK_EQ(0xFF00FF00FF, t.b_long_as_int64);
830 } 836 }
831 } 837 }
832 838
833 839
834 TEST(MIPS11) { 840 TEST(MIPS11) {
835 // Test LWL, LWR, SWL and SWR instructions. 841 // Do not run test on MIPS64r6, as these instructions are removed.
836 CcTest::InitializeVM(); 842 if (kArchVariant != kMips64r6) {
837 Isolate* isolate = CcTest::i_isolate(); 843 // Test LWL, LWR, SWL and SWR instructions.
838 HandleScope scope(isolate); 844 CcTest::InitializeVM();
845 Isolate* isolate = CcTest::i_isolate();
846 HandleScope scope(isolate);
839 847
840 typedef struct { 848 typedef struct {
841 int32_t reg_init; 849 int32_t reg_init;
842 int32_t mem_init; 850 int32_t mem_init;
843 int32_t lwl_0; 851 int32_t lwl_0;
844 int32_t lwl_1; 852 int32_t lwl_1;
845 int32_t lwl_2; 853 int32_t lwl_2;
846 int32_t lwl_3; 854 int32_t lwl_3;
847 int32_t lwr_0; 855 int32_t lwr_0;
848 int32_t lwr_1; 856 int32_t lwr_1;
849 int32_t lwr_2; 857 int32_t lwr_2;
850 int32_t lwr_3; 858 int32_t lwr_3;
851 int32_t swl_0; 859 int32_t swl_0;
852 int32_t swl_1; 860 int32_t swl_1;
853 int32_t swl_2; 861 int32_t swl_2;
854 int32_t swl_3; 862 int32_t swl_3;
855 int32_t swr_0; 863 int32_t swr_0;
856 int32_t swr_1; 864 int32_t swr_1;
857 int32_t swr_2; 865 int32_t swr_2;
858 int32_t swr_3; 866 int32_t swr_3;
859 } T; 867 } T;
860 T t; 868 T t;
861 869
862 Assembler assm(isolate, NULL, 0); 870 Assembler assm(isolate, NULL, 0);
863 871
864 // Test all combinations of LWL and vAddr. 872 // Test all combinations of LWL and vAddr.
865 __ lw(a4, MemOperand(a0, OFFSET_OF(T, reg_init)) ); 873 __ lw(a4, MemOperand(a0, OFFSET_OF(T, reg_init)) );
866 __ lwl(a4, MemOperand(a0, OFFSET_OF(T, mem_init)) ); 874 __ lwl(a4, MemOperand(a0, OFFSET_OF(T, mem_init)) );
867 __ sw(a4, MemOperand(a0, OFFSET_OF(T, lwl_0)) ); 875 __ sw(a4, MemOperand(a0, OFFSET_OF(T, lwl_0)) );
868 876
869 __ lw(a5, MemOperand(a0, OFFSET_OF(T, reg_init)) ); 877 __ lw(a5, MemOperand(a0, OFFSET_OF(T, reg_init)) );
870 __ lwl(a5, MemOperand(a0, OFFSET_OF(T, mem_init) + 1) ); 878 __ lwl(a5, MemOperand(a0, OFFSET_OF(T, mem_init) + 1) );
871 __ sw(a5, MemOperand(a0, OFFSET_OF(T, lwl_1)) ); 879 __ sw(a5, MemOperand(a0, OFFSET_OF(T, lwl_1)) );
872 880
873 __ lw(a6, MemOperand(a0, OFFSET_OF(T, reg_init)) ); 881 __ lw(a6, MemOperand(a0, OFFSET_OF(T, reg_init)) );
874 __ lwl(a6, MemOperand(a0, OFFSET_OF(T, mem_init) + 2) ); 882 __ lwl(a6, MemOperand(a0, OFFSET_OF(T, mem_init) + 2) );
875 __ sw(a6, MemOperand(a0, OFFSET_OF(T, lwl_2)) ); 883 __ sw(a6, MemOperand(a0, OFFSET_OF(T, lwl_2)) );
876 884
877 __ lw(a7, MemOperand(a0, OFFSET_OF(T, reg_init)) ); 885 __ lw(a7, MemOperand(a0, OFFSET_OF(T, reg_init)) );
878 __ lwl(a7, MemOperand(a0, OFFSET_OF(T, mem_init) + 3) ); 886 __ lwl(a7, MemOperand(a0, OFFSET_OF(T, mem_init) + 3) );
879 __ sw(a7, MemOperand(a0, OFFSET_OF(T, lwl_3)) ); 887 __ sw(a7, MemOperand(a0, OFFSET_OF(T, lwl_3)) );
880 888
881 // Test all combinations of LWR and vAddr. 889 // Test all combinations of LWR and vAddr.
882 __ lw(a4, MemOperand(a0, OFFSET_OF(T, reg_init)) ); 890 __ lw(a4, MemOperand(a0, OFFSET_OF(T, reg_init)) );
883 __ lwr(a4, MemOperand(a0, OFFSET_OF(T, mem_init)) ); 891 __ lwr(a4, MemOperand(a0, OFFSET_OF(T, mem_init)) );
884 __ sw(a4, MemOperand(a0, OFFSET_OF(T, lwr_0)) ); 892 __ sw(a4, MemOperand(a0, OFFSET_OF(T, lwr_0)) );
885 893
886 __ lw(a5, MemOperand(a0, OFFSET_OF(T, reg_init)) ); 894 __ lw(a5, MemOperand(a0, OFFSET_OF(T, reg_init)) );
887 __ lwr(a5, MemOperand(a0, OFFSET_OF(T, mem_init) + 1) ); 895 __ lwr(a5, MemOperand(a0, OFFSET_OF(T, mem_init) + 1) );
888 __ sw(a5, MemOperand(a0, OFFSET_OF(T, lwr_1)) ); 896 __ sw(a5, MemOperand(a0, OFFSET_OF(T, lwr_1)) );
889 897
890 __ lw(a6, MemOperand(a0, OFFSET_OF(T, reg_init)) ); 898 __ lw(a6, MemOperand(a0, OFFSET_OF(T, reg_init)) );
891 __ lwr(a6, MemOperand(a0, OFFSET_OF(T, mem_init) + 2) ); 899 __ lwr(a6, MemOperand(a0, OFFSET_OF(T, mem_init) + 2) );
892 __ sw(a6, MemOperand(a0, OFFSET_OF(T, lwr_2)) ); 900 __ sw(a6, MemOperand(a0, OFFSET_OF(T, lwr_2)) );
893 901
894 __ lw(a7, MemOperand(a0, OFFSET_OF(T, reg_init)) ); 902 __ lw(a7, MemOperand(a0, OFFSET_OF(T, reg_init)) );
895 __ lwr(a7, MemOperand(a0, OFFSET_OF(T, mem_init) + 3) ); 903 __ lwr(a7, MemOperand(a0, OFFSET_OF(T, mem_init) + 3) );
896 __ sw(a7, MemOperand(a0, OFFSET_OF(T, lwr_3)) ); 904 __ sw(a7, MemOperand(a0, OFFSET_OF(T, lwr_3)) );
897 905
898 // Test all combinations of SWL and vAddr. 906 // Test all combinations of SWL and vAddr.
899 __ lw(a4, MemOperand(a0, OFFSET_OF(T, mem_init)) ); 907 __ lw(a4, MemOperand(a0, OFFSET_OF(T, mem_init)) );
900 __ sw(a4, MemOperand(a0, OFFSET_OF(T, swl_0)) ); 908 __ sw(a4, MemOperand(a0, OFFSET_OF(T, swl_0)) );
901 __ lw(a4, MemOperand(a0, OFFSET_OF(T, reg_init)) ); 909 __ lw(a4, MemOperand(a0, OFFSET_OF(T, reg_init)) );
902 __ swl(a4, MemOperand(a0, OFFSET_OF(T, swl_0)) ); 910 __ swl(a4, MemOperand(a0, OFFSET_OF(T, swl_0)) );
903 911
904 __ lw(a5, MemOperand(a0, OFFSET_OF(T, mem_init)) ); 912 __ lw(a5, MemOperand(a0, OFFSET_OF(T, mem_init)) );
905 __ sw(a5, MemOperand(a0, OFFSET_OF(T, swl_1)) ); 913 __ sw(a5, MemOperand(a0, OFFSET_OF(T, swl_1)) );
906 __ lw(a5, MemOperand(a0, OFFSET_OF(T, reg_init)) ); 914 __ lw(a5, MemOperand(a0, OFFSET_OF(T, reg_init)) );
907 __ swl(a5, MemOperand(a0, OFFSET_OF(T, swl_1) + 1) ); 915 __ swl(a5, MemOperand(a0, OFFSET_OF(T, swl_1) + 1) );
908 916
909 __ lw(a6, MemOperand(a0, OFFSET_OF(T, mem_init)) ); 917 __ lw(a6, MemOperand(a0, OFFSET_OF(T, mem_init)) );
910 __ sw(a6, MemOperand(a0, OFFSET_OF(T, swl_2)) ); 918 __ sw(a6, MemOperand(a0, OFFSET_OF(T, swl_2)) );
911 __ lw(a6, MemOperand(a0, OFFSET_OF(T, reg_init)) ); 919 __ lw(a6, MemOperand(a0, OFFSET_OF(T, reg_init)) );
912 __ swl(a6, MemOperand(a0, OFFSET_OF(T, swl_2) + 2) ); 920 __ swl(a6, MemOperand(a0, OFFSET_OF(T, swl_2) + 2) );
913 921
914 __ lw(a7, MemOperand(a0, OFFSET_OF(T, mem_init)) ); 922 __ lw(a7, MemOperand(a0, OFFSET_OF(T, mem_init)) );
915 __ sw(a7, MemOperand(a0, OFFSET_OF(T, swl_3)) ); 923 __ sw(a7, MemOperand(a0, OFFSET_OF(T, swl_3)) );
916 __ lw(a7, MemOperand(a0, OFFSET_OF(T, reg_init)) ); 924 __ lw(a7, MemOperand(a0, OFFSET_OF(T, reg_init)) );
917 __ swl(a7, MemOperand(a0, OFFSET_OF(T, swl_3) + 3) ); 925 __ swl(a7, MemOperand(a0, OFFSET_OF(T, swl_3) + 3) );
918 926
919 // Test all combinations of SWR and vAddr. 927 // Test all combinations of SWR and vAddr.
920 __ lw(a4, MemOperand(a0, OFFSET_OF(T, mem_init)) ); 928 __ lw(a4, MemOperand(a0, OFFSET_OF(T, mem_init)) );
921 __ sw(a4, MemOperand(a0, OFFSET_OF(T, swr_0)) ); 929 __ sw(a4, MemOperand(a0, OFFSET_OF(T, swr_0)) );
922 __ lw(a4, MemOperand(a0, OFFSET_OF(T, reg_init)) ); 930 __ lw(a4, MemOperand(a0, OFFSET_OF(T, reg_init)) );
923 __ swr(a4, MemOperand(a0, OFFSET_OF(T, swr_0)) ); 931 __ swr(a4, MemOperand(a0, OFFSET_OF(T, swr_0)) );
924 932
925 __ lw(a5, MemOperand(a0, OFFSET_OF(T, mem_init)) ); 933 __ lw(a5, MemOperand(a0, OFFSET_OF(T, mem_init)) );
926 __ sw(a5, MemOperand(a0, OFFSET_OF(T, swr_1)) ); 934 __ sw(a5, MemOperand(a0, OFFSET_OF(T, swr_1)) );
927 __ lw(a5, MemOperand(a0, OFFSET_OF(T, reg_init)) ); 935 __ lw(a5, MemOperand(a0, OFFSET_OF(T, reg_init)) );
928 __ swr(a5, MemOperand(a0, OFFSET_OF(T, swr_1) + 1) ); 936 __ swr(a5, MemOperand(a0, OFFSET_OF(T, swr_1) + 1) );
929 937
930 __ lw(a6, MemOperand(a0, OFFSET_OF(T, mem_init)) ); 938 __ lw(a6, MemOperand(a0, OFFSET_OF(T, mem_init)) );
931 __ sw(a6, MemOperand(a0, OFFSET_OF(T, swr_2)) ); 939 __ sw(a6, MemOperand(a0, OFFSET_OF(T, swr_2)) );
932 __ lw(a6, MemOperand(a0, OFFSET_OF(T, reg_init)) ); 940 __ lw(a6, MemOperand(a0, OFFSET_OF(T, reg_init)) );
933 __ swr(a6, MemOperand(a0, OFFSET_OF(T, swr_2) + 2) ); 941 __ swr(a6, MemOperand(a0, OFFSET_OF(T, swr_2) + 2) );
934 942
935 __ lw(a7, MemOperand(a0, OFFSET_OF(T, mem_init)) ); 943 __ lw(a7, MemOperand(a0, OFFSET_OF(T, mem_init)) );
936 __ sw(a7, MemOperand(a0, OFFSET_OF(T, swr_3)) ); 944 __ sw(a7, MemOperand(a0, OFFSET_OF(T, swr_3)) );
937 __ lw(a7, MemOperand(a0, OFFSET_OF(T, reg_init)) ); 945 __ lw(a7, MemOperand(a0, OFFSET_OF(T, reg_init)) );
938 __ swr(a7, MemOperand(a0, OFFSET_OF(T, swr_3) + 3) ); 946 __ swr(a7, MemOperand(a0, OFFSET_OF(T, swr_3) + 3) );
939 947
940 __ jr(ra); 948 __ jr(ra);
941 __ nop(); 949 __ nop();
942 950
943 CodeDesc desc; 951 CodeDesc desc;
944 assm.GetCode(&desc); 952 assm.GetCode(&desc);
945 Handle<Code> code = isolate->factory()->NewCode( 953 Handle<Code> code = isolate->factory()->NewCode(
946 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); 954 desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
947 F3 f = FUNCTION_CAST<F3>(code->entry()); 955 F3 f = FUNCTION_CAST<F3>(code->entry());
948 t.reg_init = 0xaabbccdd; 956 t.reg_init = 0xaabbccdd;
949 t.mem_init = 0x11223344; 957 t.mem_init = 0x11223344;
950 958
951 Object* dummy = CALL_GENERATED_CODE(f, &t, 0, 0, 0, 0); 959 Object* dummy = CALL_GENERATED_CODE(f, &t, 0, 0, 0, 0);
952 USE(dummy); 960 USE(dummy);
953 961
954 CHECK_EQ(0x44bbccdd, t.lwl_0); 962 CHECK_EQ(0x44bbccdd, t.lwl_0);
955 CHECK_EQ(0x3344ccdd, t.lwl_1); 963 CHECK_EQ(0x3344ccdd, t.lwl_1);
956 CHECK_EQ(0x223344dd, t.lwl_2); 964 CHECK_EQ(0x223344dd, t.lwl_2);
957 CHECK_EQ(0x11223344, t.lwl_3); 965 CHECK_EQ(0x11223344, t.lwl_3);
958 966
959 CHECK_EQ(0x11223344, t.lwr_0); 967 CHECK_EQ(0x11223344, t.lwr_0);
960 CHECK_EQ(0xaa112233, t.lwr_1); 968 CHECK_EQ(0xaa112233, t.lwr_1);
961 CHECK_EQ(0xaabb1122, t.lwr_2); 969 CHECK_EQ(0xaabb1122, t.lwr_2);
962 CHECK_EQ(0xaabbcc11, t.lwr_3); 970 CHECK_EQ(0xaabbcc11, t.lwr_3);
963 971
964 CHECK_EQ(0x112233aa, t.swl_0); 972 CHECK_EQ(0x112233aa, t.swl_0);
965 CHECK_EQ(0x1122aabb, t.swl_1); 973 CHECK_EQ(0x1122aabb, t.swl_1);
966 CHECK_EQ(0x11aabbcc, t.swl_2); 974 CHECK_EQ(0x11aabbcc, t.swl_2);
967 CHECK_EQ(0xaabbccdd, t.swl_3); 975 CHECK_EQ(0xaabbccdd, t.swl_3);
968 976
969 CHECK_EQ(0xaabbccdd, t.swr_0); 977 CHECK_EQ(0xaabbccdd, t.swr_0);
970 CHECK_EQ(0xbbccdd44, t.swr_1); 978 CHECK_EQ(0xbbccdd44, t.swr_1);
971 CHECK_EQ(0xccdd3344, t.swr_2); 979 CHECK_EQ(0xccdd3344, t.swr_2);
972 CHECK_EQ(0xdd223344, t.swr_3); 980 CHECK_EQ(0xdd223344, t.swr_3);
981 }
973 } 982 }
974 983
975 984
976 TEST(MIPS12) { 985 TEST(MIPS12) {
977 CcTest::InitializeVM(); 986 CcTest::InitializeVM();
978 Isolate* isolate = CcTest::i_isolate(); 987 Isolate* isolate = CcTest::i_isolate();
979 HandleScope scope(isolate); 988 HandleScope scope(isolate);
980 989
981 typedef struct { 990 typedef struct {
982 int32_t x; 991 int32_t x;
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after
1357 // Signed data, 32 & 64. 1366 // Signed data, 32 & 64.
1358 CHECK_EQ(0x33333333ffffbbccL, t.r3); 1367 CHECK_EQ(0x33333333ffffbbccL, t.r3);
1359 CHECK_EQ(0xffffffff0000bbccL, t.r4); 1368 CHECK_EQ(0xffffffff0000bbccL, t.r4);
1360 1369
1361 // Signed data, 32 & 64. 1370 // Signed data, 32 & 64.
1362 CHECK_EQ(0x55555555ffffffccL, t.r5); 1371 CHECK_EQ(0x55555555ffffffccL, t.r5);
1363 CHECK_EQ(0x000000003333bbccL, t.r6); 1372 CHECK_EQ(0x000000003333bbccL, t.r6);
1364 } 1373 }
1365 1374
1366 #undef __ 1375 #undef __
OLDNEW
« no previous file with comments | « test/cctest/test-api.cc ('k') | test/cctest/test-disasm-mips64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698