Mercurial > hg > CbC > old > device
comparison mc-code-powerpc.c @ 189:f53d70110377
immediate instructions.
author | kono |
---|---|
date | Mon, 01 Dec 2003 21:18:45 +0900 |
parents | dffcccf8b1cb |
children | c193120ee2a6 |
comparison
equal
deleted
inserted
replaced
188:4303255fc3cf | 189:f53d70110377 |
---|---|
1748 } | 1748 } |
1749 if(oreg!=creg) free_register(oreg); | 1749 if(oreg!=creg) free_register(oreg); |
1750 regv[creg]=1; | 1750 regv[creg]=1; |
1751 } | 1751 } |
1752 | 1752 |
1753 int | |
1754 code_const_op_p(int op,int v) | |
1755 { | |
1756 if (op==BAND||op==DIV||op==UDIV||op==MOD||op==UMOD) return 0; | |
1757 return (-127<v&&v<128); | |
1758 } | |
1759 | |
1760 void | |
1761 oprtc(int op,int v) | |
1762 { | |
1763 char *crn = register_name(creg); | |
1764 | |
1765 switch(op) { | |
1766 case LSHIFT: | |
1767 case ULSHIFT: | |
1768 printf("\tslwi %s,%s,%d\n",crn,crn,v); | |
1769 return; | |
1770 case RSHIFT: | |
1771 printf("\tsrawi %s,%s,%d\n",crn,crn,v); | |
1772 return; | |
1773 case URSHIFT: | |
1774 printf("\tsrwi %s,%s,%d\n",crn,crn,v); | |
1775 return; | |
1776 case ADD: | |
1777 printf("\taddi %s,%s,lo16(%d)\n",crn,crn,v); | |
1778 break; | |
1779 case SUB: | |
1780 printf("\tsubi %s,%s,lo16(%d)\n",crn,crn,v); | |
1781 break; | |
1782 case CMP: | |
1783 printf("\tcmpwi cr0,%s,lo16(%d)\n",crn,v); | |
1784 break; | |
1785 case EOR: | |
1786 printf("\txori %s,%s,lo16(%d)\n",crn,crn,v); | |
1787 break; | |
1788 case BOR: | |
1789 printf("\tori %s,%s,lo16(%d)\n",crn,crn,v); | |
1790 break; | |
1791 case MUL: | |
1792 printf("\tmulli %s,%s,lo16(%d)\n",crn,crn,v); | |
1793 break; | |
1794 case UMUL: | |
1795 printf("\tmulli %s,%s,lo16(%d)\n",crn,crn,v); | |
1796 break; | |
1797 default: | |
1798 error(-1); | |
1799 } | |
1800 } | |
1753 | 1801 |
1754 void | 1802 void |
1755 shift(char *op, int reg) | 1803 shift(char *op, int reg) |
1756 { | 1804 { |
1757 char *crn = register_name(creg); | 1805 char *crn = register_name(creg); |