changeset 81:f94ca1168520

float first try...
author kono
date Mon, 03 Mar 2003 20:59:51 +0900
parents 83d901658ce9
children 25654dc29ecc
files .gdbinit Changes Makefile mc-code-ia32.c mc-code.h mc-codegen.c mc-codegen.h mc-parse.c mc-tree.c mc.h test/float.c
diffstat 11 files changed, 465 insertions(+), 70 deletions(-) [+]
line wrap: on
line diff
--- a/.gdbinit	Mon Mar 03 05:41:10 2003 +0900
+++ b/.gdbinit	Mon Mar 03 20:59:51 2003 +0900
@@ -13,5 +13,4 @@
 x/1i $eip
 end
 b errmsg
-r -s test/goto.c
-
+r -s test/float.c
--- a/Changes	Mon Mar 03 05:41:10 2003 +0900
+++ b/Changes	Mon Mar 03 20:59:51 2003 +0900
@@ -1840,3 +1840,19 @@
 あぁ、まぁ、いろいろ、めんどくさい。
 
 やっぱり、arglist の再帰的扱いがちゃんとしてないとだめ。
+
+うーむ、 enum なんてのもあるのね。やさしいけど、いるのか?
+
+code (code *) * みたいなのがあるので、conv は手直しが必要。
+
+Mon Mar  3 12:38:08 JST 2003
+
+float/duble は順調に進んでるけど、3日はかかるでしょう。
+
+binop を書いちゃうとmc-parse.c は、ほとんど終り?!
+代入と関数呼び出しが残っているか。あと single もあるね。
+
+emit_push base で書くんだけど、他のCPUではだいぶ様相が
+違うんだろうな。
+
+dreg/creg のfloating versionが必要です。( です? )
--- a/Makefile	Mon Mar 03 05:41:10 2003 +0900
+++ b/Makefile	Mon Mar 03 20:59:51 2003 +0900
@@ -30,7 +30,7 @@
 	    conv/cbc2c.h conv/conv.h conv/convdef.h conv/null.c conv/null.h
 
 clean :
-	-rm -f *.s *.o *.cc mc mc1 a.out *~ core* */*.o *.bak test/*.s test/*.cc test/*.o
+	-rm -f *.bak *.s *.o *.cc mc mc1 a.out *~ core* */*.o *.bak test/*.s test/*.cc test/*.o test/*.bak test/*~ conv/*.s conv/*.cc conv/*.o conv/*.bak conv/*~
 
 mc1 : b00.s b01.s mc-codegen.o mc-tree.o $(CONVERTER)
 	$(CC) -g -o $@ $(PRINTF) b00.s b01.s mc-codegen.o mc-tree.o $(CONVERTER)
--- a/mc-code-ia32.c	Mon Mar 03 05:41:10 2003 +0900
+++ b/mc-code-ia32.c	Mon Mar 03 20:59:51 2003 +0900
@@ -39,6 +39,9 @@
 int jump_offset = 0;
 
 int size_of_int = 4;
+int size_of_float = 4;
+int size_of_dobule = 8;
+int size_of_longlong = 8;
 int endian = 0;
 int MAX_REGISTER=6;         /* intel386のレジスタを4つまで使う*/
 int REAL_MAX_REGISTER=8;    /* intel386のレジスタが8つということ*/
