# HG changeset patch # User Shinji KONO # Date 1290321383 -32400 # Node ID fcb642ef08c954cfb7df307baffe0743ddb21a5f # Parent ffd2e5dbbf64486025b96492e91457c5e091d329 minor fix diff -r ffd2e5dbbf64 -r fcb642ef08c9 mc-code-i64.c --- a/mc-code-i64.c Sun Nov 21 12:04:56 2010 +0900 +++ b/mc-code-i64.c Sun Nov 21 15:36:23 2010 +0900 @@ -3082,9 +3082,13 @@ int code_get_fixed_creg(int reg,int type) { if (type==FLOAT||type==DOUBLE) { - return 0; - } else if (type==LONGLONG||type==ULONGLONG) { - use_longlong(reg); + if (reg==USE_CREG) { + if (regs[FREG_FREGISTER]==0) { + set_freg(FREG_FREGISTER,(!is_int_reg(freg))&®s[freg]==USING_REG); + return FREG_FREGISTER; + } + } + use_float(type==DOUBLE, reg); return reg; } else { if (reg==USE_CREG) { @@ -3758,6 +3762,8 @@ printf("\tcvttsd2siq %s,%s\n",f,register_name(ireg,0)); } +#if 0 +static void code_u2d1(int reg,int d) { use_int(reg); @@ -3778,16 +3784,19 @@ printf(" shrq %s\n",t); printf(" andl $1, %s\n",register_name(i,SIZE_OF_INT)); printf(" orq %s, %s\n",t,u); - printf(" cvtsi2s%sq %s, %s\n",dbs,u,dn); - printf(" movap%s %s, %s\n",dbs,dn,fregister_name(td)); + printf(" cvtsi2s%sq %s, %s\n",dbs,u,dn); printf(" movap%s %s, %s\n",dbs,dn,fregister_name(td)); printf(" adds%s %s, %s\n",dbs,dn,fregister_name(td)); printf("2:\n"); free_register(tmp); free_register(td); } +#endif void code_u2d(int reg) { - code_u2d1(reg,1); + use_int(reg); + int c = reg; + set_freg(get_dregister(1),0); + printf("\tcvtsi2sdq %s,%s\n",register_name(c,0),fregister_name(freg)); } void code_d2f(int reg) { @@ -3825,7 +3834,11 @@ printf("\tcvtsi2ss %s,%s\n",register_name(c,0),fregister_name(creg)); } void code_u2f(int reg) { - code_u2d1(reg,0); + use_int(reg); + int c = reg; + set_freg(get_dregister(0),0); + printf("\tmovl %s,%s\n",register_name(c,SIZE_OF_INT),register_name(c,SIZE_OF_INT)); + printf("\tcvtsi2ss %s,%s\n",register_name(c,0),fregister_name(creg)); } void code_drgvar(int e2,int d,int freg) @@ -3956,7 +3969,7 @@ use_float(d,reg); frn =fregister_name(reg); - printf("\t%s %s,0(%s)\n",fload(d),frn,crn); + printf("\t%s 0(%s),%s\n",fload(d),crn,frn); dtosop(op,reg,xreg); printf("\t%s %s,0(%s)\n",fstore(d),frn,crn); emit_dpop_free(xreg,d); diff -r ffd2e5dbbf64 -r fcb642ef08c9 mc-codegen.c --- a/mc-codegen.c Sun Nov 21 12:04:56 2010 +0900 +++ b/mc-codegen.c Sun Nov 21 15:36:23 2010 +0900 @@ -4356,8 +4356,7 @@ switch(type0) { case INT: break; - case UNSIGNED: - break; + case UNSIGNED: op=US; type=set_type_with_attr(UNSIGNED,type); break; case VOID: break; case CHAR: op=COP; type=set_type_with_attr(INT,type); break; case UCHAR: op=COP+US; type=set_type_with_attr(UNSIGNED,type); break; diff -r ffd2e5dbbf64 -r fcb642ef08c9 mc-inline.c --- a/mc-inline.c Sun Nov 21 12:04:56 2010 +0900 +++ b/mc-inline.c Sun Nov 21 15:36:23 2010 +0900 @@ -807,6 +807,33 @@ return offset; } +#if 0 +static void +pzfill(int var, int offset, int sz) +{ + int c0 = list2(CONST,0); + int l0 = llist2(LCONST,0L); + while(sz>0) { + int t,c; + switch(sz) { + case 1: t = UCHAR; c = c0; break; + case 2: t = USHORT; c = c0; break; + case 4: t = UNSIGNED; c = c0; break; + default: t = ULONGLONG; c = l0; break; + } + int ass = assign_expr0( + offset? + lp64?list3(LADD,var,llist2(LCONST,offset)): // binop? + list3(ADD,var,list2(CONST,offset)): + var, + c ,t,t); // already correct_typed + init_vars = list2(ass,init_vars); + sz -= size(t); + offset += size(t); + } +} +#endif + static int pdecl_data_field(int var,int init,int target_type,int offset) { @@ -1213,6 +1240,7 @@ e2 = cadr(e1); switch (car(e1)){ case GVAR: case RGVAR: case CRGVAR: case CURGVAR: case SRGVAR: + case URGVAR: case SURGVAR: case REGISTER: case DREGISTER: case FREGISTER: case FRGVAR: case DRGVAR: diff -r ffd2e5dbbf64 -r fcb642ef08c9 test/float.c --- a/test/float.c Sun Nov 21 12:04:56 2010 +0900 +++ b/test/float.c Sun Nov 21 15:36:23 2010 +0900 @@ -207,44 +207,44 @@ g = 1.0; g = g+g; - printf("#0209:%d:%g\t",n++,g); + printf("#0209:%d:%g\n",n++,g); g1 = g*g; - printf("#0211:%d:%g\t",n++,g1); + printf("#0211:%d:%g\n",n++,g1); g = g/g1; - printf("#0213:%d:%g\t",n++,g); + printf("#0213:%d:%g\n",n++,g); g = g-g1; - printf("#0215:%d:%g\t",n++,g); + printf("#0215:%d:%g\n",n++,g); g = sin(g1); - printf("#0217:%d:%g\t",n++,g); + printf("#0217:%d:%g\n",n++,g); g = testd(g,g1); - printf("#0219:%d:%g\t",n++,g); + printf("#0219:%d:%g\n",n++,g); printf("#0220:\n"); printf("#0222:simple float "); f = f+f; - printf("#0224:%d:%g\t",n++,f); + printf("#0224:%d:%g\n",n++,f); f1 = f*f; - printf("#0226:%d:%g\t",n++,f1); + printf("#0226:%d:%g\n",n++,f1); f = f/f1; - printf("#0228:%d:%g\t",n++,f); + printf("#0228:%d:%g\n",n++,f); f = f-f1; - printf("#0230:%d:%g\t",n++,f); + printf("#0230:%d:%g\n",n++,f); f = sin(f1); - printf("#0232:%d:%g\t",n++,f); + printf("#0232:%d:%g\n",n++,f); printf("#0233:\n"); printf("#0235:post/pre increment "); g1 = g; - printf("#0237:%d:%g\t",n++,g1++ - ++g); + printf("#0237:%d:%g\n",n++,g1++ - ++g); f1 = f; - printf("#0240:%d:%g\t",n++,f1++ - ++f); + printf("#0240:%d:%g\n",n++,f1++ - ++f); g1 = g; - printf("#0243:%d:%g\t",n++,g1-- - --g); + printf("#0243:%d:%g\n",n++,g1-- - --g); f1 = f; - printf("#0246:%d:%g\t",n++,f1-- - --f); + printf("#0246:%d:%g\n",n++,f1-- - --f); printf("#0248:\n"); printf("#0249:simple calc "); @@ -252,16 +252,16 @@ f=0.13; g=-0.56; f1=-0.13; g1=0.56; g = f+f; - printf("#0254:%d:%g\t",n++,g); + printf("#0254:%d:%g\n",n++,g); f = g*g; - printf("#0256:%d:%g\t",n++,f); + printf("#0256:%d:%g\n",n++,f); g = g*g+f*f-g1*g1; - printf("#0258:%d:%g\t",n++,g); + printf("#0258:%d:%g\n",n++,g); printf("#0259:\n"); printf("#0261:float argument "); f = testf(f,f1); - printf("#0263:%d:%g\t",n++,f); + printf("#0263:%d:%g\n",n++,f); printf("#0265:\nindirect "); n=1; @@ -269,59 +269,59 @@ g = 1.0; pg=&g; pg1=&g1; *pg = *pg+ *pg; - printf("#0271:%d:%g\t",n++,*pg); + printf("#0271:%d:%g\n",n++,*pg); *pg1 = *pg**pg; - printf("#0273:%d:%g\t",n++,*pg1); + printf("#0273:%d:%g\n",n++,*pg1); *pg = *pg/ *pg1; - printf("#0275:%d:%g\t",n++,*pg); + printf("#0275:%d:%g\n",n++,*pg); *pg = *pg-*pg1; - printf("#0277:%d:%g\t",n++,*pg); + printf("#0277:%d:%g\n",n++,*pg); *pg = sin(*pg1); - printf("#0279:%d:%g\t",n++,*pg); + printf("#0279:%d:%g\n",n++,*pg); *pg = testd(*pg,*pg1); - printf("#0281:%d:%g\t",n++,*pg); + printf("#0281:%d:%g\n",n++,*pg); printf("#0282:\n"); *pf = *pf+*pf; - printf("#0285:%d:%g\t",n++,*pf); + printf("#0285:%d:%g\n",n++,*pf); *pf1 = *pf**pf; - printf("#0287:%d:%g\t",n++,*pf1); + printf("#0287:%d:%g\n",n++,*pf1); *pf = *pf/ *pf1; - printf("#0289:%d:%g\t",n++,*pf); + printf("#0289:%d:%g\n",n++,*pf); *pf = *pf-*pf1; - printf("#0291:%d:%g\t",n++,*pf); + printf("#0291:%d:%g\n",n++,*pf); *pf = sin(*pf1); - printf("#0293:%d:%g\t",n++,*pf); + printf("#0293:%d:%g\n",n++,*pf); printf("#0294:\n"); printf("#0296:indirect post/pre "); *pg1 = *pg; - printf("#0298:%d:%g\t",n++,(*pg1)++ - ++(*pg)); + printf("#0298:%d:%g\n",n++,(*pg1)++ - ++(*pg)); *pf1 = *pf; - printf("#0301:%d:%g\t",n++,(*pf1)++ - ++(*pf)); + printf("#0301:%d:%g\n",n++,(*pf1)++ - ++(*pf)); *pg1 = *pg; - printf("#0304:%d:%g\t",n++, (*pg1)-- - --(*pg)); + printf("#0304:%d:%g\n",n++, (*pg1)-- - --(*pg)); *pf1 = *pf; - printf("#0307:%d:%g\t",n++, (*pf1)-- - --(*pf)); + printf("#0307:%d:%g\n",n++, (*pf1)-- - --(*pf)); printf("#0308:\n"); *pf=0.13; *pg=-0.56; *pf1=-0.13; *pg1=0.56; *pg = *pf+*pf; - printf("#0313:%d:%g\t",n++,*pg); + printf("#0313:%d:%g\n",n++,*pg); *pf = *pg**pg; - printf("#0315:%d:%g\t",n++,*pf); + printf("#0315:%d:%g\n",n++,*pf); *pg = *pg**pg+*pf**pf-*pg1**pg1; - printf("#0317:%d:%g\t",n++,*pg); + printf("#0317:%d:%g\n",n++,*pg); printf("#0318:\n"); printf("#0320:float argument "); *pf = testf(*pf,*pf1); - printf("#0323:%d:%g\t",n++,*pf); + printf("#0323:%d:%g\n",n++,*pf); printf("#0326:\nassop "); @@ -330,22 +330,22 @@ g = 1.0; g *= 2*g; - printf("#0332:%d:%g\t",n++,g); + printf("#0332:%d:%g\n",n++,g); g /= 2*g; - printf("#0334:%d:%g\t",n++,g); + printf("#0334:%d:%g\n",n++,g); g -= 2*g; - printf("#0336:%d:%g\t",n++,g); + printf("#0336:%d:%g\n",n++,g); g += 2*g; - printf("#0338:%d:%g\t",n++,g); + printf("#0338:%d:%g\n",n++,g); f *= 2*g; - printf("#0341:%d:%g\t",n++,f); + printf("#0341:%d:%g\n",n++,f); f /= 2*g; - printf("#0343:%d:%g\t",n++,f); + printf("#0343:%d:%g\n",n++,f); f -= 2*g; - printf("#0345:%d:%g\t",n++,f); + printf("#0345:%d:%g\n",n++,f); f += 2*g; - printf("#0347:%d:%g\t",n++,f); + printf("#0347:%d:%g\n",n++,f); printf("#0348:\n"); n=1; @@ -354,22 +354,22 @@ printf("#0354:indirect assop "); *pg *= 2**pg; - printf("#0356:%d:%g\t",n++,*pg); + printf("#0356:%d:%g\n",n++,*pg); *pg /= 2**pg; - printf("#0358:%d:%g\t",n++,*pg); + printf("#0358:%d:%g\n",n++,*pg); *pg -= 2**pg; - printf("#0360:%d:%g\t",n++,*pg); + printf("#0360:%d:%g\n",n++,*pg); *pg += 2**pg; - printf("#0362:%d:%g\t",n++,*pg); + printf("#0362:%d:%g\n",n++,*pg); *pf *= 2**pg; - printf("#0365:%d:%g\t",n++,*pf); + printf("#0365:%d:%g\n",n++,*pf); *pf /= 2**pg; - printf("#0367:%d:%g\t",n++,*pf); + printf("#0367:%d:%g\n",n++,*pf); *pf -= 2**pg; - printf("#0369:%d:%g\t",n++,*pf); + printf("#0369:%d:%g\n",n++,*pf); *pf += 2**pg; - printf("#0371:%d:%g\t",n++,*pf); + printf("#0371:%d:%g\n",n++,*pf); printf("#0372:\n");