| 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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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) \ | 95 #define COMPARE_PC_REL_COMPACT(asm_, compare_string, offset) \ |
| 96 { \ | 96 { \ |
| 97 int pc_offset = assm.pc_offset(); \ | 97 int pc_offset = assm.pc_offset(); \ |
| 98 byte *progcounter = &buffer[pc_offset]; \ | 98 byte *progcounter = &buffer[pc_offset]; \ |
| 99 char str_with_address[100]; \ | 99 char str_with_address[100]; \ |
| 100 snprintf(str_with_address, sizeof(str_with_address), "%s -> %p", \ | 100 snprintf(str_with_address, sizeof(str_with_address), "%s -> %p", \ |
| 101 compare_string, progcounter + 4 + (offset * 4)); \ | 101 compare_string, progcounter + 4 + (offset << 2)); \ |
| 102 assm.asm_; \ | 102 assm.asm_; \ |
| 103 if (!DisassembleAndCompare(progcounter, str_with_address)) failure = true; \ | 103 if (!DisassembleAndCompare(progcounter, str_with_address)) failure = true; \ |
| 104 } | 104 } |
| 105 | 105 |
| 106 | 106 |
| 107 #define COMPARE_PC_REL(asm_, compare_string, offset) \ | 107 #define COMPARE_PC_REL(asm_, compare_string, offset) \ |
| 108 { \ | 108 { \ |
| 109 int pc_offset = assm.pc_offset(); \ | 109 int pc_offset = assm.pc_offset(); \ |
| 110 byte *progcounter = &buffer[pc_offset]; \ | 110 byte *progcounter = &buffer[pc_offset]; \ |
| 111 char str_with_address[100]; \ | 111 char str_with_address[100]; \ |
| 112 snprintf(str_with_address, sizeof(str_with_address), "%s -> %p", \ | 112 snprintf(str_with_address, sizeof(str_with_address), "%s -> %p", \ |
| 113 compare_string, progcounter + (offset * 4)); \ | 113 compare_string, progcounter + (offset << 2)); \ |
| 114 assm.asm_; \ | 114 assm.asm_; \ |
| 115 if (!DisassembleAndCompare(progcounter, str_with_address)) failure = true; \ | 115 if (!DisassembleAndCompare(progcounter, str_with_address)) failure = true; \ |
| 116 } | 116 } |
| 117 | 117 |
| 118 | 118 |
| 119 #define COMPARE_PC_JUMP(asm_, compare_string, target) \ | 119 #define COMPARE_PC_JUMP(asm_, compare_string, target) \ |
| 120 { \ | 120 { \ |
| 121 int pc_offset = assm.pc_offset(); \ | 121 int pc_offset = assm.pc_offset(); \ |
| 122 byte *progcounter = &buffer[pc_offset]; \ | 122 byte *progcounter = &buffer[pc_offset]; \ |
| 123 char str_with_address[100]; \ | 123 char str_with_address[100]; \ |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 415 COMPARE_PC_REL_COMPACT(bnec(a0, a1, -32768), | 415 COMPARE_PC_REL_COMPACT(bnec(a0, a1, -32768), |
| 416 "60858000 bnec a0, a1, -32768", -32768); | 416 "60858000 bnec a0, a1, -32768", -32768); |
| 417 COMPARE_PC_REL_COMPACT(bnec(a0, a1, -1), "6085ffff bnec a0, a1, -1", | 417 COMPARE_PC_REL_COMPACT(bnec(a0, a1, -1), "6085ffff bnec a0, a1, -1", |
| 418 -1); | 418 -1); |
| 419 COMPARE_PC_REL_COMPACT(bnec(a0, a1, 1), "60850001 bnec a0, a1, 1", | 419 COMPARE_PC_REL_COMPACT(bnec(a0, a1, 1), "60850001 bnec a0, a1, 1", |
| 420 1); | 420 1); |
| 421 COMPARE_PC_REL_COMPACT(bnec(a0, a1, 32767), | 421 COMPARE_PC_REL_COMPACT(bnec(a0, a1, 32767), |
| 422 "60857fff bnec a0, a1, 32767", 32767); | 422 "60857fff bnec a0, a1, 32767", 32767); |
| 423 } | 423 } |
| 424 | 424 |
| 425 COMPARE_PC_REL_COMPACT(bne(a0, a1, 65535U), | 425 COMPARE_PC_REL_COMPACT(bne(a0, a1, -32768), |
| 426 "14858000 bne a0, a1, 65535U", 65535U); | 426 "14858000 bne a0, a1, -32768", -32768); |
| 427 COMPARE_PC_REL_COMPACT(bne(a0, a1, -1), "1485ffff bne a0, a1, -1", | 427 COMPARE_PC_REL_COMPACT(bne(a0, a1, -1), "1485ffff bne a0, a1, -1", |
| 428 -1); | 428 -1); |
| 429 COMPARE_PC_REL_COMPACT(bne(a0, a1, 1), "14850001 bne a0, a1, 1", 1); | 429 COMPARE_PC_REL_COMPACT(bne(a0, a1, 1), "14850001 bne a0, a1, 1", 1); |
| 430 COMPARE_PC_REL_COMPACT(bne(a0, a1, 32767), | 430 COMPARE_PC_REL_COMPACT(bne(a0, a1, 32767), |
| 431 "14857fff bne a0, a1, 32767", 32767); | 431 "14857fff bne a0, a1, 32767", 32767); |
| 432 | 432 |
| 433 COMPARE_PC_REL_COMPACT(beq(a0, a1, 65535U), | 433 COMPARE_PC_REL_COMPACT(beq(a0, a1, -32768), |
| 434 "10858000 beq a0, a1, 65535U", 65535U); | 434 "10858000 beq a0, a1, -32768", -32768); |
| 435 COMPARE_PC_REL_COMPACT(beq(a0, a1, -1), "1085ffff beq a0, a1, -1", | 435 COMPARE_PC_REL_COMPACT(beq(a0, a1, -1), "1085ffff beq a0, a1, -1", |
| 436 -1); | 436 -1); |
| 437 COMPARE_PC_REL_COMPACT(beq(a0, a1, 1), "10850001 beq a0, a1, 1", 1); | 437 COMPARE_PC_REL_COMPACT(beq(a0, a1, 1), "10850001 beq a0, a1, 1", 1); |
| 438 COMPARE_PC_REL_COMPACT(beq(a0, a1, 32767), | 438 COMPARE_PC_REL_COMPACT(beq(a0, a1, 32767), |
| 439 "10857fff beq a0, a1, 32767", 32767); | 439 "10857fff beq a0, a1, 32767", 32767); |
| 440 | 440 |
| 441 COMPARE_PC_REL_COMPACT(bltz(a0, 65535U), "04808000 bltz a0, 65535U", | 441 COMPARE_PC_REL_COMPACT(bltz(a0, -32768), "04808000 bltz a0, -32768", |
| 442 65535U); | 442 -32768); |
| 443 COMPARE_PC_REL_COMPACT(bltz(a0, -1), "0480ffff bltz a0, -1", -1); | 443 COMPARE_PC_REL_COMPACT(bltz(a0, -1), "0480ffff bltz a0, -1", -1); |
| 444 COMPARE_PC_REL_COMPACT(bltz(a0, 1), "04800001 bltz a0, 1", 1); | 444 COMPARE_PC_REL_COMPACT(bltz(a0, 1), "04800001 bltz a0, 1", 1); |
| 445 COMPARE_PC_REL_COMPACT(bltz(a0, 32767), "04807fff bltz a0, 32767", | 445 COMPARE_PC_REL_COMPACT(bltz(a0, 32767), "04807fff bltz a0, 32767", |
| 446 32767); | 446 32767); |
| 447 | 447 |
| 448 COMPARE_PC_REL_COMPACT(bgez(a0, 65535U), "04818000 bgez a0, 65535U", | 448 COMPARE_PC_REL_COMPACT(bgez(a0, -32768), "04818000 bgez a0, -32768", |
| 449 65535U); | 449 -32768); |
| 450 COMPARE_PC_REL_COMPACT(bgez(a0, -1), "0481ffff bgez a0, -1", -1); | 450 COMPARE_PC_REL_COMPACT(bgez(a0, -1), "0481ffff bgez a0, -1", -1); |
| 451 COMPARE_PC_REL_COMPACT(bgez(a0, 1), "04810001 bgez a0, 1", 1); | 451 COMPARE_PC_REL_COMPACT(bgez(a0, 1), "04810001 bgez a0, 1", 1); |
| 452 COMPARE_PC_REL_COMPACT(bgez(a0, 32767), "04817fff bgez a0, 32767", | 452 COMPARE_PC_REL_COMPACT(bgez(a0, 32767), "04817fff bgez a0, 32767", |
| 453 32767); | 453 32767); |
| 454 | 454 |
| 455 COMPARE_PC_REL_COMPACT(blez(a0, 65535U), "18808000 blez a0, 65535U", | 455 COMPARE_PC_REL_COMPACT(blez(a0, -32768), "18808000 blez a0, -32768", |
| 456 65535U); | 456 -32768); |
| 457 COMPARE_PC_REL_COMPACT(blez(a0, -1), "1880ffff blez a0, -1", -1); | 457 COMPARE_PC_REL_COMPACT(blez(a0, -1), "1880ffff blez a0, -1", -1); |
| 458 COMPARE_PC_REL_COMPACT(blez(a0, 1), "18800001 blez a0, 1", 1); | 458 COMPARE_PC_REL_COMPACT(blez(a0, 1), "18800001 blez a0, 1", 1); |
| 459 COMPARE_PC_REL_COMPACT(blez(a0, 32767), "18807fff blez a0, 32767", | 459 COMPARE_PC_REL_COMPACT(blez(a0, 32767), "18807fff blez a0, 32767", |
| 460 32767); | 460 32767); |
| 461 | 461 |
| 462 COMPARE_PC_REL_COMPACT(bgtz(a0, 65535U), "1c808000 bgtz a0, 65535U", | 462 COMPARE_PC_REL_COMPACT(bgtz(a0, -32768), "1c808000 bgtz a0, -32768", |
| 463 65535U); | 463 -32768); |
| 464 COMPARE_PC_REL_COMPACT(bgtz(a0, -1), "1c80ffff bgtz a0, -1", -1); | 464 COMPARE_PC_REL_COMPACT(bgtz(a0, -1), "1c80ffff bgtz a0, -1", -1); |
| 465 COMPARE_PC_REL_COMPACT(bgtz(a0, 1), "1c800001 bgtz a0, 1", 1); | 465 COMPARE_PC_REL_COMPACT(bgtz(a0, 1), "1c800001 bgtz a0, 1", 1); |
| 466 COMPARE_PC_REL_COMPACT(bgtz(a0, 32767), "1c807fff bgtz a0, 32767", | 466 COMPARE_PC_REL_COMPACT(bgtz(a0, 32767), "1c807fff bgtz a0, 32767", |
| 467 32767); | 467 32767); |
| 468 | 468 |
| 469 COMPARE_PC_JUMP(j(0x4), "08000001 j 0x4", 0x4); | 469 COMPARE_PC_JUMP(j(0x4), "08000001 j 0x4", 0x4); |
| 470 COMPARE_PC_JUMP(j(0xffffffc), "0bffffff j 0xffffffc", 0xffffffc); | 470 COMPARE_PC_JUMP(j(0xffffffc), "0bffffff j 0xffffffc", 0xffffffc); |
| 471 | 471 |
| 472 COMPARE_PC_JUMP(jal(0x4), "0c000001 jal 0x4", 0x4); | 472 COMPARE_PC_JUMP(jal(0x4), "0c000001 jal 0x4", 0x4); |
| 473 COMPARE_PC_JUMP(jal(0xffffffc), "0fffffff jal 0xffffffc", | 473 COMPARE_PC_JUMP(jal(0xffffffc), "0fffffff jal 0xffffffc", |
| (...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1031 COMPARE(cvt_s_w(f22, f24), "4680c5a0 cvt.s.w f22, f24"); | 1031 COMPARE(cvt_s_w(f22, f24), "4680c5a0 cvt.s.w f22, f24"); |
| 1032 if (IsMipsArchVariant(kMips32r6) || IsMipsArchVariant(kMips32r2)) { | 1032 if (IsMipsArchVariant(kMips32r6) || IsMipsArchVariant(kMips32r2)) { |
| 1033 COMPARE(cvt_s_l(f22, f24), "46a0c5a0 cvt.s.l f22, f24"); | 1033 COMPARE(cvt_s_l(f22, f24), "46a0c5a0 cvt.s.l f22, f24"); |
| 1034 } | 1034 } |
| 1035 | 1035 |
| 1036 COMPARE(cvt_s_d(f22, f24), "4620c5a0 cvt.s.d f22, f24"); | 1036 COMPARE(cvt_s_d(f22, f24), "4620c5a0 cvt.s.d f22, f24"); |
| 1037 COMPARE(cvt_s_w(f22, f24), "4680c5a0 cvt.s.w f22, f24"); | 1037 COMPARE(cvt_s_w(f22, f24), "4680c5a0 cvt.s.w f22, f24"); |
| 1038 | 1038 |
| 1039 VERIFY_RUN(); | 1039 VERIFY_RUN(); |
| 1040 } | 1040 } |
| OLD | NEW |