@@ -657,18 +660,18 @@
 int
 struct_push(int e4,int t) 
 {
-    int length,xreg,save,lreg;
+    int length,xreg,save,lreg,count;
     g_expr(e4);
     length=size(t); 
     if(length%size_of_int) {
 	length += size_of_int - (length%size_of_int);
     }
-    if (length==4) {
-	printf("\tpushl (%s)\n",register_name(creg,0)); return 1;
-    }
-    if (length==8) {
-	printf("\tpushl 4(%s)\n",register_name(creg,0));
-	printf("\tpushl (%s)\n",register_name(creg,0)); return 2;
+    for(count=0;length<MAX_COPY_LEN;count++,length-=size_of_int) {
+	if (length==0) return count;
+	else {
+	    printf("\tpushl %d(%s)\n",
+		length-size_of_int,register_name(creg,0));
+	}
     }
     printf("\tsubl $%d,%%esp\n",length);
     if (register_full()) {
@@ -1291,4 +1294,67 @@
     }
 }
 
+/* floating point */
+
+
+void code_cmp_drgvar(int e)
+{ }
+
+
+void code_cmp_drlvar(int e)
+{ }
+
+
+void code_dassign_gvar(int e2,int byte)
+{ }
+
+
+void code_dassign_lvar(int e,int byte)
+{ }
+
+void code_dassign(int e)
+{ }
+
+
+void code_dconst(int e2)
+{ }
+
+
+void code_dneg()
+{ }
+
+
+void code_drgvar(int e1)
+{ }
+
+
+void code_drlvar(int e1)
+{ }
+
+
+void code_frgvar(int e1)
+{ }
+
+
+void code_frlvar(int e1)
+{ }
+
+
+void dtosop(int e,int e1)
+{ }
+
+int dpop_register()
+{ return 1;}
+
+int emit_dpop(int e1)
+{ return 1;}
+
+void emit_dpop_free(int e1)
+{ }
+
+void emit_dpush()
+{ }
+
+
+
 /* end */
--- a/mc-code.h	Mon Mar 03 05:41:10 2003 +0900
+++ b/mc-code.h	Mon Mar 03 20:59:51 2003 +0900
@@ -67,3 +67,22 @@
 extern void global_table(void);
 extern int lvar(int l);
 
+/* floating point part */
+
+extern int dpop_register();
+extern int emit_dpop(int);
+extern void code_cmp_drgvar(int);
+extern void code_cmp_drlvar(int);
+extern void code_dassign(int,int);
+extern void code_dassign_gvar(int,int);
+extern void code_dassign_lvar(int,int);
+extern void code_dconst(int);
+extern void code_dneg();
+extern void code_drgvar(int);
+extern void code_drlvar(int);
+extern void code_frgvar(int);
+extern void code_frlvar(int);
+extern void dtosop(int,int);
+extern void emit_dpop_free(int);
+extern void emit_dpush();
+
--- a/mc-codegen.c	Mon Mar 03 05:41:10 2003 +0900
+++ b/mc-codegen.c	Mon Mar 03 20:59:51 2003 +0900
@@ -10,6 +10,8 @@
 int  dreg;     /* temporary register */
 int  reg_sp;   /* REGister Stack-Pointer */
 
+int  freg;     /* current floating point register */
+
 /*
     creg   currrent virtual register
     dreg   spare virtual register
@@ -275,6 +277,22 @@
 	code_crlvar(lvar(e2));
 	regv[creg]=1;
 	return;
+    case FRLVAR:
+	code_frlvar(lvar(e2));
+	regv[creg]=1;
+	return;
+    case FRGVAR:
+	code_frgvar(lvar(e2));
+	regv[creg]=1;
+	return;
+    case DRLVAR:
+	code_drlvar(lvar(e2));
+	regv[creg]=1;
+	return;
+    case DRGVAR:
+	code_drgvar(lvar(e2));
+	regv[creg]=1;
+	return;
     case FNAME:
 	code_fname(((NMTBL *)(e2))->nm);
 	regv[creg]=1;
@@ -283,6 +301,10 @@
 	code_const(e2);
 	regv[creg]=1;
 	return;
+    case DCONST:
+	code_dconst(e2);
+	regv[creg]=1;
+	return;
     case STRING:
 	string(e1);
 	regv[creg]=1;
@@ -297,7 +319,8 @@
     case INDIRECT:
 	g_expr(e2);
 	return;
-    case RINDIRECT: case CRINDIRECT:
+    case RINDIRECT:  case CRINDIRECT:
+    case DRINDIRECT: case FRINDIRECT:
 	rindirect(e1);
 	return;
     case ADDRESS:
@@ -307,6 +330,10 @@
 	g_expr(e2);
 	code_neg();
 	return;
+    case DMINUS: 
+	g_expr(e2);
+	code_dneg();
+	return;
     case BNOT:   /* ~ */
 	g_expr(e2);
 	code_not();
@@ -341,6 +368,10 @@
     case ADD: case SUB: case BAND: case EOR: case BOR:
 	machinop(e1);
 	return;
+    case DMUL: case DDIV:
+    case DADD: case DSUB:
+	dmachinop(e1);
+	return;
     case COND:
 	e2=fwdlabel();
 	b_expr(cadr(e1),0,e2,0);
@@ -358,12 +389,18 @@
     case SASS: 
 	sassign(e1);
 	return;
-    case ASS: case CASS:
+    case ASS: case CASS: case FASS:
 	assign(e1);
 	return;
+    case DASS: case LASS: 
+	dassign(e1);
+	return;
     case ASSOP: case CASSOP:
 	assop(e1);
 	return;
+    case DASSOP: case FASSOP:
+	dassop(e1);
+	return;
     case RSTRUCT:
 	g_expr(e2);
 	return;
@@ -461,6 +498,14 @@
 	code_cmp_rlvar(lvar(e2));
 	jcond(l1,cond);
 	return;
+    case DRLVAR:
+	code_cmp_drlvar(lvar(e2));
+	jcond(l1,cond);
+	return;
+    case DRGVAR:
+	code_cmp_drgvar(lvar(e2));
+	jcond(l1,cond);
+	return;
     case REGISTER:
 	code_cmp_register(e2);
 	jcond(l1,cond);
@@ -468,9 +513,13 @@
     case CONST:
 	if((cond&&e2)||(!cond&&!e2)) jmp(l1);
 	return;
+    case DCONST:
+	if((dcadr(e2)!=0.0)^cond) jmp(l1);
+	return;
     default:
+	/* type ? */
 	if(err) {
-	    error(-1); return; /* recursice g_expr/b_expr */
+	    error(-1); return; /* recursive g_expr/b_expr */
 	}
 	g_expr(e1);
 	code_cmp_register(creg);
@@ -636,7 +685,8 @@
 {
     return (
 	e1==CONST || e1==FNAME || e1==LVAR || e1==REGISTER ||
-	e1==GVAR || e1==RGVAR || e1==RLVAR || e1==CRLVAR || e1==CRGVAR
+	e1==GVAR || e1==RGVAR || e1==RLVAR || e1==CRLVAR || e1==CRGVAR ||
+	e1==DRLVAR || e1==FRLVAR 
     );
 }
 
@@ -646,10 +696,10 @@
     int ce1=car(e1);
     int ce2=car(e2);
     return (   
-         (ce1==LVAR && (ce2==RLVAR||ce2==CRLVAR))
-      || (ce2==LVAR && (ce1==RLVAR||ce1==CRLVAR))
-      || (ce1==GVAR && (ce2==RGVAR||ce2==CRGVAR))
-      || (ce2==GVAR && (ce1==RGVAR||ce1==CRGVAR))
+         (ce1==LVAR && (ce2==RLVAR||ce2==CRLVAR||ce2==FRLVAR||ce2==DRLVAR))
+      || (ce2==LVAR && (ce1==RLVAR||ce1==CRLVAR||ce1==FRLVAR||ce1==DRLVAR))
+      || (ce1==GVAR && (ce2==RGVAR||ce2==CRGVAR||ce2==FRGVAR||ce2==DRGVAR))
+      || (ce2==GVAR && (ce1==RGVAR||ce1==CRGVAR||ce1==FRGVAR||ce1==DRGVAR))
     );
 }
 
