OLD | NEW |
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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 | 85 |
86 | 86 |
87 // Verify that all invocations of the COMPARE macro passed successfully. | 87 // Verify that all invocations of the COMPARE macro passed successfully. |
88 // Exit with a failure if at least one of the tests failed. | 88 // Exit with a failure if at least one of the tests failed. |
89 #define VERIFY_RUN() \ | 89 #define VERIFY_RUN() \ |
90 if (failure) { \ | 90 if (failure) { \ |
91 V8_Fatal(__FILE__, __LINE__, "MIPS Disassembler tests failed.\n"); \ | 91 V8_Fatal(__FILE__, __LINE__, "MIPS Disassembler tests failed.\n"); \ |
92 } | 92 } |
93 | 93 |
94 | 94 |
| 95 #define COMPARE_PC_REL_COMPACT(asm_, compare_string, offset) \ |
| 96 { \ |
| 97 int pc_offset = assm.pc_offset(); \ |
| 98 byte *progcounter = &buffer[pc_offset]; \ |
| 99 char str_with_address[100]; \ |
| 100 snprintf(str_with_address, sizeof(str_with_address), "%s -> %p", \ |
| 101 compare_string, progcounter + 4 + (offset << 2)); \ |
| 102 assm.asm_; \ |
| 103 if (!DisassembleAndCompare(progcounter, str_with_address)) failure = true; \ |
| 104 } |
| 105 |
| 106 |
| 107 #define COMPARE_PC_REL(asm_, compare_string, offset) \ |
| 108 { \ |
| 109 int pc_offset = assm.pc_offset(); \ |
| 110 byte *progcounter = &buffer[pc_offset]; \ |
| 111 char str_with_address[100]; \ |
| 112 snprintf(str_with_address, sizeof(str_with_address), "%s -> %p", \ |
| 113 compare_string, progcounter + (offset << 2)); \ |
| 114 assm.asm_; \ |
| 115 if (!DisassembleAndCompare(progcounter, str_with_address)) failure = true; \ |
| 116 } |
| 117 |
| 118 |
| 119 #define COMPARE_PC_JUMP(asm_, compare_string, target) \ |
| 120 { \ |
| 121 int pc_offset = assm.pc_offset(); \ |
| 122 byte *progcounter = &buffer[pc_offset]; \ |
| 123 char str_with_address[100]; \ |
| 124 int instr_index = target >> 2; \ |
| 125 snprintf(str_with_address, sizeof(str_with_address), "%s -> %p", \ |
| 126 compare_string, reinterpret_cast<byte *>( \ |
| 127 ((uint64_t)(progcounter + 1) & ~0xfffffff) | \ |
| 128 (instr_index << 2))); \ |
| 129 assm.asm_; \ |
| 130 if (!DisassembleAndCompare(progcounter, str_with_address)) failure = true; \ |
| 131 } |
| 132 |
| 133 |
95 TEST(Type0) { | 134 TEST(Type0) { |
96 SET_UP(); | 135 SET_UP(); |
97 | 136 |
98 COMPARE(addu(a0, a1, a2), | 137 COMPARE(addu(a0, a1, a2), |
99 "00a62021 addu a0, a1, a2"); | 138 "00a62021 addu a0, a1, a2"); |
100 COMPARE(daddu(a0, a1, a2), | 139 COMPARE(daddu(a0, a1, a2), |
101 "00a6202d daddu a0, a1, a2"); | 140 "00a6202d daddu a0, a1, a2"); |
102 COMPARE(addu(a6, a7, t0), | 141 COMPARE(addu(a6, a7, t0), |
103 "016c5021 addu a6, a7, t0"); | 142 "016c5021 addu a6, a7, t0"); |
104 COMPARE(daddu(a6, a7, t0), | 143 COMPARE(daddu(a6, a7, t0), |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 COMPARE(dmodu(a5, a6, a7), | 311 COMPARE(dmodu(a5, a6, a7), |
273 "014b48df dmodu a5, a6, a7"); | 312 "014b48df dmodu a5, a6, a7"); |
274 COMPARE(divu(v0, v1, a0), | 313 COMPARE(divu(v0, v1, a0), |
275 "0064109b divu v0, v1, a0"); | 314 "0064109b divu v0, v1, a0"); |
276 COMPARE(modu(v0, v1, a0), | 315 COMPARE(modu(v0, v1, a0), |
277 "006410db modu v0, v1, a0"); | 316 "006410db modu v0, v1, a0"); |
278 COMPARE(ddivu(v0, v1, a0), | 317 COMPARE(ddivu(v0, v1, a0), |
279 "0064109f ddivu v0, v1, a0"); | 318 "0064109f ddivu v0, v1, a0"); |
280 COMPARE(dmodu(v0, v1, a0), | 319 COMPARE(dmodu(v0, v1, a0), |
281 "006410df dmodu v0, v1, a0"); | 320 "006410df dmodu v0, v1, a0"); |
282 | |
283 COMPARE(bovc(a0, a0, static_cast<int16_t>(0)), | |
284 "20840000 bovc a0, a0, 0"); | |
285 COMPARE(bovc(a1, a0, static_cast<int16_t>(0)), | |
286 "20a40000 bovc a1, a0, 0"); | |
287 COMPARE(bovc(a1, a0, 32767), | |
288 "20a47fff bovc a1, a0, 32767"); | |
289 COMPARE(bovc(a1, a0, -32768), | |
290 "20a48000 bovc a1, a0, -32768"); | |
291 | |
292 COMPARE(bnvc(a0, a0, static_cast<int16_t>(0)), | |
293 "60840000 bnvc a0, a0, 0"); | |
294 COMPARE(bnvc(a1, a0, static_cast<int16_t>(0)), | |
295 "60a40000 bnvc a1, a0, 0"); | |
296 COMPARE(bnvc(a1, a0, 32767), | |
297 "60a47fff bnvc a1, a0, 32767"); | |
298 COMPARE(bnvc(a1, a0, -32768), | |
299 "60a48000 bnvc a1, a0, -32768"); | |
300 | |
301 COMPARE(beqzc(a0, 0), | |
302 "d8800000 beqzc a0, 0x0"); | |
303 COMPARE(beqzc(a0, 0xfffff), // 0x0fffff == 1048575. | |
304 "d88fffff beqzc a0, 0xfffff"); | |
305 COMPARE(beqzc(a0, 0x100000), // 0x100000 == -1048576. | |
306 "d8900000 beqzc a0, 0x100000"); | |
307 | |
308 COMPARE(bnezc(a0, 0), | |
309 "f8800000 bnezc a0, 0x0"); | |
310 COMPARE(bnezc(a0, 0xfffff), // 0x0fffff == 1048575. | |
311 "f88fffff bnezc a0, 0xfffff"); | |
312 COMPARE(bnezc(a0, 0x100000), // 0x100000 == -1048576. | |
313 "f8900000 bnezc a0, 0x100000"); | |
314 | |
315 COMPARE(bc(-33554432), "ca000000 bc -33554432"); | |
316 COMPARE(bc(-1), "cbffffff bc -1"); | |
317 COMPARE(bc(0), "c8000000 bc 0"); | |
318 COMPARE(bc(1), "c8000001 bc 1"); | |
319 COMPARE(bc(33554431), "c9ffffff bc 33554431"); | |
320 | |
321 COMPARE(balc(-33554432), "ea000000 balc -33554432"); | |
322 COMPARE(balc(-1), "ebffffff balc -1"); | |
323 COMPARE(balc(0), "e8000000 balc 0"); | |
324 COMPARE(balc(1), "e8000001 balc 1"); | |
325 COMPARE(balc(33554431), "e9ffffff balc 33554431"); | |
326 } | 321 } |
327 | 322 |
328 COMPARE(addiu(a0, a1, 0x0), | 323 COMPARE(addiu(a0, a1, 0x0), |
329 "24a40000 addiu a0, a1, 0"); | 324 "24a40000 addiu a0, a1, 0"); |
330 COMPARE(addiu(s0, s1, 32767), | 325 COMPARE(addiu(s0, s1, 32767), |
331 "26307fff addiu s0, s1, 32767"); | 326 "26307fff addiu s0, s1, 32767"); |
332 COMPARE(addiu(a6, a7, -32768), | 327 COMPARE(addiu(a6, a7, -32768), |
333 "256a8000 addiu a6, a7, -32768"); | 328 "256a8000 addiu a6, a7, -32768"); |
334 COMPARE(addiu(v0, v1, -1), | 329 COMPARE(addiu(v0, v1, -1), |
335 "2462ffff addiu v0, v1, -1"); | 330 "2462ffff addiu v0, v1, -1"); |
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
745 COMPARE(lwupc(a0, 262143), "ec93ffff lwupc a0, 262143"); | 740 COMPARE(lwupc(a0, 262143), "ec93ffff lwupc a0, 262143"); |
746 } | 741 } |
747 | 742 |
748 if (kArchVariant == kMips64r6) { | 743 if (kArchVariant == kMips64r6) { |
749 COMPARE(jic(t0, 16), "d80c0010 jic t0, 16"); | 744 COMPARE(jic(t0, 16), "d80c0010 jic t0, 16"); |
750 COMPARE(jic(t0, 4), "d80c0004 jic t0, 4"); | 745 COMPARE(jic(t0, 4), "d80c0004 jic t0, 4"); |
751 COMPARE(jic(t0, -32), "d80cffe0 jic t0, -32"); | 746 COMPARE(jic(t0, -32), "d80cffe0 jic t0, -32"); |
752 } | 747 } |
753 | 748 |
754 if (kArchVariant == kMips64r6) { | 749 if (kArchVariant == kMips64r6) { |
755 COMPARE(beqzc(a0, 16), "d8800010 beqzc a0, 0x10"); | 750 COMPARE_PC_REL_COMPACT(beqzc(a0, 16), "d8800010 beqzc a0, 0x10", |
756 COMPARE(beqzc(a0, 4), "d8800004 beqzc a0, 0x4"); | 751 16); |
757 COMPARE(beqzc(a0, -32), "d89fffe0 beqzc a0, 0x1fffe0"); | 752 COMPARE_PC_REL_COMPACT(beqzc(a0, 4), "d8800004 beqzc a0, 0x4", 4); |
| 753 COMPARE_PC_REL_COMPACT(beqzc(a0, -32), |
| 754 "d89fffe0 beqzc a0, 0x1fffe0", -32); |
758 } | 755 } |
759 | 756 |
760 if (kArchVariant == kMips64r6) { | 757 if (kArchVariant == kMips64r6) { |
761 COMPARE(ldpc(v0, 256), "ec580100 ldpc v0, 256"); | 758 COMPARE(ldpc(v0, 256), "ec580100 ldpc v0, 256"); |
762 COMPARE(ldpc(a0, -1), "ec9bffff ldpc a0, -1"); | 759 COMPARE(ldpc(a0, -1), "ec9bffff ldpc a0, -1"); |
763 COMPARE(ldpc(a1, 0), "ecb80000 ldpc a1, 0"); | 760 COMPARE(ldpc(a1, 0), "ecb80000 ldpc a1, 0"); |
764 } | 761 } |
765 | 762 |
766 if (kArchVariant == kMips64r6) { | 763 if (kArchVariant == kMips64r6) { |
767 COMPARE(addiupc(a0, 262143), "ec83ffff addiupc a0, 262143"); | 764 COMPARE(addiupc(a0, 262143), "ec83ffff addiupc a0, 262143"); |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
880 SET_UP(); | 877 SET_UP(); |
881 | 878 |
882 COMPARE(class_s(f3, f4), "460020db class.s f3, f4"); | 879 COMPARE(class_s(f3, f4), "460020db class.s f3, f4"); |
883 COMPARE(class_d(f2, f3), "4620189b class.d f2, f3"); | 880 COMPARE(class_d(f2, f3), "4620189b class.d f2, f3"); |
884 | 881 |
885 VERIFY_RUN(); | 882 VERIFY_RUN(); |
886 } | 883 } |
887 } | 884 } |
888 | 885 |
889 | 886 |
| 887 TEST(Type3) { |
| 888 SET_UP(); |
| 889 |
| 890 if (kArchVariant == kMips64r6) { |
| 891 COMPARE_PC_REL_COMPACT(bovc(a0, a0, static_cast<int16_t>(0)), |
| 892 "20840000 bovc a0, a0, 0", 0); |
| 893 COMPARE_PC_REL_COMPACT(bovc(a1, a0, static_cast<int16_t>(0)), |
| 894 "20a40000 bovc a1, a0, 0", 0); |
| 895 COMPARE_PC_REL_COMPACT(bovc(a1, a0, 32767), |
| 896 "20a47fff bovc a1, a0, 32767", 32767); |
| 897 COMPARE_PC_REL_COMPACT(bovc(a1, a0, -32768), |
| 898 "20a48000 bovc a1, a0, -32768", -32768); |
| 899 |
| 900 COMPARE_PC_REL_COMPACT(bnvc(a0, a0, static_cast<int16_t>(0)), |
| 901 "60840000 bnvc a0, a0, 0", 0); |
| 902 COMPARE_PC_REL_COMPACT(bnvc(a1, a0, static_cast<int16_t>(0)), |
| 903 "60a40000 bnvc a1, a0, 0", 0); |
| 904 COMPARE_PC_REL_COMPACT(bnvc(a1, a0, 32767), |
| 905 "60a47fff bnvc a1, a0, 32767", 32767); |
| 906 COMPARE_PC_REL_COMPACT(bnvc(a1, a0, -32768), |
| 907 "60a48000 bnvc a1, a0, -32768", -32768); |
| 908 |
| 909 COMPARE_PC_REL_COMPACT(beqzc(a0, 0), "d8800000 beqzc a0, 0x0", 0); |
| 910 COMPARE_PC_REL_COMPACT(beqzc(a0, 0xfffff), // 0x0fffff == 1048575. |
| 911 "d88fffff beqzc a0, 0xfffff", 1048575); |
| 912 COMPARE_PC_REL_COMPACT(beqzc(a0, 0x100000), // 0x100000 == -1048576. |
| 913 "d8900000 beqzc a0, 0x100000", -1048576); |
| 914 |
| 915 COMPARE_PC_REL_COMPACT(bnezc(a0, 0), "f8800000 bnezc a0, 0x0", 0); |
| 916 COMPARE_PC_REL_COMPACT(bnezc(a0, 0xfffff), // 0x0fffff == 1048575. |
| 917 "f88fffff bnezc a0, 0xfffff", 1048575); |
| 918 COMPARE_PC_REL_COMPACT(bnezc(a0, 0x100000), // 0x100000 == -1048576. |
| 919 "f8900000 bnezc a0, 0x100000", -1048576); |
| 920 |
| 921 COMPARE_PC_REL_COMPACT(bc(-33554432), "ca000000 bc -33554432", |
| 922 -33554432); |
| 923 COMPARE_PC_REL_COMPACT(bc(-1), "cbffffff bc -1", -1); |
| 924 COMPARE_PC_REL_COMPACT(bc(0), "c8000000 bc 0", 0); |
| 925 COMPARE_PC_REL_COMPACT(bc(1), "c8000001 bc 1", 1); |
| 926 COMPARE_PC_REL_COMPACT(bc(33554431), "c9ffffff bc 33554431", |
| 927 33554431); |
| 928 |
| 929 COMPARE_PC_REL_COMPACT(balc(-33554432), "ea000000 balc -33554432", |
| 930 -33554432); |
| 931 COMPARE_PC_REL_COMPACT(balc(-1), "ebffffff balc -1", -1); |
| 932 COMPARE_PC_REL_COMPACT(balc(0), "e8000000 balc 0", 0); |
| 933 COMPARE_PC_REL_COMPACT(balc(1), "e8000001 balc 1", 1); |
| 934 COMPARE_PC_REL_COMPACT(balc(33554431), "e9ffffff balc 33554431", |
| 935 33554431); |
| 936 |
| 937 COMPARE_PC_REL_COMPACT(bgeuc(a0, a1, -32768), |
| 938 "18858000 bgeuc a0, a1, -32768", -32768); |
| 939 COMPARE_PC_REL_COMPACT(bgeuc(a0, a1, -1), |
| 940 "1885ffff bgeuc a0, a1, -1", -1); |
| 941 COMPARE_PC_REL_COMPACT(bgeuc(a0, a1, 1), |
| 942 "18850001 bgeuc a0, a1, 1", 1); |
| 943 COMPARE_PC_REL_COMPACT(bgeuc(a0, a1, 32767), |
| 944 "18857fff bgeuc a0, a1, 32767", 32767); |
| 945 |
| 946 COMPARE_PC_REL_COMPACT(bgezalc(a0, -32768), |
| 947 "18848000 bgezalc a0, -32768", -32768); |
| 948 COMPARE_PC_REL_COMPACT(bgezalc(a0, -1), "1884ffff bgezalc a0, -1", |
| 949 -1); |
| 950 COMPARE_PC_REL_COMPACT(bgezalc(a0, 1), "18840001 bgezalc a0, 1", 1); |
| 951 COMPARE_PC_REL_COMPACT(bgezalc(a0, 32767), |
| 952 "18847fff bgezalc a0, 32767", 32767); |
| 953 |
| 954 COMPARE_PC_REL_COMPACT(blezalc(a0, -32768), |
| 955 "18048000 blezalc a0, -32768", -32768); |
| 956 COMPARE_PC_REL_COMPACT(blezalc(a0, -1), "1804ffff blezalc a0, -1", |
| 957 -1); |
| 958 COMPARE_PC_REL_COMPACT(blezalc(a0, 1), "18040001 blezalc a0, 1", 1); |
| 959 COMPARE_PC_REL_COMPACT(blezalc(a0, 32767), |
| 960 "18047fff blezalc a0, 32767", 32767); |
| 961 |
| 962 COMPARE_PC_REL_COMPACT(bltuc(a0, a1, -32768), |
| 963 "1c858000 bltuc a0, a1, -32768", -32768); |
| 964 COMPARE_PC_REL_COMPACT(bltuc(a0, a1, -1), |
| 965 "1c85ffff bltuc a0, a1, -1", -1); |
| 966 COMPARE_PC_REL_COMPACT(bltuc(a0, a1, 1), "1c850001 bltuc a0, a1, 1", |
| 967 1); |
| 968 COMPARE_PC_REL_COMPACT(bltuc(a0, a1, 32767), |
| 969 "1c857fff bltuc a0, a1, 32767", 32767); |
| 970 |
| 971 COMPARE_PC_REL_COMPACT(bltzalc(a0, -32768), |
| 972 "1c848000 bltzalc a0, -32768", -32768); |
| 973 COMPARE_PC_REL_COMPACT(bltzalc(a0, -1), "1c84ffff bltzalc a0, -1", |
| 974 -1); |
| 975 COMPARE_PC_REL_COMPACT(bltzalc(a0, 1), "1c840001 bltzalc a0, 1", 1); |
| 976 COMPARE_PC_REL_COMPACT(bltzalc(a0, 32767), |
| 977 "1c847fff bltzalc a0, 32767", 32767); |
| 978 |
| 979 COMPARE_PC_REL_COMPACT(bgtzalc(a0, -32768), |
| 980 "1c048000 bgtzalc a0, -32768", -32768); |
| 981 COMPARE_PC_REL_COMPACT(bgtzalc(a0, -1), "1c04ffff bgtzalc a0, -1", |
| 982 -1); |
| 983 COMPARE_PC_REL_COMPACT(bgtzalc(a0, 1), "1c040001 bgtzalc a0, 1", 1); |
| 984 COMPARE_PC_REL_COMPACT(bgtzalc(a0, 32767), |
| 985 "1c047fff bgtzalc a0, 32767", 32767); |
| 986 |
| 987 COMPARE_PC_REL_COMPACT(bgezc(a0, -32768), |
| 988 "58848000 bgezc a0, -32768", -32768); |
| 989 COMPARE_PC_REL_COMPACT(bgezc(a0, -1), "5884ffff bgezc a0, -1", -1); |
| 990 COMPARE_PC_REL_COMPACT(bgezc(a0, 1), "58840001 bgezc a0, 1", 1); |
| 991 COMPARE_PC_REL_COMPACT(bgezc(a0, 32767), |
| 992 "58847fff bgezc a0, 32767", 32767); |
| 993 |
| 994 COMPARE_PC_REL_COMPACT(bgec(a0, a1, -32768), |
| 995 "58858000 bgec a0, a1, -32768", -32768); |
| 996 COMPARE_PC_REL_COMPACT(bgec(a0, a1, -1), |
| 997 "5885ffff bgec a0, a1, -1", -1); |
| 998 COMPARE_PC_REL_COMPACT(bgec(a0, a1, 1), "58850001 bgec a0, a1, 1", |
| 999 1); |
| 1000 COMPARE_PC_REL_COMPACT(bgec(a0, a1, 32767), |
| 1001 "58857fff bgec a0, a1, 32767", 32767); |
| 1002 |
| 1003 COMPARE_PC_REL_COMPACT(blezc(a0, -32768), |
| 1004 "58048000 blezc a0, -32768", -32768); |
| 1005 COMPARE_PC_REL_COMPACT(blezc(a0, -1), "5804ffff blezc a0, -1", -1); |
| 1006 COMPARE_PC_REL_COMPACT(blezc(a0, 1), "58040001 blezc a0, 1", 1); |
| 1007 COMPARE_PC_REL_COMPACT(blezc(a0, 32767), |
| 1008 "58047fff blezc a0, 32767", 32767); |
| 1009 |
| 1010 COMPARE_PC_REL_COMPACT(bltzc(a0, -32768), |
| 1011 "5c848000 bltzc a0, -32768", -32768); |
| 1012 COMPARE_PC_REL_COMPACT(bltzc(a0, -1), "5c84ffff bltzc a0, -1", -1); |
| 1013 COMPARE_PC_REL_COMPACT(bltzc(a0, 1), "5c840001 bltzc a0, 1", 1); |
| 1014 COMPARE_PC_REL_COMPACT(bltzc(a0, 32767), |
| 1015 "5c847fff bltzc a0, 32767", 32767); |
| 1016 |
| 1017 COMPARE_PC_REL_COMPACT(bltc(a0, a1, -32768), |
| 1018 "5c858000 bltc a0, a1, -32768", -32768); |
| 1019 COMPARE_PC_REL_COMPACT(bltc(a0, a1, -1), |
| 1020 "5c85ffff bltc a0, a1, -1", -1); |
| 1021 COMPARE_PC_REL_COMPACT(bltc(a0, a1, 1), "5c850001 bltc a0, a1, 1", |
| 1022 1); |
| 1023 COMPARE_PC_REL_COMPACT(bltc(a0, a1, 32767), |
| 1024 "5c857fff bltc a0, a1, 32767", 32767); |
| 1025 |
| 1026 COMPARE_PC_REL_COMPACT(bgtzc(a0, -32768), |
| 1027 "5c048000 bgtzc a0, -32768", -32768); |
| 1028 COMPARE_PC_REL_COMPACT(bgtzc(a0, -1), "5c04ffff bgtzc a0, -1", -1); |
| 1029 COMPARE_PC_REL_COMPACT(bgtzc(a0, 1), "5c040001 bgtzc a0, 1", 1); |
| 1030 COMPARE_PC_REL_COMPACT(bgtzc(a0, 32767), |
| 1031 "5c047fff bgtzc a0, 32767", 32767); |
| 1032 |
| 1033 COMPARE_PC_REL_COMPACT(bc1eqz(-32768, f1), |
| 1034 "45218000 bc1eqz f1, -32768", -32768); |
| 1035 COMPARE_PC_REL_COMPACT(bc1eqz(-1, f1), "4521ffff bc1eqz f1, -1", |
| 1036 -1); |
| 1037 COMPARE_PC_REL_COMPACT(bc1eqz(1, f1), "45210001 bc1eqz f1, 1", 1); |
| 1038 COMPARE_PC_REL_COMPACT(bc1eqz(32767, f1), |
| 1039 "45217fff bc1eqz f1, 32767", 32767); |
| 1040 |
| 1041 COMPARE_PC_REL_COMPACT(bc1nez(-32768, f1), |
| 1042 "45a18000 bc1nez f1, -32768", -32768); |
| 1043 COMPARE_PC_REL_COMPACT(bc1nez(-1, f1), "45a1ffff bc1nez f1, -1", |
| 1044 -1); |
| 1045 COMPARE_PC_REL_COMPACT(bc1nez(1, f1), "45a10001 bc1nez f1, 1", 1); |
| 1046 COMPARE_PC_REL_COMPACT(bc1nez(32767, f1), |
| 1047 "45a17fff bc1nez f1, 32767", 32767); |
| 1048 |
| 1049 COMPARE_PC_REL_COMPACT(bovc(a1, a0, -1), "20a4ffff bovc a1, a0, -1", |
| 1050 -1); |
| 1051 COMPARE_PC_REL_COMPACT(bovc(a0, a0, 1), "20840001 bovc a0, a0, 1", |
| 1052 1); |
| 1053 |
| 1054 COMPARE_PC_REL_COMPACT(beqc(a0, a1, -32768), |
| 1055 "20858000 beqc a0, a1, -32768", -32768); |
| 1056 COMPARE_PC_REL_COMPACT(beqc(a0, a1, -1), "2085ffff beqc a0, a1, -1", |
| 1057 -1); |
| 1058 COMPARE_PC_REL_COMPACT(beqc(a0, a1, 1), "20850001 beqc a0, a1, 1", |
| 1059 1); |
| 1060 COMPARE_PC_REL_COMPACT(beqc(a0, a1, 32767), |
| 1061 "20857fff beqc a0, a1, 32767", 32767); |
| 1062 |
| 1063 COMPARE_PC_REL_COMPACT(bnec(a0, a1, -32768), |
| 1064 "60858000 bnec a0, a1, -32768", -32768); |
| 1065 COMPARE_PC_REL_COMPACT(bnec(a0, a1, -1), "6085ffff bnec a0, a1, -1", |
| 1066 -1); |
| 1067 COMPARE_PC_REL_COMPACT(bnec(a0, a1, 1), "60850001 bnec a0, a1, 1", |
| 1068 1); |
| 1069 COMPARE_PC_REL_COMPACT(bnec(a0, a1, 32767), |
| 1070 "60857fff bnec a0, a1, 32767", 32767); |
| 1071 } |
| 1072 |
| 1073 COMPARE_PC_REL_COMPACT(bne(a0, a1, -32768), |
| 1074 "14858000 bne a0, a1, -32768", -32768); |
| 1075 COMPARE_PC_REL_COMPACT(bne(a0, a1, -1), "1485ffff bne a0, a1, -1", |
| 1076 -1); |
| 1077 COMPARE_PC_REL_COMPACT(bne(a0, a1, 1), "14850001 bne a0, a1, 1", 1); |
| 1078 COMPARE_PC_REL_COMPACT(bne(a0, a1, 32767), |
| 1079 "14857fff bne a0, a1, 32767", 32767); |
| 1080 |
| 1081 COMPARE_PC_REL_COMPACT(beq(a0, a1, -32768), |
| 1082 "10858000 beq a0, a1, -32768", -32768); |
| 1083 COMPARE_PC_REL_COMPACT(beq(a0, a1, -1), "1085ffff beq a0, a1, -1", |
| 1084 -1); |
| 1085 COMPARE_PC_REL_COMPACT(beq(a0, a1, 1), "10850001 beq a0, a1, 1", 1); |
| 1086 COMPARE_PC_REL_COMPACT(beq(a0, a1, 32767), |
| 1087 "10857fff beq a0, a1, 32767", 32767); |
| 1088 |
| 1089 COMPARE_PC_REL_COMPACT(bltz(a0, -32768), "04808000 bltz a0, -32768", |
| 1090 -32768); |
| 1091 COMPARE_PC_REL_COMPACT(bltz(a0, -1), "0480ffff bltz a0, -1", -1); |
| 1092 COMPARE_PC_REL_COMPACT(bltz(a0, 1), "04800001 bltz a0, 1", 1); |
| 1093 COMPARE_PC_REL_COMPACT(bltz(a0, 32767), "04807fff bltz a0, 32767", |
| 1094 32767); |
| 1095 |
| 1096 COMPARE_PC_REL_COMPACT(bgez(a0, -32768), "04818000 bgez a0, -32768", |
| 1097 -32768); |
| 1098 COMPARE_PC_REL_COMPACT(bgez(a0, -1), "0481ffff bgez a0, -1", -1); |
| 1099 COMPARE_PC_REL_COMPACT(bgez(a0, 1), "04810001 bgez a0, 1", 1); |
| 1100 COMPARE_PC_REL_COMPACT(bgez(a0, 32767), "04817fff bgez a0, 32767", |
| 1101 32767); |
| 1102 |
| 1103 COMPARE_PC_REL_COMPACT(blez(a0, -32768), "18808000 blez a0, -32768", |
| 1104 -32768); |
| 1105 COMPARE_PC_REL_COMPACT(blez(a0, -1), "1880ffff blez a0, -1", -1); |
| 1106 COMPARE_PC_REL_COMPACT(blez(a0, 1), "18800001 blez a0, 1", 1); |
| 1107 COMPARE_PC_REL_COMPACT(blez(a0, 32767), "18807fff blez a0, 32767", |
| 1108 32767); |
| 1109 |
| 1110 COMPARE_PC_REL_COMPACT(bgtz(a0, -32768), "1c808000 bgtz a0, -32768", |
| 1111 -32768); |
| 1112 COMPARE_PC_REL_COMPACT(bgtz(a0, -1), "1c80ffff bgtz a0, -1", -1); |
| 1113 COMPARE_PC_REL_COMPACT(bgtz(a0, 1), "1c800001 bgtz a0, 1", 1); |
| 1114 COMPARE_PC_REL_COMPACT(bgtz(a0, 32767), "1c807fff bgtz a0, 32767", |
| 1115 32767); |
| 1116 |
| 1117 COMPARE_PC_JUMP(j(0x4), "08000001 j 0x4", 0x4); |
| 1118 COMPARE_PC_JUMP(j(0xffffffc), "0bffffff j 0xffffffc", 0xffffffc); |
| 1119 |
| 1120 COMPARE_PC_JUMP(jal(0x4), "0c000001 jal 0x4", 0x4); |
| 1121 COMPARE_PC_JUMP(jal(0xffffffc), "0fffffff jal 0xffffffc", |
| 1122 0xffffffc); |
| 1123 |
| 1124 VERIFY_RUN(); |
| 1125 } |
| 1126 |
| 1127 |
890 TEST(C_FMT_DISASM) { | 1128 TEST(C_FMT_DISASM) { |
891 if (kArchVariant == kMips64r2) { | 1129 if (kArchVariant == kMips64r2) { |
892 SET_UP(); | 1130 SET_UP(); |
893 | 1131 |
894 COMPARE(c_s(F, f8, f10, 0), "460a4030 c.f.s f8, f10, cc(0)"); | 1132 COMPARE(c_s(F, f8, f10, 0), "460a4030 c.f.s f8, f10, cc(0)"); |
895 COMPARE(c_d(F, f8, f10, 0), "462a4030 c.f.d f8, f10, cc(0)"); | 1133 COMPARE(c_d(F, f8, f10, 0), "462a4030 c.f.d f8, f10, cc(0)"); |
896 | 1134 |
897 COMPARE(c_s(UN, f8, f10, 2), "460a4231 c.un.s f8, f10, cc(2)"); | 1135 COMPARE(c_s(UN, f8, f10, 2), "460a4231 c.un.s f8, f10, cc(2)"); |
898 COMPARE(c_d(UN, f8, f10, 2), "462a4231 c.un.d f8, f10, cc(2)"); | 1136 COMPARE(c_d(UN, f8, f10, 2), "462a4231 c.un.d f8, f10, cc(2)"); |
899 | 1137 |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
979 COMPARE(cvt_s_w(f22, f24), "4680c5a0 cvt.s.w f22, f24"); | 1217 COMPARE(cvt_s_w(f22, f24), "4680c5a0 cvt.s.w f22, f24"); |
980 if (kArchVariant == kMips64r6 || kArchVariant == kMips64r2) { | 1218 if (kArchVariant == kMips64r6 || kArchVariant == kMips64r2) { |
981 COMPARE(cvt_s_l(f22, f24), "46a0c5a0 cvt.s.l f22, f24"); | 1219 COMPARE(cvt_s_l(f22, f24), "46a0c5a0 cvt.s.l f22, f24"); |
982 } | 1220 } |
983 | 1221 |
984 COMPARE(cvt_s_d(f22, f24), "4620c5a0 cvt.s.d f22, f24"); | 1222 COMPARE(cvt_s_d(f22, f24), "4620c5a0 cvt.s.d f22, f24"); |
985 COMPARE(cvt_s_w(f22, f24), "4680c5a0 cvt.s.w f22, f24"); | 1223 COMPARE(cvt_s_w(f22, f24), "4680c5a0 cvt.s.w f22, f24"); |
986 | 1224 |
987 VERIFY_RUN(); | 1225 VERIFY_RUN(); |
988 } | 1226 } |
OLD | NEW |