src/emu/cpu/sh2/sh2drc.c
| r9332 | r9333 | |
| 22 | 22 | #include "profiler.h" |
| 23 | 23 | |
| 24 | 24 | CPU_DISASSEMBLE( sh2 ); |
| 25 | extern unsigned DasmSH2(char *buffer, unsigned pc, UINT16 opcode); |
| 25 | 26 | |
| 26 | 27 | #ifdef USE_SH2DRC |
| 27 | 28 | |
| r9332 | r9333 | |
| 106 | 107 | |
| 107 | 108 | static void generate_update_cycles(sh2_state *sh2, drcuml_block *block, compiler_state *compiler, drcuml_ptype ptype, UINT64 pvalue, int allow_exception); |
| 108 | 109 | static void generate_checksum_block(sh2_state *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *seqhead, const opcode_desc *seqlast); |
| 109 | | static void generate_sequence_instruction(sh2_state *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc); |
| 110 | | static void generate_delay_slot(sh2_state *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc); |
| 110 | static void generate_sequence_instruction(sh2_state *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc, UINT32 ovrpc); |
| 111 | static void generate_delay_slot(sh2_state *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc, UINT32 ovrpc); |
| 111 | 112 | |
| 112 | | static int generate_opcode(sh2_state *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc); |
| 113 | | static int generate_group_0(sh2_state *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc, UINT16 opcode, int in_delay_slot); |
| 114 | | static int generate_group_2(sh2_state *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc, UINT16 opcode, int in_delay_slot); |
| 115 | | static int generate_group_3(sh2_state *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc, UINT16 opcode); |
| 116 | | static int generate_group_4(sh2_state *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc, UINT16 opcode, int in_delay_slot); |
| 117 | | static int generate_group_6(sh2_state *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc, UINT16 opcode, int in_delay_slot); |
| 118 | | static int generate_group_8(sh2_state *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc, UINT16 opcode, int in_delay_slot); |
| 119 | | static int generate_group_12(sh2_state *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc, UINT16 opcode, int in_delay_slot); |
| 113 | static int generate_opcode(sh2_state *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc, UINT32 ovrpc); |
| 114 | static int generate_group_0(sh2_state *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc, UINT16 opcode, int in_delay_slot, UINT32 ovrpc); |
| 115 | static int generate_group_2(sh2_state *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc, UINT16 opcode, int in_delay_slot, UINT32 ovrpc); |
| 116 | static int generate_group_3(sh2_state *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc, UINT16 opcode, UINT32 ovrpc); |
| 117 | static int generate_group_4(sh2_state *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc, UINT16 opcode, int in_delay_slot, UINT32 ovrpc); |
| 118 | static int generate_group_6(sh2_state *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc, UINT16 opcode, int in_delay_slot, UINT32 ovrpc); |
| 119 | static int generate_group_8(sh2_state *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc, UINT16 opcode, int in_delay_slot, UINT32 ovrpc); |
| 120 | static int generate_group_12(sh2_state *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc, UINT16 opcode, int in_delay_slot, UINT32 ovrpc); |
| 120 | 121 | |
| 121 | 122 | static void code_compile_block(sh2_state *sh2, UINT8 mode, offs_t pc); |
| 122 | 123 | |
| r9332 | r9333 | |
| 1001 | 1002 | /* iterate over instructions in the sequence and compile them */ |
| 1002 | 1003 | for (curdesc = seqhead; curdesc != seqlast->next; curdesc = curdesc->next) |
| 1003 | 1004 | { |
| 1004 | | generate_sequence_instruction(sh2, block, &compiler, curdesc); |
| 1005 | generate_sequence_instruction(sh2, block, &compiler, curdesc, 0xffffffff); |
| 1005 | 1006 | } |
| 1006 | 1007 | |
| 1007 | 1008 | /* if we need to return to the start, do it */ |
| r9332 | r9333 | |
| 1571 | 1572 | for a single instruction in a sequence |
| 1572 | 1573 | -------------------------------------------------*/ |
| 1573 | 1574 | |
| 1574 | | static void generate_sequence_instruction(sh2_state *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc) |
| 1575 | static void generate_sequence_instruction(sh2_state *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc, UINT32 ovrpc) |
| 1575 | 1576 | { |
| 1576 | 1577 | offs_t expc; |
| 1577 | 1578 | |
| r9332 | r9333 | |
| 1642 | 1643 | else if (!(desc->flags & OPFLAG_VIRTUAL_NOOP)) |
| 1643 | 1644 | { |
| 1644 | 1645 | /* compile the instruction */ |
| 1645 | | if (!generate_opcode(sh2, block, compiler, desc)) |
| 1646 | if (!generate_opcode(sh2, block, compiler, desc, ovrpc)) |
| 1646 | 1647 | { |
| 1647 | 1648 | UML_MOV(block, MEM(&sh2->pc), IMM(desc->pc)); // mov [pc],desc->pc |
| 1648 | 1649 | UML_MOV(block, MEM(&sh2->arg0), IMM(desc->opptr.w[0])); // mov [arg0],opcode |
| r9332 | r9333 | |
| 1655 | 1656 | generate_delay_slot |
| 1656 | 1657 | ------------------------------------------------------------------*/ |
| 1657 | 1658 | |
| 1658 | | static void generate_delay_slot(sh2_state *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc) |
| 1659 | static void generate_delay_slot(sh2_state *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc, UINT32 ovrpc) |
| 1659 | 1660 | { |
| 1660 | 1661 | compiler_state compiler_temp = *compiler; |
| 1661 | 1662 | |
| 1662 | 1663 | /* compile the delay slot using temporary compiler state */ |
| 1663 | 1664 | assert(desc->delay != NULL); |
| 1664 | | generate_sequence_instruction(sh2, block, &compiler_temp, desc->delay); // <next instruction> |
| 1665 | generate_sequence_instruction(sh2, block, &compiler_temp, desc->delay, ovrpc); // <next instruction> |
| 1665 | 1666 | |
| 1666 | 1667 | /* update the label */ |
| 1667 | 1668 | compiler->labelnum = compiler_temp.labelnum; |
| r9332 | r9333 | |
| 1672 | 1673 | opcode |
| 1673 | 1674 | -------------------------------------------------*/ |
| 1674 | 1675 | |
| 1675 | | static int generate_opcode(sh2_state *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc) |
| 1676 | static int generate_opcode(sh2_state *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc, UINT32 ovrpc) |
| 1676 | 1677 | { |
| 1677 | 1678 | UINT32 scratch, scratch2; |
| 1678 | 1679 | INT32 disp; |
| r9332 | r9333 | |
| 1683 | 1684 | switch (opswitch) |
| 1684 | 1685 | { |
| 1685 | 1686 | case 0: |
| 1686 | | return generate_group_0(sh2, block, compiler, desc, opcode, in_delay_slot); |
| 1687 | return generate_group_0(sh2, block, compiler, desc, opcode, in_delay_slot, ovrpc); |
| 1687 | 1688 | |
| 1688 | 1689 | case 1: // MOVLS4 |
| 1689 | 1690 | scratch = (opcode & 0x0f) * 4; |
| r9332 | r9333 | |
| 1697 | 1698 | return TRUE; |
| 1698 | 1699 | |
| 1699 | 1700 | case 2: |
| 1700 | | return generate_group_2(sh2, block, compiler, desc, opcode, in_delay_slot); |
| 1701 | return generate_group_2(sh2, block, compiler, desc, opcode, in_delay_slot, ovrpc); |
| 1701 | 1702 | case 3: |
| 1702 | | return generate_group_3(sh2, block, compiler, desc, opcode); |
| 1703 | return generate_group_3(sh2, block, compiler, desc, opcode, ovrpc); |
| 1703 | 1704 | case 4: |
| 1704 | | return generate_group_4(sh2, block, compiler, desc, opcode, in_delay_slot); |
| 1705 | return generate_group_4(sh2, block, compiler, desc, opcode, in_delay_slot, ovrpc); |
| 1705 | 1706 | |
| 1706 | 1707 | case 5: // MOVLL4 |
| 1707 | 1708 | scratch = (opcode & 0x0f) * 4; |
| r9332 | r9333 | |
| 1715 | 1716 | return TRUE; |
| 1716 | 1717 | |
| 1717 | 1718 | case 6: |
| 1718 | | return generate_group_6(sh2, block, compiler, desc, opcode, in_delay_slot); |
| 1719 | return generate_group_6(sh2, block, compiler, desc, opcode, in_delay_slot, ovrpc); |
| 1719 | 1720 | |
| 1720 | 1721 | case 7: // ADDI |
| 1721 | 1722 | scratch = opcode & 0xff; |
| r9332 | r9333 | |
| 1724 | 1725 | return TRUE; |
| 1725 | 1726 | |
| 1726 | 1727 | case 8: |
| 1727 | | return generate_group_8(sh2, block, compiler, desc, opcode, in_delay_slot); |
| 1728 | return generate_group_8(sh2, block, compiler, desc, opcode, in_delay_slot, ovrpc); |
| 1728 | 1729 | |
| 1729 | 1730 | case 9: // MOVWI |
| 1730 | | scratch = (desc->pc + 2) + ((opcode & 0xff) * 2) + 2; |
| 1731 | if (ovrpc == 0xffffffff) |
| 1732 | { |
| 1733 | scratch = (desc->pc + 2) + ((opcode & 0xff) * 2) + 2; |
| 1734 | } |
| 1735 | else |
| 1736 | { |
| 1737 | scratch = (ovrpc + 2) + ((opcode & 0xff) * 2) + 2; |
| 1738 | } |
| 1731 | 1739 | |
| 1732 | 1740 | if (sh2->drcoptions & SH2DRC_STRICT_PCREL) |
| 1733 | 1741 | { |
| r9332 | r9333 | |
| 1747 | 1755 | return TRUE; |
| 1748 | 1756 | |
| 1749 | 1757 | case 10: // BRA |
| 1750 | | generate_delay_slot(sh2, block, compiler, desc); |
| 1751 | | |
| 1752 | 1758 | disp = ((INT32)opcode << 20) >> 20; |
| 1753 | | |
| 1754 | 1759 | sh2->ea = (desc->pc + 2) + disp * 2 + 2; // sh2->ea = pc+4 + disp*2 + 2 |
| 1755 | 1760 | |
| 1761 | generate_delay_slot(sh2, block, compiler, desc, sh2->ea); |
| 1762 | |
| 1756 | 1763 | generate_update_cycles(sh2, block, compiler, IMM(sh2->ea), TRUE); // <subtract cycles> |
| 1757 | 1764 | UML_HASHJMP(block, IMM(0), IMM(sh2->ea), sh2->nocode); // hashjmp sh2->ea |
| 1758 | 1765 | return TRUE; |
| r9332 | r9333 | |
| 1762 | 1769 | // do this before running the delay slot |
| 1763 | 1770 | UML_ADD(block, MEM(&sh2->pr), IMM(desc->pc), IMM(4)); // add sh2->pr, desc->pc, #4 (skip the current insn & delay slot) |
| 1764 | 1771 | |
| 1765 | | generate_delay_slot(sh2, block, compiler, desc); |
| 1766 | | |
| 1767 | 1772 | disp = ((INT32)opcode << 20) >> 20; |
| 1773 | sh2->ea = (desc->pc + 2) + disp * 2 + 2; // sh2->ea = pc+4 + disp*2 + 2 |
| 1768 | 1774 | |
| 1769 | | sh2->ea = (desc->pc + 2) + disp * 2 + 2; // sh2->ea = pc+4 + disp*2 + 2 |
| 1775 | generate_delay_slot(sh2, block, compiler, desc, sh2->ea); |
| 1776 | |
| 1770 | 1777 | generate_update_cycles(sh2, block, compiler, IMM(sh2->ea), TRUE); // <subtract cycles> |
| 1771 | 1778 | UML_HASHJMP(block, IMM(0), IMM(sh2->ea), sh2->nocode); // hashjmp sh2->ea |
| 1772 | 1779 | return TRUE; |
| 1773 | 1780 | |
| 1774 | 1781 | case 12: |
| 1775 | | return generate_group_12(sh2, block, compiler, desc, opcode, in_delay_slot); |
| 1782 | return generate_group_12(sh2, block, compiler, desc, opcode, in_delay_slot, ovrpc); |
| 1776 | 1783 | |
| 1777 | 1784 | case 13: // MOVLI |
| 1778 | | scratch = ((desc->pc + 4) & ~3) + ((opcode & 0xff) * 4); |
| 1785 | if (ovrpc == 0xffffffff) |
| 1786 | { |
| 1787 | scratch = ((desc->pc + 4) & ~3) + ((opcode & 0xff) * 4); |
| 1788 | } |
| 1789 | else |
| 1790 | { |
| 1791 | scratch = ((ovrpc + 4) & ~3) + ((opcode & 0xff) * 4); |
| 1792 | } |
| 1779 | 1793 | |
| 1780 | 1794 | if (sh2->drcoptions & SH2DRC_STRICT_PCREL) |
| 1781 | 1795 | { |
| r9332 | r9333 | |
| 1806 | 1820 | return FALSE; |
| 1807 | 1821 | } |
| 1808 | 1822 | |
| 1809 | | static int generate_group_0(sh2_state *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc, UINT16 opcode, int in_delay_slot) |
| 1823 | static int generate_group_0(sh2_state *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc, UINT16 opcode, int in_delay_slot, UINT32 ovrpc) |
| 1810 | 1824 | { |
| 1811 | 1825 | switch (opcode & 0x3F) |
| 1812 | 1826 | { |
| r9332 | r9333 | |
| 1842 | 1856 | // clobbering the calculated PR, so do it first |
| 1843 | 1857 | UML_ADD(block, MEM(&sh2->pr), IMM(desc->pc), IMM(4)); // add sh2->pr, desc->pc, #4 (skip the current insn & delay slot) |
| 1844 | 1858 | |
| 1845 | | generate_delay_slot(sh2, block, compiler, desc); |
| 1859 | generate_delay_slot(sh2, block, compiler, desc, sh2->target); |
| 1846 | 1860 | |
| 1847 | 1861 | generate_update_cycles(sh2, block, compiler, MEM(&sh2->target), TRUE); // <subtract cycles> |
| 1848 | 1862 | UML_HASHJMP(block, IMM(0), MEM(&sh2->target), sh2->nocode); // jmp target |
| r9332 | r9333 | |
| 1908 | 1922 | case 0x0b: // RTS(); |
| 1909 | 1923 | UML_MOV(block, MEM(&sh2->target), MEM(&sh2->pr)); // mov target, pr (in case of d-slot shenanigans) |
| 1910 | 1924 | |
| 1911 | | generate_delay_slot(sh2, block, compiler, desc); |
| 1925 | generate_delay_slot(sh2, block, compiler, desc, sh2->target); |
| 1912 | 1926 | |
| 1913 | 1927 | generate_update_cycles(sh2, block, compiler, MEM(&sh2->target), TRUE); // <subtract cycles> |
| 1914 | 1928 | UML_HASHJMP(block, IMM(0), MEM(&sh2->target), sh2->nocode); |
| r9332 | r9333 | |
| 2026 | 2040 | { |
| 2027 | 2041 | UML_ADD(block, MEM(&sh2->target), R32(Rn), IMM(desc->pc+4)); // add target, Rn, pc+4 |
| 2028 | 2042 | |
| 2029 | | generate_delay_slot(sh2, block, compiler, desc); |
| 2043 | generate_delay_slot(sh2, block, compiler, desc, sh2->target); |
| 2030 | 2044 | |
| 2031 | 2045 | generate_update_cycles(sh2, block, compiler, MEM(&sh2->target), TRUE); // <subtract cycles> |
| 2032 | 2046 | UML_HASHJMP(block, IMM(0), MEM(&sh2->target), sh2->nocode); // jmp target |
| r9332 | r9333 | |
| 2048 | 2062 | return TRUE; |
| 2049 | 2063 | |
| 2050 | 2064 | case 0x2b: // RTE(); |
| 2051 | | generate_delay_slot(sh2, block, compiler, desc); |
| 2065 | generate_delay_slot(sh2, block, compiler, desc, 0xffffffff); |
| 2052 | 2066 | |
| 2053 | 2067 | UML_MOV(block, IREG(0), R32(15)); // mov r0, R15 |
| 2054 | 2068 | UML_CALLH(block, sh2->read32); // call read32 |
| r9332 | r9333 | |
| 2071 | 2085 | return FALSE; |
| 2072 | 2086 | } |
| 2073 | 2087 | |
| 2074 | | static int generate_group_2(sh2_state *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc, UINT16 opcode, int in_delay_slot) |
| 2088 | static int generate_group_2(sh2_state *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc, UINT16 opcode, int in_delay_slot, UINT32 ovrpc) |
| 2075 | 2089 | { |
| 2076 | 2090 | switch (opcode & 15) |
| 2077 | 2091 | { |
| r9332 | r9333 | |
| 2240 | 2254 | return FALSE; |
| 2241 | 2255 | } |
| 2242 | 2256 | |
| 2243 | | static int generate_group_3(sh2_state *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc, UINT16 opcode) |
| 2257 | static int generate_group_3(sh2_state *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc, UINT16 opcode, UINT32 ovrpc) |
| 2244 | 2258 | { |
| 2245 | 2259 | switch (opcode & 15) |
| 2246 | 2260 | { |
| r9332 | r9333 | |
| 2352 | 2366 | return FALSE; |
| 2353 | 2367 | } |
| 2354 | 2368 | |
| 2355 | | static int generate_group_4(sh2_state *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc, UINT16 opcode, int in_delay_slot) |
| 2369 | static int generate_group_4(sh2_state *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc, UINT16 opcode, int in_delay_slot, UINT32 ovrpc) |
| 2356 | 2370 | { |
| 2357 | 2371 | switch (opcode & 0x3F) |
| 2358 | 2372 | { |
| r9332 | r9333 | |
| 2459 | 2473 | |
| 2460 | 2474 | UML_ADD(block, MEM(&sh2->pr), IMM(desc->pc), IMM(4)); // add sh2->pr, desc->pc, #4 (skip the current insn & delay slot) |
| 2461 | 2475 | |
| 2462 | | generate_delay_slot(sh2, block, compiler, desc); |
| 2476 | generate_delay_slot(sh2, block, compiler, desc, sh2->target); |
| 2463 | 2477 | |
| 2464 | 2478 | generate_update_cycles(sh2, block, compiler, MEM(&sh2->target), TRUE); // <subtract cycles> |
| 2465 | 2479 | UML_HASHJMP(block, IMM(0), MEM(&sh2->target), sh2->nocode); // and do the jump |
| r9332 | r9333 | |
| 2679 | 2693 | case 0x2b: // JMP(Rn); |
| 2680 | 2694 | UML_MOV(block, MEM(&sh2->target), R32(Rn)); // mov target, Rn |
| 2681 | 2695 | |
| 2682 | | generate_delay_slot(sh2, block, compiler, desc); |
| 2696 | generate_delay_slot(sh2, block, compiler, desc, sh2->target); |
| 2683 | 2697 | |
| 2684 | 2698 | generate_update_cycles(sh2, block, compiler, MEM(&sh2->target), TRUE); // <subtract cycles> |
| 2685 | 2699 | UML_HASHJMP(block, IMM(0), MEM(&sh2->target), sh2->nocode); // jmp (target) |
| r9332 | r9333 | |
| 2717 | 2731 | return FALSE; |
| 2718 | 2732 | } |
| 2719 | 2733 | |
| 2720 | | static int generate_group_6(sh2_state *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc, UINT16 opcode, int in_delay_slot) |
| 2734 | static int generate_group_6(sh2_state *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc, UINT16 opcode, int in_delay_slot, UINT32 ovrpc) |
| 2721 | 2735 | { |
| 2722 | 2736 | switch (opcode & 15) |
| 2723 | 2737 | { |
| r9332 | r9333 | |
| 2847 | 2861 | return FALSE; |
| 2848 | 2862 | } |
| 2849 | 2863 | |
| 2850 | | static int generate_group_8(sh2_state *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc, UINT16 opcode, int in_delay_slot) |
| 2864 | static int generate_group_8(sh2_state *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc, UINT16 opcode, int in_delay_slot, UINT32 ovrpc) |
| 2851 | 2865 | { |
| 2852 | 2866 | INT32 disp; |
| 2853 | 2867 | UINT32 udisp; |
| r9332 | r9333 | |
| 2951 | 2965 | UML_TEST(block, MEM(&sh2->sr), IMM(T)); // test sh2->sr, T |
| 2952 | 2966 | UML_JMPc(block, IF_Z, compiler->labelnum); // jz compiler->labelnum |
| 2953 | 2967 | |
| 2968 | disp = ((INT32)opcode << 24) >> 24; |
| 2969 | sh2->ea = (desc->pc + 2) + disp * 2 + 2; // sh2->ea = destination |
| 2970 | |
| 2954 | 2971 | templabel = compiler->labelnum; // save our label |
| 2955 | 2972 | compiler->labelnum++; // make sure the delay slot doesn't use it |
| 2956 | | generate_delay_slot(sh2, block, compiler, desc); |
| 2973 | generate_delay_slot(sh2, block, compiler, desc, sh2->ea); |
| 2957 | 2974 | |
| 2958 | | disp = ((INT32)opcode << 24) >> 24; |
| 2959 | | sh2->ea = (desc->pc + 2) + disp * 2 + 2; // sh2->ea = destination |
| 2960 | | |
| 2961 | 2975 | generate_update_cycles(sh2, block, compiler, IMM(sh2->ea), TRUE); // <subtract cycles> |
| 2962 | 2976 | UML_HASHJMP(block, IMM(0), IMM(sh2->ea), sh2->nocode); // jmp sh2->ea |
| 2963 | 2977 | |
| r9332 | r9333 | |
| 2972 | 2986 | UML_TEST(block, MEM(&sh2->sr), IMM(T)); // test sh2->sr, T |
| 2973 | 2987 | UML_JMPc(block, IF_NZ, compiler->labelnum); // jnz compiler->labelnum |
| 2974 | 2988 | |
| 2989 | disp = ((INT32)opcode << 24) >> 24; |
| 2990 | sh2->ea = (desc->pc + 2) + disp * 2 + 2; // sh2->ea = destination |
| 2991 | |
| 2975 | 2992 | templabel = compiler->labelnum; // save our label |
| 2976 | 2993 | compiler->labelnum++; // make sure the delay slot doesn't use it |
| 2977 | | generate_delay_slot(sh2, block, compiler, desc); // delay slot only if the branch is taken |
| 2994 | generate_delay_slot(sh2, block, compiler, desc, sh2->ea); // delay slot only if the branch is taken |
| 2978 | 2995 | |
| 2979 | | disp = ((INT32)opcode << 24) >> 24; |
| 2980 | | sh2->ea = (desc->pc + 2) + disp * 2 + 2; // sh2->ea = destination |
| 2981 | | |
| 2982 | 2996 | generate_update_cycles(sh2, block, compiler, IMM(sh2->ea), TRUE); // <subtract cycles> |
| 2983 | 2997 | UML_HASHJMP(block, IMM(0), IMM(sh2->ea), sh2->nocode); // jmp sh2->ea |
| 2984 | 2998 | |
| r9332 | r9333 | |
| 2991 | 3005 | return FALSE; |
| 2992 | 3006 | } |
| 2993 | 3007 | |
| 2994 | | static int generate_group_12(sh2_state *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc, UINT16 opcode, int in_delay_slot) |
| 3008 | static int generate_group_12(sh2_state *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc, UINT16 opcode, int in_delay_slot, UINT32 ovrpc) |
| 2995 | 3009 | { |
| 2996 | 3010 | UINT32 scratch; |
| 2997 | 3011 | |