@@ -658,8 +708,8 @@
 {
     int ce1=car(e1);
     return (   
-         ce1==LVAR ||ce1==RLVAR||ce1==CRLVAR ||
-         ce1==GVAR ||ce1==RGVAR||ce1==CRGVAR ||
+         ce1==LVAR ||ce1==RLVAR||ce1==CRLVAR || ce1==DRLVAR ||
+         ce1==GVAR ||ce1==RGVAR||ce1==CRGVAR || ce1==DRGVAR ||
          ce1==REGISTER
     );
 }
@@ -792,6 +842,23 @@
     return;
 }
 
+void
+dmachinop(int e1)
+{
+    int e2,e3,op;
+
+    e2 = cadr(e1);
+    op = car(e1);
+    e3 = caddr(e1);
+    g_expr(e3);
+    emit_dpush();
+    g_expr(e2);
+    dtosop(car(e1),(e2=dpop_register()));
+    emit_dpop_free(e2);
+    regv[freg]=1;
+    return;
+}
+
 
 void
 sassign(int e1)
@@ -827,6 +894,9 @@
     int e2,e3,e4,byte;
 
     byte=(car(e1) == CASS);
+    if(car(e1) == FASS) {
+	/* move float to creg */
+    }
     /*    e2=e4 */
     e2 = cadr(e1);
     e3 = cadr(e2);
