Commit fb48f71b3dc1d7eff8bea99e1e4c2f352362ca9f
1 parent
8137cde8
CRIS: Avoid more cpu_T usage.
* Explicit operand passing to prep_alu_r. * Avoid some more cpu_T[] usage. Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5550 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
1 changed file
with
175 additions
and
95 deletions
target-cris/translate.c
@@ -1342,14 +1342,14 @@ static inline void dec_prep_move_r(DisasContext *dc, int rs, int rd, | @@ -1342,14 +1342,14 @@ static inline void dec_prep_move_r(DisasContext *dc, int rs, int rd, | ||
1342 | s_ext decides if the operand1 should be sign-extended or zero-extended when | 1342 | s_ext decides if the operand1 should be sign-extended or zero-extended when |
1343 | needed. */ | 1343 | needed. */ |
1344 | static void dec_prep_alu_r(DisasContext *dc, int rs, int rd, | 1344 | static void dec_prep_alu_r(DisasContext *dc, int rs, int rd, |
1345 | - int size, int s_ext) | 1345 | + int size, int s_ext, TCGv dst, TCGv src) |
1346 | { | 1346 | { |
1347 | - dec_prep_move_r(dc, rs, rd, size, s_ext, cpu_T[1]); | 1347 | + dec_prep_move_r(dc, rs, rd, size, s_ext, src); |
1348 | 1348 | ||
1349 | if (s_ext) | 1349 | if (s_ext) |
1350 | - t_gen_sext(cpu_T[0], cpu_R[rd], size); | 1350 | + t_gen_sext(dst, cpu_R[rd], size); |
1351 | else | 1351 | else |
1352 | - t_gen_zext(cpu_T[0], cpu_R[rd], size); | 1352 | + t_gen_zext(dst, cpu_R[rd], size); |
1353 | } | 1353 | } |
1354 | 1354 | ||
1355 | static int dec_prep_move_m(DisasContext *dc, int s_ext, int memsize, | 1355 | static int dec_prep_move_m(DisasContext *dc, int s_ext, int memsize, |
@@ -1459,6 +1459,7 @@ static unsigned int dec_addoq(DisasContext *dc) | @@ -1459,6 +1459,7 @@ static unsigned int dec_addoq(DisasContext *dc) | ||
1459 | cris_cc_mask(dc, 0); | 1459 | cris_cc_mask(dc, 0); |
1460 | /* Fetch register operand, */ | 1460 | /* Fetch register operand, */ |
1461 | tcg_gen_addi_tl(cpu_R[R_ACR], cpu_R[dc->op2], imm); | 1461 | tcg_gen_addi_tl(cpu_R[R_ACR], cpu_R[dc->op2], imm); |
1462 | + | ||
1462 | return 2; | 1463 | return 2; |
1463 | } | 1464 | } |
1464 | static unsigned int dec_addq(DisasContext *dc) | 1465 | static unsigned int dec_addq(DisasContext *dc) |
@@ -1639,102 +1640,135 @@ static unsigned int dec_scc_r(DisasContext *dc) | @@ -1639,102 +1640,135 @@ static unsigned int dec_scc_r(DisasContext *dc) | ||
1639 | return 2; | 1640 | return 2; |
1640 | } | 1641 | } |
1641 | 1642 | ||
1643 | +static inline void cris_alu_alloc_temps(DisasContext *dc, int size, TCGv *t) | ||
1644 | +{ | ||
1645 | + if (size == 4) { | ||
1646 | + t[0] = cpu_R[dc->op2]; | ||
1647 | + t[1] = cpu_R[dc->op1]; | ||
1648 | + } else { | ||
1649 | + t[0] = tcg_temp_new(TCG_TYPE_TL); | ||
1650 | + t[1] = tcg_temp_new(TCG_TYPE_TL); | ||
1651 | + } | ||
1652 | +} | ||
1653 | + | ||
1654 | +static inline void cris_alu_free_temps(DisasContext *dc, int size, TCGv *t) | ||
1655 | +{ | ||
1656 | + if (size != 4) { | ||
1657 | + tcg_temp_free(t[0]); | ||
1658 | + tcg_temp_free(t[1]); | ||
1659 | + } | ||
1660 | +} | ||
1661 | + | ||
1642 | static unsigned int dec_and_r(DisasContext *dc) | 1662 | static unsigned int dec_and_r(DisasContext *dc) |
1643 | { | 1663 | { |
1664 | + TCGv t[2]; | ||
1644 | int size = memsize_zz(dc); | 1665 | int size = memsize_zz(dc); |
1645 | 1666 | ||
1646 | DIS(fprintf (logfile, "and.%c $r%u, $r%u\n", | 1667 | DIS(fprintf (logfile, "and.%c $r%u, $r%u\n", |
1647 | memsize_char(size), dc->op1, dc->op2)); | 1668 | memsize_char(size), dc->op1, dc->op2)); |
1669 | + | ||
1648 | cris_cc_mask(dc, CC_MASK_NZ); | 1670 | cris_cc_mask(dc, CC_MASK_NZ); |
1649 | - dec_prep_alu_r(dc, dc->op1, dc->op2, size, 0); | ||
1650 | 1671 | ||
1651 | - cris_alu(dc, CC_OP_AND, | ||
1652 | - cpu_R[dc->op2], | ||
1653 | - cpu_R[dc->op2], cpu_T[1], size); | 1672 | + cris_alu_alloc_temps(dc, size, t); |
1673 | + dec_prep_alu_r(dc, dc->op1, dc->op2, size, 0, t[0], t[1]); | ||
1674 | + cris_alu(dc, CC_OP_AND, cpu_R[dc->op2], t[0], t[1], size); | ||
1675 | + cris_alu_free_temps(dc, size, t); | ||
1654 | return 2; | 1676 | return 2; |
1655 | } | 1677 | } |
1656 | 1678 | ||
1657 | static unsigned int dec_lz_r(DisasContext *dc) | 1679 | static unsigned int dec_lz_r(DisasContext *dc) |
1658 | { | 1680 | { |
1681 | + TCGv t0; | ||
1659 | DIS(fprintf (logfile, "lz $r%u, $r%u\n", | 1682 | DIS(fprintf (logfile, "lz $r%u, $r%u\n", |
1660 | dc->op1, dc->op2)); | 1683 | dc->op1, dc->op2)); |
1661 | cris_cc_mask(dc, CC_MASK_NZ); | 1684 | cris_cc_mask(dc, CC_MASK_NZ); |
1662 | - dec_prep_alu_r(dc, dc->op1, dc->op2, 4, 0); | ||
1663 | - cris_alu(dc, CC_OP_LZ, | ||
1664 | - cpu_R[dc->op2], cpu_R[dc->op2], cpu_T[1], 4); | 1685 | + t0 = tcg_temp_new(TCG_TYPE_TL); |
1686 | + dec_prep_alu_r(dc, dc->op1, dc->op2, 4, 0, cpu_R[dc->op2], t0); | ||
1687 | + cris_alu(dc, CC_OP_LZ, cpu_R[dc->op2], cpu_R[dc->op2], t0, 4); | ||
1688 | + tcg_temp_free(t0); | ||
1665 | return 2; | 1689 | return 2; |
1666 | } | 1690 | } |
1667 | 1691 | ||
1668 | static unsigned int dec_lsl_r(DisasContext *dc) | 1692 | static unsigned int dec_lsl_r(DisasContext *dc) |
1669 | { | 1693 | { |
1694 | + TCGv t[2]; | ||
1670 | int size = memsize_zz(dc); | 1695 | int size = memsize_zz(dc); |
1671 | 1696 | ||
1672 | DIS(fprintf (logfile, "lsl.%c $r%u, $r%u\n", | 1697 | DIS(fprintf (logfile, "lsl.%c $r%u, $r%u\n", |
1673 | memsize_char(size), dc->op1, dc->op2)); | 1698 | memsize_char(size), dc->op1, dc->op2)); |
1674 | - cris_cc_mask(dc, CC_MASK_NZ); | ||
1675 | - dec_prep_alu_r(dc, dc->op1, dc->op2, size, 0); | ||
1676 | - tcg_gen_andi_tl(cpu_T[1], cpu_T[1], 63); | ||
1677 | 1699 | ||
1678 | - cris_alu(dc, CC_OP_LSL, | ||
1679 | - cpu_R[dc->op2], cpu_T[0], cpu_T[1], size); | 1700 | + cris_cc_mask(dc, CC_MASK_NZ); |
1701 | + cris_alu_alloc_temps(dc, size, t); | ||
1702 | + dec_prep_alu_r(dc, dc->op1, dc->op2, size, 0, t[0], t[1]); | ||
1703 | + tcg_gen_andi_tl(t[1], t[1], 63); | ||
1704 | + cris_alu(dc, CC_OP_LSL, cpu_R[dc->op2], t[0], t[1], size); | ||
1705 | + cris_alu_alloc_temps(dc, size, t); | ||
1680 | return 2; | 1706 | return 2; |
1681 | } | 1707 | } |
1682 | 1708 | ||
1683 | static unsigned int dec_lsr_r(DisasContext *dc) | 1709 | static unsigned int dec_lsr_r(DisasContext *dc) |
1684 | { | 1710 | { |
1711 | + TCGv t[2]; | ||
1685 | int size = memsize_zz(dc); | 1712 | int size = memsize_zz(dc); |
1686 | 1713 | ||
1687 | DIS(fprintf (logfile, "lsr.%c $r%u, $r%u\n", | 1714 | DIS(fprintf (logfile, "lsr.%c $r%u, $r%u\n", |
1688 | memsize_char(size), dc->op1, dc->op2)); | 1715 | memsize_char(size), dc->op1, dc->op2)); |
1689 | - cris_cc_mask(dc, CC_MASK_NZ); | ||
1690 | - dec_prep_alu_r(dc, dc->op1, dc->op2, size, 0); | ||
1691 | - tcg_gen_andi_tl(cpu_T[1], cpu_T[1], 63); | ||
1692 | 1716 | ||
1693 | - cris_alu(dc, CC_OP_LSR, | ||
1694 | - cpu_R[dc->op2], cpu_T[0], cpu_T[1], size); | 1717 | + cris_cc_mask(dc, CC_MASK_NZ); |
1718 | + cris_alu_alloc_temps(dc, size, t); | ||
1719 | + dec_prep_alu_r(dc, dc->op1, dc->op2, size, 0, t[0], t[1]); | ||
1720 | + tcg_gen_andi_tl(t[1], t[1], 63); | ||
1721 | + cris_alu(dc, CC_OP_LSR, cpu_R[dc->op2], t[0], t[1], size); | ||
1722 | + cris_alu_free_temps(dc, size, t); | ||
1695 | return 2; | 1723 | return 2; |
1696 | } | 1724 | } |
1697 | 1725 | ||
1698 | static unsigned int dec_asr_r(DisasContext *dc) | 1726 | static unsigned int dec_asr_r(DisasContext *dc) |
1699 | { | 1727 | { |
1728 | + TCGv t[2]; | ||
1700 | int size = memsize_zz(dc); | 1729 | int size = memsize_zz(dc); |
1701 | 1730 | ||
1702 | DIS(fprintf (logfile, "asr.%c $r%u, $r%u\n", | 1731 | DIS(fprintf (logfile, "asr.%c $r%u, $r%u\n", |
1703 | memsize_char(size), dc->op1, dc->op2)); | 1732 | memsize_char(size), dc->op1, dc->op2)); |
1704 | - cris_cc_mask(dc, CC_MASK_NZ); | ||
1705 | - dec_prep_alu_r(dc, dc->op1, dc->op2, size, 1); | ||
1706 | - tcg_gen_andi_tl(cpu_T[1], cpu_T[1], 63); | ||
1707 | 1733 | ||
1708 | - cris_alu(dc, CC_OP_ASR, | ||
1709 | - cpu_R[dc->op2], cpu_T[0], cpu_T[1], size); | 1734 | + cris_cc_mask(dc, CC_MASK_NZ); |
1735 | + cris_alu_alloc_temps(dc, size, t); | ||
1736 | + dec_prep_alu_r(dc, dc->op1, dc->op2, size, 1, t[0], t[1]); | ||
1737 | + tcg_gen_andi_tl(t[1], t[1], 63); | ||
1738 | + cris_alu(dc, CC_OP_ASR, cpu_R[dc->op2], t[0], t[1], size); | ||
1739 | + cris_alu_free_temps(dc, size, t); | ||
1710 | return 2; | 1740 | return 2; |
1711 | } | 1741 | } |
1712 | 1742 | ||
1713 | static unsigned int dec_muls_r(DisasContext *dc) | 1743 | static unsigned int dec_muls_r(DisasContext *dc) |
1714 | { | 1744 | { |
1745 | + TCGv t[2]; | ||
1715 | int size = memsize_zz(dc); | 1746 | int size = memsize_zz(dc); |
1716 | 1747 | ||
1717 | DIS(fprintf (logfile, "muls.%c $r%u, $r%u\n", | 1748 | DIS(fprintf (logfile, "muls.%c $r%u, $r%u\n", |
1718 | memsize_char(size), dc->op1, dc->op2)); | 1749 | memsize_char(size), dc->op1, dc->op2)); |
1719 | cris_cc_mask(dc, CC_MASK_NZV); | 1750 | cris_cc_mask(dc, CC_MASK_NZV); |
1720 | - dec_prep_alu_r(dc, dc->op1, dc->op2, size, 1); | 1751 | + cris_alu_alloc_temps(dc, size, t); |
1752 | + dec_prep_alu_r(dc, dc->op1, dc->op2, size, 1, t[0], t[1]); | ||
1721 | 1753 | ||
1722 | - cris_alu(dc, CC_OP_MULS, | ||
1723 | - cpu_R[dc->op2], cpu_T[0], cpu_T[1], 4); | 1754 | + cris_alu(dc, CC_OP_MULS, cpu_R[dc->op2], t[0], t[1], 4); |
1755 | + cris_alu_free_temps(dc, size, t); | ||
1724 | return 2; | 1756 | return 2; |
1725 | } | 1757 | } |
1726 | 1758 | ||
1727 | static unsigned int dec_mulu_r(DisasContext *dc) | 1759 | static unsigned int dec_mulu_r(DisasContext *dc) |
1728 | { | 1760 | { |
1761 | + TCGv t[2]; | ||
1729 | int size = memsize_zz(dc); | 1762 | int size = memsize_zz(dc); |
1730 | 1763 | ||
1731 | DIS(fprintf (logfile, "mulu.%c $r%u, $r%u\n", | 1764 | DIS(fprintf (logfile, "mulu.%c $r%u, $r%u\n", |
1732 | memsize_char(size), dc->op1, dc->op2)); | 1765 | memsize_char(size), dc->op1, dc->op2)); |
1733 | cris_cc_mask(dc, CC_MASK_NZV); | 1766 | cris_cc_mask(dc, CC_MASK_NZV); |
1734 | - dec_prep_alu_r(dc, dc->op1, dc->op2, size, 0); | 1767 | + cris_alu_alloc_temps(dc, size, t); |
1768 | + dec_prep_alu_r(dc, dc->op1, dc->op2, size, 0, t[0], t[1]); | ||
1735 | 1769 | ||
1736 | - cris_alu(dc, CC_OP_MULU, | ||
1737 | - cpu_R[dc->op2], cpu_T[0], cpu_T[1], 4); | 1770 | + cris_alu(dc, CC_OP_MULU, cpu_R[dc->op2], t[0], t[1], 4); |
1771 | + cris_alu_alloc_temps(dc, size, t); | ||
1738 | return 2; | 1772 | return 2; |
1739 | } | 1773 | } |
1740 | 1774 | ||
@@ -1750,40 +1784,46 @@ static unsigned int dec_dstep_r(DisasContext *dc) | @@ -1750,40 +1784,46 @@ static unsigned int dec_dstep_r(DisasContext *dc) | ||
1750 | 1784 | ||
1751 | static unsigned int dec_xor_r(DisasContext *dc) | 1785 | static unsigned int dec_xor_r(DisasContext *dc) |
1752 | { | 1786 | { |
1787 | + TCGv t[2]; | ||
1753 | int size = memsize_zz(dc); | 1788 | int size = memsize_zz(dc); |
1754 | DIS(fprintf (logfile, "xor.%c $r%u, $r%u\n", | 1789 | DIS(fprintf (logfile, "xor.%c $r%u, $r%u\n", |
1755 | memsize_char(size), dc->op1, dc->op2)); | 1790 | memsize_char(size), dc->op1, dc->op2)); |
1756 | BUG_ON(size != 4); /* xor is dword. */ | 1791 | BUG_ON(size != 4); /* xor is dword. */ |
1757 | cris_cc_mask(dc, CC_MASK_NZ); | 1792 | cris_cc_mask(dc, CC_MASK_NZ); |
1758 | - dec_prep_alu_r(dc, dc->op1, dc->op2, size, 0); | 1793 | + cris_alu_alloc_temps(dc, size, t); |
1794 | + dec_prep_alu_r(dc, dc->op1, dc->op2, size, 0, t[0], t[1]); | ||
1759 | 1795 | ||
1760 | - cris_alu(dc, CC_OP_XOR, | ||
1761 | - cpu_R[dc->op2], cpu_T[0], cpu_T[1], 4); | 1796 | + cris_alu(dc, CC_OP_XOR, cpu_R[dc->op2], t[0], t[1], 4); |
1797 | + cris_alu_free_temps(dc, size, t); | ||
1762 | return 2; | 1798 | return 2; |
1763 | } | 1799 | } |
1764 | 1800 | ||
1765 | static unsigned int dec_bound_r(DisasContext *dc) | 1801 | static unsigned int dec_bound_r(DisasContext *dc) |
1766 | { | 1802 | { |
1803 | + TCGv l0; | ||
1767 | int size = memsize_zz(dc); | 1804 | int size = memsize_zz(dc); |
1768 | DIS(fprintf (logfile, "bound.%c $r%u, $r%u\n", | 1805 | DIS(fprintf (logfile, "bound.%c $r%u, $r%u\n", |
1769 | memsize_char(size), dc->op1, dc->op2)); | 1806 | memsize_char(size), dc->op1, dc->op2)); |
1770 | cris_cc_mask(dc, CC_MASK_NZ); | 1807 | cris_cc_mask(dc, CC_MASK_NZ); |
1771 | - dec_prep_move_r(dc, dc->op1, dc->op2, size, 0, cpu_T[1]); | 1808 | + l0 = tcg_temp_local_new(TCG_TYPE_TL); |
1809 | + dec_prep_move_r(dc, dc->op1, dc->op2, size, 0, l0); | ||
1772 | cris_alu(dc, CC_OP_BOUND, | 1810 | cris_alu(dc, CC_OP_BOUND, |
1773 | - cpu_R[dc->op2], cpu_R[dc->op2], cpu_T[1], 4); | 1811 | + cpu_R[dc->op2], cpu_R[dc->op2], l0, 4); |
1774 | return 2; | 1812 | return 2; |
1775 | } | 1813 | } |
1776 | 1814 | ||
1777 | static unsigned int dec_cmp_r(DisasContext *dc) | 1815 | static unsigned int dec_cmp_r(DisasContext *dc) |
1778 | { | 1816 | { |
1817 | + TCGv t[2]; | ||
1779 | int size = memsize_zz(dc); | 1818 | int size = memsize_zz(dc); |
1780 | DIS(fprintf (logfile, "cmp.%c $r%u, $r%u\n", | 1819 | DIS(fprintf (logfile, "cmp.%c $r%u, $r%u\n", |
1781 | memsize_char(size), dc->op1, dc->op2)); | 1820 | memsize_char(size), dc->op1, dc->op2)); |
1782 | cris_cc_mask(dc, CC_MASK_NZVC); | 1821 | cris_cc_mask(dc, CC_MASK_NZVC); |
1783 | - dec_prep_alu_r(dc, dc->op1, dc->op2, size, 0); | 1822 | + cris_alu_alloc_temps(dc, size, t); |
1823 | + dec_prep_alu_r(dc, dc->op1, dc->op2, size, 0, t[0], t[1]); | ||
1784 | 1824 | ||
1785 | - cris_alu(dc, CC_OP_CMP, | ||
1786 | - cpu_R[dc->op2], cpu_T[0], cpu_T[1], size); | 1825 | + cris_alu(dc, CC_OP_CMP, cpu_R[dc->op2], t[0], t[1], size); |
1826 | + cris_alu_free_temps(dc, size, t); | ||
1787 | return 2; | 1827 | return 2; |
1788 | } | 1828 | } |
1789 | 1829 | ||
@@ -1808,14 +1848,16 @@ static unsigned int dec_abs_r(DisasContext *dc) | @@ -1808,14 +1848,16 @@ static unsigned int dec_abs_r(DisasContext *dc) | ||
1808 | 1848 | ||
1809 | static unsigned int dec_add_r(DisasContext *dc) | 1849 | static unsigned int dec_add_r(DisasContext *dc) |
1810 | { | 1850 | { |
1851 | + TCGv t[2]; | ||
1811 | int size = memsize_zz(dc); | 1852 | int size = memsize_zz(dc); |
1812 | DIS(fprintf (logfile, "add.%c $r%u, $r%u\n", | 1853 | DIS(fprintf (logfile, "add.%c $r%u, $r%u\n", |
1813 | memsize_char(size), dc->op1, dc->op2)); | 1854 | memsize_char(size), dc->op1, dc->op2)); |
1814 | cris_cc_mask(dc, CC_MASK_NZVC); | 1855 | cris_cc_mask(dc, CC_MASK_NZVC); |
1815 | - dec_prep_alu_r(dc, dc->op1, dc->op2, size, 0); | 1856 | + cris_alu_alloc_temps(dc, size, t); |
1857 | + dec_prep_alu_r(dc, dc->op1, dc->op2, size, 0, t[0], t[1]); | ||
1816 | 1858 | ||
1817 | - cris_alu(dc, CC_OP_ADD, | ||
1818 | - cpu_R[dc->op2], cpu_T[0], cpu_T[1], size); | 1859 | + cris_alu(dc, CC_OP_ADD, cpu_R[dc->op2], t[0], t[1], size); |
1860 | + cris_alu_free_temps(dc, size, t); | ||
1819 | return 2; | 1861 | return 2; |
1820 | } | 1862 | } |
1821 | 1863 | ||
@@ -1825,9 +1867,8 @@ static unsigned int dec_addc_r(DisasContext *dc) | @@ -1825,9 +1867,8 @@ static unsigned int dec_addc_r(DisasContext *dc) | ||
1825 | dc->op1, dc->op2)); | 1867 | dc->op1, dc->op2)); |
1826 | cris_evaluate_flags(dc); | 1868 | cris_evaluate_flags(dc); |
1827 | cris_cc_mask(dc, CC_MASK_NZVC); | 1869 | cris_cc_mask(dc, CC_MASK_NZVC); |
1828 | - dec_prep_alu_r(dc, dc->op1, dc->op2, 4, 0); | ||
1829 | cris_alu(dc, CC_OP_ADDC, | 1870 | cris_alu(dc, CC_OP_ADDC, |
1830 | - cpu_R[dc->op2], cpu_T[0], cpu_T[1], 4); | 1871 | + cpu_R[dc->op2], cpu_R[dc->op2], cpu_R[dc->op1], 4); |
1831 | return 2; | 1872 | return 2; |
1832 | } | 1873 | } |
1833 | 1874 | ||
@@ -1860,6 +1901,7 @@ static char * swapmode_name(int mode, char *modename) { | @@ -1860,6 +1901,7 @@ static char * swapmode_name(int mode, char *modename) { | ||
1860 | 1901 | ||
1861 | static unsigned int dec_swap_r(DisasContext *dc) | 1902 | static unsigned int dec_swap_r(DisasContext *dc) |
1862 | { | 1903 | { |
1904 | + TCGv t0; | ||
1863 | #if DISAS_CRIS | 1905 | #if DISAS_CRIS |
1864 | char modename[4]; | 1906 | char modename[4]; |
1865 | #endif | 1907 | #endif |
@@ -1867,64 +1909,72 @@ static unsigned int dec_swap_r(DisasContext *dc) | @@ -1867,64 +1909,72 @@ static unsigned int dec_swap_r(DisasContext *dc) | ||
1867 | swapmode_name(dc->op2, modename), dc->op1)); | 1909 | swapmode_name(dc->op2, modename), dc->op1)); |
1868 | 1910 | ||
1869 | cris_cc_mask(dc, CC_MASK_NZ); | 1911 | cris_cc_mask(dc, CC_MASK_NZ); |
1870 | - t_gen_mov_TN_reg(cpu_T[0], dc->op1); | 1912 | + t0 = tcg_temp_new(TCG_TYPE_TL); |
1913 | + t_gen_mov_TN_reg(t0, dc->op1); | ||
1871 | if (dc->op2 & 8) | 1914 | if (dc->op2 & 8) |
1872 | - tcg_gen_not_tl(cpu_T[0], cpu_T[0]); | 1915 | + tcg_gen_not_tl(t0, t0); |
1873 | if (dc->op2 & 4) | 1916 | if (dc->op2 & 4) |
1874 | - t_gen_swapw(cpu_T[0], cpu_T[0]); | 1917 | + t_gen_swapw(t0, t0); |
1875 | if (dc->op2 & 2) | 1918 | if (dc->op2 & 2) |
1876 | - t_gen_swapb(cpu_T[0], cpu_T[0]); | 1919 | + t_gen_swapb(t0, t0); |
1877 | if (dc->op2 & 1) | 1920 | if (dc->op2 & 1) |
1878 | - t_gen_swapr(cpu_T[0], cpu_T[0]); | 1921 | + t_gen_swapr(t0, t0); |
1879 | cris_alu(dc, CC_OP_MOVE, | 1922 | cris_alu(dc, CC_OP_MOVE, |
1880 | - cpu_R[dc->op1], cpu_R[dc->op1], cpu_T[0], 4); | ||
1881 | - | 1923 | + cpu_R[dc->op1], cpu_R[dc->op1], t0, 4); |
1882 | return 2; | 1924 | return 2; |
1883 | } | 1925 | } |
1884 | 1926 | ||
1885 | static unsigned int dec_or_r(DisasContext *dc) | 1927 | static unsigned int dec_or_r(DisasContext *dc) |
1886 | { | 1928 | { |
1929 | + TCGv t[2]; | ||
1887 | int size = memsize_zz(dc); | 1930 | int size = memsize_zz(dc); |
1888 | DIS(fprintf (logfile, "or.%c $r%u, $r%u\n", | 1931 | DIS(fprintf (logfile, "or.%c $r%u, $r%u\n", |
1889 | memsize_char(size), dc->op1, dc->op2)); | 1932 | memsize_char(size), dc->op1, dc->op2)); |
1890 | cris_cc_mask(dc, CC_MASK_NZ); | 1933 | cris_cc_mask(dc, CC_MASK_NZ); |
1891 | - dec_prep_alu_r(dc, dc->op1, dc->op2, size, 0); | ||
1892 | - | ||
1893 | - cris_alu(dc, CC_OP_OR, | ||
1894 | - cpu_R[dc->op2], cpu_T[0], cpu_T[1], size); | 1934 | + cris_alu_alloc_temps(dc, size, t); |
1935 | + dec_prep_alu_r(dc, dc->op1, dc->op2, size, 0, t[0], t[1]); | ||
1936 | + cris_alu(dc, CC_OP_OR, cpu_R[dc->op2], t[0], t[1], size); | ||
1937 | + cris_alu_free_temps(dc, size, t); | ||
1895 | return 2; | 1938 | return 2; |
1896 | } | 1939 | } |
1897 | 1940 | ||
1898 | static unsigned int dec_addi_r(DisasContext *dc) | 1941 | static unsigned int dec_addi_r(DisasContext *dc) |
1899 | { | 1942 | { |
1943 | + TCGv t0; | ||
1900 | DIS(fprintf (logfile, "addi.%c $r%u, $r%u\n", | 1944 | DIS(fprintf (logfile, "addi.%c $r%u, $r%u\n", |
1901 | memsize_char(memsize_zz(dc)), dc->op2, dc->op1)); | 1945 | memsize_char(memsize_zz(dc)), dc->op2, dc->op1)); |
1902 | cris_cc_mask(dc, 0); | 1946 | cris_cc_mask(dc, 0); |
1903 | - tcg_gen_shl_tl(cpu_T[0], cpu_R[dc->op2], tcg_const_tl(dc->zzsize)); | ||
1904 | - tcg_gen_add_tl(cpu_R[dc->op1], cpu_R[dc->op1], cpu_T[0]); | 1947 | + t0 = tcg_temp_new(TCG_TYPE_TL); |
1948 | + tcg_gen_shl_tl(t0, cpu_R[dc->op2], tcg_const_tl(dc->zzsize)); | ||
1949 | + tcg_gen_add_tl(cpu_R[dc->op1], cpu_R[dc->op1], t0); | ||
1905 | return 2; | 1950 | return 2; |
1906 | } | 1951 | } |
1907 | 1952 | ||
1908 | static unsigned int dec_addi_acr(DisasContext *dc) | 1953 | static unsigned int dec_addi_acr(DisasContext *dc) |
1909 | { | 1954 | { |
1955 | + TCGv t0; | ||
1910 | DIS(fprintf (logfile, "addi.%c $r%u, $r%u, $acr\n", | 1956 | DIS(fprintf (logfile, "addi.%c $r%u, $r%u, $acr\n", |
1911 | memsize_char(memsize_zz(dc)), dc->op2, dc->op1)); | 1957 | memsize_char(memsize_zz(dc)), dc->op2, dc->op1)); |
1912 | cris_cc_mask(dc, 0); | 1958 | cris_cc_mask(dc, 0); |
1913 | - tcg_gen_shl_tl(cpu_T[0], cpu_R[dc->op2], tcg_const_tl(dc->zzsize)); | ||
1914 | - tcg_gen_add_tl(cpu_R[R_ACR], cpu_R[dc->op1], cpu_T[0]); | 1959 | + t0 = tcg_temp_new(TCG_TYPE_TL); |
1960 | + tcg_gen_shl_tl(t0, cpu_R[dc->op2], tcg_const_tl(dc->zzsize)); | ||
1961 | + tcg_gen_add_tl(cpu_R[R_ACR], cpu_R[dc->op1], t0); | ||
1962 | + | ||
1915 | return 2; | 1963 | return 2; |
1916 | } | 1964 | } |
1917 | 1965 | ||
1918 | static unsigned int dec_neg_r(DisasContext *dc) | 1966 | static unsigned int dec_neg_r(DisasContext *dc) |
1919 | { | 1967 | { |
1968 | + TCGv t[2]; | ||
1920 | int size = memsize_zz(dc); | 1969 | int size = memsize_zz(dc); |
1921 | DIS(fprintf (logfile, "neg.%c $r%u, $r%u\n", | 1970 | DIS(fprintf (logfile, "neg.%c $r%u, $r%u\n", |
1922 | memsize_char(size), dc->op1, dc->op2)); | 1971 | memsize_char(size), dc->op1, dc->op2)); |
1923 | cris_cc_mask(dc, CC_MASK_NZVC); | 1972 | cris_cc_mask(dc, CC_MASK_NZVC); |
1924 | - dec_prep_alu_r(dc, dc->op1, dc->op2, size, 0); | 1973 | + cris_alu_alloc_temps(dc, size, t); |
1974 | + dec_prep_alu_r(dc, dc->op1, dc->op2, size, 0, t[0], t[1]); | ||
1925 | 1975 | ||
1926 | - cris_alu(dc, CC_OP_NEG, | ||
1927 | - cpu_R[dc->op2], cpu_T[0], cpu_T[1], size); | 1976 | + cris_alu(dc, CC_OP_NEG, cpu_R[dc->op2], t[0], t[1], size); |
1977 | + cris_alu_free_temps(dc, size, t); | ||
1928 | return 2; | 1978 | return 2; |
1929 | } | 1979 | } |
1930 | 1980 | ||
@@ -1933,7 +1983,7 @@ static unsigned int dec_btst_r(DisasContext *dc) | @@ -1933,7 +1983,7 @@ static unsigned int dec_btst_r(DisasContext *dc) | ||
1933 | DIS(fprintf (logfile, "btst $r%u, $r%u\n", | 1983 | DIS(fprintf (logfile, "btst $r%u, $r%u\n", |
1934 | dc->op1, dc->op2)); | 1984 | dc->op1, dc->op2)); |
1935 | cris_cc_mask(dc, CC_MASK_NZ); | 1985 | cris_cc_mask(dc, CC_MASK_NZ); |
1936 | - dec_prep_alu_r(dc, dc->op1, dc->op2, 4, 0); | 1986 | + dec_prep_alu_r(dc, dc->op1, dc->op2, 4, 0, cpu_T[0], cpu_T[1]); |
1937 | 1987 | ||
1938 | cris_alu(dc, CC_OP_BTST, | 1988 | cris_alu(dc, CC_OP_BTST, |
1939 | cpu_T[0], cpu_T[0], cpu_T[1], 4); | 1989 | cpu_T[0], cpu_T[0], cpu_T[1], 4); |
@@ -1945,108 +1995,127 @@ static unsigned int dec_btst_r(DisasContext *dc) | @@ -1945,108 +1995,127 @@ static unsigned int dec_btst_r(DisasContext *dc) | ||
1945 | 1995 | ||
1946 | static unsigned int dec_sub_r(DisasContext *dc) | 1996 | static unsigned int dec_sub_r(DisasContext *dc) |
1947 | { | 1997 | { |
1998 | + TCGv t[2]; | ||
1948 | int size = memsize_zz(dc); | 1999 | int size = memsize_zz(dc); |
1949 | DIS(fprintf (logfile, "sub.%c $r%u, $r%u\n", | 2000 | DIS(fprintf (logfile, "sub.%c $r%u, $r%u\n", |
1950 | memsize_char(size), dc->op1, dc->op2)); | 2001 | memsize_char(size), dc->op1, dc->op2)); |
1951 | cris_cc_mask(dc, CC_MASK_NZVC); | 2002 | cris_cc_mask(dc, CC_MASK_NZVC); |
1952 | - dec_prep_alu_r(dc, dc->op1, dc->op2, size, 0); | ||
1953 | - cris_alu(dc, CC_OP_SUB, | ||
1954 | - cpu_R[dc->op2], cpu_T[0], cpu_T[1], size); | 2003 | + cris_alu_alloc_temps(dc, size, t); |
2004 | + dec_prep_alu_r(dc, dc->op1, dc->op2, size, 0, t[0], t[1]); | ||
2005 | + cris_alu(dc, CC_OP_SUB, cpu_R[dc->op2], t[0], t[1], size); | ||
2006 | + cris_alu_free_temps(dc, size, t); | ||
1955 | return 2; | 2007 | return 2; |
1956 | } | 2008 | } |
1957 | 2009 | ||
1958 | /* Zero extension. From size to dword. */ | 2010 | /* Zero extension. From size to dword. */ |
1959 | static unsigned int dec_movu_r(DisasContext *dc) | 2011 | static unsigned int dec_movu_r(DisasContext *dc) |
1960 | { | 2012 | { |
2013 | + TCGv t0; | ||
1961 | int size = memsize_z(dc); | 2014 | int size = memsize_z(dc); |
1962 | DIS(fprintf (logfile, "movu.%c $r%u, $r%u\n", | 2015 | DIS(fprintf (logfile, "movu.%c $r%u, $r%u\n", |
1963 | memsize_char(size), | 2016 | memsize_char(size), |
1964 | dc->op1, dc->op2)); | 2017 | dc->op1, dc->op2)); |
1965 | 2018 | ||
1966 | cris_cc_mask(dc, CC_MASK_NZ); | 2019 | cris_cc_mask(dc, CC_MASK_NZ); |
1967 | - dec_prep_move_r(dc, dc->op1, dc->op2, size, 0, cpu_T[1]); | ||
1968 | - cris_alu(dc, CC_OP_MOVE, | ||
1969 | - cpu_R[dc->op2], cpu_T[0], cpu_T[1], 4); | 2020 | + t0 = tcg_temp_new(TCG_TYPE_TL); |
2021 | + dec_prep_move_r(dc, dc->op1, dc->op2, size, 0, t0); | ||
2022 | + cris_alu(dc, CC_OP_MOVE, cpu_R[dc->op2], cpu_R[dc->op2], t0, 4); | ||
2023 | + tcg_temp_free(t0); | ||
1970 | return 2; | 2024 | return 2; |
1971 | } | 2025 | } |
1972 | 2026 | ||
1973 | /* Sign extension. From size to dword. */ | 2027 | /* Sign extension. From size to dword. */ |
1974 | static unsigned int dec_movs_r(DisasContext *dc) | 2028 | static unsigned int dec_movs_r(DisasContext *dc) |
1975 | { | 2029 | { |
2030 | + TCGv t0; | ||
1976 | int size = memsize_z(dc); | 2031 | int size = memsize_z(dc); |
1977 | DIS(fprintf (logfile, "movs.%c $r%u, $r%u\n", | 2032 | DIS(fprintf (logfile, "movs.%c $r%u, $r%u\n", |
1978 | memsize_char(size), | 2033 | memsize_char(size), |
1979 | dc->op1, dc->op2)); | 2034 | dc->op1, dc->op2)); |
1980 | 2035 | ||
1981 | cris_cc_mask(dc, CC_MASK_NZ); | 2036 | cris_cc_mask(dc, CC_MASK_NZ); |
2037 | + t0 = tcg_temp_new(TCG_TYPE_TL); | ||
1982 | /* Size can only be qi or hi. */ | 2038 | /* Size can only be qi or hi. */ |
1983 | - t_gen_sext(cpu_T[1], cpu_R[dc->op1], size); | 2039 | + t_gen_sext(t0, cpu_R[dc->op1], size); |
1984 | cris_alu(dc, CC_OP_MOVE, | 2040 | cris_alu(dc, CC_OP_MOVE, |
1985 | - cpu_R[dc->op2], cpu_R[dc->op1], cpu_T[1], 4); | 2041 | + cpu_R[dc->op2], cpu_R[dc->op1], t0, 4); |
2042 | + tcg_temp_free(t0); | ||
1986 | return 2; | 2043 | return 2; |
1987 | } | 2044 | } |
1988 | 2045 | ||
1989 | /* zero extension. From size to dword. */ | 2046 | /* zero extension. From size to dword. */ |
1990 | static unsigned int dec_addu_r(DisasContext *dc) | 2047 | static unsigned int dec_addu_r(DisasContext *dc) |
1991 | { | 2048 | { |
2049 | + TCGv t0; | ||
1992 | int size = memsize_z(dc); | 2050 | int size = memsize_z(dc); |
1993 | DIS(fprintf (logfile, "addu.%c $r%u, $r%u\n", | 2051 | DIS(fprintf (logfile, "addu.%c $r%u, $r%u\n", |
1994 | memsize_char(size), | 2052 | memsize_char(size), |
1995 | dc->op1, dc->op2)); | 2053 | dc->op1, dc->op2)); |
1996 | 2054 | ||
1997 | cris_cc_mask(dc, CC_MASK_NZVC); | 2055 | cris_cc_mask(dc, CC_MASK_NZVC); |
2056 | + t0 = tcg_temp_new(TCG_TYPE_TL); | ||
1998 | /* Size can only be qi or hi. */ | 2057 | /* Size can only be qi or hi. */ |
1999 | - t_gen_zext(cpu_T[1], cpu_R[dc->op1], size); | 2058 | + t_gen_zext(t0, cpu_R[dc->op1], size); |
2000 | cris_alu(dc, CC_OP_ADD, | 2059 | cris_alu(dc, CC_OP_ADD, |
2001 | - cpu_R[dc->op2], cpu_R[dc->op2], cpu_T[1], 4); | 2060 | + cpu_R[dc->op2], cpu_R[dc->op2], t0, 4); |
2061 | + tcg_temp_free(t0); | ||
2002 | return 2; | 2062 | return 2; |
2003 | } | 2063 | } |
2004 | 2064 | ||
2005 | /* Sign extension. From size to dword. */ | 2065 | /* Sign extension. From size to dword. */ |
2006 | static unsigned int dec_adds_r(DisasContext *dc) | 2066 | static unsigned int dec_adds_r(DisasContext *dc) |
2007 | { | 2067 | { |
2068 | + TCGv t0; | ||
2008 | int size = memsize_z(dc); | 2069 | int size = memsize_z(dc); |
2009 | DIS(fprintf (logfile, "adds.%c $r%u, $r%u\n", | 2070 | DIS(fprintf (logfile, "adds.%c $r%u, $r%u\n", |
2010 | memsize_char(size), | 2071 | memsize_char(size), |
2011 | dc->op1, dc->op2)); | 2072 | dc->op1, dc->op2)); |
2012 | 2073 | ||
2013 | cris_cc_mask(dc, CC_MASK_NZVC); | 2074 | cris_cc_mask(dc, CC_MASK_NZVC); |
2075 | + t0 = tcg_temp_new(TCG_TYPE_TL); | ||
2014 | /* Size can only be qi or hi. */ | 2076 | /* Size can only be qi or hi. */ |
2015 | - t_gen_sext(cpu_T[1], cpu_R[dc->op1], size); | 2077 | + t_gen_sext(t0, cpu_R[dc->op1], size); |
2016 | cris_alu(dc, CC_OP_ADD, | 2078 | cris_alu(dc, CC_OP_ADD, |
2017 | - cpu_R[dc->op2], cpu_R[dc->op2], cpu_T[1], 4); | 2079 | + cpu_R[dc->op2], cpu_R[dc->op2], t0, 4); |
2080 | + tcg_temp_free(t0); | ||
2018 | return 2; | 2081 | return 2; |
2019 | } | 2082 | } |
2020 | 2083 | ||
2021 | /* Zero extension. From size to dword. */ | 2084 | /* Zero extension. From size to dword. */ |
2022 | static unsigned int dec_subu_r(DisasContext *dc) | 2085 | static unsigned int dec_subu_r(DisasContext *dc) |
2023 | { | 2086 | { |
2087 | + TCGv t0; | ||
2024 | int size = memsize_z(dc); | 2088 | int size = memsize_z(dc); |
2025 | DIS(fprintf (logfile, "subu.%c $r%u, $r%u\n", | 2089 | DIS(fprintf (logfile, "subu.%c $r%u, $r%u\n", |
2026 | memsize_char(size), | 2090 | memsize_char(size), |
2027 | dc->op1, dc->op2)); | 2091 | dc->op1, dc->op2)); |
2028 | 2092 | ||
2029 | cris_cc_mask(dc, CC_MASK_NZVC); | 2093 | cris_cc_mask(dc, CC_MASK_NZVC); |
2094 | + t0 = tcg_temp_new(TCG_TYPE_TL); | ||
2030 | /* Size can only be qi or hi. */ | 2095 | /* Size can only be qi or hi. */ |
2031 | - t_gen_zext(cpu_T[1], cpu_R[dc->op1], size); | 2096 | + t_gen_zext(t0, cpu_R[dc->op1], size); |
2032 | cris_alu(dc, CC_OP_SUB, | 2097 | cris_alu(dc, CC_OP_SUB, |
2033 | - cpu_R[dc->op2], cpu_R[dc->op2], cpu_T[1], 4); | 2098 | + cpu_R[dc->op2], cpu_R[dc->op2], t0, 4); |
2099 | + tcg_temp_free(t0); | ||
2034 | return 2; | 2100 | return 2; |
2035 | } | 2101 | } |
2036 | 2102 | ||
2037 | /* Sign extension. From size to dword. */ | 2103 | /* Sign extension. From size to dword. */ |
2038 | static unsigned int dec_subs_r(DisasContext *dc) | 2104 | static unsigned int dec_subs_r(DisasContext *dc) |
2039 | { | 2105 | { |
2106 | + TCGv t0; | ||
2040 | int size = memsize_z(dc); | 2107 | int size = memsize_z(dc); |
2041 | DIS(fprintf (logfile, "subs.%c $r%u, $r%u\n", | 2108 | DIS(fprintf (logfile, "subs.%c $r%u, $r%u\n", |
2042 | memsize_char(size), | 2109 | memsize_char(size), |
2043 | dc->op1, dc->op2)); | 2110 | dc->op1, dc->op2)); |
2044 | 2111 | ||
2045 | cris_cc_mask(dc, CC_MASK_NZVC); | 2112 | cris_cc_mask(dc, CC_MASK_NZVC); |
2113 | + t0 = tcg_temp_new(TCG_TYPE_TL); | ||
2046 | /* Size can only be qi or hi. */ | 2114 | /* Size can only be qi or hi. */ |
2047 | - t_gen_sext(cpu_T[1], cpu_R[dc->op1], size); | 2115 | + t_gen_sext(t0, cpu_R[dc->op1], size); |
2048 | cris_alu(dc, CC_OP_SUB, | 2116 | cris_alu(dc, CC_OP_SUB, |
2049 | - cpu_R[dc->op2], cpu_R[dc->op2], cpu_T[1], 4); | 2117 | + cpu_R[dc->op2], cpu_R[dc->op2], t0, 4); |
2118 | + tcg_temp_free(t0); | ||
2050 | return 2; | 2119 | return 2; |
2051 | } | 2120 | } |
2052 | 2121 | ||
@@ -2055,6 +2124,7 @@ static unsigned int dec_setclrf(DisasContext *dc) | @@ -2055,6 +2124,7 @@ static unsigned int dec_setclrf(DisasContext *dc) | ||
2055 | uint32_t flags; | 2124 | uint32_t flags; |
2056 | int set = (~dc->opcode >> 2) & 1; | 2125 | int set = (~dc->opcode >> 2) & 1; |
2057 | 2126 | ||
2127 | + | ||
2058 | flags = (EXTRACT_FIELD(dc->ir, 12, 15) << 4) | 2128 | flags = (EXTRACT_FIELD(dc->ir, 12, 15) << 4) |
2059 | | EXTRACT_FIELD(dc->ir, 0, 3); | 2129 | | EXTRACT_FIELD(dc->ir, 0, 3); |
2060 | if (set && flags == 0) { | 2130 | if (set && flags == 0) { |
@@ -2069,7 +2139,7 @@ static unsigned int dec_setclrf(DisasContext *dc) | @@ -2069,7 +2139,7 @@ static unsigned int dec_setclrf(DisasContext *dc) | ||
2069 | flags)); | 2139 | flags)); |
2070 | } | 2140 | } |
2071 | 2141 | ||
2072 | - /* User space is not allowed to touch these. Silently ignore. */ | 2142 | + /* User space is not allowed to touch these. Silently ignore. */ |
2073 | if (dc->tb_flags & U_FLAG) { | 2143 | if (dc->tb_flags & U_FLAG) { |
2074 | flags &= ~(S_FLAG | I_FLAG | U_FLAG); | 2144 | flags &= ~(S_FLAG | I_FLAG | U_FLAG); |
2075 | } | 2145 | } |
@@ -2138,41 +2208,48 @@ static unsigned int dec_move_sr(DisasContext *dc) | @@ -2138,41 +2208,48 @@ static unsigned int dec_move_sr(DisasContext *dc) | ||
2138 | 2208 | ||
2139 | static unsigned int dec_move_rp(DisasContext *dc) | 2209 | static unsigned int dec_move_rp(DisasContext *dc) |
2140 | { | 2210 | { |
2211 | + TCGv t[2]; | ||
2141 | DIS(fprintf (logfile, "move $r%u, $p%u\n", dc->op1, dc->op2)); | 2212 | DIS(fprintf (logfile, "move $r%u, $p%u\n", dc->op1, dc->op2)); |
2142 | cris_cc_mask(dc, 0); | 2213 | cris_cc_mask(dc, 0); |
2143 | 2214 | ||
2215 | + t[0] = tcg_temp_new(TCG_TYPE_TL); | ||
2144 | if (dc->op2 == PR_CCS) { | 2216 | if (dc->op2 == PR_CCS) { |
2145 | cris_evaluate_flags(dc); | 2217 | cris_evaluate_flags(dc); |
2146 | - t_gen_mov_TN_reg(cpu_T[0], dc->op1); | 2218 | + t_gen_mov_TN_reg(t[0], dc->op1); |
2147 | if (dc->tb_flags & U_FLAG) { | 2219 | if (dc->tb_flags & U_FLAG) { |
2220 | + t[1] = tcg_temp_new(TCG_TYPE_TL); | ||
2148 | /* User space is not allowed to touch all flags. */ | 2221 | /* User space is not allowed to touch all flags. */ |
2149 | - tcg_gen_andi_tl(cpu_T[0], cpu_T[0], 0x39f); | ||
2150 | - tcg_gen_andi_tl(cpu_T[1], cpu_PR[PR_CCS], ~0x39f); | ||
2151 | - tcg_gen_or_tl(cpu_T[0], cpu_T[1], cpu_T[0]); | 2222 | + tcg_gen_andi_tl(t[0], t[0], 0x39f); |
2223 | + tcg_gen_andi_tl(t[1], cpu_PR[PR_CCS], ~0x39f); | ||
2224 | + tcg_gen_or_tl(t[0], t[1], t[0]); | ||
2225 | + tcg_temp_free(t[1]); | ||
2152 | } | 2226 | } |
2153 | } | 2227 | } |
2154 | else | 2228 | else |
2155 | - t_gen_mov_TN_reg(cpu_T[0], dc->op1); | 2229 | + t_gen_mov_TN_reg(t[0], dc->op1); |
2156 | 2230 | ||
2157 | - t_gen_mov_preg_TN(dc, dc->op2, cpu_T[0]); | 2231 | + t_gen_mov_preg_TN(dc, dc->op2, t[0]); |
2158 | if (dc->op2 == PR_CCS) { | 2232 | if (dc->op2 == PR_CCS) { |
2159 | cris_update_cc_op(dc, CC_OP_FLAGS, 4); | 2233 | cris_update_cc_op(dc, CC_OP_FLAGS, 4); |
2160 | dc->flags_uptodate = 1; | 2234 | dc->flags_uptodate = 1; |
2161 | } | 2235 | } |
2236 | + tcg_temp_free(t[0]); | ||
2162 | return 2; | 2237 | return 2; |
2163 | } | 2238 | } |
2164 | static unsigned int dec_move_pr(DisasContext *dc) | 2239 | static unsigned int dec_move_pr(DisasContext *dc) |
2165 | { | 2240 | { |
2241 | + TCGv t0; | ||
2166 | DIS(fprintf (logfile, "move $p%u, $r%u\n", dc->op1, dc->op2)); | 2242 | DIS(fprintf (logfile, "move $p%u, $r%u\n", dc->op1, dc->op2)); |
2167 | cris_cc_mask(dc, 0); | 2243 | cris_cc_mask(dc, 0); |
2168 | 2244 | ||
2169 | if (dc->op2 == PR_CCS) | 2245 | if (dc->op2 == PR_CCS) |
2170 | cris_evaluate_flags(dc); | 2246 | cris_evaluate_flags(dc); |
2171 | 2247 | ||
2172 | - t_gen_mov_TN_preg(cpu_T[1], dc->op2); | 2248 | + t0 = tcg_temp_new(TCG_TYPE_TL); |
2249 | + t_gen_mov_TN_preg(t0, dc->op2); | ||
2173 | cris_alu(dc, CC_OP_MOVE, | 2250 | cris_alu(dc, CC_OP_MOVE, |
2174 | - cpu_R[dc->op1], cpu_R[dc->op1], cpu_T[1], | ||
2175 | - preg_sizes[dc->op2]); | 2251 | + cpu_R[dc->op1], cpu_R[dc->op1], t0, preg_sizes[dc->op2]); |
2252 | + tcg_temp_free(t0); | ||
2176 | return 2; | 2253 | return 2; |
2177 | } | 2254 | } |
2178 | 2255 | ||
@@ -2193,10 +2270,14 @@ static unsigned int dec_move_mr(DisasContext *dc) | @@ -2193,10 +2270,14 @@ static unsigned int dec_move_mr(DisasContext *dc) | ||
2193 | cris_update_result(dc, cpu_R[dc->op2]); | 2270 | cris_update_result(dc, cpu_R[dc->op2]); |
2194 | } | 2271 | } |
2195 | else { | 2272 | else { |
2196 | - insn_len = dec_prep_move_m(dc, 0, memsize, cpu_T[1]); | 2273 | + TCGv t0; |
2274 | + | ||
2275 | + t0 = tcg_temp_new(TCG_TYPE_TL); | ||
2276 | + insn_len = dec_prep_move_m(dc, 0, memsize, t0); | ||
2197 | cris_cc_mask(dc, CC_MASK_NZ); | 2277 | cris_cc_mask(dc, CC_MASK_NZ); |
2198 | cris_alu(dc, CC_OP_MOVE, | 2278 | cris_alu(dc, CC_OP_MOVE, |
2199 | - cpu_R[dc->op2], cpu_R[dc->op2], cpu_T[1], memsize); | 2279 | + cpu_R[dc->op2], cpu_R[dc->op2], t0, memsize); |
2280 | + tcg_temp_free(t0); | ||
2200 | } | 2281 | } |
2201 | do_postinc(dc, memsize); | 2282 | do_postinc(dc, memsize); |
2202 | return insn_len; | 2283 | return insn_len; |
@@ -2838,13 +2919,11 @@ static unsigned int dec_rfe_etc(DisasContext *dc) | @@ -2838,13 +2919,11 @@ static unsigned int dec_rfe_etc(DisasContext *dc) | ||
2838 | 2919 | ||
2839 | static unsigned int dec_ftag_fidx_d_m(DisasContext *dc) | 2920 | static unsigned int dec_ftag_fidx_d_m(DisasContext *dc) |
2840 | { | 2921 | { |
2841 | - /* Ignore D-cache flushes. */ | ||
2842 | return 2; | 2922 | return 2; |
2843 | } | 2923 | } |
2844 | 2924 | ||
2845 | static unsigned int dec_ftag_fidx_i_m(DisasContext *dc) | 2925 | static unsigned int dec_ftag_fidx_i_m(DisasContext *dc) |
2846 | { | 2926 | { |
2847 | - /* Ignore I-cache flushes. */ | ||
2848 | return 2; | 2927 | return 2; |
2849 | } | 2928 | } |
2850 | 2929 | ||
@@ -3207,7 +3286,8 @@ gen_intermediate_code_internal(CPUState *env, TranslationBlock *tb, | @@ -3207,7 +3286,8 @@ gen_intermediate_code_internal(CPUState *env, TranslationBlock *tb, | ||
3207 | delay slots dont break. */ | 3286 | delay slots dont break. */ |
3208 | if (!(tb->pc & 1) && env->singlestep_enabled) | 3287 | if (!(tb->pc & 1) && env->singlestep_enabled) |
3209 | break; | 3288 | break; |
3210 | - } while (!dc->is_jmp && gen_opc_ptr < gen_opc_end | 3289 | + } while (!dc->is_jmp && !dc->cpustate_changed |
3290 | + && gen_opc_ptr < gen_opc_end | ||
3211 | && (dc->pc < next_page_start) | 3291 | && (dc->pc < next_page_start) |
3212 | && num_insns < max_insns); | 3292 | && num_insns < max_insns); |
3213 | 3293 |