Mercurial > hg > Members > kono > compiler-examples
changeset 5:3fc420dc1bec
*** empty log message ***
author | kono |
---|---|
date | Fri, 17 Nov 2006 18:20:23 +0900 |
parents | a7bc45dba4aa |
children | 5350f1289f50 |
files | s-code-ppc.c |
diffstat | 1 files changed, 9 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/s-code-ppc.c Fri Nov 17 16:54:11 2006 +0900 +++ b/s-code-ppc.c Fri Nov 17 18:20:23 2006 +0900 @@ -102,7 +102,7 @@ { printf("\tlwz r4,0(r1)\n"); printf("\taddis r1,r1,4\n"); - printf("\tcmpw cr7,r3,r4\n"); + printf("\tcmpw cr7,r4,r3\n"); printf("\tmfcr r3\n"); printf("\trlwinm r3,r3,30,1\n"); } @@ -137,11 +137,11 @@ printf("\tlwz r4,0(r1)\n"); printf("\taddis r1,r1,4\n"); if(op==O_DIV) { - printf("\tdivw r4,r3,r3\n"); - } else if(op==O_SUB) { - printf("\tsubf r4,r3,r3\n"); + printf("\tdivw r3,r4,r3\n"); +// } else if(op==O_SUB) { +// printf("\tsubf r3,r3,r4\n"); } else { - printf("\t%s r4,r3,r3\n",opcode[op]); + printf("\t%s r3,r3,r4\n",opcode[op]); } } @@ -149,8 +149,10 @@ emit_value(d) int d; { - printf("\tlis r3,ha16(%d)\n",d); - printf("\tori r3,r3,lo16(%d)\n",d); + unsigned int d0 = (d&0xffff); + unsigned int d1 = ((d>>16)&0xffff); + printf("\tlis r3,0x%x\n",d1); + printf("\tori r3,r3,0x%x\n",d0); }