@@ -859,6 +929,34 @@
 }
 
 void
+dassign(int e1)
+{
+    int e2,e3,e4,byte;
+
+    /*    e2=e4 */
+    e2 = cadr(e1);
+    e3 = cadr(e2);
+    e4 = caddr(e1);
+    switch(car(e2)) {
+    case GVAR:      /*   i=3 */
+            g_expr(e4);
+	    code_dassign_gvar(e2,byte);
+            return;
+    case LVAR:
+            g_expr(e4);
+	    code_dassign_lvar(lvar(cadr(e2)),byte);
+            return;
+    }
+    g_expr(e2);
+    emit_dpush();
+    g_expr(e4);
+    e2 = emit_dpop(0);
+    code_dassign(e2,byte);
+    emit_dpop_free(e2);
+    return;
+}
+
+void
 assop(int e1)
 {
     int e2,e3,byte,op;
@@ -883,6 +981,15 @@
     return;
 }
 
+void
+dassop(int e1)
+{
+}
+
+void
+fassop(int e1)
+{
+}
 
 int
 fwdlabel(void)
--- a/mc-codegen.h	Mon Mar 03 05:41:10 2003 +0900
+++ b/mc-codegen.h	Mon Mar 03 20:59:51 2003 +0900
@@ -62,5 +62,10 @@
 extern void creg_destroy();
 extern void regvar_creg(int);
 
+/* floating point */
+
+extern void dassop(int e1);
+extern void dmachinop(int e1);
+extern void dassign(int e1);
 
 /* end */
--- a/mc-parse.c	Mon Mar 03 05:41:10 2003 +0900
+++ b/mc-parse.c	Mon Mar 03 20:59:51 2003 +0900
@@ -681,6 +681,9 @@
     if(t==VOID) return 0;
     if(t==REGISTER) return size_of_int; /* could be float? */
     if(scalar(t)) return size_of_int;
