changeset 771:5e07b9804aea

dpreinc, dpostinc
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Thu, 18 Nov 2010 12:08:55 +0900
parents b674d8421430
children 37e27e0c77d0
files mc-code-i64.c
diffstat 1 files changed, 15 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/mc-code-i64.c	Thu Nov 18 04:29:03 2010 +0900
+++ b/mc-code-i64.c	Thu Nov 18 12:08:55 2010 +0900
@@ -3686,14 +3686,9 @@
 { 
     use_float(d,freg);
     int reg = get_dregister(d);
-    if (d) {
-	printf("\txorpd      %s,%s\n",fregister_name(freg),fregister_name(reg));
-	printf("\tmovapd     %s,%s\n",fregister_name(reg),fregister_name(freg));
-    } else {
-	printf("\txorps      %s,%s\n",fregister_name(freg),fregister_name(reg));
-	printf("\tcvtss2sd   %s,%s\n",fregister_name(reg),fregister_name(reg));
-    }
-    free_register(reg);
+    code_dconst(dlist2(DCONST,0),reg,d);
+    printf("\tsubs%s      %s,%s\n",d?"d":"s",fregister_name(freg),fregister_name(reg));
+    set_freg(reg,0);
 }
 
 void code_d2i(int reg)
@@ -3978,7 +3973,7 @@
         }
         frn=fregister_name(reg);
         grn = fregister_name(g = code_dload_1(d,get_dregister(d)));
-        printf("\t%s %s,0(%s)\n",fload(d),frn,crn);
+        printf("\t%s 0(%s),%s\n",fload(d),crn,frn);
         printf("\t%s %s,%s\n",ops,grn,frn);
         printf("\t%s %s,0(%s)\n",fstore(d),frn,crn);
     }
@@ -4012,8 +4007,8 @@
         }
         frn=fregister_name(reg);
         grn = fregister_name(g = code_dload_1(d,get_dregister(d)));
-        printf("\t%s %s,0(%s)\n",fload(d),frn,crn);
-        printf("\t%s %s,%s\n",ops,grn,frn);
+        printf("\t%s 0(%s),%s\n",fload(d),crn,frn);
+        printf("\t%s %s,%s\n",ops,frn,grn);
         printf("\t%s %s,0(%s)\n",fstore(d),grn,crn);
     }
     free_register(g);
@@ -4029,20 +4024,20 @@
 drexpr0(int e1, int e2,int l1, int op,int cond,int reg,int mode)
 {       
     char *s;
-    if (!cond) {
+    if (cond) {
 	switch(op) {
 	case FOP+GT:
-	    return drexpr0(e2,e1,l1,FOP+GE,1,reg,mode);
+	    return drexpr0(e2,e1,l1,FOP+GE,0,reg,mode);
 	case FOP+GE:
-	    return drexpr0(e2,e1,l1,FOP+GT,1,reg,mode);
+	    return drexpr0(e2,e1,l1,FOP+GT,0,reg,mode);
 	case FOP+EQ:
 	    op=FOP+NEQ; break;
 	case FOP+NEQ:
 	    op=FOP+EQ; break;
 	case DOP+GT:
-	    return drexpr0(e2,e1,l1,DOP+GE,1,reg,mode);
+	    return drexpr0(e2,e1,l1,DOP+GE,0,reg,mode);
 	case DOP+GE:
-	    return drexpr0(e2,e1,l1,DOP+GT,1,reg,mode);
+	    return drexpr0(e2,e1,l1,DOP+GT,0,reg,mode);
 	case DOP+EQ:
 	    op=DOP+NEQ; break;
 	case DOP+NEQ:
@@ -4050,14 +4045,14 @@
 	default: return 0;
 	}
     }
-    s = "a";
+    s = "b";
     int cmp = FCMP;
     switch(op) {
 	case DOP+GE:
 	    cmp = DCMP;
 	case FOP+GE:
 	    g_expr(list3(cmp,e1,e2));
-	    s = "ae";
+	    s = "be";
 	    break;
 	case DOP+GT:
 	    cmp = DCMP;
@@ -4093,14 +4088,14 @@
 int
 drexpr(int e1, int e2,int l1, int op,int cond)
 {
-    drexpr0(e1, e2,l1, op,cond,USE_CREG,COND_BRANCH);
+    drexpr0(e1, e2,l1, op,!cond,USE_CREG,COND_BRANCH);
     return l1;
 }
 
 static int
 drexpr_bool(int e1, int reg)
 {
-    return drexpr0(cadr(e1), caddr(e1),0, car(e1),1,reg,COND_VALUE);
+    return drexpr0(cadr(e1), caddr(e1),0, car(e1),0,reg,COND_VALUE);
 }