Mercurial > hg > CbC > old > device
diff mc-nop-386.c @ 14:77c0710a8729
struct copy
author | kono |
---|---|
date | Mon, 17 Jan 2000 01:20:59 +0900 |
parents | a8a812dace23 |
children | 6667dbd4f718 |
line wrap: on
line diff
--- a/mc-nop-386.c Mon Jan 17 00:43:06 2000 +0900 +++ b/mc-nop-386.c Mon Jan 17 01:20:59 2000 +0900 @@ -757,37 +757,40 @@ break; default: if (length <=MAX_COPY_LEN) { - for(;length>4;length-=4,offset+=4); + for(;length>=4;length-=4,offset+=4) emit_copy(from,to,4,offset); - for(;length>2;length-=2,offset+=2); + for(;length>=2;length-=2,offset+=2) emit_copy(from,to,2,offset); if(length>0) emit_copy(from,to,length,offset); return; } - printf("\texch %%edi,%s\n",from); - printf("\texch %%esi,%s\n",to); - printf("\texch %%ecx,%s\n",drn); - printf("\tmovl $%d,%%ecx\n",length); + printf("\txchg %%edi,%s\n",from); + printf("\txchg %%esi,%s\n",to); + printf("\txchg %%ecx,%s\n",drn); + printf("\tmovl $%d,%%ecx\n",length/4); printf("\tcld\n\trep\n\tmovsl\n"); - printf("\texch %%ecx,%s\n",drn); - printf("\texch %%esi,%s\n",to); - printf("\texch %%edi,%s\n",from); + printf("\txchg %%ecx,%s\n",drn); + printf("\txchg %%esi,%s\n",to); + printf("\txchg %%edi,%s\n",from); + if(length%4) { + emit_copy("%esi","%edi",length,offset+length/4); + } } } int struct_push(int e4,int t) { - int e5; + int length; g_expr(e4); - e5=size(t); - if(e5%size_of_int) { - e5 += size_of_int - (e5%size_of_int); + length=size(t); + if(length%size_of_int) { + length += size_of_int - (length%size_of_int); } - printf("\tsubl $%d,%%esp\n",e5); - if (e5<=MAX_COPY_LEN) - emit_copy(crn,"%esp",e5,0); + printf("\tsubl $%d,%%esp\n",length); + if (length<=MAX_COPY_LEN) + emit_copy(crn,"%esp",length,0); else { printf("\tpushl %%edi\n"); printf("\tpushl %%esi\n"); @@ -795,13 +798,13 @@ printf("\tleal 12(%%esp),%%di\n"); if (rname[creg]!=REG_ESI) printf("\tmovl %s,%%esi\n",crn); - printf("\tmovl $%d,%%ecx\n",e5); + printf("\tmovl $%d,%%ecx\n",length/size_of_int); printf("\tcld\n\trep\n\tmovsl\n"); printf("\tpopl %%ecx\n"); printf("\tpopl %%esi\n"); printf("\tpopl %%edi\n"); } - return e5/size_of_int; + return length/size_of_int; } void @@ -1032,7 +1035,7 @@ e2 = cadr(e1); e3 = cadr(e2); e4 = caddr(e1); - sz = size(cadr(e2)); /* cld rep movsb */ + sz = cadddr(e1); /* cld rep movsb */ g_expr(e4); emit_push(); g_expr(e2);