+    if(t==FLOAT) return size_of_float;
+    if(t==DOUBLE) return size_of_double;
+    if(t==LONGLONG) return size_of_longlong;
     if(car(t)==STRUCT||car(t)==UNION) {	
 	if(cadr(t)==-1) error(DCERR);
 	return(cadr(t));
@@ -699,7 +702,7 @@
 static NMTBL *
 def(NMTBL *n)
 {
-    int sz,nsc,ndsp,t;
+    int sz,nsc,ndsp;
 
     conv->def_(n);
     if (n==0) {
@@ -793,13 +796,8 @@
 	}
 	cadddr(fnptr->dsp)=sz;
 	if(type==VOID) {
-	} else if (!scalar(type)) {
-	    if((t=car(type))==STRUCT || t==UNION) {
-		n->ty = type;
-	    } else if((t=car(type))==FUNCTION || t==CODE) {
-		n->ty = type;
-	    } else
-		error(TYERR);
+	} else {
+	    n->ty = type;
 	}
 	return n;
     case STAT: /* of course this is wrong */
@@ -1658,6 +1656,12 @@
 	error(TYERR);
     if(t==CHAR) {
 	type= INT;return(list3(CASS,e1,e2));
+    } else if(t==DOUBLE) {
+	if(integral(type)) e2=list2(I2D,e2);
+	type= DOUBLE;return(list3(DASS,e1,e2));
+    } else if(t==FLOAT) {
+	if(integral(type)) e2=list2(I2D,e2);
+	type= DOUBLE;return(list3(FASS,e1,e2));
     } else if(!scalar(t)&&(car(t)==STRUCT||car(t)==UNION)) {
 	if (size(t)!=size(type)) error(TYERR);
 	type=t;
@@ -1726,6 +1730,12 @@
 	    return(list4(CASSOP,e1,e2,op));
 	}
 	type=t;
+	if (t==FLOAT) {
+	    return(list4(FASSOP,e1,e2,op));
+	}
+	if (t==DOUBLE) {
+	    return(list4(DASSOP,e1,e2,op));
+	}
 	if(integral(t)) return(list4(ASSOP,e1,e2,op));
 	if((op!=ADD&&op!=SUB)||car(t)!=POINTER) error(TYERR);
 	e2=binop(MUL,e2,list2(CONST,size(cadr(t))),INT,UNSIGNED);
@@ -2102,6 +2112,12 @@
 	e1=list2(CONST,symval);
 	getsym();
 	break;
+    case DCONST:
+	conv-> const_(symval);
+	type= DOUBLE;
+	e1=dlist2(DCONST,dsymval);
+	getsym();
+	break;
     case RETURN:
 	conv-> return_f_(); 
 	if (fnptr->sc != FUNCTION) {
@@ -2136,6 +2152,11 @@
 	    conv->rpar_();
 	    checksym(RPAR);
 	    e1=expr13();
+	    if (integral(type)) {
+		if(t==FLOAT||t==DOUBLE) e1=list2(I2D,e1);
+	    } else if(type==FLOAT||type==DOUBLE) {
+		if(integral(t)) e1=list2(D2I,e1);
+	    }
 	    type=t;
 	    return e1;
 	}
@@ -2191,6 +2212,39 @@
 	default:return(e);
 	}
     }
