changeset 236:7353a818858c

ia32 code creg fix done
author kono
date Thu, 29 Apr 2004 23:53:31 +0900
parents c575422d8b6e
children 1933266f1efa
files mc-code-ia32.c
diffstat 1 files changed, 24 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/mc-code-ia32.c	Thu Apr 29 23:33:02 2004 +0900
+++ b/mc-code-ia32.c	Thu Apr 29 23:53:31 2004 +0900
@@ -1627,6 +1627,7 @@
     if (type==FLOAT||type==DOUBLE) {
 	return 0;
     } else {
+	use_int(reg);
 	return rname[reg];
     }
 }
@@ -2030,49 +2031,50 @@
 void
 drexpr(int e1, int e2,int l1, int op,int cond)
 {       
-    if (cond) {
+    if (!cond) {
 	switch(op) {
-	    case DOP+GE:
-		drexpr(e2,e1,l1,DOP+GT,0); break;
-	    case FOP+GE:
-		drexpr(e2,e1,l1,FOP+GT,0); break;
-	    case DOP+GT:
-		drexpr(e2,e1,l1,DOP+GE,0); break;
-	    case FOP+GT:
-		drexpr(e2,e1,l1,FOP+GE,0); break;
-	    case DOP+EQ:
-		op = DOP+NEQ; break;
-	    case FOP+EQ:
-		op = FOP+NEQ; break;
-	    case DOP+NEQ:
-		op = DOP+EQ; break;
-	    case FOP+NEQ:
-		op = FOP+EQ; break;
+	case FOP+GT:
+	    drexpr(e2,e1,l1,FOP+GE,1); return;
+	case FOP+GE:
+	    drexpr(e2,e1,l1,FOP+GT,1); return;
+	case FOP+EQ:
+	    op=FOP+NEQ; break;
+	case FOP+NEQ:
+	    op=FOP+EQ; break;
+	case DOP+GT:
+	    drexpr(e2,e1,l1,DOP+GE,1); return;
+	case DOP+GE:
+	    drexpr(e2,e1,l1,DOP+GT,1); return;
+	case DOP+EQ:
+	    op=DOP+NEQ; break;
+	case DOP+NEQ:
+	    op=DOP+EQ; break;
 	}
     }
+
     g_expr(list3(DCMP,e1,e2));
     switch(op) {
 	case DOP+GE:
 	case FOP+GE:
 	    printf("\ttestb\t$5,%%ah\n");
-	    printf("\tjne\t_%d\n",l1);
+	    printf("\tje\t_%d\n",l1);
 	    break;
 	case DOP+GT:
 	case FOP+GT:
 	    printf("\ttestb\t$69,%%ah\n");
-	    printf("\tjne\t_%d\n",l1);
+	    printf("\tje\t_%d\n",l1);
 	    break;
 	case DOP+EQ:
 	case FOP+EQ:
 	    printf("\tandb\t$69,%%ah\n");
 	    printf("\txorb\t$64,%%ah\n");
-	    printf("\tjne\t_%d\n",l1);
+	    printf("\tje\t_%d\n",l1);
 	    break;
 	case DOP+NEQ:
 	case FOP+NEQ:
 	    printf("\tandb\t$69,%%ah\n");
 	    printf("\txorb\t$64,%%ah\n");
-	    printf("\tje\t_%d\n",l1);
+	    printf("\tjne\t_%d\n",l1);
 	    break;
     }
 }
@@ -2088,7 +2090,7 @@
 {
     if (e2!=USE_CREG)
 	error(-1);
-    printf("\tfldz\n"); return;
+    printf("\tfldz\n"); 
     printf("\tfucompp\n");
     printf("\tfnstsw\t%%ax\n");
     printf("\tandb\t$69,%%ah\n");