diff mc-code-powerpc.c @ 209:7bfc1435cdc6 regv-fix

regv fix done
author kono
date Wed, 21 Apr 2004 17:40:29 +0900
parents 70b1da1864f6
children f21651f85344
line wrap: on
line diff
--- a/mc-code-powerpc.c	Wed Apr 21 16:39:15 2004 +0900
+++ b/mc-code-powerpc.c	Wed Apr 21 17:40:29 2004 +0900
@@ -1790,9 +1790,9 @@
     char *crn;
     g_expr(e1);
     crn=register_name(creg);
+    creg = d?use_double(creg):use_float(creg);
     printf("\t%s %s,%d(%s)\n",fload(d),
 	fregister_name(freg),offset,crn);
-    creg = freg;
     return d?DOUBLE:FLOAT;
 }
 #endif
@@ -2924,11 +2924,12 @@
 void
 code_dassop(int op,int d) {
     /* we have lvalue in creg, applied floating value is in freg */
-    char *frn=fregister_name(freg);
     int  xreg=emit_dpop(d);
     char *crn=register_name(creg);
-
-    if (!is_float_reg(freg)) error(-1);
+    char *frn;
+    creg = d?use_double(creg):use_float(creg);
+    frn  =fregister_name(freg);
+
     printf("\t%s %s,0(%s)\n",fload(d),frn,crn);
     dtosop(op,xreg);
     printf("\t%s %s,0(%s)\n",fstore(d),frn,crn);
@@ -2943,17 +2944,20 @@
     int  g;
     char *grn,*drn;
     int r;
-    r = get_ptr_cache(&float_one);
-    float_one_lib_used=1;
 
     if (car(e2)==DREGISTER||car(e2)==FREGISTER) {
 	error(-1); /* unspported now */
     }
     g_expr(e2);
 
+    float_one_lib_used=1;
+    r = get_ptr_cache(&float_one);
+    drn=register_name(r);
+
     crn=register_name(creg);
+
+    creg = d?use_double(creg):use_float(creg);
     frn=fregister_name(freg);
-    drn=register_name(r);
     grn=fregister_name(g=get_dregister(d));
 
     printf("\t%s %s,0(%s)\n",fload(d),frn,crn);
@@ -2975,8 +2979,6 @@
     int  g;
     char *grn,*drn;
     int r;
-    r = get_ptr_cache(&float_one);
-    float_one_lib_used=1;
 
     if (car(e2)==DREGISTER||car(e2)==FREGISTER) {
 	error(-1); /* unspported now */
@@ -2984,8 +2986,13 @@
     g_expr(e2);
 
     crn=register_name(creg);
+
+    float_one_lib_used=1;
+    r = get_ptr_cache(&float_one);
+    drn=register_name(r);
+
+    creg = d?use_double(creg):use_float(creg);
     frn=fregister_name(freg);
-    drn=register_name(r);
     grn=fregister_name(g=get_dregister(d));
 
     printf("\t%s %s,0(%s)\n",fload(d),frn,crn);