+    if(type==FLOAT) {	
+	switch(car(e)) {
+	case GVAR:
+	    return(list3(FRGVAR,cadr(e),caddr(e)));
+	case LVAR:
+	    return(list2(FRLVAR,cadr(e)));
+	case INDIRECT:
+	    return(list2(FRINDIRECT,cadr(e)));
+	default:return(e);
+	}
+    }
+    if(type==DOUBLE) {	
+	switch(car(e)) {
+	case GVAR:
+	    return(list3(DRGVAR,cadr(e),caddr(e)));
+	case LVAR:
+	    return(list2(DRLVAR,cadr(e)));
+	case INDIRECT:
+	    return(list2(DRINDIRECT,cadr(e)));
+	default:return(e);
+	}
+    }
+    if(type==LONGLONG) {	
+	switch(car(e)) {
+	case GVAR:
+	    return(list3(LRGVAR,cadr(e),caddr(e)));
+	case LVAR:
+	    return(list2(LRLVAR,cadr(e)));
+	case INDIRECT:
+	    return(list2(LRINDIRECT,cadr(e)));
+	default:return(e);
+	}
+    }
     if(!integral(type)&&type!=VOID) {
 	if(type==CODE) {
 	    return e;
@@ -2232,7 +2286,7 @@
 lcheck(int e)
 {
     int t;
-    if(!scalar(type)||
+    if(!(scalar(type)||type==DOUBLE||type==FLOAT)||
 	(car(e)!=GVAR&&car(e)!=LVAR&&car(e)!=INDIRECT&&car(e)!=REGISTER))
 	if ((t=car(type))<0 && t!=STRUCT && t!=UNION)
 	    error(LVERR);
@@ -2290,11 +2344,52 @@
 }
 
 static int
+dbinop(int op, int e1, int e2, int t1, int t2)
+{
+    double d1,d2,d;
+
+    type= DOUBLE;
+    if(t1==FLOAT) t1=DOUBLE;
+    if(t2==FLOAT) t2=DOUBLE;
+    if(car(e1)==DCONST&&car(e2)==DCONST) {
+	if (integral(t1)) { d1=cadr(e1);
+	} else if(t1==DOUBLE) d1=dcadr(e1);
+	else error(-1);
+	if (integral(t2)) { d2=cadr(e2);
+	} else if(t2==DOUBLE) d2=dcadr(e2);
+	else error(-1);
+	switch(op) {
+	case ADD: d=d1+d2; break;
+	case SUB: d=d1-d2; break;
+	case MUL: d=d1*d2;break;
+	case DIV:
+	    if(!d2) error(EXERR);d=d1/d2;break;
+	case GT:
+	    d=(d1>d2);break;
+	case GE:
+	    d=(d1>=d2);break;
+	case LT:
+	    d=(d1<d2);break;
+	case LE:
+	    d=(d1<=d2);break;
+	}
+	return dlist2(DCONST,d);
+    }
+    if (integral(t1)) e1=list2(I2D,e1);
+    if (integral(t2)) e2=list2(I2D,e2);
+    if(op==GT||op==GE||op==LT||op==LE||
+	    ADD||SUB||MUL||DIV)
+	return(list3(op+DOP,e1,e2));
+}
+
+static int
 binop(int op, int e1, int e2, int t1, int t2)
 {
     int e;
 
-    if(car(e1)==CONST&&car(e2)==CONST) {	
+    if(t1==DOUBLE||t2==DOUBLE) 
+	return dbinop(op,e1,e2,t1,t2);
+    if(car(e1)==CONST&&car(e2)==CONST) {
 	e1=cadr(e1);
 	e2=cadr(e2);
 	type= INT;
@@ -2420,7 +2515,6 @@
 
     /* function call */
     if(car(type)==POINTER) {
-printf("# expr15 pointer\n");
 	if (car(cadr(type))==FUNCTION||car(cadr(type))==CODE) {
 	    e1=rvalue(e1);
 	    type=cadr(type);
@@ -2479,6 +2573,7 @@
 {
     return (integral(s) || s==CODE || s==SHORT || 
 	s==LONG || s==STRUCT || s==UNION ||
+	s==LONGLONG || s==FLOAT || s==DOUBLE ||
     (s==IDENT && nptr->sc==TYPE));
 }
 
@@ -2550,11 +2645,14 @@
 
 static int in_comment = 0;
 
+extern double strtod(const char *nptr, char **endptr);
+
 static int
 getsym(void)
 {
     NMTBL *nptr0,*nptr1,*nptrm;
     int i,slfree,macrop;
+    char *scheapp;
     char c;
 
     if (alpha(skipspc())) {	
@@ -2620,7 +2718,7 @@
 	}
 	nptr=nptr1;
 	return sym;
-    } else if (digit(ch)) {	
+    } else if (digit(ch)||ch=='.') {
 	symval=0;
 	if (ch == '0') {	
 	    if (getch() == 'x' || ch == 'X') {
@@ -2638,12 +2736,47 @@
 		    symval=symval*8+ch-'0';getch();
 		}
 	    }
+	    return sym=CONST;
+	}
+	scheapp = cheapp;
+	if(ch=='.') {
+	    getch();
+	    if(ch=='.') {
+		getch();
+		if (ch=='.') {
+		    getch();
+		    return sym=DOTS;
+		} 
+		error(CHERR);
+		return getsym();
+	    } else if (!digit(ch))
+		return sym=PERIOD;
+	    *cheapp++ = '.';
+	    *cheapp++ = ch;
+	    getch();
 	} else {
+	    *cheapp++ = ch;
+	    getch();
 	    while(digit(ch)) {
+		*cheapp++ = ch;
 		symval=symval*10+ch-'0';getch();
 	    }
+	    if (!(ch=='.'||ch=='e')) {
+		cheapp=scheapp;
+		return sym=CONST;
+	    }
 	}
-	return sym=CONST;
+	while(digit(ch)|| ch=='.'||ch=='e') {
+	    *cheapp++ = ch;
+	    getch();
+	    if (ch=='-' && cheapp[-1]=='e') {
+		*cheapp++ = ch; getch();
+	    }
+	}
+	*cheapp++ = 0;
+	dsymval = strtod(scheapp,0);
+	cheapp=scheapp;
+	return sym=DCONST;
     } else if(ch=='\'') {	
 	getch();
 	symval=escape();
@@ -2708,17 +2841,6 @@
 	return sym=COLON;
     case '?':
 	return sym=COND;
-    case '.':
-	if(ch=='.') {
-	    getch();
-	    if (ch=='.') {
-		getch();
-		return sym=DOTS;
-	    }
-	    error(CHERR);
-	    return getsym();
-	} else
-	    return sym=PERIOD;
     case '/':
 	if(ch=='/') {
 	    in_comment = 1;
@@ -3368,6 +3490,29 @@
 }
 
 int
+dlist2(int e1, double d1)
+{
+    int e;
+
+    e=getfree((size_of_int+size_of_double)/size_of_int);
+    heap[e]=e1;
+    dcadr(e)=d1;
+    return e;
+}
+
+int
+dlist3(int e1, int e2,double d1)
+{
+    int e;
+
+    e=getfree((size_of_int*2+size_of_double)/size_of_int);
+    heap[e]=e1;
+    heap[e+1]=e2;
+    dcaddr(e)=d1;
+    return e;
+}
+
+int
 list2(int e1, int e2)
 {
     int e;
--- a/mc-tree.c	Mon Mar 03 05:41:10 2003 +0900
+++ b/mc-tree.c	Mon Mar 03 20:59:51 2003 +0900
@@ -138,22 +138,22 @@
     {67,"cname",""},
     {68,"sass",""},
     {69,"rstruct",""},
-    {100,"=",""},
-    {124,"*=","ee"},
-    {125,"*=","ee"},
-    {126,"/=","ee"},
-    {127,"/=","ee"},
-    {128,"%=","ee"},
-    {129,"%=","ee"},
-    {130,"+=","ee"},
-    {131,"-=","ee"},
-    {132,">>=","ee"},
-    {133,">>=","ee"},
-    {134,"<<=","ee"},
-    {135,"<<=","ee"},
-    {146,"&=","ee"},
-    {147,"^=","ee"},
-    {148,"|=","ee"},
+    {00,"=",""},
+    {AS+24,"*=","ee"},
+    {AS+25,"*=","ee"},
+    {AS+26,"/=","ee"},
+    {AS+27,"/=","ee"},
+    {AS+28,"%=","ee"},
+    {AS+29,"%=","ee"},
+    {AS+30,"+=","ee"},
+    {AS+31,"-=","ee"},
+    {AS+32,">>=","ee"},
+    {AS+33,">>=","ee"},
+    {AS+34,"<<=","ee"},
+    {AS+35,"<<=","ee"},
+    {AS+46,"&=","ee"},
+    {AS+47,"^=","ee"},
+    {AS+48,"|=","ee"},
 };
 
 void
--- a/mc.h	Mon Mar 03 05:41:10 2003 +0900
+++ b/mc.h	Mon Mar 03 20:59:51 2003 +0900
@@ -147,10 +147,10 @@
 #define SASS	68
 #define RSTRUCT	69
 
-#define FMUL	70
-#define FDIV	71
-#define FADD	72
-#define FSUB	73
+#define FASSOP	70
+#define DASSOP	71
+
+#define DMINUS	73
 #define DMUL	74
 #define DDIV	75
 #define DADD	76
@@ -160,8 +160,28 @@
 #define LADD	80
 #define LSUB	81
 
+#define FRGVAR	82
+#define FRLVAR	83
+#define FRINDIRECT	84
+#define DRGVAR	85
+#define DRLVAR	86
+#define DRINDIRECT	87
+#define LRGVAR	88
+#define LRLVAR	89
+#define LRINDIRECT	90
+#define DCONST	91
+#define LCONST	92
+#define DASS	93
+#define FASS	94
+#define LASS	95
+#define SHASS	96
+
+#define I2D	97
+#define D2I	98
+
 #define US	1
-#define AS	100
+#define AS	200
+#define DOP	300
 
 #define FILERR	1
 #define DCERR	2
@@ -203,6 +223,7 @@
 EXTERN int symval,args,init_vars,heap[HEAPSIZE];
 EXTERN int blabel,clabel,dlabel,cslabel,ilabel,control,ac,ac2,lsrc,chk,asmf;
 EXTERN int MAX_REGISTER_VAR;
+EXTERN double dsymval;
 
 EXTERN unsigned hash;
 
@@ -212,6 +233,7 @@
 EXTERN char *name,*cheapp,**av,/*obuf[320],*/*sptr,escape(void);
 EXTERN int arg_offset,stat_no,size_of_int,disp_offset,endian,csvalue1;
 EXTERN int code_arg_offset;
+EXTERN int size_of_double,size_of_float,size_of_longlong;
 EXTERN int retlabel,retpending,retcont;
 EXTERN int arglist;
 
@@ -234,6 +256,7 @@
 extern void error(int n);
 extern int size(int t);
 extern int scalar(int t);
+extern int dlist2(int e1, double e2);
 extern int list2(int e1, int e2);
 extern int list3(int e1, int e2, int e3);
 extern int list4(int e1, int e2, int e3,int e4);
@@ -253,6 +276,9 @@
 
 #define cadddr(e) (heap[((int)(e))+3])
 
+#define dcadr(e) (*(double*)&heap[((int)(e))+1])
+#define dcaddr(e) (*(double*)&heap[((int)(e))+2])
+
 #include "conv/conv.h"
 #include "conv/c.h"
 /*
--- a/test/float.c	Mon Mar 03 05:41:10 2003 +0900
+++ b/test/float.c	Mon Mar 03 20:59:51 2003 +0900
@@ -3,12 +3,27 @@
 void test2(double);
 void test1();
 
+extern double sin(double);
+extern float fsin(float);
+
 int
 main(int ac,char *av[]) {
    test1();
    return 0;
 }
 
+double
+testd(double i,double j)
+{
+    return i+1.1+.0e3+12.3e-12;
+}
+
+float
+testf(float i,float j)
+{
+    return i+1;
+}
+
 void
 test1()
 {
@@ -25,6 +40,7 @@
     g = g/g1;
     g = g-g1;
     g = sin(g1);
+    g = testd(g,g1);
 
     f = f+f;
     f1 = f*f;
@@ -34,7 +50,7 @@
 
     g = f+f;
     f = g*g;
-    test2(f);
+    f = testf(f,f1);
 
     g = g*g+f*f-g1*g1;
 
@@ -42,7 +58,3 @@
     return;
 }
 
-void
-test2(double i)
-{
-}