| Index: test/cctest/test-disasm-mips.cc
|
| diff --git a/test/cctest/test-disasm-mips.cc b/test/cctest/test-disasm-mips.cc
|
| index c04cd23bf5aa9c0c53fd586c0067347f21ee9a32..1688d199cc599f701cf07663c422ef33e8845e79 100644
|
| --- a/test/cctest/test-disasm-mips.cc
|
| +++ b/test/cctest/test-disasm-mips.cc
|
| @@ -121,16 +121,25 @@ if (failure) { \
|
| int pc_offset = assm.pc_offset(); \
|
| byte *progcounter = &buffer[pc_offset]; \
|
| char str_with_address[100]; \
|
| - int instr_index = target >> 2; \
|
| - snprintf(str_with_address, sizeof(str_with_address), "%s -> %p", \
|
| - compare_string, reinterpret_cast<byte *>( \
|
| - ((uint32_t)(progcounter + 1) & ~0xfffffff) | \
|
| + int instr_index = (target >> 2) & kImm26Mask; \
|
| + snprintf( \
|
| + str_with_address, sizeof(str_with_address), "%s %p -> %p", \
|
| + compare_string, reinterpret_cast<byte *>(target), \
|
| + reinterpret_cast<byte *>(((uint32_t)(progcounter + 4) & ~0xfffffff) | \
|
| (instr_index << 2))); \
|
| assm.asm_; \
|
| if (!DisassembleAndCompare(progcounter, str_with_address)) failure = true; \
|
| }
|
|
|
|
|
| +#define GET_PC_REGION(pc_region) \
|
| + { \
|
| + int pc_offset = assm.pc_offset(); \
|
| + byte *progcounter = &buffer[pc_offset]; \
|
| + pc_region = reinterpret_cast<int32_t>(progcounter + 4) & ~0xfffffff; \
|
| + }
|
| +
|
| +
|
| TEST(Type0) {
|
| SET_UP();
|
|
|
| @@ -466,12 +475,18 @@ TEST(Type0) {
|
| COMPARE_PC_REL_COMPACT(bgtz(a0, 32767), "1c807fff bgtz a0, 32767",
|
| 32767);
|
|
|
| - COMPARE_PC_JUMP(j(0x4), "08000001 j 0x4", 0x4);
|
| - COMPARE_PC_JUMP(j(0xffffffc), "0bffffff j 0xffffffc", 0xffffffc);
|
| + int32_t pc_region;
|
| + GET_PC_REGION(pc_region);
|
| +
|
| + int32_t target = pc_region | 0x4;
|
| + COMPARE_PC_JUMP(j(target), "08000001 j ", target);
|
| + target = pc_region | 0xffffffc;
|
| + COMPARE_PC_JUMP(j(target), "0bffffff j ", target);
|
|
|
| - COMPARE_PC_JUMP(jal(0x4), "0c000001 jal 0x4", 0x4);
|
| - COMPARE_PC_JUMP(jal(0xffffffc), "0fffffff jal 0xffffffc",
|
| - 0xffffffc);
|
| + target = pc_region | 0x4;
|
| + COMPARE_PC_JUMP(jal(target), "0c000001 jal ", target);
|
| + target = pc_region | 0xffffffc;
|
| + COMPARE_PC_JUMP(jal(target), "0fffffff jal ", target);
|
|
|
| COMPARE(addiu(a0, a1, 0x0),
|
| "24a40000 addiu a0, a1, 0");
|
|
|